mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 18:45:23 -04:00
3DS: Don't always force vsync, and try to tie joystick movement to framerate
This commit is contained in:
parent
8b53b9eb9d
commit
6d1ec70de1
@ -119,6 +119,7 @@ void Gfx_Create(void) {
|
||||
Gfx.MaxTexWidth = 512;
|
||||
Gfx.MaxTexHeight = 512;
|
||||
Gfx.Created = true;
|
||||
gfx_vsync = true;
|
||||
|
||||
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
|
||||
target = C3D_RenderTargetCreate(240, 400, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8);
|
||||
@ -326,10 +327,11 @@ void Gfx_SetFpsLimit(cc_bool vsync, float minFrameMs) {
|
||||
}
|
||||
|
||||
void Gfx_BeginFrame(void) {
|
||||
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
||||
int flags = gfx_vsync ? C3D_FRAME_SYNCDRAW : 0;
|
||||
C3D_FrameBegin(flags);
|
||||
}
|
||||
|
||||
void Gfx_Clear(void) {
|
||||
//Platform_Log1("CLEAR: %i", &clear_color);
|
||||
C3D_RenderTargetClear(target, C3D_CLEAR_ALL, clear_color, 0);
|
||||
C3D_FrameDrawOn(target);
|
||||
}
|
||||
|
@ -106,12 +106,14 @@ static void HandleButtons_Launcher(u32 mods) {
|
||||
Input_SetNonRepeatable(CCPAD_DOWN, mods & KEY_DDOWN);
|
||||
}
|
||||
|
||||
static void ProcessJoystickInput(circlePosition* pos) {
|
||||
static void ProcessJoystickInput(circlePosition* pos, double delta) {
|
||||
float scale = (delta * 60.0) / 8.0f;
|
||||
|
||||
// May not be exactly 0 on actual hardware
|
||||
if (Math_AbsI(pos->dx) <= 4) pos->dx = 0;
|
||||
if (Math_AbsI(pos->dy) <= 4) pos->dy = 0;
|
||||
|
||||
Event_RaiseRawMove(&PointerEvents.RawMoved, pos->dx / 8.0f, -pos->dy / 8.0f);
|
||||
Event_RaiseRawMove(&PointerEvents.RawMoved, pos->dx * scale, -pos->dy * scale);
|
||||
}
|
||||
|
||||
void Window_ProcessEvents(double delta) {
|
||||
@ -156,14 +158,14 @@ void Window_ProcessEvents(double delta) {
|
||||
if (Input.RawMode) {
|
||||
circlePosition pos;
|
||||
hidCircleRead(&pos);
|
||||
ProcessJoystickInput(&pos);
|
||||
ProcessJoystickInput(&pos, delta);
|
||||
}
|
||||
|
||||
if (Input.RawMode && irrst_result == 0) {
|
||||
circlePosition pos;
|
||||
irrstScanInput();
|
||||
irrstCstickRead(&pos);
|
||||
ProcessJoystickInput(&pos);
|
||||
ProcessJoystickInput(&pos, delta);
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,7 +287,6 @@ cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) {
|
||||
}
|
||||
|
||||
cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
|
||||
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user