diff --git a/src/data.h b/src/data.h index 1181d6c..88f4aca 100644 --- a/src/data.h +++ b/src/data.h @@ -1,28 +1,44 @@ +<<<<<<< HEAD #pragma once +======= +>>>>>>> 8e3d2ca (add game structure) #include #define MAX_UNITS 100 #define MAX_BUILDINGS 50 #define MAX_PLAYERS 2 +<<<<<<< HEAD #define MAX_MISSIONS 10 #define MAX_RESOURCES 50 #define MAP_SIZE 100 typedef struct Player { +======= + +typedef struct { +>>>>>>> 8e3d2ca (add game structure) int playerID; char playerName[50]; int gold; int xp; } Player; +<<<<<<< HEAD typedef struct Unit { +======= +typedef struct { +>>>>>>> 8e3d2ca (add game structure) int unitID; int playerID; int x, y; // Position int health; } Unit; +<<<<<<< HEAD typedef struct Building { +======= +typedef struct { +>>>>>>> 8e3d2ca (add game structure) int buildingID; int playerID; int x, y; // Position @@ -30,17 +46,29 @@ typedef struct Building { int health; } Building; +<<<<<<< HEAD typedef struct Map { +======= +typedef struct { +>>>>>>> 8e3d2ca (add game structure) int mapID; char mapName[50]; int mapWidth; int mapHeight; +<<<<<<< HEAD int tileData[MAP_SIZE][MAP_SIZE]; // 2D array for map tile indices +======= + int tileData[MAX_MAP_WIDTH][MAX_MAP_HEIGHT]; +>>>>>>> 8e3d2ca (add game structure) int playerStartingPositions[MAX_PLAYERS][2]; // [x, y] coordinates for each player int resourceLocations[MAX_RESOURCES][2]; // [x, y] coordinates for each resource } Map; +<<<<<<< HEAD typedef struct Mission { +======= +typedef struct { +>>>>>>> 8e3d2ca (add game structure) int missionID; char missionName[50]; char missionDescription[100]; @@ -55,12 +83,17 @@ typedef struct Mission { bool hasSpecialConditions; // Flag indicating whether the mission has special conditions } Mission; +<<<<<<< HEAD typedef struct GameData { +======= +typedef struct { +>>>>>>> 8e3d2ca (add game structure) Player players[MAX_PLAYERS]; Unit units[MAX_UNITS]; Building buildings[MAX_BUILDINGS]; Map currentMap; Mission missions[MAX_MISSIONS]; +<<<<<<< HEAD int mapx, mapy; } GameData; @@ -89,4 +122,7 @@ typedef struct { GameData data; BuildingData buildings[100]; UnitData units[100]; -} Game; \ No newline at end of file +} Game; +======= +} GameData; +>>>>>>> 8e3d2ca (add game structure) diff --git a/src/draw.h b/src/draw.h index a0b367d..491e86b 100644 --- a/src/draw.h +++ b/src/draw.h @@ -1,3 +1,4 @@ +<<<<<<< HEAD #ifndef DRAW_H #define DRAW_H @@ -11,3 +12,23 @@ void drawGameData(SDL_Renderer *renderer, const GameData *gameData, SDL_Texture *tileTexture, SDL_Texture *unitTexture, SDL_Texture *buildingTexture); #endif /* DRAW_H */ +======= +#define MAP_SIZE 96 + +#define TILE_HEIGHT 30 +#define TILE_WIDTH 60 + +#define MAP_RENDER_SIZE 24 + +#define MAP_RENDER_OFFSET_X ((SCREEN_WIDTH - (TILE_WIDTH * MAP_RENDER_SIZE)) / 2) +#define MAP_RENDER_OFFSET_Y 425 + +typedef struct { + int x; + int y; + int sx; + int sy; + AtlasImage *texture; +} ISOObject; + +>>>>>>> 8e3d2ca (add game structure) diff --git a/src/main.c b/src/main.c index bda4270..e83cb00 100644 --- a/src/main.c +++ b/src/main.c @@ -16,29 +16,41 @@ int main(int argc, char* argv[]) { SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); // Main loop flag - bool quit = false; +bool quit = false; +SDL_Event event; - // Event handler - SDL_Event e; - - // Main loop - while (!quit) { - // Handle events on queue - while (SDL_PollEvent(&e) != 0) { - // User requests quit - if (e.type == SDL_QUIT) { - quit = true; - } +while (!quit) { + // Event handling + while (SDL_PollEvent(&event) != 0) { + if (event.type == SDL_QUIT) { + quit = true; } - - // Clear screen - SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF); - SDL_RenderClear(renderer); - - // Update screen - SDL_RenderPresent(renderer); + // Handle other events such as key presses, mouse input, etc. } + // Update game state + updateGameState(); // You need to define this function to update the game state + + // Clear the screen + SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); + SDL_RenderClear(renderer); + + // Render game objects + renderGame(renderer); // You need to define this function to render the game + + // Update the screen + SDL_RenderPresent(renderer); + + // Cap the frame rate + SDL_Delay(16); // Cap to approximately 60 frames per second +} + +// Clean up and exit +SDL_DestroyRenderer(renderer); +SDL_DestroyWindow(window); +SDL_Quit(); + + // Destroy window and renderer SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window);