gg/src/gx/shader.go

34 lines
490 B
Go
Raw Normal View History

2023-05-22 23:39:01 +03:00
package gx
import (
"github.com/hajimehoshi/ebiten/v2"
//"fmt"
)
type Shader = ebiten.Shader
var (
// The shader does not
SolidColorShader = MustNewShader([]byte(`
package main
func Fragment(p vec4, coord vec2, color vec4) vec4 {
return vec4(1, 0, 1, 1)
}
`))
)
func MustNewShader(src []byte) (*Shader) {
shader, err := NewShader(src)
if err != nil {
panic(err)
}
return shader
}
func NewShader(src []byte) (*Shader, error) {
return ebiten.NewShader(src)
}