mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-09-21 05:42:18 +02:00
30 lines
714 B
Go
30 lines
714 B
Go
|
package opengl
|
||
|
|
||
|
import (
|
||
|
"github.com/hajimehoshi/go-ebiten/graphics"
|
||
|
"image"
|
||
|
)
|
||
|
|
||
|
type SharedContext struct {
|
||
|
ids *ids
|
||
|
}
|
||
|
|
||
|
func NewSharedContext() *SharedContext {
|
||
|
device := &SharedContext{
|
||
|
ids: newIds(),
|
||
|
}
|
||
|
return device
|
||
|
}
|
||
|
|
||
|
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)
|
||
|
}
|