internal/ui: refactoring

This commit is contained in:
Hajime Hoshi 2023-01-01 17:45:20 +09:00
parent fd1a90411a
commit bba32bc06e
3 changed files with 4 additions and 9 deletions

View File

@ -23,7 +23,6 @@ package nintendosdk
// //
// // UI // // UI
// void EbitenInitializeGame(); // void EbitenInitializeGame();
// void EbitenGetScreenSize(int* width, int* height);
// void EbitenBeginFrame(); // void EbitenBeginFrame();
// void EbitenEndFrame(); // void EbitenEndFrame();
import "C" import "C"
@ -32,12 +31,6 @@ func InitializeGame() {
C.EbitenInitializeGame() C.EbitenInitializeGame()
} }
func ScreenSize() (int, int) {
var width, height C.int
C.EbitenGetScreenSize(&width, &height)
return int(width), int(height)
}
func BeginFrame() { func BeginFrame() {
C.EbitenBeginFrame() C.EbitenBeginFrame()
} }

View File

@ -20,6 +20,9 @@ struct Touch {
int y; int y;
}; };
const int kScreenWidth = 1920;
const int kScreenHeight = 1080;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -75,8 +75,7 @@ func (u *userInterfaceImpl) Run(game Game, options *RunOptions) error {
gamepad.Update() gamepad.Update()
u.updateInputState() u.updateInputState()
w, h := nintendosdk.ScreenSize() if err := u.context.updateFrame(u.graphicsDriver, float64(C.kScreenWidth), float64(C.kScreenHeight), deviceScaleFactor, u); err != nil {
if err := u.context.updateFrame(u.graphicsDriver, float64(w), float64(h), deviceScaleFactor, u); err != nil {
return err return err
} }