mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 10:42:42 +01:00
Refactoring
This commit is contained in:
parent
ee23301538
commit
11a9b77be3
@ -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))
|
||||
|
@ -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(
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user