mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
parent
abbd4bddf1
commit
10415d417a
@ -43,7 +43,7 @@ type imageImportCheckError struct {
|
|||||||
Import string
|
Import string
|
||||||
}
|
}
|
||||||
|
|
||||||
func runImageImportCheck(pass *analysis.Pass) (interface{}, error) {
|
func runImageImportCheck(pass *analysis.Pass) (any, error) {
|
||||||
pkgPath := pass.Pkg.Path()
|
pkgPath := pass.Pkg.Path()
|
||||||
if strings.HasPrefix(pkgPath, "github.com/hajimehoshi/ebiten/v2/examples/") {
|
if strings.HasPrefix(pkgPath, "github.com/hajimehoshi/ebiten/v2/examples/") {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
@ -133,7 +133,7 @@ type Stroke struct {
|
|||||||
|
|
||||||
// draggingObject represents a object (sprite in this case)
|
// draggingObject represents a object (sprite in this case)
|
||||||
// that is being dragged.
|
// that is being dragged.
|
||||||
draggingObject interface{}
|
draggingObject any
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStroke(source StrokeSource) *Stroke {
|
func NewStroke(source StrokeSource) *Stroke {
|
||||||
@ -174,11 +174,11 @@ func (s *Stroke) PositionDiff() (int, int) {
|
|||||||
return dx, dy
|
return dx, dy
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Stroke) DraggingObject() interface{} {
|
func (s *Stroke) DraggingObject() any {
|
||||||
return s.draggingObject
|
return s.draggingObject
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Stroke) SetDraggingObject(object interface{}) {
|
func (s *Stroke) SetDraggingObject(object any) {
|
||||||
s.draggingObject = object
|
s.draggingObject = object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ func outputKeyRectsGo(k map[ebiten.Key]image.Rectangle) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return tmpl.Execute(f, map[string]interface{}{
|
return tmpl.Execute(f, map[string]any{
|
||||||
"License": license,
|
"License": license,
|
||||||
"KeyRectsMap": k,
|
"KeyRectsMap": k,
|
||||||
})
|
})
|
||||||
|
@ -147,7 +147,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
cx, cy := ebiten.CursorPosition()
|
cx, cy := ebiten.CursorPosition()
|
||||||
|
|
||||||
op := &ebiten.DrawRectShaderOptions{}
|
op := &ebiten.DrawRectShaderOptions{}
|
||||||
op.Uniforms = map[string]interface{}{
|
op.Uniforms = map[string]any{
|
||||||
"Time": float32(g.time) / 60,
|
"Time": float32(g.time) / 60,
|
||||||
"Cursor": []float32{float32(cx), float32(cy)},
|
"Cursor": []float32{float32(cx), float32(cy)},
|
||||||
"ScreenSize": []float32{float32(w), float32(h)},
|
"ScreenSize": []float32{float32(w), float32(h)},
|
||||||
|
@ -325,7 +325,7 @@ var eventTmpl = template.Must(template.New("event.go").Parse(`{{.License}}
|
|||||||
|
|
||||||
package {{.Package}}
|
package {{.Package}}
|
||||||
|
|
||||||
type Event interface{}
|
type Event any
|
||||||
|
|
||||||
{{range .Events}}// {{.Comment}}
|
{{range .Events}}// {{.Comment}}
|
||||||
type {{.Name}} struct {
|
type {{.Name}} struct {
|
||||||
|
8
image.go
8
image.go
@ -243,7 +243,7 @@ func (i *Image) DrawImage(img *Image, options *DrawImageOptions) {
|
|||||||
var body [16]float32
|
var body [16]float32
|
||||||
var translation [4]float32
|
var translation [4]float32
|
||||||
colorm.Elements(body[:], translation[:])
|
colorm.Elements(body[:], translation[:])
|
||||||
uniforms = shader.convertUniforms(map[string]interface{}{
|
uniforms = shader.convertUniforms(map[string]any{
|
||||||
builtinshader.UniformColorMBody: body[:],
|
builtinshader.UniformColorMBody: body[:],
|
||||||
builtinshader.UniformColorMTranslation: translation[:],
|
builtinshader.UniformColorMTranslation: translation[:],
|
||||||
})
|
})
|
||||||
@ -474,7 +474,7 @@ func (i *Image) DrawTriangles(vertices []Vertex, indices []uint16, img *Image, o
|
|||||||
var body [16]float32
|
var body [16]float32
|
||||||
var translation [4]float32
|
var translation [4]float32
|
||||||
colorm.Elements(body[:], translation[:])
|
colorm.Elements(body[:], translation[:])
|
||||||
uniforms = shader.convertUniforms(map[string]interface{}{
|
uniforms = shader.convertUniforms(map[string]any{
|
||||||
builtinshader.UniformColorMBody: body[:],
|
builtinshader.UniformColorMBody: body[:],
|
||||||
builtinshader.UniformColorMTranslation: translation[:],
|
builtinshader.UniformColorMTranslation: translation[:],
|
||||||
})
|
})
|
||||||
@ -502,7 +502,7 @@ type DrawTrianglesShaderOptions struct {
|
|||||||
// If the uniform variable type is an array, a vector or a matrix,
|
// If the uniform variable type is an array, a vector or a matrix,
|
||||||
// you have to specify linearly flattened values as a slice.
|
// you have to specify linearly flattened values as a slice.
|
||||||
// For example, if the uniform variable type is [4]vec4, the number of the slice values will be 16.
|
// For example, if the uniform variable type is [4]vec4, the number of the slice values will be 16.
|
||||||
Uniforms map[string]interface{}
|
Uniforms map[string]any
|
||||||
|
|
||||||
// Images is a set of the source images.
|
// Images is a set of the source images.
|
||||||
// All the images' sizes must be the same.
|
// All the images' sizes must be the same.
|
||||||
@ -662,7 +662,7 @@ type DrawRectShaderOptions struct {
|
|||||||
// If the uniform variable type is an array, a vector or a matrix,
|
// If the uniform variable type is an array, a vector or a matrix,
|
||||||
// you have to specify linearly flattened values as a slice.
|
// you have to specify linearly flattened values as a slice.
|
||||||
// For example, if the uniform variable type is [4]vec4, the number of the slice values will be 16.
|
// For example, if the uniform variable type is [4]vec4, the number of the slice values will be 16.
|
||||||
Uniforms map[string]interface{}
|
Uniforms map[string]any
|
||||||
|
|
||||||
// Images is a set of the source images.
|
// Images is a set of the source images.
|
||||||
// All the images' sizes must be the same.
|
// All the images' sizes must be the same.
|
||||||
|
@ -22,6 +22,6 @@ import (
|
|||||||
|
|
||||||
const IsDebug = true
|
const IsDebug = true
|
||||||
|
|
||||||
func Logf(format string, args ...interface{}) {
|
func Logf(format string, args ...any) {
|
||||||
fmt.Printf(format, args...)
|
fmt.Printf(format, args...)
|
||||||
}
|
}
|
||||||
|
@ -18,5 +18,5 @@ package debug
|
|||||||
|
|
||||||
const IsDebug = false
|
const IsDebug = false
|
||||||
|
|
||||||
func Logf(format string, args ...interface{}) {
|
func Logf(format string, args ...any) {
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ func (g *gamepads) setNativeWindow(nativeWindow uintptr) {
|
|||||||
g.m.Lock()
|
g.m.Lock()
|
||||||
defer g.m.Unlock()
|
defer g.m.Unlock()
|
||||||
|
|
||||||
var n interface{} = g.native
|
var n any = g.native
|
||||||
if n, ok := n.(interface{ setNativeWindow(uintptr) }); ok {
|
if n, ok := n.(interface{ setNativeWindow(uintptr) }); ok {
|
||||||
n.setNativeWindow(nativeWindow)
|
n.setNativeWindow(nativeWindow)
|
||||||
}
|
}
|
||||||
|
@ -1268,7 +1268,7 @@ func _GetMessageTime() int32 {
|
|||||||
return int32(r)
|
return int32(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _GetModuleHandleExW(dwFlags uint32, lpModuleName interface{}) (_HMODULE, error) {
|
func _GetModuleHandleExW(dwFlags uint32, lpModuleName any) (_HMODULE, error) {
|
||||||
var ptr unsafe.Pointer
|
var ptr unsafe.Pointer
|
||||||
switch moduleName := lpModuleName.(type) {
|
switch moduleName := lpModuleName.(type) {
|
||||||
case string:
|
case string:
|
||||||
|
@ -31,8 +31,8 @@ func download(buf *bytes.Buffer, mime string, path string) {
|
|||||||
|
|
||||||
a := global.Get("document").Call("createElement", "a")
|
a := global.Get("document").Call("createElement", "a")
|
||||||
blob := global.Get("Blob").New(
|
blob := global.Get("Blob").New(
|
||||||
[]interface{}{jsData},
|
[]any{jsData},
|
||||||
map[string]interface{}{"type": mime},
|
map[string]any{"type": mime},
|
||||||
)
|
)
|
||||||
a.Set("href", global.Get("URL").Call("createObjectURL", blob))
|
a.Set("href", global.Get("URL").Call("createObjectURL", blob))
|
||||||
a.Set("download", path)
|
a.Set("download", path)
|
||||||
|
@ -86,7 +86,7 @@ func Example_listDevices() {
|
|||||||
|
|
||||||
// printJSON prints label, then v as JSON encoded with indent to stdout. It panics on any error.
|
// printJSON prints label, then v as JSON encoded with indent to stdout. It panics on any error.
|
||||||
// It's meant to be used by examples to print the output.
|
// It's meant to be used by examples to print the output.
|
||||||
func printJSON(label string, v interface{}) {
|
func printJSON(label string, v any) {
|
||||||
fmt.Print(label)
|
fmt.Print(label)
|
||||||
w := json.NewEncoder(os.Stdout)
|
w := json.NewEncoder(os.Stdout)
|
||||||
w.SetIndent("", "\t")
|
w.SetIndent("", "\t")
|
||||||
|
@ -17,7 +17,7 @@ import (
|
|||||||
// var data []uint8
|
// var data []uint8
|
||||||
// ...
|
// ...
|
||||||
// gl.TexImage2D(glconst.TEXTURE_2D, ..., glconst.UNSIGNED_BYTE, gl.Ptr(&data[0]))
|
// gl.TexImage2D(glconst.TEXTURE_2D, ..., glconst.UNSIGNED_BYTE, gl.Ptr(&data[0]))
|
||||||
func Ptr(data interface{}) unsafe.Pointer {
|
func Ptr(data any) unsafe.Pointer {
|
||||||
if data == nil {
|
if data == nil {
|
||||||
return unsafe.Pointer(nil)
|
return unsafe.Pointer(nil)
|
||||||
}
|
}
|
||||||
|
4
internal/processtest/testdata/issue1753.go
vendored
4
internal/processtest/testdata/issue1753.go
vendored
@ -48,7 +48,7 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
|
|
||||||
op := &ebiten.DrawRectShaderOptions{}
|
op := &ebiten.DrawRectShaderOptions{}
|
||||||
op.Blend = ebiten.BlendCopy
|
op.Blend = ebiten.BlendCopy
|
||||||
op.Uniforms = map[string]interface{}{
|
op.Uniforms = map[string]any{
|
||||||
"Color": []float32{1, 1, 1, 1},
|
"Color": []float32{1, 1, 1, 1},
|
||||||
}
|
}
|
||||||
g.dst.DrawRectShader(w, h, s, op)
|
g.dst.DrawRectShader(w, h, s, op)
|
||||||
@ -78,7 +78,7 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
|
|
||||||
op := &ebiten.DrawRectShaderOptions{}
|
op := &ebiten.DrawRectShaderOptions{}
|
||||||
op.Blend = ebiten.BlendCopy
|
op.Blend = ebiten.BlendCopy
|
||||||
op.Uniforms = map[string]interface{}{
|
op.Uniforms = map[string]any{
|
||||||
"Dummy": float32(0),
|
"Dummy": float32(0),
|
||||||
"R": float32(0.5),
|
"R": float32(0.5),
|
||||||
"G": float32(1),
|
"G": float32(1),
|
||||||
|
@ -44,7 +44,7 @@ func (s *Shader) MarkDisposed() {
|
|||||||
s.shader = nil
|
s.shader = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Shader) ConvertUniforms(uniforms map[string]interface{}) [][]float32 {
|
func (s *Shader) ConvertUniforms(uniforms map[string]any) [][]float32 {
|
||||||
nameToF32s := map[string][]float32{}
|
nameToF32s := map[string][]float32{}
|
||||||
for name, v := range uniforms {
|
for name, v := range uniforms {
|
||||||
switch v := v.(type) {
|
switch v := v.(type) {
|
||||||
|
@ -359,7 +359,7 @@ func (u *userInterfaceImpl) loop(game Game) <-chan error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Should cf be released after the game ends?
|
// TODO: Should cf be released after the game ends?
|
||||||
cf = js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
cf = js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
// f can be blocked but callbacks must not be blocked. Create a goroutine (#1161).
|
// f can be blocked but callbacks must not be blocked. Create a goroutine (#1161).
|
||||||
go f()
|
go f()
|
||||||
return nil
|
return nil
|
||||||
@ -419,7 +419,7 @@ func init() {
|
|||||||
|
|
||||||
if !document.Get("body").Truthy() {
|
if !document.Get("body").Truthy() {
|
||||||
ch := make(chan struct{})
|
ch := make(chan struct{})
|
||||||
window.Call("addEventListener", "load", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
window.Call("addEventListener", "load", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
close(ch)
|
close(ch)
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
@ -465,7 +465,7 @@ func init() {
|
|||||||
setCanvasEventHandlers(canvas)
|
setCanvasEventHandlers(canvas)
|
||||||
|
|
||||||
// Pointer Lock
|
// Pointer Lock
|
||||||
document.Call("addEventListener", "pointerlockchange", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
document.Call("addEventListener", "pointerlockchange", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
if document.Get("pointerLockElement").Truthy() {
|
if document.Get("pointerLockElement").Truthy() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -478,22 +478,22 @@ func init() {
|
|||||||
theUI.input.recoverCursorPosition()
|
theUI.input.recoverCursorPosition()
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
document.Call("addEventListener", "pointerlockerror", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
document.Call("addEventListener", "pointerlockerror", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
js.Global().Get("console").Call("error", "pointerlockerror event is fired. 'sandbox=\"allow-pointer-lock\"' might be required at an iframe. This function on browsers must be called as a result of a gestural interaction or orientation change.")
|
js.Global().Get("console").Call("error", "pointerlockerror event is fired. 'sandbox=\"allow-pointer-lock\"' might be required at an iframe. This function on browsers must be called as a result of a gestural interaction or orientation change.")
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
document.Call("addEventListener", "fullscreenerror", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
document.Call("addEventListener", "fullscreenerror", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
js.Global().Get("console").Call("error", "fullscreenerror event is fired. 'allow=\"fullscreen\"' or 'allowfullscreen' might be required at an iframe. This function on browsers must be called as a result of a gestural interaction or orientation change.")
|
js.Global().Get("console").Call("error", "fullscreenerror event is fired. 'allow=\"fullscreen\"' or 'allowfullscreen' might be required at an iframe. This function on browsers must be called as a result of a gestural interaction or orientation change.")
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
document.Call("addEventListener", "webkitfullscreenerror", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
document.Call("addEventListener", "webkitfullscreenerror", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
js.Global().Get("console").Call("error", "webkitfullscreenerror event is fired. 'allow=\"fullscreen\"' or 'allowfullscreen' might be required at an iframe. This function on browsers must be called as a result of a gestural interaction or orientation change.")
|
js.Global().Get("console").Call("error", "webkitfullscreenerror event is fired. 'allow=\"fullscreen\"' or 'allowfullscreen' might be required at an iframe. This function on browsers must be called as a result of a gestural interaction or orientation change.")
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
func setWindowEventHandlers(v js.Value) {
|
func setWindowEventHandlers(v js.Value) {
|
||||||
v.Call("addEventListener", "resize", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
v.Call("addEventListener", "resize", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
theUI.updateScreenSize()
|
theUI.updateScreenSize()
|
||||||
|
|
||||||
// updateImpl can block. Use goroutine.
|
// updateImpl can block. Use goroutine.
|
||||||
@ -510,7 +510,7 @@ func setWindowEventHandlers(v js.Value) {
|
|||||||
|
|
||||||
func setCanvasEventHandlers(v js.Value) {
|
func setCanvasEventHandlers(v js.Value) {
|
||||||
// Keyboard
|
// Keyboard
|
||||||
v.Call("addEventListener", "keydown", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
v.Call("addEventListener", "keydown", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
// Focus the canvas explicitly to activate tha game (#961).
|
// Focus the canvas explicitly to activate tha game (#961).
|
||||||
v.Call("focus")
|
v.Call("focus")
|
||||||
|
|
||||||
@ -522,7 +522,7 @@ func setCanvasEventHandlers(v js.Value) {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
v.Call("addEventListener", "keyup", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
v.Call("addEventListener", "keyup", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
e := args[0]
|
e := args[0]
|
||||||
e.Call("preventDefault")
|
e.Call("preventDefault")
|
||||||
if err := theUI.input.updateFromEvent(e); err != nil && theUI.err != nil {
|
if err := theUI.input.updateFromEvent(e); err != nil && theUI.err != nil {
|
||||||
@ -533,7 +533,7 @@ func setCanvasEventHandlers(v js.Value) {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
// Mouse
|
// Mouse
|
||||||
v.Call("addEventListener", "mousedown", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
v.Call("addEventListener", "mousedown", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
// Focus the canvas explicitly to activate tha game (#961).
|
// Focus the canvas explicitly to activate tha game (#961).
|
||||||
v.Call("focus")
|
v.Call("focus")
|
||||||
|
|
||||||
@ -545,7 +545,7 @@ func setCanvasEventHandlers(v js.Value) {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
v.Call("addEventListener", "mouseup", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
v.Call("addEventListener", "mouseup", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
e := args[0]
|
e := args[0]
|
||||||
e.Call("preventDefault")
|
e.Call("preventDefault")
|
||||||
if err := theUI.input.updateFromEvent(e); err != nil && theUI.err != nil {
|
if err := theUI.input.updateFromEvent(e); err != nil && theUI.err != nil {
|
||||||
@ -554,7 +554,7 @@ func setCanvasEventHandlers(v js.Value) {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
v.Call("addEventListener", "mousemove", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
v.Call("addEventListener", "mousemove", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
e := args[0]
|
e := args[0]
|
||||||
e.Call("preventDefault")
|
e.Call("preventDefault")
|
||||||
if err := theUI.input.updateFromEvent(e); err != nil && theUI.err != nil {
|
if err := theUI.input.updateFromEvent(e); err != nil && theUI.err != nil {
|
||||||
@ -563,7 +563,7 @@ func setCanvasEventHandlers(v js.Value) {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
v.Call("addEventListener", "wheel", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
v.Call("addEventListener", "wheel", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
e := args[0]
|
e := args[0]
|
||||||
e.Call("preventDefault")
|
e.Call("preventDefault")
|
||||||
if err := theUI.input.updateFromEvent(e); err != nil && theUI.err != nil {
|
if err := theUI.input.updateFromEvent(e); err != nil && theUI.err != nil {
|
||||||
@ -574,7 +574,7 @@ func setCanvasEventHandlers(v js.Value) {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
// Touch
|
// Touch
|
||||||
v.Call("addEventListener", "touchstart", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
v.Call("addEventListener", "touchstart", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
// Focus the canvas explicitly to activate tha game (#961).
|
// Focus the canvas explicitly to activate tha game (#961).
|
||||||
v.Call("focus")
|
v.Call("focus")
|
||||||
|
|
||||||
@ -586,7 +586,7 @@ func setCanvasEventHandlers(v js.Value) {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
v.Call("addEventListener", "touchend", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
v.Call("addEventListener", "touchend", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
e := args[0]
|
e := args[0]
|
||||||
e.Call("preventDefault")
|
e.Call("preventDefault")
|
||||||
if err := theUI.input.updateFromEvent(e); err != nil && theUI.err != nil {
|
if err := theUI.input.updateFromEvent(e); err != nil && theUI.err != nil {
|
||||||
@ -595,7 +595,7 @@ func setCanvasEventHandlers(v js.Value) {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
v.Call("addEventListener", "touchmove", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
v.Call("addEventListener", "touchmove", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
e := args[0]
|
e := args[0]
|
||||||
e.Call("preventDefault")
|
e.Call("preventDefault")
|
||||||
if err := theUI.input.updateFromEvent(e); err != nil && theUI.err != nil {
|
if err := theUI.input.updateFromEvent(e); err != nil && theUI.err != nil {
|
||||||
@ -606,14 +606,14 @@ func setCanvasEventHandlers(v js.Value) {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
// Context menu
|
// Context menu
|
||||||
v.Call("addEventListener", "contextmenu", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
v.Call("addEventListener", "contextmenu", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
e := args[0]
|
e := args[0]
|
||||||
e.Call("preventDefault")
|
e.Call("preventDefault")
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// Context
|
// Context
|
||||||
v.Call("addEventListener", "webglcontextlost", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
v.Call("addEventListener", "webglcontextlost", js.FuncOf(func(this js.Value, args []js.Value) any {
|
||||||
e := args[0]
|
e := args[0]
|
||||||
e.Call("preventDefault")
|
e.Call("preventDefault")
|
||||||
window.Get("location").Call("reload")
|
window.Get("location").Call("reload")
|
||||||
|
@ -52,7 +52,7 @@ func (s *Shader) Dispose() {
|
|||||||
s.shader = nil
|
s.shader = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Shader) convertUniforms(uniforms map[string]interface{}) [][]float32 {
|
func (s *Shader) convertUniforms(uniforms map[string]any) [][]float32 {
|
||||||
return s.shader.ConvertUniforms(uniforms)
|
return s.shader.ConvertUniforms(uniforms)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ func TestShaderUniformFirstElement(t *testing.T) {
|
|||||||
shaders := []struct {
|
shaders := []struct {
|
||||||
Name string
|
Name string
|
||||||
Shader string
|
Shader string
|
||||||
Uniforms map[string]interface{}
|
Uniforms map[string]any
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
Name: "float array",
|
Name: "float array",
|
||||||
@ -510,7 +510,7 @@ var C [2]float
|
|||||||
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
return vec4(C[0], 1, 1, 1)
|
return vec4(C[0], 1, 1, 1)
|
||||||
}`,
|
}`,
|
||||||
Uniforms: map[string]interface{}{
|
Uniforms: map[string]any{
|
||||||
"C": []float32{1, 1},
|
"C": []float32{1, 1},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -523,7 +523,7 @@ var C [1]float
|
|||||||
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
return vec4(C[0], 1, 1, 1)
|
return vec4(C[0], 1, 1, 1)
|
||||||
}`,
|
}`,
|
||||||
Uniforms: map[string]interface{}{
|
Uniforms: map[string]any{
|
||||||
"C": []float32{1},
|
"C": []float32{1},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -536,7 +536,7 @@ var C [2]mat2
|
|||||||
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
return vec4(C[0][0][0], 1, 1, 1)
|
return vec4(C[0][0][0], 1, 1, 1)
|
||||||
}`,
|
}`,
|
||||||
Uniforms: map[string]interface{}{
|
Uniforms: map[string]any{
|
||||||
"C": []float32{1, 0, 0, 0, 0, 0, 0, 0},
|
"C": []float32{1, 0, 0, 0, 0, 0, 0, 0},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -745,7 +745,7 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
op := &ebiten.DrawRectShaderOptions{}
|
op := &ebiten.DrawRectShaderOptions{}
|
||||||
op.Uniforms = map[string]interface{}{
|
op.Uniforms = map[string]any{
|
||||||
"Mat2": []float32{
|
"Mat2": []float32{
|
||||||
1.0 / 256.0, 2.0 / 256.0,
|
1.0 / 256.0, 2.0 / 256.0,
|
||||||
3.0 / 256.0, 4.0 / 256.0,
|
3.0 / 256.0, 4.0 / 256.0,
|
||||||
@ -783,7 +783,7 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
op := &ebiten.DrawRectShaderOptions{}
|
op := &ebiten.DrawRectShaderOptions{}
|
||||||
op.Uniforms = map[string]interface{}{
|
op.Uniforms = map[string]any{
|
||||||
"Mat2": []float32{
|
"Mat2": []float32{
|
||||||
1.0 / 256.0, 2.0 / 256.0,
|
1.0 / 256.0, 2.0 / 256.0,
|
||||||
3.0 / 256.0, 4.0 / 256.0,
|
3.0 / 256.0, 4.0 / 256.0,
|
||||||
@ -823,7 +823,7 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
op := &ebiten.DrawRectShaderOptions{}
|
op := &ebiten.DrawRectShaderOptions{}
|
||||||
op.Uniforms = map[string]interface{}{
|
op.Uniforms = map[string]any{
|
||||||
"Mat3": []float32{
|
"Mat3": []float32{
|
||||||
1.0 / 256.0, 2.0 / 256.0, 3.0 / 256.0,
|
1.0 / 256.0, 2.0 / 256.0, 3.0 / 256.0,
|
||||||
4.0 / 256.0, 5.0 / 256.0, 6.0 / 256.0,
|
4.0 / 256.0, 5.0 / 256.0, 6.0 / 256.0,
|
||||||
@ -862,7 +862,7 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
op := &ebiten.DrawRectShaderOptions{}
|
op := &ebiten.DrawRectShaderOptions{}
|
||||||
op.Uniforms = map[string]interface{}{
|
op.Uniforms = map[string]any{
|
||||||
"Mat3": []float32{
|
"Mat3": []float32{
|
||||||
1.0 / 256.0, 2.0 / 256.0, 3.0 / 256.0,
|
1.0 / 256.0, 2.0 / 256.0, 3.0 / 256.0,
|
||||||
4.0 / 256.0, 5.0 / 256.0, 6.0 / 256.0,
|
4.0 / 256.0, 5.0 / 256.0, 6.0 / 256.0,
|
||||||
@ -904,7 +904,7 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
op := &ebiten.DrawRectShaderOptions{}
|
op := &ebiten.DrawRectShaderOptions{}
|
||||||
op.Uniforms = map[string]interface{}{
|
op.Uniforms = map[string]any{
|
||||||
"Mat4": []float32{
|
"Mat4": []float32{
|
||||||
1.0 / 256.0, 2.0 / 256.0, 3.0 / 256.0, 4.0 / 256.0,
|
1.0 / 256.0, 2.0 / 256.0, 3.0 / 256.0, 4.0 / 256.0,
|
||||||
5.0 / 256.0, 6.0 / 256.0, 7.0 / 256.0, 8.0 / 256.0,
|
5.0 / 256.0, 6.0 / 256.0, 7.0 / 256.0, 8.0 / 256.0,
|
||||||
@ -944,7 +944,7 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
op := &ebiten.DrawRectShaderOptions{}
|
op := &ebiten.DrawRectShaderOptions{}
|
||||||
op.Uniforms = map[string]interface{}{
|
op.Uniforms = map[string]any{
|
||||||
"Mat4": []float32{
|
"Mat4": []float32{
|
||||||
1.0 / 256.0, 2.0 / 256.0, 3.0 / 256.0, 4.0 / 256.0,
|
1.0 / 256.0, 2.0 / 256.0, 3.0 / 256.0, 4.0 / 256.0,
|
||||||
5.0 / 256.0, 6.0 / 256.0, 7.0 / 256.0, 8.0 / 256.0,
|
5.0 / 256.0, 6.0 / 256.0, 7.0 / 256.0, 8.0 / 256.0,
|
||||||
|
Loading…
Reference in New Issue
Block a user