Difference between revisions of "GSDP:GAM100/CProcessing/CP main"
From Inside
< GSDP:GAM100 | CProcessing
>Zachary.logsdon (New page: {{GSDP:GAM100API.css}} = CP_Main() = == Description == A special version of main() used by CProcessing. You will write it like you would any main function. From CP_Main you will set your ...) |
>Zachary.logsdon |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{GSDP:GAM100API.css}} | {{GSDP:GAM100API.css}} | ||
− | = | + | = CP_main = |
== Description == | == Description == | ||
Line 22: | Line 22: | ||
} | } | ||
− | + | CP_main | |
{ | { | ||
// Set the initial game state | // Set the initial game state | ||
Line 36: | Line 36: | ||
* [[GSDP:GAM100/CProcessing|Main Page]] | * [[GSDP:GAM100/CProcessing|Main Page]] | ||
* [[GSDP:GAM100/CProcessing/Run()|Run()]] | * [[GSDP:GAM100/CProcessing/Run()|Run()]] | ||
− | * [[GSDP:GAM100/CProcessing/CP_main|CP_main | + | * [[GSDP:GAM100/CProcessing/CP_main|CP_main]] |
* [[GSDP:GAM100/CProcessing/Terminate()|Terminate()]] | * [[GSDP:GAM100/CProcessing/Terminate()|Terminate()]] | ||
* [[GSDP:GAM100/CProcessing/SetNextGameState()|SetNextGameState()]] | * [[GSDP:GAM100/CProcessing/SetNextGameState()|SetNextGameState()]] | ||
* [[GSDP:GAM100/CProcessing/SetNextGameStateForced()|SetNextGameStateForced()]] | * [[GSDP:GAM100/CProcessing/SetNextGameStateForced()|SetNextGameStateForced()]] |
Latest revision as of 09:40, 20 October 2019
CP_main
Description
A special version of main() used by CProcessing. You will write it like you would any main function. From CP_Main you will set your first game state and call Run() to start the CProcessing engine.
Example Usage
void init(void)
{
/* Set the size of the window */
size(500, 500);
}
void update(void)
{
/* Set the background color to black every frame */
background(color(0, 0, 0, 255));
/* Draw a rectangle at the mouse position */
rect(mouseX, mouseY, 50, 50);
}
CP_main
{
// Set the initial game state
SetNextGameState(init, update, NULL);
// Run the program
Run();
}