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



    Inside

    GSDP:GAM100/CProcessing/Run()

    Run()

    Description

    This function is what starts the CProcessing engine. Before calling run(), SetNextGameState() or 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 */
      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();    
    }
    

    See Also