small cleanup in debug code

isolation_bkp/dynres
Dominik Madarász 2021-05-14 06:24:56 +02:00
parent 60454a302a
commit 44d98257c7
1 changed files with 25 additions and 22 deletions

View File

@ -175,6 +175,9 @@ debug_draw_result debug_draw_list(debug_item *list, float xpos, float ypos, bool
void debug_draw(void) {
float xpos = debug_xpos;
float ypos = debug_ypos;
// NOTE(zaklaus): move debug ui
{
debug_area_status area = check_mouse_area(xpos, ypos, DBG_CTRL_HANDLE_DIM, DBG_CTRL_HANDLE_DIM);
Color color = BLUE;
if (area == DAREA_HOVER) color = YELLOW;
@ -183,7 +186,6 @@ void debug_draw(void) {
is_handle_ctrl_held = 1;
}
// NOTE(zaklaus): move debug ui
if (is_handle_ctrl_held) {
debug_xpos = xpos = GetMouseX() - DBG_CTRL_HANDLE_DIM/2;
debug_ypos = ypos = GetMouseY() - DBG_CTRL_HANDLE_DIM/2;
@ -194,19 +196,20 @@ void debug_draw(void) {
}
DrawRectangle(xpos, ypos, DBG_CTRL_HANDLE_DIM, DBG_CTRL_HANDLE_DIM, color);
}
// NOTE(zaklaus): toggle debug ui
{
Color toggle_color = BLUE;
debug_area_status toggle_area = check_mouse_area(xpos, 15+ypos, DBG_CTRL_HANDLE_DIM, DBG_CTRL_HANDLE_DIM);
if (toggle_area == DAREA_HOVER) toggle_color = YELLOW;
if (toggle_area == DAREA_HELD) {
toggle_color = RED;
Color color = BLUE;
debug_area_status area = check_mouse_area(xpos, 15+ypos, DBG_CTRL_HANDLE_DIM, DBG_CTRL_HANDLE_DIM);
if (area == DAREA_HOVER) color = YELLOW;
if (area == DAREA_HELD) {
color = RED;
}
if (toggle_area == DAREA_PRESS) {
if (area == DAREA_PRESS) {
is_debug_open = !is_debug_open;
}
DrawPoly((Vector2){xpos+DBG_CTRL_HANDLE_DIM/2, ypos+15+DBG_CTRL_HANDLE_DIM/2}, 3, 7.5f,is_debug_open ? 0.0f : 180.0f, toggle_color);
DrawPoly((Vector2){xpos+DBG_CTRL_HANDLE_DIM/2, ypos+15+DBG_CTRL_HANDLE_DIM/2}, 3, 7.5f,is_debug_open ? 0.0f : 180.0f, color);
}
if (is_debug_open) {