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.addComponent<Sprite>(); background.getComponent<Sprite>().loadTexture("res/background.png");
Components can be created an added (Kinda like scripts)
class Player : public Component { public: Player(Entity &entity) : Component(entity) { entity.addComponent<Sprite>().loadTexture("res/player.png"); } void update() override { Sprite& sprite = entity.getComponent<Sprite>(); sprite.angle.lookAt(entity.box.getCenter(), InputManager::getMouseWorldPosition()); } };
The start method will run during the component initialization Update will of course run every game loop And then can be added to Entities
Entity* player = createEntity("Player"); player.addComponent<Player>();
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
Comments
Log in with itch.io to leave a comment.
nice