summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2025-03-04 13:44:30 -0500
committerJonathan Bradley <jcb@pikum.xyz>2025-03-04 14:04:17 -0500
commit78ca2865441df428228d158796c346e1df75d302 (patch)
treeebcbea508c88162c99fd3fa217aae79cc9440217 /src/game.cpp
parent3ca179e53bb4840a88c95e26b7eb11b36e1830dd (diff)
pke: ui draws on screen as expected
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 8b6d23d..fcb8736 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -19,6 +19,7 @@
#include "player-input.hpp"
#include "plugins.hpp"
#include "project.hpp"
+#include "static-ui.hpp"
#include "thread-pool.hpp"
#include "window.hpp"
#include "pk.h"
@@ -568,6 +569,7 @@ void Game_Tick(double delta) {
EntityType_Tick(delta);
ECS_Tick(delta);
PkeInput_Tick(delta);
+ pke_ui_tick(delta);
FontType_Tick(delta);
const auto pluginCount = LoadedPkePlugins.Count();
@@ -598,6 +600,8 @@ void Game_Main(PKEWindowProperties windowProps, const char *executablePath) {
CreateWindow(windowProps);
EntityType_Init();
PkeInput_Init();
+ pke_ui_init();
+ pke_ui_init_bindings();
FontType_Init();
PkeProject_Load(pkeSettings.args.projectPath);
if (pkeSettings.args.pluginPath != nullptr) {
@@ -634,6 +638,20 @@ void Game_Main(PKEWindowProperties windowProps, const char *executablePath) {
FontType_AddStringRender(FontTypeIndex{1}, pk_cstr_to_pk_str(&test_text2), &fr_set);
}
+ pke_ui_box *ui_box = pke_ui_box_new_root();
+ ui_box->flags = PKE_UI_BOX_FLAG_POSITION_TYPE_DYNAMIC;
+ ui_box->pos_top_left_x = 0.1;
+ ui_box->pos_top_left_y = 0.1;
+ ui_box->max_width = 0.8;
+ ui_box->max_height = 0.8;
+
+ pke_ui_box *c_ui_box = pke_ui_box_new_child(ui_box);
+ c_ui_box->flags = PKE_UI_BOX_FLAG_POSITION_TYPE_STATIC;
+ c_ui_box->pos_top_left_x = 20;
+ c_ui_box->pos_top_left_y = 20;
+ c_ui_box->max_width = 3000;
+ c_ui_box->max_height = 3000;
+
GameTimePoint lastTimePoint = pkeSettings.steadyClock.now();
double deltaTillNextRender = pkeSettings.deltaPerFrame;
GameTimePoint lastLogTimePoint = pkeSettings.steadyClock.now();
@@ -682,6 +700,7 @@ void Game_Main(PKEWindowProperties windowProps, const char *executablePath) {
tickCount += 1;
Game_Tick(deltaThisTick);
+ pkeSettings.rt.was_framebuffer_resized = false;
if (shouldRender) {
Render();
renderCount += 1;
@@ -731,6 +750,7 @@ void Game_Main(PKEWindowProperties windowProps, const char *executablePath) {
Event_Teardown();
EntityType_Teardown();
FontType_Teardown();
+ pke_ui_teardown();
PkeInput_Teardown();
PkeCamera_Teardown();
Physics_Teardown();