Skip to content

Commit

Permalink
Rename GameUi->Ui
Browse files Browse the repository at this point in the history
  • Loading branch information
scallyw4g committed Aug 28, 2023
1 parent 9500a9d commit 5ac4fdb
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 23 deletions.
10 changes: 5 additions & 5 deletions examples/turn_based/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,15 +445,15 @@ BONSAI_API_MAIN_THREAD_CALLBACK()
}

local_persist window_layout ActionsWindow = {};
PushBorderlessWindowStart(GameUi, &ActionsWindow, V2(0, 128));
PushBorderlessWindowStart(Ui, &ActionsWindow, V2(0, 128));
for (u32 ActionIndex = 0; ActionIndex < PlayerAction_Count; ++ActionIndex)
{
ui_style *Style = ActionIndex == SelectedAction ? &DefaultSelectedStyle : &DefaultStyle;
PushTableStart(GameUi);
PushColumn(GameUi, ToString((player_action)ActionIndex), Style);
PushTableEnd(GameUi);
PushTableStart(Ui);
PushColumn(Ui, ToString((player_action)ActionIndex), Style);
PushTableEnd(Ui);
}
PushWindowEnd(GameUi, &ActionsWindow);
PushWindowEnd(Ui, &ActionsWindow);

if (Hotkeys)
{
Expand Down
18 changes: 9 additions & 9 deletions src/engine/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Bonsai_Init(engine_resources *Resources)
if (!Resources->Graphics) { Error("Initializing Graphics"); return False; }

memory_arena *GraphicsMemory2D = AllocateArena();
InitRenderer2D(&Resources->GameUi, &Resources->Heap, GraphicsMemory2D, &Plat->MouseP, &Plat->MouseDP, &Plat->ScreenDim, &Plat->Input);
InitRenderer2D(&Resources->Ui, &Resources->Heap, GraphicsMemory2D, &Plat->MouseP, &Plat->MouseDP, &Plat->ScreenDim, &Plat->Input);

Resources->EntityTable = AllocateEntityTable(BonsaiInitArena, TOTAL_ENTITY_COUNT);

Expand Down Expand Up @@ -81,7 +81,7 @@ Bonsai_FrameBegin(engine_resources *Resources)
DEBUG_DrawLine_Aligned(&CopyDest, V3(0,0,0), V3(0, 0, 10000), BLUE, 0.15f );
}

UiFrameBegin(&Resources->GameUi);
UiFrameBegin(&Resources->Ui);


Resources->MousedOverVoxel = MousePickVoxel(Resources);
Expand All @@ -103,7 +103,7 @@ link_export b32
Bonsai_FrameEnd(engine_resources *Resources)
{
DoEngineDebugMenu(Resources);
UiFrameEnd(&Resources->GameUi);
UiFrameEnd(&Resources->Ui);

b32 Result = True;
return Result;
Expand Down Expand Up @@ -136,7 +136,7 @@ Bonsai_SimulateAndBufferGeometry(engine_resources *Resources)

{
input *InputForCamera = 0;
if (UiCapturedMouseInput(GameUi) == False)
if (UiCapturedMouseInput(Ui) == False)
{
InputForCamera = &Plat->Input;
}
Expand Down Expand Up @@ -253,17 +253,17 @@ Bonsai_Render(engine_resources *Resources)
GL.DisableVertexAttribArray(1);
GL.DisableVertexAttribArray(2);

/* DebugVisualize(GameUi, &Resources->MeshFreelist); */
/* DebugVisualize(GameUi, Resources->World->FreeChunks, (s32)Resources->World->FreeChunkCount); */
/* DebugVisualize(Ui, &Resources->MeshFreelist); */
/* DebugVisualize(Ui, Resources->World->FreeChunks, (s32)Resources->World->FreeChunkCount); */


{
/* DoEngineDebugMenu(GameUi); */
/* DoEngineDebugMenu(Ui); */

// NOTE(Jesse): This should probably render the last such that we can
// capture all the debug tracking info we want to
/* GameUi->ScreenDim = V2(Plat->WindowWidth, Plat->WindowHeight); */
/* FlushCommandBuffer(GameUi, GameUi->CommandBuffer); */
/* Ui->ScreenDim = V2(Plat->WindowWidth, Plat->WindowHeight); */
/* FlushCommandBuffer(Ui, Ui->CommandBuffer); */
}

b32 Result = True;
Expand Down
5 changes: 0 additions & 5 deletions src/engine/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ link_internal void
DebugUi(engine_resources *Engine, cs Name, world_chunk *Value)
{
UNPACK_ENGINE_RESOURCES(Engine);
auto Ui = GameUi;

Text(Ui, Name);
PushNewRow(Ui);
Expand Down Expand Up @@ -197,7 +196,6 @@ link_internal void
DebugUi(engine_resources *Engine, cs Name, window_layout *Value)
{
UNPACK_ENGINE_RESOURCES(Engine);
renderer_2d *Ui = GameUi;

Text(Ui, Name);
Text(Ui, Value->Title);
Expand All @@ -207,7 +205,6 @@ link_internal void
DebugUi(engine_resources *Engine, cs Name, interactable *Value)
{
UNPACK_ENGINE_RESOURCES(Engine);
renderer_2d *Ui = GameUi;

DebugValue(Ui, &Value->ID);
DebugValue(Ui, &Value->MinP);
Expand All @@ -221,8 +218,6 @@ DoEngineDebugMenu(engine_resources *Engine)
{
UNPACK_ENGINE_RESOURCES(Engine);

renderer_2d *Ui = GameUi;

local_persist ui_element_toggle_button Buttons[] = {
{CSz("Edit"), False},
{CSz("WorldChunks"), False},
Expand Down
4 changes: 2 additions & 2 deletions src/engine/resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct engine_resources
tiered_mesh_freelist MeshFreelist;

// TODO(Jesse): Put this in Graphics?
renderer_2d GameUi;
renderer_2d Ui;

debug_state *DebugState;

Expand Down Expand Up @@ -78,7 +78,7 @@ GetEngineResources()
#define UNPACK_GRAPHICS_RESOURCES(Res) \
graphics *Graphics = Res->Graphics; \
lighting_render_group *Lighting = &Graphics->Lighting; \
renderer_2d *GameUi = &Res->GameUi; \
renderer_2d *Ui = &Res->Ui; \
gpu_mapped_element_buffer *GpuMap = GetCurrentGpuMap(Graphics); \
g_buffer_render_group *gBuffer = Graphics->gBuffer; \
camera *Camera = Graphics->Camera;
Expand Down
4 changes: 2 additions & 2 deletions src/game_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ main( s32 ArgCount, const char ** Args )


#if DEBUG_SYSTEM_API
GetDebugState()->SetRenderer(&EngineResources.GameUi);
GetDebugState()->SetRenderer(&EngineResources.Ui);
#endif

LaunchWorkerThreads(&Plat, &EngineResources, &EngineApi, &GameApi);
Expand Down Expand Up @@ -412,7 +412,7 @@ main( s32 ArgCount, const char ** Args )
BindHotkeysToInput(&Hotkeys, &Plat.Input);

// NOTE(Jesse): Must come after input has been processed
UiFrameBegin(&EngineResources.GameUi);
UiFrameBegin(&EngineResources.Ui);

DEBUG_FRAME_BEGIN(Hotkeys.Debug_ToggleMenu, Hotkeys.Debug_ToggleProfiling);

Expand Down

0 comments on commit 5ac4fdb

Please sign in to comment.