#include "debug.h" #include "../game.h" #include "uiContainer.h" #include "string.h" #include #include "../Input/inputHandler.h" void DebugDraw(Game *game, UiContainer *uiContainer){ char strings[10][41]; // Platz für bis zu 10 Strings der Länge 40 int lineamount = 0; // sollte aktuell gehalten werden, wie viele Lines sind aktuell im Strings Array int neededWidth = MeasureText("1234567890123456789012345", DEBUG_FONT_SIZE); // sollte an den längsten debug String angepasst werden, damit dieser noch reinpasst // Hier die Debug Information in den Strings Array einfügen // im Endeffekt einfach im Array an der Stelle lineamount++ die Elemente einfügen sprintf(strings[lineamount++], "Screen: %d", game->screen); sprintf(strings[lineamount++], "MouseScreenX: %d", GetMouseX()); sprintf(strings[lineamount++], "MouseScreenY: %d", GetMouseY()); sprintf(strings[lineamount++], "MouseWorldX: %d", (int)game->inputHandler->cursorWorldPos.x); sprintf(strings[lineamount++], "MouseWorldY: %d", (int)game->inputHandler->cursorWorldPos.y); sprintf(strings[lineamount++], "Selected Layer: %d", game->inputHandler->selectedLayer); sprintf(strings[lineamount++], "DEPTH: %d", (int)(game->inputHandler->cursorWorldPos.x + game->inputHandler->cursorWorldPos.y + game->inputHandler->selectedLayer)); sprintf(strings[lineamount++], "Camera Zoom: %f", game->camera->zoom); // Drawed eine Box für die Debug Info DrawRectangleLines(0, 0, neededWidth, lineamount * DEBUG_FONT_SIZE + 5, (Color){0, 0, 0, 255}); DrawRectangle(0, 0, neededWidth, lineamount * DEBUG_FONT_SIZE + 5, (Color){0, 0, 0, 150}); // Drawed den Inhalt des "strings" Arrays int counter = 0; while(counter < lineamount){ DrawText(strings[counter], 2, counter * DEBUG_FONT_SIZE + 2, DEBUG_FONT_SIZE, (Color){220, 25, 25, 255}); counter++; } }