Remove LazyContext

This commit is contained in:
Hajime Hoshi 2014-01-13 15:30:27 +09:00
parent 8ff6e4efa0
commit 144b890558
2 changed files with 1 additions and 87 deletions

View File

@ -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)
})
}

View File

@ -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];
}