-
Notifications
You must be signed in to change notification settings - Fork 1
Home
invoker__qq edited this page Nov 15, 2020
·
3 revisions
NOTE: SwitchPixelGameEngine was released recently, thus this documentation is being compiled, and therefore not completed. However, the engine is intuitively easy to use, and there will be some examples in the main repo.
- Getting Started
- Include the header file "SwitchPixelGameEngine.h" from a source file
- Implement a constructor for your derived class, and name your application
- Optionally override the OnUserCreate() function
- Override the OnUserUpdate() function
- Optionally override the OnUserDestroy() function
- Create an instance of your derived class somewhere, typically main()
- Call the Construct() function and specify the screen and pixel dimensions
- Call the GameThread() function to, well, start the engine 😂
#include "SwitchPixelGameEngine.h"
class Demo : public SwitchPixelGameEngine
{
public:
Demo()
{
}
std::string s_str = "hello world !";
virtual bool OnUserCreate() override
{
return true;
}
virtual bool OnUserUpdate(float fElapsedTime) override
{
ClearScreen();
DrawTriangle(20,20,20,60,50,50,FG_YELLOW);
DrawCircle(20,60,10,FG_GREEN);
DrawString(ScreenWidth()/2, ScreenHeight()/2, s_str);
return true;
}
};
int main()
{
Demo example;
example.ConstructConsole(1,1);
example.GameThread();
}