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