internal/cbackend: rename to nintendosdk

Updates #2242
This commit is contained in:
Hajime Hoshi 2022-08-12 17:19:28 +09:00
parent e7c0a121c4
commit 8081d0636a
5 changed files with 16 additions and 17 deletions

View File

@ -22,7 +22,7 @@ import (
"github.com/hajimehoshi/oto/v2/mux"
"github.com/hajimehoshi/ebiten/v2/internal/cbackend"
"github.com/hajimehoshi/ebiten/v2/internal/nintendosdk"
)
func newContext(sampleRate, channelCount, bitDepthInBytes int) (context, chan struct{}, error) {
@ -30,11 +30,10 @@ func newContext(sampleRate, channelCount, bitDepthInBytes int) (context, chan st
close(ready)
c := &contextProxy{mux.New(sampleRate, channelCount, bitDepthInBytes)}
cbackend.OpenAudio(sampleRate, channelCount, c.mux.ReadFloat32s)
nintendosdk.OpenAudio(sampleRate, channelCount, c.mux.ReadFloat32s)
return c, ready, nil
}
// contextProxy is a proxy between cbackend.Context and context.
type contextProxy struct {
mux *mux.Mux
}

View File

@ -20,12 +20,12 @@ package gamepad
import (
"time"
"github.com/hajimehoshi/ebiten/v2/internal/cbackend"
"github.com/hajimehoshi/ebiten/v2/internal/gamepaddb"
"github.com/hajimehoshi/ebiten/v2/internal/nintendosdk"
)
type nativeGamepadsImpl struct {
gamepads []cbackend.Gamepad
gamepads []nintendosdk.Gamepad
ids map[int]struct{}
}
@ -39,7 +39,7 @@ func (*nativeGamepadsImpl) init(gamepads *gamepads) error {
func (g *nativeGamepadsImpl) update(gamepads *gamepads) error {
g.gamepads = g.gamepads[:0]
g.gamepads = cbackend.AppendGamepads(g.gamepads)
g.gamepads = nintendosdk.AppendGamepads(g.gamepads)
for id := range g.ids {
delete(g.ids, id)
@ -147,5 +147,5 @@ func (*nativeGamepadImpl) hatState(hat int) int {
}
func (g *nativeGamepadImpl) vibrate(duration time.Duration, strongMagnitude float64, weakMagnitude float64) {
cbackend.VibrateGamepad(g.id, duration, strongMagnitude, weakMagnitude)
nintendosdk.VibrateGamepad(g.id, duration, strongMagnitude, weakMagnitude)
}

View File

@ -15,7 +15,7 @@
//go:build nintendosdk
// +build nintendosdk
package cbackend
package nintendosdk
// #cgo !darwin LDFLAGS: -Wl,-unresolved-symbols=ignore-all
// #cgo darwin LDFLAGS: -Wl,-undefined,dynamic_lookup

View File

@ -20,13 +20,13 @@ package ui
import (
"sync"
"github.com/hajimehoshi/ebiten/v2/internal/cbackend"
"github.com/hajimehoshi/ebiten/v2/internal/gamepad"
"github.com/hajimehoshi/ebiten/v2/internal/nintendosdk"
)
type Input struct {
gamepads []cbackend.Gamepad
touches []cbackend.Touch
gamepads []nintendosdk.Gamepad
touches []nintendosdk.Touch
m sync.Mutex
}
@ -38,7 +38,7 @@ func (i *Input) update(context *context) {
gamepad.Update()
i.touches = i.touches[:0]
i.touches = cbackend.AppendTouches(i.touches)
i.touches = nintendosdk.AppendTouches(i.touches)
for idx, t := range i.touches {
x, y := context.adjustPosition(float64(t.X), float64(t.Y), deviceScaleFactor)

View File

@ -20,9 +20,9 @@ package ui
import (
"runtime"
"github.com/hajimehoshi/ebiten/v2/internal/cbackend"
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver"
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/opengl"
"github.com/hajimehoshi/ebiten/v2/internal/nintendosdk"
)
type graphicsDriverCreatorImpl struct{}
@ -64,17 +64,17 @@ func (u *userInterfaceImpl) Run(game Game) error {
return err
}
u.graphicsDriver = g
cbackend.InitializeGame()
nintendosdk.InitializeGame()
for {
cbackend.BeginFrame()
nintendosdk.BeginFrame()
u.input.update(u.context)
w, h := cbackend.ScreenSize()
w, h := nintendosdk.ScreenSize()
if err := u.context.updateFrame(u.graphicsDriver, float64(w), float64(h), deviceScaleFactor); err != nil {
return err
}
cbackend.EndFrame()
nintendosdk.EndFrame()
}
}