GSDP:GAM100/CProcessing/CP Engine Run()

From Inside
< GSDP:GAM100‎ | CProcessing
Revision as of 22:38, 19 September 2020 by >Justin.chambers (New page: {{GSDP:GAM100API.css}} = CP_Engine_Run() = == Description == This function is what starts the CProcessing engine. Before calling '''CP_Engine_Run()''', [[GSDP:GAM100/CProcessing/CP_Engine_...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

CP_Engine_Run()

Description

This function is what starts the CProcessing engine. Before calling CP_Engine_Run(), CP_Engine_SetNextGameState() or CP_Engine_SetNextGameStateForced() must be called to set the initial state of the program. Failing to do so will cause the program to end immediately.

Example Usage

void init(void)
{
  /* Set the size of the window */
  CP_System_Size(500, 500);
}

void update(void)
{
  /* Set the background color to black every frame */
  CP_Settings_Background(CP_Color_Create(0, 0, 0, 255));

  /* Draw a rectangle at the mouse position */
  CP_Graphics_DrawRect(CP_Input_GetMouseX(), CP_Input_GetMouseY(), 50, 50);
}

int main(void)
{
  // Set the initial game state
  CP_Engine_SetNextGameState(init, update, NULL);

  // Run the program
  CP_Engine_Run();    
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>