minor tweaks

main
JanEhehalt 3 years ago
parent 94e809af6d
commit de0dacd814

@ -4,14 +4,14 @@
#include "raylib.h" #include "raylib.h"
#include "../game.h" #include "../game.h"
#define BUTTON_STATE_DEFAULT 0 #define BUTTON_STATE_DEFAULT 0 // button is just there
#define BUTTON_STATE_HOVERED 1 #define BUTTON_STATE_HOVERED 1 // mouse is being hovered over the button
#define BUTTON_STATE_PRESSED 2 #define BUTTON_STATE_PRESSED 2 // left mouse button is down while hovering the button
#define BUTTON_STATE_RELEASED 3 #define BUTTON_STATE_RELEASED 3 // left mouse button is released while hovering the button, button code will be executed
#define BUTTON_ID_CONTINUE 0 #define BUTTON_ID_CONTINUE 0 // going to game screen, supposed to be used from pause screen
#define BUTTON_ID_EXIT 1 #define BUTTON_ID_EXIT 1 // closing the game using exit code 0
#define BUTTON_ID_START_GAME 2 #define BUTTON_ID_START_GAME 2 // going to game screen, supposed to be used from mainmenu screen
typedef struct Button{ typedef struct Button{
Texture2D textures[4]; // [0]: Normal [1]: Hovered [2]: Pressed [3]: Released Texture2D textures[4]; // [0]: Normal [1]: Hovered [2]: Pressed [3]: Released

@ -9,6 +9,7 @@ void DebugDraw(Game *game, UiContainer *uiContainer){
char strings[10][41]; // Platz für bis zu 10 Strings der Länge 40 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 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 // Hier die Debug Information in den Strings Array einfügen
// im Endeffekt einfach im Array an der Stelle lineamount++ die Elemente einfügen // im Endeffekt einfach im Array an der Stelle lineamount++ die Elemente einfügen
@ -21,13 +22,13 @@ void DebugDraw(Game *game, UiContainer *uiContainer){
sprintf(strings[lineamount++], "DEPTH: %d", (int)(game->inputHandler->cursorWorldPos.x + game->inputHandler->cursorWorldPos.y + 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 // Drawed eine Box für die Debug Info
DrawRectangleLines(0, 0, 250, lineamount * DEBUG_FONT_SIZE + 5, (Color){0, 0, 0, 255}); DrawRectangleLines(0, 0, neededWidth, lineamount * DEBUG_FONT_SIZE + 5, (Color){0, 0, 0, 255});
DrawRectangle(0, 0, 250, lineamount * DEBUG_FONT_SIZE + 5, (Color){0, 0, 0, 150}); DrawRectangle(0, 0, neededWidth, lineamount * DEBUG_FONT_SIZE + 5, (Color){0, 0, 0, 150});
// Drawed den Inhalt des "strings" Arrays // Drawed den Inhalt des "strings" Arrays
int counter = 0; int counter = 0;
while(counter < lineamount){ while(counter < lineamount){
DrawText(strings[counter], 2, counter * DEBUG_FONT_SIZE + 2, DEBUG_FONT_SIZE, RED); DrawText(strings[counter], 2, counter * DEBUG_FONT_SIZE + 2, DEBUG_FONT_SIZE, (Color){220, 25, 25, 255});
counter++; counter++;
} }
} }

@ -4,7 +4,7 @@
#include "../game.h" #include "../game.h"
#include "uiContainer.h" #include "uiContainer.h"
#define DEBUG_FONT_SIZE 20 #define DEBUG_FONT_SIZE 20 // Font size of the Debug window
// Drawed das Debug Fenster in die obere Linke Ecke // Drawed das Debug Fenster in die obere Linke Ecke
void DebugDraw(Game *game, UiContainer *uiContainer); void DebugDraw(Game *game, UiContainer *uiContainer);

@ -1,7 +1,7 @@
#ifndef SCREENIDS_H_ #ifndef SCREENIDS_H_
#define SCREENIDS_H_ #define SCREENIDS_H_
#define SCREEN_EXIT 0 #define SCREEN_EXIT 0 // Will exit the game using code 0
#define SCREEN_MAINMENU 1 #define SCREEN_MAINMENU 1
#define SCREEN_OPTIONS 2 #define SCREEN_OPTIONS 2
#define SCREEN_GAME 3 #define SCREEN_GAME 3

@ -38,9 +38,9 @@ int main(){
game->cursorSprite->x = GetMousePosition().x; game->cursorSprite->x = GetMousePosition().x;
game->cursorSprite->y = GetMousePosition().y; game->cursorSprite->y = GetMousePosition().y;
BeginDrawing(); BeginDrawing(); // Drawing ist grundsätzlich immer aktiviert
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE); // Screen wird in jedem Frame gecleared
switch(game->screen){ switch(game->screen){ // Screenspecific Code
case SCREEN_EXIT: case SCREEN_EXIT:
printf("EXIT \n"); printf("EXIT \n");
return 0; return 0;

Loading…
Cancel
Save