mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 03:02:49 +01:00
Rename Context.TextureID -> ToTexture
This commit is contained in:
parent
cb25b6a9e4
commit
e2509e3439
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
type Input struct {
|
type Input struct {
|
||||||
textTextureID graphics.TextureID
|
textTextureID graphics.TextureID
|
||||||
inputState ebiten.InputState
|
inputState ebiten.InputState
|
||||||
}
|
}
|
||||||
|
|
||||||
func New() *Input {
|
func New() *Input {
|
||||||
|
@ -10,15 +10,15 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ebitenTextureWidth = 57
|
ebitenTextureWidth = 57
|
||||||
ebitenTextureHeight = 26
|
ebitenTextureHeight = 26
|
||||||
)
|
)
|
||||||
|
|
||||||
type Monochrome struct {
|
type Monochrome struct {
|
||||||
ebitenTextureID graphics.TextureID
|
ebitenTextureID graphics.TextureID
|
||||||
ch chan bool
|
ch chan bool
|
||||||
colorMatrix matrix.Color
|
colorMatrix matrix.Color
|
||||||
geometryMatrix matrix.Geometry
|
geometryMatrix matrix.Geometry
|
||||||
}
|
}
|
||||||
|
|
||||||
func New() *Monochrome {
|
func New() *Monochrome {
|
||||||
|
@ -11,9 +11,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Rects struct {
|
type Rects struct {
|
||||||
rectTextureID graphics.RenderTargetID
|
rectTextureID graphics.RenderTargetID
|
||||||
rectTextureInited bool
|
rectTextureInited bool
|
||||||
offscreenID graphics.RenderTargetID
|
offscreenID graphics.RenderTargetID
|
||||||
offscreenInited bool
|
offscreenInited bool
|
||||||
rectBounds *graphics.Rect
|
rectBounds *graphics.Rect
|
||||||
rectColor *color.RGBA
|
rectColor *color.RGBA
|
||||||
@ -91,12 +91,12 @@ func (game *Rects) Draw(g graphics.Context) {
|
|||||||
g.Fill(0, 0, 0)
|
g.Fill(0, 0, 0)
|
||||||
game.offscreenInited = true
|
game.offscreenInited = true
|
||||||
}
|
}
|
||||||
g.DrawTexture(g.TextureID(game.rectTextureID),
|
g.DrawTexture(g.ToTexture(game.rectTextureID),
|
||||||
game.rectGeometryMatrix(),
|
game.rectGeometryMatrix(),
|
||||||
game.rectColorMatrix())
|
game.rectColorMatrix())
|
||||||
|
|
||||||
g.ResetOffscreen()
|
g.ResetOffscreen()
|
||||||
g.DrawTexture(g.TextureID(game.offscreenID),
|
g.DrawTexture(g.ToTexture(game.offscreenID),
|
||||||
matrix.IdentityGeometry(),
|
matrix.IdentityGeometry(),
|
||||||
matrix.IdentityColor())
|
matrix.IdentityColor())
|
||||||
}
|
}
|
||||||
|
@ -11,14 +11,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ebitenTextureWidth = 57
|
ebitenTextureWidth = 57
|
||||||
ebitenTextureHeight = 26
|
ebitenTextureHeight = 26
|
||||||
)
|
)
|
||||||
|
|
||||||
type Rotating struct {
|
type Rotating struct {
|
||||||
ebitenTextureID graphics.TextureID
|
ebitenTextureID graphics.TextureID
|
||||||
x int
|
x int
|
||||||
geometryMatrix matrix.Geometry
|
geometryMatrix matrix.Geometry
|
||||||
}
|
}
|
||||||
|
|
||||||
func New() *Rotating {
|
func New() *Rotating {
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ebitenTextureWidth = 57
|
ebitenTextureWidth = 57
|
||||||
ebitenTextureHeight = 26
|
ebitenTextureHeight = 26
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ func (sprite *Sprite) Update() {
|
|||||||
|
|
||||||
type Sprites struct {
|
type Sprites struct {
|
||||||
ebitenTextureID graphics.TextureID
|
ebitenTextureID graphics.TextureID
|
||||||
sprites []*Sprite
|
sprites []*Sprite
|
||||||
}
|
}
|
||||||
|
|
||||||
func New() *Sprites {
|
func New() *Sprites {
|
||||||
|
@ -19,19 +19,19 @@ type TexturePart struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Context interface {
|
type Context interface {
|
||||||
TextureID(renderTargetID RenderTargetID) TextureID
|
ToTexture(renderTargetID RenderTargetID) TextureID
|
||||||
|
|
||||||
Clear()
|
Clear()
|
||||||
Fill(r, g, b uint8)
|
Fill(r, g, b uint8)
|
||||||
DrawTexture(textureID TextureID,
|
DrawTexture(id TextureID,
|
||||||
geometryMatrix matrix.Geometry,
|
geometryMatrix matrix.Geometry,
|
||||||
colorMatrix matrix.Color)
|
colorMatrix matrix.Color)
|
||||||
DrawTextureParts(textureID TextureID,
|
DrawTextureParts(id TextureID,
|
||||||
parts []TexturePart,
|
parts []TexturePart,
|
||||||
geometryMatrix matrix.Geometry,
|
geometryMatrix matrix.Geometry,
|
||||||
colorMatrix matrix.Color)
|
colorMatrix matrix.Color)
|
||||||
ResetOffscreen()
|
ResetOffscreen()
|
||||||
SetOffscreen(renderTargetID RenderTargetID)
|
SetOffscreen(id RenderTargetID)
|
||||||
}
|
}
|
||||||
|
|
||||||
type TextureFactory interface {
|
type TextureFactory interface {
|
||||||
|
@ -52,7 +52,7 @@ func (context *Context) Init() {
|
|||||||
context.screen = context.textures[C.GLuint(screenID)]
|
context.screen = context.textures[C.GLuint(screenID)]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (context *Context) TextureID(renderTargetID graphics.RenderTargetID) graphics.TextureID {
|
func (context *Context) ToTexture(renderTargetID graphics.RenderTargetID) graphics.TextureID {
|
||||||
return graphics.TextureID(renderTargetID)
|
return graphics.TextureID(renderTargetID)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ func (context *Context) setOffscreen(renderTarget *Texture) {
|
|||||||
C.GLsizei(abs(renderTarget.textureHeight)))
|
C.GLsizei(abs(renderTarget.textureHeight)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (context *Context) resetOffscreen() {
|
func (context *Context) setMainFramebufferOffscreen() {
|
||||||
context.setOffscreen(context.mainFramebufferTexture)
|
context.setOffscreen(context.mainFramebufferTexture)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ func (context *Context) NewRenderTarget(width, height int) graphics.RenderTarget
|
|||||||
|
|
||||||
context.setOffscreen((*Texture)(renderTarget))
|
context.setOffscreen((*Texture)(renderTarget))
|
||||||
context.Clear()
|
context.Clear()
|
||||||
context.resetOffscreen()
|
context.setMainFramebufferOffscreen()
|
||||||
|
|
||||||
return graphics.RenderTargetID(renderTarget.id)
|
return graphics.RenderTargetID(renderTarget.id)
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,7 @@ func (device *Device) Update(draw func(graphics.Context)) {
|
|||||||
|
|
||||||
C.glTexParameteri(C.GL_TEXTURE_2D, C.GL_TEXTURE_MIN_FILTER, C.GL_LINEAR)
|
C.glTexParameteri(C.GL_TEXTURE_2D, C.GL_TEXTURE_MIN_FILTER, C.GL_LINEAR)
|
||||||
C.glTexParameteri(C.GL_TEXTURE_2D, C.GL_TEXTURE_MAG_FILTER, C.GL_LINEAR)
|
C.glTexParameteri(C.GL_TEXTURE_2D, C.GL_TEXTURE_MAG_FILTER, C.GL_LINEAR)
|
||||||
// TODO: The name is not good.
|
context.setMainFramebufferOffscreen()
|
||||||
context.resetOffscreen()
|
|
||||||
context.Clear()
|
context.Clear()
|
||||||
|
|
||||||
scale := float64(context.screenScale)
|
scale := float64(context.screenScale)
|
||||||
|
Loading…
Reference in New Issue
Block a user