Charlie2D
A downloadable tool
A simple game engine that acts like an extension of sdl2, uses an entity-component architecture. The idea behind this project is to have a game engine with the editor being a separate piece of software (LDTK recommended).
Examples
https://ethanscharlie.itch.io/piracybutspace
https://ethanscharlie.itch.io/theyre-coming-for-my-uranium
https://ethanscharlie.itch.io/christmas-cannonade
https://ethanscharlie.itch.io/icntball-remastered
Quickstart
Init
int main() { GameManager::init({1920, 1080}); // Game code GameManager::doUpdateLoop(); return 0; }
The init() must be ran first and will also set the 'original' resolution, note that this should be set once and left because changing it will change game behavior, defaults to 1920x1080 if no argument is given.
Entities
Entity* player = GameManager::createEntity("Player");
Entites can be created with the GameManager::createEntity method. In the instance above the Entity is given the tag "Player".
Components
Entity* background = GameManager::createEntity("Background"); background->add<Sprite>(); background->get<Sprite>()->loadTexture("img/background.png"); Entity* background2 = GameManager::createEntity("Background");
Components can be created an added (Kinda like scripts)
class Player : public Component { public: void start() override { entity->add<Sprite>()->loadTexture("img/player.png"); } void update(float deltaTime) override { Sprite* sprite = entity->get<Sprite>(); sprite->angle.lookAt(entity->box.getCenter(), InputManager::getMouseWorldPosition()); } };
The start method will run during the component initalization Update will of course run every game loop And then can be added to Entities
Entity* player = createEntity("Player"); player->add<Player>();
Published | 6 hours ago |
Status | In development |
Category | Tool |
Author | Ethanscharlie |
Tags | 2D, c, charlie2d, Game engine, sdl2 |
Download
Install instructions
Clone or download the project template, more info in the readme
https://github.com/Ethanscharlie/Charlie2D-Project-Template.git
Leave a comment
Log in with itch.io to leave a comment.