Clearing out template stuff and adding basic styles
This commit is contained in:
24
src/main.cpp
24
src/main.cpp
@@ -11,13 +11,10 @@
|
||||
#include <RmlUi_Backend.h>
|
||||
#include <RmlUi/Debugger.h>
|
||||
#include <RmlUi/Lua/Lua.h>
|
||||
#include <memory>
|
||||
#include "app.hpp"
|
||||
#include "element_registry.hpp"
|
||||
#include "pages/test_page.hpp"
|
||||
#include "ButtonClickListener.hpp"
|
||||
#include "lui_app_api.hpp"
|
||||
#include "elements/health_bar_element.hpp"
|
||||
|
||||
static bool is_initalized = false;
|
||||
static bool is_running = false;
|
||||
@@ -26,7 +23,7 @@ static App *app;
|
||||
static ElementRegistry elementRegistry;
|
||||
|
||||
void RegisterElements() {
|
||||
elementRegistry.Register<HealthBarElement>("healthbar");
|
||||
|
||||
}
|
||||
|
||||
bool InitalizeApplication() {
|
||||
@@ -58,6 +55,9 @@ bool InitalizeApplication() {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string assets_dir = App::GetAssetsPath();
|
||||
Rml::LoadFontFace(assets_dir + "/fonts/PTSerif-Regular.ttf");
|
||||
|
||||
lua_State* L = Rml::Lua::Interpreter::GetLuaState();
|
||||
AppLuaApi *lua_app_api = new AppLuaApi(app, L);
|
||||
lua_app_api->RegisterLuaBindings();
|
||||
@@ -105,22 +105,6 @@ int main() {
|
||||
|
||||
std::cout << "Loading UI...\n";
|
||||
|
||||
app->RegisterPage<TestPagePage>("test-page");
|
||||
|
||||
app->SetupListeners([](Rml::ElementDocument *doc) {
|
||||
if (auto *btn = doc->GetElementById("nav-test")) {
|
||||
app->RegisterListener(btn, std::make_unique<ButtonClickListener>([](Rml::Event&){
|
||||
app->NavigateTo("test-page");
|
||||
}));
|
||||
}
|
||||
|
||||
if (auto *btn = doc->GetElementById("nav-home")) {
|
||||
app->RegisterListener(btn, std::make_unique<ButtonClickListener>([](Rml::Event&){
|
||||
app->NavigateTo("home");
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
app->LoadUi();
|
||||
app->NavigateTo("home");
|
||||
std::cout << "UI Loaded\n";
|
||||
|
||||
Reference in New Issue
Block a user