Progress!
EsterdonEngine » Devlog
After a few rewrites from my previous post, I'm actually making progress. For those familiar with unity, a lot of those code will feel familiar. On to ldtk.io integration, which i have working in a previous project and won't be a big deal at all.
The attached scene image is the following simple enough code. Yes i know my title text is mis-aligned. math is hard.
class MainMenuScene : public Scene { public: MainMenuScene() {} virtual ~MainMenuScene() {} virtual void OnCreate() override { obj = std::make_shared<EmptyObject>("empty object"); auto img = std::make_shared<ImageComponent>("bg image"); img->SetAlignment(AlignPin::MIDDLE_CENTER) ->SetMargin({0, 0, 0, 0}) ->SetImagePath("data/castle.png") ->SetScale(Scale::FIT_VERTICAL_NO_STRETCH); img->zOrder = -1; img->debug = true; obj->AddComponent(img); auto title = std::make_shared<TextComponent>("title"); title->SetTitle("ESTERDON"); title->SetFontSize(20); title->SetAlignment(AlignPin::MIDDLE_CENTER); title->SetColor(Colors::red); obj->AddComponent(title); auto startBtn = std::make_shared<ButtonComponent>("startBtn"); startBtn->SetAlignment(AlignPin::MIDDLE_CENTER); startBtn->SetMargin({0, 0, 50, 0}); startBtn->SetTitle("Start Game"); startBtn->OnClick([&]() { GetSceneManager()->SetActiveScene("main"); }); obj->AddComponent(startBtn); AddObject(obj); } virtual void OnUpdate() override {} private: std::shared_ptr<EmptyObject> obj; };
EsterdonEngine
2d sprite based engine for roguelike development (with LDTK support)
More posts
- Initial design notesNov 17, 2023
Leave a comment
Log in with itch.io to leave a comment.