Small cross-platform 2D game engine.
To start simple project follow these steps:
-
Clone repo
git clone https://github.com/ayles/A2D.git
-
Use
generate.py
to generate project files:python3 A2D/tools/generate.py MySimpleProject -d .
-
Optionally edit
MySimpleProject/src/root_component.hpp
-
Build desktop project:
cd MySimpleProject/projects/proj.desktop mkdir build cd build cmake .. cmake --build .
-
Run:
./MySimpleProject
- Windows (MSVC)
- Linux
- macOS
- Android
- iOS
// root_component.hpp
namespace a2d {
class RootComponent : public Component {
public:
intrusive_ptr<Object2D> text;
intrusive_ptr<Camera> camera;
void Initialize() override {
camera = Object2D::Create()->AddComponent<Camera>();
Renderer::SetMainCamera(camera);
text = Object2D::Create();
text->AddComponent<Text>()->SetFont(Resources::Get<BitmapFont>("impact"));
text->GetComponent<Text>()->SetOrigin(0.5f, 0.0f);
text->GetComponent<Text>()->SetFontSize(24);
text->GetComponent<Text>()->SetText(U"Hello, A2D!");
}
void Update() override {
text->SetRotation(text->GetRotation() + Engine::GetDeltaTime());
camera->SetHeight(Renderer::GetHeight());
}
};
}
- Rework audio
- Add support for texture atlas creation on-the-fly
- Add Emscripten support
- And more...
This project is small, so all contributions are welcome.
You can contact with me by email selya.main@gmail.com.