monogame: Update

Updates #1078
This commit is contained in:
Hajime Hoshi 2020-04-15 00:58:14 +09:00
parent de02bcf19f
commit 4dad044ad1
5 changed files with 111 additions and 3 deletions

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// +build !monogame
package jsutil
import (

View File

@ -0,0 +1,25 @@
// Copyright 2019 The Ebiten Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +build monogame
package jsutil
import (
"syscall/js"
)
func TemporaryUint8Array(byteLength int) js.Value {
panic("jsutil: TemporaryUint8Array is not implemented on monogame")
}

View File

@ -30,7 +30,7 @@ import (
// Create 'ebitenmonogame' command to generate C# project for the MonoGame.
// TODO: Update this
const temporaryNamespace = "Go2DotNet.Example.Rotate"
const temporaryNamespace = "Go2DotNet.Example.Ebiten"
type UpdateDrawer interface {
Update() error

View File

@ -0,0 +1,80 @@
// Copyright 2020 The Ebiten Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +build js
package monogame
import (
"github.com/hajimehoshi/ebiten/internal/driver"
)
type Input struct {
}
func (i *Input) CursorPosition() (x, y int) {
return 0, 0
}
func (i *Input) GamepadSDLID(id int) string {
return ""
}
func (i *Input) GamepadName(id int) string {
return ""
}
func (i *Input) GamepadAxis(id int, axis int) float64 {
return 0
}
func (i *Input) GamepadAxisNum(id int) int {
return 0
}
func (i *Input) GamepadButtonNum(id int) int {
return 0
}
func (i *Input) GamepadIDs() []int {
return nil
}
func (i *Input) IsGamepadButtonPressed(id int, button driver.GamepadButton) bool {
return false
}
func (i *Input) IsKeyPressed(key driver.Key) bool {
return false
}
func (i *Input) IsMouseButtonPressed(button driver.MouseButton) bool {
return false
}
func (i *Input) RuneBuffer() []rune {
return nil
}
func (i *Input) TouchIDs() []int {
return nil
}
func (i *Input) TouchPosition(id int) (x, y int) {
return 0, 0
}
func (i *Input) Wheel() (xoff, yoff float64) {
return 0, 0
}

View File

@ -25,6 +25,7 @@ import (
type UI struct {
game *monogame.Game
context driver.UIContext
input Input
}
var theUI = &UI{}
@ -114,8 +115,8 @@ func (*UI) SetScreenTransparent(transparent bool) {
panic("monogame: SetScreenTransparent is not implemented")
}
func (*UI) Input() driver.Input {
return nil
func (u *UI) Input() driver.Input {
return &u.input
}
func (*UI) Window() driver.Window {