Refactoring

This commit is contained in:
Hajime Hoshi 2014-01-11 15:18:04 +09:00
parent ee23301538
commit 11a9b77be3
4 changed files with 11 additions and 13 deletions

View File

@ -33,13 +33,12 @@ func main() {
textureFactory := cocoa.TextureFactory()
window := u.CreateGameWindow(screenWidth, screenHeight, screenScale, title)
textureFactoryEvents := textureFactory.Events()
drawing := make(chan *graphics.LazyContext)
quit := make(chan struct{})
go func() {
defer close(quit)
textureFactoryEvents := textureFactory.Events()
windowEvents := window.Events()
var game Game = blocks.NewGame(textureFactory)
frameTime := time.Duration(int64(time.Second) / int64(fps))

View File

@ -15,14 +15,14 @@ type Context struct {
}
func newContext(ids *ids, screenWidth, screenHeight, screenScale int) *Context {
mainFramebuffer := rendertarget.NewWithCurrentFramebuffer(
screenWidth*screenScale,
screenHeight*screenScale)
context := &Context{
ids: ids,
screenScale: screenScale,
}
context.mainId = context.ids.AddRenderTarget(mainFramebuffer)
mainRenderTarget := rendertarget.NewWithCurrentFramebuffer(
screenWidth*screenScale,
screenHeight*screenScale)
context.mainId = context.ids.AddRenderTarget(mainRenderTarget)
var err error
context.screenId, err = ids.CreateRenderTarget(

View File

@ -10,10 +10,9 @@ type SharedContext struct {
}
func NewSharedContext() *SharedContext {
device := &SharedContext{
return &SharedContext{
ids: newIds(),
}
return device
}
func (s *SharedContext) CreateContext(screenWidth, screenHeight, screenScale int) *Context {

View File

@ -15,12 +15,12 @@ import (
)
type sharedContext struct {
inited chan struct{}
inited chan struct{}
graphicsSharedContext *opengl.SharedContext
events chan interface{}
funcs chan func()
funcsDone chan struct{}
gameWindows chan *GameWindow
events chan interface{}
funcs chan func()
funcsDone chan struct{}
gameWindows chan *GameWindow
}
func newSharedContext() *sharedContext {