BEEP-8 Helper Lib 1.0.0
Loading...
Searching...
No Matches
pico8::Pico8 Class Reference

Base class for creating PICO-8 compatible applications in C/C++. More...

#include <pico8.h>

Public Member Functions

void run ()
 Runs the application by calling the overridden _init(), _update(), and _draw().
 

Friends

class ImplPico8
 

Detailed Description

Base class for creating PICO-8 compatible applications in C/C++.

In the original PICO-8 environment, init(), update(), and draw() are reserved functions that are used to initialize, update, and render the game, respectively. This class provides a C/C++ compatible API for users to implement similar functionality by creating a derived class.

Users are expected to create a subclass of Pico8 and override the following virtual functions:

  • _init(): Called once at the beginning, for any initialization code.
  • _update(): Called every frame to handle game logic and state updates.
  • _draw(): Called every frame after _update(), used to render the graphics.

Example:

class Pico8App : public Pico8 {
public:
void _init() override {
// Initialize game variables
}
void _update() override {
// Update game logic
}
void _draw() override {
// Render the game screen
}
};
Base class for creating PICO-8 compatible applications in C/C++.
Definition pico8.h:1790

The run() function in this class is responsible for executing the application by calling _init(), _update(), and _draw() in the appropriate order.


The documentation for this class was generated from the following files: