ebiten/graphics/graphics.go

53 lines
903 B
Go
Raw Normal View History

2013-06-19 01:49:54 +02:00
package graphics
import (
2013-06-20 18:47:39 +02:00
"github.com/hajimehoshi/go.ebiten/graphics/matrix"
2013-06-19 01:49:54 +02:00
"image"
"image/color"
)
type Device interface {
Update()
2013-06-19 16:08:24 +02:00
TextureFactory() TextureFactory
2013-06-19 01:49:54 +02:00
}
type Rect struct {
X int
Y int
Width int
2013-06-21 17:03:45 +02:00
Height int
}
2013-06-22 19:16:22 +02:00
type TexturePart struct {
LocationX int
LocationY int
Source Rect
}
2013-06-19 01:49:54 +02:00
type GraphicsContext interface {
Clear()
Fill(color color.Color)
2013-06-22 08:56:25 +02:00
DrawRect(rect Rect, clr color.Color)
DrawTexture(textureID TextureID,
2013-06-21 19:42:14 +02:00
geometryMatrix matrix.Geometry,
colorMatrix matrix.Color)
DrawTextureParts(textureID TextureID,
2013-06-22 19:16:22 +02:00
locations []TexturePart,
2013-06-21 19:42:14 +02:00
geometryMatrix matrix.Geometry,
colorMatrix matrix.Color)
SetOffscreen(textureID TextureID)
2013-06-19 16:08:24 +02:00
}
type TextureFactory interface {
NewTexture(width, height int) Texture
2013-06-23 09:06:32 +02:00
NewTextureFromImage(img image.Image) (Texture, error)
2013-06-19 01:49:54 +02:00
}
2013-06-19 03:31:44 +02:00
type Texture struct {
2013-06-19 16:51:41 +02:00
ID TextureID
Width int
2013-06-19 03:31:44 +02:00
Height int
}
2013-06-19 16:08:24 +02:00
type TextureID int