ebiten/graphics/context.go

48 lines
747 B
Go
Raw Normal View History

2013-12-02 13:45:10 +01:00
package graphics
import (
2014-12-05 14:16:58 +01:00
"github.com/hajimehoshi/ebiten/graphics/matrix"
2013-12-02 13:45:10 +01:00
)
2014-05-02 17:06:20 +02:00
type Rect struct {
X int
Y int
Width int
Height int
}
type TexturePart struct {
LocationX int
LocationY int
Source Rect
}
2014-05-01 15:45:48 +02:00
type Drawer interface {
2014-05-03 06:58:18 +02:00
Draw(parts []TexturePart,
2013-12-02 13:45:10 +01:00
geometryMatrix matrix.Geometry,
colorMatrix matrix.Color)
2014-05-01 15:45:48 +02:00
}
2014-05-03 06:58:18 +02:00
func DrawWhole(
drawer Drawer,
width, height int,
geo matrix.Geometry,
color matrix.Color) {
parts := []TexturePart{
{0, 0, Rect{0, 0, width, height}},
}
drawer.Draw(parts, geo, color)
}
2014-05-01 15:45:48 +02:00
type Context interface {
Clear()
Fill(r, g, b uint8)
Texture(id TextureId) Drawer
RenderTarget(id RenderTargetId) Drawer
2013-12-02 13:45:10 +01:00
ResetOffscreen()
SetOffscreen(id RenderTargetId)
// TODO: glTextureSubImage2D
2013-12-02 13:45:10 +01:00
}