mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Rename Game.Init -> Game.InitTextures
This commit is contained in:
parent
6be8a2c691
commit
801688f511
@ -9,7 +9,7 @@ const (
|
||||
)
|
||||
|
||||
type Game interface {
|
||||
Init(tf graphics.TextureFactory)
|
||||
InitTextures(tf graphics.TextureFactory)
|
||||
Update(context GameContext)
|
||||
Draw(context graphics.Context)
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ func New() *Blank {
|
||||
return &Blank{}
|
||||
}
|
||||
|
||||
func (game *Blank) Init(tf graphics.TextureFactory) {
|
||||
func (game *Blank) InitTextures(tf graphics.TextureFactory) {
|
||||
}
|
||||
|
||||
func (game *Blank) Update(context ebiten.GameContext) {
|
||||
|
@ -18,7 +18,7 @@ func New() *Input {
|
||||
return &Input{}
|
||||
}
|
||||
|
||||
func (game *Input) Init(tf graphics.TextureFactory) {
|
||||
func (game *Input) InitTextures(tf graphics.TextureFactory) {
|
||||
file, err := os.Open("images/text.png")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -29,7 +29,7 @@ func New() *Monochrome {
|
||||
}
|
||||
}
|
||||
|
||||
func (game *Monochrome) Init(tf graphics.TextureFactory) {
|
||||
func (game *Monochrome) InitTextures(tf graphics.TextureFactory) {
|
||||
file, err := os.Open("images/ebiten.png")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -35,7 +35,7 @@ func New() *Rects {
|
||||
}
|
||||
}
|
||||
|
||||
func (game *Rects) Init(tf graphics.TextureFactory) {
|
||||
func (game *Rects) InitTextures(tf graphics.TextureFactory) {
|
||||
game.rectTextureID = tf.NewRenderTarget(rectTextureWidth, rectTextureHeight)
|
||||
game.offscreenID = tf.NewRenderTarget(offscreenWidth, offscreenHeight)
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ func New() *Rotating {
|
||||
return &Rotating{}
|
||||
}
|
||||
|
||||
func (game *Rotating) Init(tf graphics.TextureFactory) {
|
||||
func (game *Rotating) InitTextures(tf graphics.TextureFactory) {
|
||||
file, err := os.Open("images/ebiten.png")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -72,7 +72,7 @@ func New() *Sprites {
|
||||
return &Sprites{}
|
||||
}
|
||||
|
||||
func (game *Sprites) Init(tf graphics.TextureFactory) {
|
||||
func (game *Sprites) InitTextures(tf graphics.TextureFactory) {
|
||||
file, err := os.Open("images/ebiten.png")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -21,7 +21,7 @@ func New() *TestPattern {
|
||||
return &TestPattern{}
|
||||
}
|
||||
|
||||
func (game *TestPattern) Init(tf graphics.TextureFactory) {
|
||||
func (game *TestPattern) InitTextures(tf graphics.TextureFactory) {
|
||||
file, err := os.Open("images/test_pattern.png")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -15,7 +15,6 @@ import (
|
||||
)
|
||||
|
||||
type Context struct {
|
||||
screen *RenderTarget
|
||||
screenId graphics.RenderTargetID
|
||||
screenWidth int
|
||||
screenHeight int
|
||||
@ -54,7 +53,6 @@ func (context *Context) Init() {
|
||||
|
||||
context.screenId = context.NewRenderTarget(
|
||||
context.screenWidth, context.screenHeight)
|
||||
context.screen = context.renderTargets[context.screenId]
|
||||
}
|
||||
|
||||
func (context *Context) ToTexture(renderTargetID graphics.RenderTargetID) graphics.TextureID {
|
||||
@ -146,7 +144,7 @@ func (context *Context) DrawTextureParts(
|
||||
}
|
||||
|
||||
func (context *Context) ResetOffscreen() {
|
||||
context.setOffscreen(context.screen)
|
||||
context.SetOffscreen(context.screenId)
|
||||
}
|
||||
|
||||
func (context *Context) SetOffscreen(renderTargetID graphics.RenderTargetID) {
|
||||
|
@ -100,7 +100,7 @@ func ebiten_EbitenOpenGLView_Initialized() {
|
||||
currentUI.graphicsDevice.Init()
|
||||
|
||||
game := <-currentUI.initializing
|
||||
game.Init(currentUI.graphicsDevice.TextureFactory())
|
||||
game.InitTextures(currentUI.graphicsDevice.TextureFactory())
|
||||
currentUI.initialized <- game
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ func (ui *UI) MainLoop() {
|
||||
ui.graphicsDevice.Init()
|
||||
|
||||
game := <-ui.initializing
|
||||
game.Init(ui.graphicsDevice.TextureFactory())
|
||||
game.InitTextures(ui.graphicsDevice.TextureFactory())
|
||||
ui.initialized <- game
|
||||
|
||||
// Set the callbacks
|
||||
|
Loading…
Reference in New Issue
Block a user