You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.8 KiB
34 lines
1.8 KiB
#include "debug.h"
|
|
#include "../game.h"
|
|
#include "uiContainer.h"
|
|
#include "string.h"
|
|
#include <stdio.h>
|
|
#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));
|
|
|
|
// 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++;
|
|
}
|
|
} |