Anonymous
×
Create a new article
Write your page title here:
We currently have 399 articles on Inside. Type your article name above or click on one of the titles below and start writing!



    Inside

    GSDP:GAM100/CProcessing/CP System GetFrameCount()

    CP_System_GetFrameCount()

    Description

    Returns the current frame count. The frame count starts at 0 when the program launches and increments every frame until the program ends.

    Note: the frame count can't be set by the user and isn't reset when changing game states

    Example

    void update(void) 
    {
        // print the current frame count 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));
        
        int currentFrameCount = CP_System_GetFrameCount();
        
        char buffer[16] = { 0 };
        sprintf_s(buffer, _countof(buffer), "%i", currentFrameCount);
        CP_Font_DrawText(buffer, 200, 200);
    }
    

    Related