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
// void EbitenInitializeGame();
// void EbitenGetScreenSize(int* width, int* height);
// void EbitenBeginFrame();
// void EbitenEndFrame();
import "C"
@ -32,12 +31,6 @@ func InitializeGame() {
C.EbitenInitializeGame()
}
func ScreenSize() (int, int) {
var width, height C.int
C.EbitenGetScreenSize(&width, &height)
return int(width), int(height)
}
func BeginFrame() {
C.EbitenBeginFrame()
}

View File

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

View File

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