Raquet / Wiki / v1x / Creating A Basic Raquet Program

Creating a Basic Raquet Program

Table of Contents

 If you're able to compile the example given in the github repo, you're all set on being able to do stuff with Raquet. Delete the main.c in your src/ folder, and then create a new main.c file, because we're gonna make our own program from scratch.

Basic Setup

First, we need to include the Raquet Header file

#include <include/Raquet.h>

 This single header file contains everything that Raquet does and I don't want to hear any complaints about that, because it's easy.

The Main Functions

Anyways, the next step is to create and setup our main function.

int main()
{
  Raquet_Main();
  return 0;
}

 Congratulations, we have created the program. From here, we need to setup our creation and loop functions that Raquet uses. In your code, before your main function, define the following 2 functions: void createthedog() and void runthedog(). As their names suggest, createthedog() will be ran once, at the beginning of our program, while void runthedog() will be constant looping code (until we close the program).

void createthedog()
{

}

void runthedog()
{

}

Our Favorite Color

 Now, let's do something simple. We need to be able to clear the screen before and after we draw to it, otherwise our graphics will stack on top of eachother and it'll look really messy. For demonstration purposes, we'll clear the screen with a nice blue, specifically PAL12. We'll put it at the beginning of our runthedog function. (For more info on Palettes, please see the enclosed instruction booklet)

void runthedog()
{
  Raquet_Clear(PAL12);
}

Now, at the beginning of each frame, we will clear the screen with a nice vibrant blue :)
...
Just kidding! We need to also tell Raquet to update the window, so let's do that also.

void runthedog()
{
  Raquet_Clear(PAL12);

  Raquet_Update();
}

We put our update function at the end of the loop, so that we can draw everything we need before the window gets updated. Compiling our program now, should give us a bright blue window! perfect for the senses! :)