mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-07 02:40:30 -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);
|
||||
}
|
||||
|
||||
void Window::RunCommands(Gfx* Commands) {
|
||||
void Window::StartFrame() {
|
||||
gfx_start_frame();
|
||||
}
|
||||
|
||||
void Window::RunCommands(Gfx* Commands) {
|
||||
gfx_run(Commands);
|
||||
gfx_end_frame();
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ namespace Ship {
|
||||
~Window();
|
||||
void MainLoop(void (*MainFunction)(void));
|
||||
void Init();
|
||||
void StartFrame();
|
||||
void RunCommands(Gfx* Commands);
|
||||
void SetFrameDivisor(int divisor);
|
||||
void GetPixelDepthPrepare(float x, float y);
|
||||
|
@ -5,6 +5,7 @@
|
||||
extern "C" {
|
||||
void InitOTR();
|
||||
void Graph_ProcessFrame(void (*run_one_game_iter)(void));
|
||||
void Graph_StartFrame();
|
||||
void Graph_ProcessGfxCommands(Gfx* commands);
|
||||
void OTRLogString(const char* src);
|
||||
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);
|
||||
}
|
||||
|
||||
extern "C" void Graph_StartFrame() {
|
||||
OTRGlobals::Instance->context->GetWindow()->StartFrame();
|
||||
}
|
||||
|
||||
// C->C++ Bridge
|
||||
extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
|
||||
OTRGlobals::Instance->context->GetWindow()->SetFrameDivisor(R_UPDATE_RATE);
|
||||
|
@ -21,6 +21,7 @@ private:
|
||||
#ifndef __cplusplus
|
||||
void InitOTR();
|
||||
void Graph_ProcessFrame(void (*run_one_game_iter)(void));
|
||||
void Graph_StartFrame();
|
||||
void Graph_ProcessGfxCommands(Gfx* commands);
|
||||
void OTRLogString(const char* src);
|
||||
void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(void*, char));
|
||||
|
@ -472,6 +472,7 @@ static void RunFrame()
|
||||
uint64_t ticksA, ticksB;
|
||||
ticksA = GetPerfCounter();
|
||||
|
||||
Graph_StartFrame();
|
||||
|
||||
PadMgr_ThreadEntry(&gPadMgr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user