diff --git a/graphics/context.go b/graphics/context.go index 8b6463490..d4fb4d5a7 100644 --- a/graphics/context.go +++ b/graphics/context.go @@ -28,82 +28,3 @@ type Context interface { // TODO: glTextureSubImage2D } - -type LazyContext struct { - funcs []func(Context) -} - -func NewLazyContext() *LazyContext { - return &LazyContext{ - funcs: []func(Context){}, - } -} - -func (c *LazyContext) Flush(actual Context) { - for _, f := range c.funcs { - f(actual) - } - c.funcs = []func(Context){} -} - -func (c *LazyContext) Clear() { - c.funcs = append(c.funcs, func(actual Context) { - actual.Clear() - }) -} - -func (c *LazyContext) Fill(r, g, b uint8) { - c.funcs = append(c.funcs, func(actual Context) { - actual.Fill(r, g, b) - }) -} - -func (c *LazyContext) DrawTexture(id TextureId, - geometryMatrix matrix.Geometry, - colorMatrix matrix.Color) { - c.funcs = append(c.funcs, func(actual Context) { - actual.DrawTexture(id, geometryMatrix, colorMatrix) - }) -} - -func (c *LazyContext) DrawRenderTarget(id RenderTargetId, - geometryMatrix matrix.Geometry, - colorMatrix matrix.Color) { - c.funcs = append(c.funcs, func(actual Context) { - actual.DrawRenderTarget(id, geometryMatrix, colorMatrix) - }) -} - -func (c *LazyContext) DrawTextureParts(id TextureId, - parts []TexturePart, - geometryMatrix matrix.Geometry, - colorMatrix matrix.Color) { - parts2 := make([]TexturePart, len(parts)) - copy(parts2, parts) - c.funcs = append(c.funcs, func(actual Context) { - actual.DrawTextureParts(id, parts2, geometryMatrix, colorMatrix) - }) -} - -func (c *LazyContext) DrawRenderTargetParts(id RenderTargetId, - parts []TexturePart, - geometryMatrix matrix.Geometry, - colorMatrix matrix.Color) { - parts2 := make([]TexturePart, len(parts)) - copy(parts2, parts) - c.funcs = append(c.funcs, func(actual Context) { - actual.DrawRenderTargetParts(id, parts2, geometryMatrix, colorMatrix) - }) -} - -func (c *LazyContext) ResetOffscreen() { - c.funcs = append(c.funcs, func(actual Context) { - actual.ResetOffscreen() - }) -} - -func (c *LazyContext) SetOffscreen(id RenderTargetId) { - c.funcs = append(c.funcs, func(actual Context) { - actual.SetOffscreen(id) - }) -} diff --git a/ui/cocoa/mainloop.c b/ui/cocoa/mainloop.c index fb304fd0d..78343d4ea 100644 --- a/ui/cocoa/mainloop.c +++ b/ui/cocoa/mainloop.c @@ -32,10 +32,9 @@ void StartApplication(void) { NSApplication* app = [NSApplication sharedApplication]; [app setActivationPolicy:NSApplicationActivationPolicyRegular]; - initMenu(); - [app finishLaunching]; + [NSApp activateIgnoringOtherApps:YES]; } void DoEvents(void) { @@ -50,12 +49,6 @@ void DoEvents(void) { [NSApp sendEvent:event]; } - static BOOL initialBoot = YES; - if (initialBoot) { - [NSApp activateIgnoringOtherApps:YES]; - initialBoot = NO; - } - [pool drain]; pool = [NSAutoreleasePool new]; }