Skip to content

Commit 047d2b3

Browse files
committed
Debug UI option
1 parent 6ada8c8 commit 047d2b3

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

Platform Game/Motor2D/GUI_Object.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ void GUI_Object::Draw(SDL_Texture* atlas)
2424
App->render->Blit(texture, position.x, position.y, (const SDL_Rect*)0, 0.0F);
2525
}
2626

27+
if (App->gui->debug_ui == true)
28+
{
29+
SDL_Rect rect;
30+
rect.x = position.x;
31+
rect.y = position.y + 95;
32+
rect.w = section.w;
33+
rect.h = section.h;
34+
App->render->DrawQuad(rect, 255, 0, 0, 255, false, true);
35+
}
2736
}
2837

2938
void GUI_Object::Update()

Platform Game/Motor2D/j1GUI.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ bool j1Gui::PostUpdate()
6363
if (objects[i] != nullptr)
6464
objects[i]->Draw(atlas);
6565
}
66+
67+
if (App->input->GetKey(SDL_SCANCODE_F8) == KEY_DOWN)
68+
{
69+
if (!debug_ui) debug_ui = true;
70+
else debug_ui = false;
71+
}
6672
return true;
6773
}
6874

Platform Game/Motor2D/j1GUI.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ class j1Gui : public j1Module
6464
bool DestroyElement(GUI_Object* element);
6565

6666

67+
public:
68+
bool debug_ui = false;
69+
6770
private:
6871

6972
SDL_Texture* atlas;

0 commit comments

Comments
 (0)