#pragma once // Extra frames between the client's 30-per-second ticks. The client draws a 3D window's frame when the window gets // WM_PAINT, and steps its scene on its own timer (SceneWindow.dll's runApp: a step, then the window is invalidated); // its message loop also wakes for WM_PAINT between steps. So asking the windows to repaint more often makes the client // draw more frames, without stepping the scene. The rate is the user's (T5DE's settings, Graphics: HKCU\Software\T5DE\ // Graphics, FrameRate): 30, the client's own and the default, adds nothing; 60, 120, 240 or 360 add frames between // ticks; 0 is uncapped. // // The rate counts all of a window's frames, the client's own included: a window is asked for one once its last frame // is drawn and the interval since it began has passed. Drawing runs on the client's main thread, with its input and // interface, so the client is also always left idle a third of a frame's time between frames: when the rate can't be // reached, the client draws as many frames as that allows. #include namespace t5de::frame_pacer { // A 3D window an engine draws into: repainted at the user's frame rate while added. void add(HWND window); void remove(HWND window); // A frame drawn into window, taking the client this long (beginRendering to endRendering). void frameDrawn(HWND window, double seconds); } // namespace t5de::frame_pacer