Closed tiehuis closed 7 years ago
Now that frontends are much more flexible, the requirement for this generic type of event is less pronounced. The idea still makes sense for each however, but each frontend's implementation strategy will likely differ.
A generic rendering hook would be useful for rendering details which aren't tied to any particular game state or which have a period of action where they occur before stopping. Examples include line clear animations and displaying of high scoring or technical moves such as T-Spins or tetrises.
The proposed outline is currently as follows:
Define a single function interface
fsiRenderEvent(FSPSView *v, FS_RENDER_EVENT event, int currentFrame, int totalFrames)
.v
This is simply the current game state which allows the implementer to get any required data.
event
A render event specifies the type of event which the implementer must render. For example, an event
FS_RENDER_EVENT_LINE_CLEAR
could be utilized and the implementer can then perform their specific action, choosing via a switch statement.currentFrame
,totalFrames
An implementer must implement their event based on the current frame and the total frames that this event will be called for. This is done to allow for different length events and for the implementer to handle variable time steps by means of interpolation or otherwise.
When are these renderered?
Events are renderered during the
fsiDraw
phase. A game instance will have a set of slots with which can be filled with render events (say 10). During this phase these slots are walked and the current frame to render with the total frames is passed to thefsiRenderEvent
function for the implementer to handle.This requires keeping track of the following three items in each slot: