-
Notifications
You must be signed in to change notification settings - Fork 1
Tutorial
It follows our recommendation on how to develop games for MES.
Because uploading your game to a real console while debugging is really time consuming, we created a MES simulator called Virtual-MES. V-MES compiles your games source code with its own drivers, allowing MES games to run on pc (this is what makes it a simulator, not an emulator). You can set it up using the instructions over at its repository, but we recommend using our template repository. It incorporates simulation and uploading to real hardware and reduces the complexity of your workflow significantly. In this Tutorial, we will be using the template, so follow the instructions found in that repository. If you want to include MES/V-MES into your own build system, you're probably skilled enough to follow this tutorial anyway.
In terms of "Time to hello world", MES ranks quite high, considering it needs to render the characters and not simply send them through a data stream. This is what a "Hello World" program for MES looks like:
#include <gpu.h>
uint8_t start(void) {
char* helloworld = "Hello, World!";
gpu_blank(FRONT_BUFFER, 0);
gpu_print_text(FRONT_BUFFER, 1, 1, 1, 0, helloworld);
while (1);
}Since we will be drawing something on the screen, first include the gpu header. The main function, the one that will be executed when the user opens your game, is called start and has uint8_t as its return type. For a list of all return codes, see the documentation.
Inside the function we first declare our hello world string as a char*. The following two functions are provided by the gpu header and will clear the screen (with the color black, which is 0 in the standard palette), then render our text onto it at the location (1, 1), with foreground color 1 (white) and background color 0. All of this is applied to the FRONT_BUFFER, which is the buffer the user sees on screen.