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.

62 lines
2.2 KiB

#include "raylib.h"
#include "string.h"
#include <stdio.h>
#include <stdlib.h>
#include "Sprite/sprite.h"
#include "Input/inputHandler.h"
#include "Entity/entity.h"
#include "raymath.h"
#include "IsometricMap/isometricMap.h"
#include "game.h"
#include "Ui/button.h"
#include "Ui/uiContainer.h"
#include "Ui/debug.h"
#include "definitions.h"
#include "Screen/screen.h"
int main(){
InitWindow(1280, 720, "basic window");
Game *game = GameInit();
// Hides the operating systems own cursor
HideCursor();
//Dict **functions = dict_alloc();
//dict_addItem(functions, sprintf_id("OnSelected", SELECTABLE_ID_SPAWN_BUILDING), (void *)&OnSelectedSpawnBuilding);
//dict_addItem(functions, sprintf_id("OnSelected", SELECTABLE_ID_SPAWN_LUMBERJACK), (void *) &OnSelectedSpawnLumberjack);
//dict_addItem(functions, sprintf_id( "OnSelected", SELECTABLE_ID_SPAWN_WORKER), (void *) &OnSelectedSpawnWorker);
//dict_addItem(functions, sprintf_id("OnClick", BUTTON_ID_CONTINUE), (void *)&OnClickContinueButton);
//dict_addItem(functions, sprintf_id("OnClick", BUTTON_ID_EXIT), (void *)&OnClickExitButton);
//dict_addItem(functions, sprintf_id("OnClick", BUTTON_ID_START_GAME), (void *)&OnClickStartButton);
//printf("%p\n", dict_getItem(*functions, sprintf_id("OnClick", BUTTON_ID_START_GAME)));
//dict_dealloc(*functions);
//SetTargetFPS(60);
while(!WindowShouldClose()){
BeginDrawing(); // Drawing ist grundsätzlich immer aktiviert
ClearBackground(RAYWHITE); // Screen wird in jedem Frame gecleared
game->mouseOnUI = 0;
game->cursorSprite->x = GetMousePosition().x;
game->cursorSprite->y = GetMousePosition().y;
UiContainerUpdateUiContainer(game->screens[game->currentScreen]->uiContainer, game);
game->screens[game->currentScreen]->render(game); // Die ganze Game Logik ist hier drin
UiContainerDrawUiContainer(game->screens[game->currentScreen]->uiContainer);
DebugDraw(game);
DrawSpriteToScreen(game->cursorSprite);
EndDrawing();
if(game->currentScreen == SCREEN_EXIT){
break;
}
}
CloseWindow();
return 0;
}