GSDP:GAM100/CProcessing/CP System GetDt()

From Inside
< GSDP:GAM100‎ | CProcessing
Revision as of 13:50, 25 July 2020 by >Justin.chambers (New page: {{GSDP:GAM100API.css}} =CP_System_GetDt()= ==Description== Returns the elapsed time from the last frame. ==Example== <syntaxhighlight lang='c'> void update(void) { // print the curr...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

CP_System_GetDt()

Description

Returns the elapsed time from the last frame.

Example

void update(void) 
{
    // print the current frame rate to the center of the window
    CP_Settings_TextSize(200);
    CP_Settings_TextAlignment(CP_TEXT_ALIGN_H_CENTER, CP_TEXT_ALIGN_V_MIDDLE);
    CP_Settings_Background(CP_Color_Create(200, 200, 200, 255));
    CP_Settings_Fill(CP_Color_Create(100, 20, 100, 255));
    
    float currentFrameRate = CP_System_GetFrameRate();
    
    char buffer[16] = { 0 };
    sprintf_s(buffer, _countof(buffer), "%.1f", currentFrameRate );
    CP_Font_DrawText(buffer, 200, 200);
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>