mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-14 06:10:17 -05:00
Reduce input lag by one frame by reading the controller at the correct place
This commit is contained in:
parent
5b52e7e570
commit
589557be9c
@ -275,8 +275,11 @@ namespace Ship {
|
|||||||
WmApi->set_keyboard_callbacks(Window::KeyDown, Window::KeyUp, Window::AllKeysUp);
|
WmApi->set_keyboard_callbacks(Window::KeyDown, Window::KeyUp, Window::AllKeysUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::RunCommands(Gfx* Commands) {
|
void Window::StartFrame() {
|
||||||
gfx_start_frame();
|
gfx_start_frame();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window::RunCommands(Gfx* Commands) {
|
||||||
gfx_run(Commands);
|
gfx_run(Commands);
|
||||||
gfx_end_frame();
|
gfx_end_frame();
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ namespace Ship {
|
|||||||
~Window();
|
~Window();
|
||||||
void MainLoop(void (*MainFunction)(void));
|
void MainLoop(void (*MainFunction)(void));
|
||||||
void Init();
|
void Init();
|
||||||
|
void StartFrame();
|
||||||
void RunCommands(Gfx* Commands);
|
void RunCommands(Gfx* Commands);
|
||||||
void SetFrameDivisor(int divisor);
|
void SetFrameDivisor(int divisor);
|
||||||
void GetPixelDepthPrepare(float x, float y);
|
void GetPixelDepthPrepare(float x, float y);
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
void InitOTR();
|
void InitOTR();
|
||||||
void Graph_ProcessFrame(void (*run_one_game_iter)(void));
|
void Graph_ProcessFrame(void (*run_one_game_iter)(void));
|
||||||
|
void Graph_StartFrame();
|
||||||
void Graph_ProcessGfxCommands(Gfx* commands);
|
void Graph_ProcessGfxCommands(Gfx* commands);
|
||||||
void OTRLogString(const char* src);
|
void OTRLogString(const char* src);
|
||||||
void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(void*, char));
|
void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(void*, char));
|
||||||
|
@ -92,6 +92,10 @@ extern "C" void Graph_ProcessFrame(void (*run_one_game_iter)(void)) {
|
|||||||
OTRGlobals::Instance->context->GetWindow()->MainLoop(run_one_game_iter);
|
OTRGlobals::Instance->context->GetWindow()->MainLoop(run_one_game_iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void Graph_StartFrame() {
|
||||||
|
OTRGlobals::Instance->context->GetWindow()->StartFrame();
|
||||||
|
}
|
||||||
|
|
||||||
// C->C++ Bridge
|
// C->C++ Bridge
|
||||||
extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
|
extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
|
||||||
OTRGlobals::Instance->context->GetWindow()->SetFrameDivisor(R_UPDATE_RATE);
|
OTRGlobals::Instance->context->GetWindow()->SetFrameDivisor(R_UPDATE_RATE);
|
||||||
|
@ -21,6 +21,7 @@ private:
|
|||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
void InitOTR();
|
void InitOTR();
|
||||||
void Graph_ProcessFrame(void (*run_one_game_iter)(void));
|
void Graph_ProcessFrame(void (*run_one_game_iter)(void));
|
||||||
|
void Graph_StartFrame();
|
||||||
void Graph_ProcessGfxCommands(Gfx* commands);
|
void Graph_ProcessGfxCommands(Gfx* commands);
|
||||||
void OTRLogString(const char* src);
|
void OTRLogString(const char* src);
|
||||||
void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(void*, char));
|
void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(void*, char));
|
||||||
|
@ -472,6 +472,7 @@ static void RunFrame()
|
|||||||
uint64_t ticksA, ticksB;
|
uint64_t ticksA, ticksB;
|
||||||
ticksA = GetPerfCounter();
|
ticksA = GetPerfCounter();
|
||||||
|
|
||||||
|
Graph_StartFrame();
|
||||||
|
|
||||||
PadMgr_ThreadEntry(&gPadMgr);
|
PadMgr_ThreadEntry(&gPadMgr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user