GSDP:GAM100/CProcessing/CP System Run()

From Inside
Jump to: navigation, search

CP_System_Run()

Description

This function is what starts the CProcessing engine. Before calling CP_System_Run(), CP_System_SetNextGameState() or CP_System_SetNextGameStateForced() must be called to set the initial state of the program. Failing to do so will make the program 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_System_SetNextGameState(init, update, NULL);

  // Run the program
  CP_System_Run();    
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>