mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
internal/ui: refactoring
This commit is contained in:
parent
fd1a90411a
commit
bba32bc06e
@ -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()
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user