ebiten/graphics/opengl/shared_context.go

29 lines
696 B
Go
Raw Normal View History

2014-01-11 03:42:23 +01:00
package opengl
import (
"github.com/hajimehoshi/go-ebiten/graphics"
"image"
)
type SharedContext struct {
ids *ids
}
func NewSharedContext() *SharedContext {
2014-01-11 07:18:04 +01:00
return &SharedContext{
2014-01-11 03:42:23 +01:00
ids: newIds(),
}
}
func (s *SharedContext) CreateContext(screenWidth, screenHeight, screenScale int) *Context {
return newContext(s.ids, screenWidth, screenHeight, screenScale)
}
func (s *SharedContext) CreateRenderTarget(width, height int) (graphics.RenderTargetId, error) {
return s.ids.CreateRenderTarget(width, height, graphics.FilterLinear)
}
func (s *SharedContext) CreateTexture(img image.Image, filter graphics.Filter) (graphics.TextureId, error) {
return s.ids.CreateTexture(img, filter)
}