From 394190999a23d979a61e867dbdf60437b6fa1a29 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 5 Mar 2023 14:29:19 +0100 Subject: [PATCH] map can be edited easily now --- Input/inputHandler.h | 1 + IsometricMap/isometricMap.c | 18 ++++++++--- Screen/screen.c | 1 + Ui/debug.c | 1 + Ui/onClickFunctions.c | 18 +++++++++++ Ui/onClickFunctions.h | 1 + Ui/selectable.c | 36 ++++++++++++++------- Ui/selectable.h | 3 +- Ui/uiContainer.c | 26 +++++++++++---- assets/{mapobjects => dump}/ressources.png | Bin assets/{ => tiles}/bigtower.png | Bin assets/{ => tiles}/desert.png | Bin assets/tiles/desert_palm.png | Bin 0 -> 1665 bytes assets/tiles/empty.png | Bin 0 -> 6005 bytes assets/{ => tiles}/grass.png | Bin assets/{ => tiles}/grass_selected.png | Bin assets/tiles/ice.png | Bin 0 -> 6312 bytes assets/{ => tiles}/tower.png | Bin assets/tiles/water.png | Bin 0 -> 6431 bytes definitions.h | 5 +++ game.c | 1 + 21 files changed, 88 insertions(+), 23 deletions(-) rename assets/{mapobjects => dump}/ressources.png (100%) rename assets/{ => tiles}/bigtower.png (100%) rename assets/{ => tiles}/desert.png (100%) create mode 100644 assets/tiles/desert_palm.png create mode 100644 assets/tiles/empty.png rename assets/{ => tiles}/grass.png (100%) rename assets/{ => tiles}/grass_selected.png (100%) create mode 100644 assets/tiles/ice.png rename assets/{ => tiles}/tower.png (100%) create mode 100644 assets/tiles/water.png diff --git a/Input/inputHandler.h b/Input/inputHandler.h index 6fe2405..b6ed88c 100644 --- a/Input/inputHandler.h +++ b/Input/inputHandler.h @@ -11,6 +11,7 @@ typedef struct InputHandler{ Vector2 cursorWorldPos; // position of cursor in World Vector2 cursorWorldTile; // Selected Tile int selectionRectActive; //0: not active | 1: active + int drawTileId; } InputHandler; void mouseInput(Game *game); diff --git a/IsometricMap/isometricMap.c b/IsometricMap/isometricMap.c index 24db7b0..a53f1a1 100644 --- a/IsometricMap/isometricMap.c +++ b/IsometricMap/isometricMap.c @@ -9,10 +9,17 @@ IsometricMap * IsometricMapInit(){ IsometricMap* map = malloc(sizeof(IsometricMap)); - - map->tileTextures[0] = LoadTexture("assets/grass.png"); - map->tileTextures[1] = LoadTexture("assets/grass_selected.png"); - map->tileTextures[2] = LoadTexture("assets/tower.png"); + + int counter = 0; + map->tileTextures[counter++] = LoadTexture("assets/tiles/grass.png"); + map->tileTextures[counter++] = LoadTexture("assets/tiles/desert.png"); + map->tileTextures[counter++] = LoadTexture("assets/tiles/desert_palm.png"); + map->tileTextures[counter++] = LoadTexture("assets/tiles/tower.png"); + map->tileTextures[counter++] = LoadTexture("assets/tiles/bigtower.png"); + map->tileTextures[counter++] = LoadTexture("assets/tiles/grass_selected.png"); + map->tileTextures[counter++] = LoadTexture("assets/tiles/ice.png"); + map->tileTextures[counter++] = LoadTexture("assets/tiles/water.png"); + map->tileTextures[counter++] = LoadTexture("assets/tiles/empty.png"); map->width = 500; map->height = 500; @@ -157,10 +164,11 @@ void IsometricMapDraw(Game *game){ continue; } else{ + ; DrawTexture( game->map->tileTextures[game->map->tiles[i][j]->textureId], game->map->tiles[i][j]->offsetX, - game->map->tiles[i][j]->offsetY, + game->map->tiles[i][j]->offsetY - game->map->tileTextures[game->map->tiles[i][j]->textureId].height + 32, WHITE); continue; } diff --git a/Screen/screen.c b/Screen/screen.c index 99fe328..ec6830f 100644 --- a/Screen/screen.c +++ b/Screen/screen.c @@ -65,6 +65,7 @@ void ScreenRenderPauseScreen(Game *game){ DrawText("P: Pause", 5, halfScreenHeight + 32, 16, WHITE); DrawText("WASD: Move Camera", 5, halfScreenHeight + 48, 16, WHITE); DrawText("ESC: Exit Game", 5, halfScreenHeight + 64, 16, WHITE); + DrawText("CTRL: 3x3 Brush for changing Tiles", 5, halfScreenHeight + 80, 16, WHITE); if(IsKeyPressed(KEY_P)){ game->currentScreen = SCREEN_GAME; diff --git a/Ui/debug.c b/Ui/debug.c index c06b8e2..21bc7d8 100644 --- a/Ui/debug.c +++ b/Ui/debug.c @@ -24,6 +24,7 @@ void DebugDraw(Game *game){ sprintf(strings[lineamount++], "DEPTH: %d", (int)(game->inputHandler->cursorWorldPos.x + game->inputHandler->cursorWorldPos.y)); sprintf(strings[lineamount++], "Camera Zoom: %f", game->camera->zoom); sprintf(strings[lineamount++], "Sprite Amount: %d", game->sprites->spriteAmount); + sprintf(strings[lineamount++], "Draw Tile ID: %d", game->inputHandler->drawTileId); // Hier müssten wir eine bessere Lösung finden, das flackert weil pressed nur für einen Frame gilt. Eine ähnliche Funktion gibt es für CharDown leider nicht, müssten wir selbst programmieren. Ich habe es erstmal nicht auskommentiert. Kann man aber easy machen sollte es stören int pressed = GetCharPressed(); diff --git a/Ui/onClickFunctions.c b/Ui/onClickFunctions.c index cdbcde7..349dd7b 100644 --- a/Ui/onClickFunctions.c +++ b/Ui/onClickFunctions.c @@ -83,3 +83,21 @@ void OnSelectedSpawnLumberjack(Game *game, Selectable *selectable){ } } } +void OnSelectedDrawTile(Game *game, Selectable *selectable){ + game->inputHandler->drawTileId = selectable->id - SELECTABLE_ID_DRAWING_TILE; + if(IsMouseButtonDown(MOUSE_BUTTON_LEFT)&& game->mouseOnUI == 0){ + IsometricMapChangeTextureIdOfTile(game->map, game->inputHandler->cursorWorldTile.x, game->inputHandler->cursorWorldTile.y, game->inputHandler->drawTileId); + if(IsKeyDown(KEY_LEFT_CONTROL)){ + int x = game->inputHandler->cursorWorldTile.x; + int y = game->inputHandler->cursorWorldTile.y; + IsometricMapChangeTextureIdOfTile(game->map, x-1, y-1, game->inputHandler->drawTileId); + IsometricMapChangeTextureIdOfTile(game->map, x, y-1, game->inputHandler->drawTileId); + IsometricMapChangeTextureIdOfTile(game->map, x+1, y-1, game->inputHandler->drawTileId); + IsometricMapChangeTextureIdOfTile(game->map, x-1, y, game->inputHandler->drawTileId); + IsometricMapChangeTextureIdOfTile(game->map, x+1, y, game->inputHandler->drawTileId); + IsometricMapChangeTextureIdOfTile(game->map, x+1, y+1, game->inputHandler->drawTileId); + IsometricMapChangeTextureIdOfTile(game->map, x-1, y+1, game->inputHandler->drawTileId); + IsometricMapChangeTextureIdOfTile(game->map, x, y+1, game->inputHandler->drawTileId); + } + } +} diff --git a/Ui/onClickFunctions.h b/Ui/onClickFunctions.h index 3b34320..a352f93 100644 --- a/Ui/onClickFunctions.h +++ b/Ui/onClickFunctions.h @@ -13,5 +13,6 @@ void OnSelectedSelectable(Game *game, Selectable *selectable); void OnSelectedSpawnBuilding(Game *game, Selectable *selectable); void OnSelectedSpawnWorker(Game *game, Selectable *selectable); void OnSelectedSpawnLumberjack(Game *game, Selectable *selectable); +void OnSelectedDrawTile(Game *game, Selectable *selectable); #endif \ No newline at end of file diff --git a/Ui/selectable.c b/Ui/selectable.c index aed0711..79826e8 100644 --- a/Ui/selectable.c +++ b/Ui/selectable.c @@ -10,11 +10,12 @@ #include "onClickFunctions.h" Selectable * SelectableInit(Texture2D *texture, Texture2D **backgroundTextures, int hasBackground, Vector2 *position, char *description, - int showDescripton, int descriptionLEN, int fontSize, int id, int groupID, int unselectAfterExecute){ + int showDescripton, int descriptionLEN, int fontSize, int id, int groupID, int unselectAfterExecute, float scale){ Selectable *selectable = malloc(sizeof(Selectable)); selectable->texture = texture; selectable->hasBackground = hasBackground; + selectable->scale = scale; if(selectable->hasBackground == 1){ selectable->backgroundTexture = backgroundTextures; } @@ -33,6 +34,12 @@ Selectable * SelectableInit(Texture2D *texture, Texture2D **backgroundTextures, selectable->groupID = groupID; selectable->unselectAfterExecute = unselectAfterExecute; + int i = 0; + if(selectable->id > SELECTABLE_ID_DRAWING_TILE && selectable->id < ISOMETRICMAP_TILE_TEXTURE_AMOUNT + SELECTABLE_ID_DRAWING_TILE){ + selectable->onSelected = &OnSelectedDrawTile; + return selectable; + } + switch(selectable->id){ case SELECTABLE_ID_SPAWN_BUILDING: selectable->onSelected = &OnSelectedSpawnBuilding; @@ -43,6 +50,9 @@ Selectable * SelectableInit(Texture2D *texture, Texture2D **backgroundTextures, case SELECTABLE_ID_SPAWN_LUMBERJACK: selectable->onSelected = &OnSelectedSpawnLumberjack; break; + case SELECTABLE_ID_DRAWING_TILE: + selectable->onSelected = &OnSelectedDrawTile; + break; default: selectable->onSelected = &OnSelectedSelectable; printf("\n\n\n\n\n\n WARNING: Unsupported SELECTABLE ID %d \n\n\n\n\n\n", selectable->id); @@ -60,9 +70,9 @@ void SelectableExecuteSelectable(Selectable *selectable, Game * game){ int SelectableUpdateSelectableState(Selectable * selectable, Game *game){ int mouseOnElement = 0; if(GetMouseX() > selectable->position.x && - GetMouseX() < selectable->position.x + (*selectable->backgroundTexture)[selectable->state].width && + GetMouseX() < selectable->position.x + (*selectable->backgroundTexture)[selectable->state].width * selectable->scale && GetMouseY() > selectable->position.y && - GetMouseY() < selectable->position.y + (*selectable->backgroundTexture)[selectable->state].height + GetMouseY() < selectable->position.y + (*selectable->backgroundTexture)[selectable->state].height * selectable->scale ){ mouseOnElement = 1; game->mouseOnUI = 1; @@ -93,17 +103,21 @@ int SelectableUnselectSelectable(Selectable * selectable){ } void SelectableDrawSelectable(Selectable * selectable){ - int targetWidth = 0; + int padding = 19; + Rectangle from = {0, 0, selectable->backgroundTexture[0]->width, selectable->backgroundTexture[0]->height}; + Rectangle to = {selectable->position.x, selectable->position.y , selectable->backgroundTexture[0]->width* selectable->scale, selectable->backgroundTexture[0]->height* selectable->scale}; + if(selectable->hasBackground == 1) { - targetWidth = selectable->backgroundTexture[selectable->state]->width; - DrawTexture((*(selectable->backgroundTexture))[selectable->state], selectable->position.x, selectable->position.y, WHITE); + DrawTexturePro((*(selectable->backgroundTexture))[selectable->state], from, to, (Vector2){0,0}, 0.0f, WHITE); } - - // ich weiss zwar nicht wieso genau aber das hier skaliert die Texturen richtig - int padding = 19; - Rectangle from = {0, 0 , selectable->texture->width, selectable->texture->height}; - Rectangle to = {selectable->position.x +padding, selectable->position.y + padding, selectable->backgroundTexture[0]->width - 2*padding, selectable->backgroundTexture[0]->height - 2*padding}; + from.width = selectable->texture->width; + from.height = selectable->texture->height; + to.x += padding * selectable->scale; + to.y += padding * selectable->scale; + to.width -= 2*padding * selectable->scale; + to.height -= 2*padding * selectable->scale; DrawTexturePro(*selectable->texture, from, to, (Vector2){0,0}, 0.0f, WHITE); + if(selectable->state == SELECTABLE_STATE_SELECTED){ DrawTexture(*selectable->texture, GetMouseX() - selectable->texture->width / 2, GetMouseY() - selectable->texture->height*0.75, (Color){255, 255, 255, 150}); DrawRectangleLines(GetMouseX() - selectable->texture->width / 2, GetMouseY() - selectable->texture->height*0.75, selectable->texture->width, selectable->texture->height, GREEN); diff --git a/Ui/selectable.h b/Ui/selectable.h index b912891..067197d 100644 --- a/Ui/selectable.h +++ b/Ui/selectable.h @@ -21,6 +21,7 @@ typedef struct Selectable{ // Notiz: Die Selectables können auch in einem 2-Dimensionalen Array im UiContainer gespeichert werden, worüber die Groups auch definiert werden könnten int groupID; // Selectables können gruppiert werden, man kann also mehrere Dinge gleichzeitig selected haben + float scale; void (*onSelected)(Game *game, Selectable *selectable); }Selectable; @@ -29,7 +30,7 @@ typedef struct Selectable{ // showDescription 0: zeigt Description nicht | 1: zeigt Description // unselectAfterExecute 0: wird abgewählt | 1: bleibt ausgewählt // Max Description LEN 20 -Selectable * SelectableInit(Texture2D *texture, Texture2D **backgroundTextures, int hasBackground, Vector2 *position, char *description, int showDescripton, int descriptionLEN, int fontSize, int id, int groupID, int unselectAfterExecute); +Selectable * SelectableInit(Texture2D *texture, Texture2D **backgroundTextures, int hasBackground, Vector2 *position, char *description, int showDescripton, int descriptionLEN, int fontSize, int id, int groupID, int unselectAfterExecute, float scale); void SelectableExecuteSelectable(Selectable *selectable, Game * game); diff --git a/Ui/uiContainer.c b/Ui/uiContainer.c index 4644ae2..6c903cf 100644 --- a/Ui/uiContainer.c +++ b/Ui/uiContainer.c @@ -5,6 +5,7 @@ #include "raylib.h" #include "stdlib.h" #include "stdio.h" +#include "../IsometricMap/isometricMap.h" static UiContainer * UiContainerInitEmptyUiContainer(){ UiContainer *uiContainer = malloc(sizeof(UiContainer)); @@ -66,7 +67,7 @@ static UiContainer * UiContainerInitGameUiContainer(Game *game){ Texture2D *texture2 = game->textures->textures[TE_WORKER] ; Texture2D *texture3 = game->textures->textures[TE_LUMBERJACK] ; Texture2D **backgroundTextures = &(game->textures->textures[TE_SELECTABLE_BACKGROUND]); - Vector2 position = (Vector2){20, 300}; + Vector2 position = (Vector2){4, GetScreenHeight() - 100}; int showDescription = 1; int hasBackground = 1; int fontSize = 16; @@ -75,21 +76,34 @@ static UiContainer * UiContainerInitGameUiContainer(Game *game){ // creating the ui elements Selectable *selectable1 = SelectableInit(texture1, backgroundTextures, hasBackground , &position, "Building", showDescription, 9/*String len*/, fontSize, SELECTABLE_ID_SPAWN_BUILDING, - 1/*Group*/, unselectAfterExecute); - position.y += 100; + 1/*Group*/, unselectAfterExecute, 1); + position.x += 100; Selectable *selectable2 = SelectableInit(texture2, backgroundTextures, hasBackground,&position, "Worker", showDescription, 7/*String len*/, fontSize, SELECTABLE_ID_SPAWN_WORKER, 1/*Group*/, - unselectAfterExecute); - position.y += 100; + unselectAfterExecute, 1); + position.x += 100; Selectable *selectable3 = SelectableInit(texture3, backgroundTextures, hasBackground,&position, "Lumberjack", showDescription, 11/*String len*/, fontSize, SELECTABLE_ID_SPAWN_LUMBERJACK, 1/*Group*/, - unselectAfterExecute); + unselectAfterExecute, 1); // adding the ui elements UiContainerAddSelectable(uiContainer, selectable1); UiContainerAddSelectable(uiContainer, selectable2); UiContainerAddSelectable(uiContainer, selectable3); + showDescription = 0; + unselectAfterExecute = 0; + int i = 0; + position = (Vector2){GetScreenWidth()-50, 2}; + for(i; i < ISOMETRICMAP_TILE_TEXTURE_AMOUNT; i++){ + UiContainerAddSelectable(uiContainer, + SelectableInit(&(game->map->tileTextures[i]), backgroundTextures, hasBackground , &position, "", + showDescription, 0/*String len*/, fontSize, SELECTABLE_ID_DRAWING_TILE+i, + 1/*Group*/, 1, 0.5f) + ); + position.y += 50; + } + return uiContainer; } diff --git a/assets/mapobjects/ressources.png b/assets/dump/ressources.png similarity index 100% rename from assets/mapobjects/ressources.png rename to assets/dump/ressources.png diff --git a/assets/bigtower.png b/assets/tiles/bigtower.png similarity index 100% rename from assets/bigtower.png rename to assets/tiles/bigtower.png diff --git a/assets/desert.png b/assets/tiles/desert.png similarity index 100% rename from assets/desert.png rename to assets/tiles/desert.png diff --git a/assets/tiles/desert_palm.png b/assets/tiles/desert_palm.png new file mode 100644 index 0000000000000000000000000000000000000000..b0235ce5ba8c892f5bbda2a3dd73b4543db35724 GIT binary patch literal 1665 zcmV-{27dX8P)EX>4Tx04R}tkv&MmKp2MKrk09S9PA+CkfAzR5ET(8twIqhgj%6h2a`+xph-iL z;^HW{799LptU9+0Yt2!cN#t}afBE>hxmNufoIcO3Wd-uJ%TeFq4Q3e&8vF+kI8 zGo4I`+1#oaenk)=L}<>)%rfRADFxs0b&mkw@8UemzwXb`tL7~R1VrLlW|%hd2JzIU zZE)TvjznMuzRM~TH^2P+-SN~T6UNgPu(o$`gO z$13M7&RV6$TKD8HjO6u|Wvu?YAB-u8*$ooQY@tDJmKRXbo~;!6mpfp z$gzMbG{~+W{11Nj)+$Vldr6T55PET(k6|FZ3pDGF^L^|%%@ZK_3|#4Lf3*Qjf0ABr zYq2AsZyUI{ZfnXOaJd5vJQ=bnyHb#rP$&TJXY@@up#K)=S@ZhVI>+e)kfC0sZh(VB zV5CUd>pt)9?(EyYHLd>r08%7!nj-N_4gdfE24YJ`L;(K){{a7>y{D4^000SaNLh0L z04^f{04^f|c%?sf00007bV*G`2j>F?3??W@n%Tkt00ezWL_t(&-tCxAXd_h|$G>kj zthkWOHrh@DVNWIuMCc)GSy;ghm4zB*4_yQgQhV~yqbEfXq3CIki{NFcxk)^9wFU~> zUV2(q=t7r}xki#q+a%M0MT6#fn7)@clbOt)jM+jqoyS|kq9K|N_dubQ6c0032!L&Pd!#WD-c^%_yUcGtXZSpH7-)u>t*>Z>kcsIuxxAMMfdePp5kzk)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eogoh{4Xf!-X#1n}CVgX3wgfd702&Gmkh$#$LSjv&`#WKD~ zh*n`jY*CDifx#gC=(q6+#6CXn;DypREFgT~6_6NDz=3#y0RN$fROS|ofV>IlFFmAz z$SV|{1xrOS5)SMZ3kzjdA3{WM-ua7TB+--UL~!tMG%P?&rO2p+kB0PM`uM%`P*K3+ z3&fLN2-zQ5%J|&(WPKEys%J8t4+BBm-{F2_{WkYWW5mkGhwduk#Hhk!x-u}T@#zsF z4nKlES+u88U<$~l0wBkZ29RMQ382CxDnKDqBe-@Xiamuw{s4+8l*%9>2UbBL;5a^l z!zMvw5|Ir7$c2DFP{;t41hN4Fl}05J?8p#A<9-0KQo=`62}OSxl?o~Xfg&NH(72#I zKw(ok0GY;t0XBy~1z?W7J=>l{0wJ#bBvb^4?khl+5zlOL0T zA>zRIEq>9EjEguhFy4G&jN*MqAYT9n$RHJ)1Uq{wNT5=wNI`XfZ?p=QND(EfFbN=z zG=;007CMp)LM)`xDFQI*f#gDWk-(5lBncFWq8S)fNNAPkq`c7%Qiq8aqkl;*VpI zN5U$eKtx9%au5Ou_H+u7P9fNW1Ud*}@c(>@_G}7=0J6CN7bMyNWHyxuK*)Ro5P=v$ zvL|!6b`WcH`pkWB*FbMWsroj0;jErx&a z_hv=?gCii&p9lFQem~RonXXS_;FF9$tLrmepTxi?8GlyS-$s}A`_EQbh`h_nk&jZl z1@6Vj2dxI%%fl5lq59`nAI(Bqw8WkvQWOejr8?CVh09}+Mok&h$4#?OeTJ@)QP1At yZlq}*)72?3xc2cSH8rG`jGj0l^mJ4ehcxujD7Ej#SGOS*6w}Suwaj^a^1lJUHW!2d literal 0 HcmV?d00001 diff --git a/assets/grass.png b/assets/tiles/grass.png similarity index 100% rename from assets/grass.png rename to assets/tiles/grass.png diff --git a/assets/grass_selected.png b/assets/tiles/grass_selected.png similarity index 100% rename from assets/grass_selected.png rename to assets/tiles/grass_selected.png diff --git a/assets/tiles/ice.png b/assets/tiles/ice.png new file mode 100644 index 0000000000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N literal 0 HcmV?d00001 diff --git a/assets/tower.png b/assets/tiles/tower.png similarity index 100% rename from assets/tower.png rename to assets/tiles/tower.png diff --git a/assets/tiles/water.png b/assets/tiles/water.png new file mode 100644 index 0000000000000000000000000000000000000000..b0ed387a93761e73ffe8b61421fbf41f56bac815 GIT binary patch literal 6431 zcmeHKdpuO@8Xgr1rHcxYF_c>~v*u-*mK`QGRGo^QUjlDs@! zr)wE%ArOe^EH|bP{EJi_ni}x8EGp_X0->=y%8xDg0ToDzRLmEILP&X}1VTbe0Uv=- z-g(9r?lQK}8NF^LO>lJ5G~Rms@Lgo%O6^|yp#9*Ts`4@OOoPEX0LfIWcy83YA*Ss4 zRLpFaX;M}wb;HSBi}I3}*EFvhCaf1Y3_A~7oIV$#dtEnSvCHMYs-9D0d35{f*@q4- z7VBhgiU}TcVAnp|GoLZc>|aI6#n;glA z{JHYgvp00B8w=th{}C+h(O%ixt~TT_Bfz`!y`DVflxOyflu@=d;t$QDzAb`!>6(_U zIUVIMOD?9i*W0X18o-QBl5WZ}sorX7a=aoph9I+6?C3agJHl^%+5Fe!k&xY0w^LTN z?p6ywJO2&)N?ESSBRBi-X%h5?WQWbu?w#nwc!h7(yY$baiKkq*PpMt)9@b#ECi_%> zdHqEuA?=V;Ym$NsF3M|e-tclM#>aMHKpk|y(xR{k8@4iJjqb+kxV^5-HOas{T+da- z$dlMAJ3Y?nD|2i{oO=T6rw273c%I_JP5?}|Vb#f(=JE>6Z=@DZn!XBTp>{bJY-3%^_RY#Z&R?0l%HP-PX31e^ zkC4t?$-4t8cXJ914a@||kgpAYwM}oyu>f4{Ax7yA!xOFMm3J#M`K1v}MMW68;#tAE zqwyNLJ*nwicj7}^4J`7BExY#?HRFZ1)QizGY|#FZkFBq+j;@Gkd3*1@`mL^OhQh+r zdG`K{BTwp?ujQy_1I@fNl>V9`MBL)Oerwz!X>a!Nt7(6xy?T&O2{NN`1A%L96pLoV@ti>~T8@i4Q|eQ!`qb>=-i2SIw;ll^LuZsq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KWv~-fm^c7Kn7~y{3k@a%3k#}z3ImL1 zz+7kyDFn*JQa`acl#WuBgj8jY+Z$;&F)3~W85|L*a{LF+`$Az8R})JhR50F!M2_2* z2686`k%18qZ+sv)Z=#DE42psvczu5`)W>$gUrZJVkSSC?iHo+S68UH%hy&0d2^Jhj zBvD8Jfah@V|AsCT^W_Rq3ONSBOkp;#fyUV&Eyty_`nncHFr?B6fPDnOADkbKOe5iG zB%BR^qX7U4`}b2Mb4Xkqz~Q6$@GPQ<910!{0YEQk4w`I z`yY#UBH)Yt3O4ve8@vy~+bZ_czWTxWs`dUizCQeE{EZ{P(BB97CVjul^Nc1hpEd>cXv2HPs<8p}gj;D&;Y~$Pm3fKj!Q0d0O^gpN)u8SRoKctVq93+4MPzwa z>3U*H;rumD&QeXY4$39IX)V++$!I6X+@?I&g2?s*C!ai|yKquNeiW}BOwu`kEiafF zCqNuvNEYEki;ef_->gCW%(&5VA?HY&@n&>s+7B~kCL4zO>riV4!o7>l&Gkqe_g@4F rZrh7}7oduE5S(}Fs2Ik11A1zRdnVlC{ea(ASOEmf*^^o36d3m}Ep@7= literal 0 HcmV?d00001 diff --git a/definitions.h b/definitions.h index d30074e..b8f901c 100644 --- a/definitions.h +++ b/definitions.h @@ -84,9 +84,14 @@ #define SELECTABLE_ID_SPAWN_BUILDING 0 #define SELECTABLE_ID_SPAWN_WORKER 1 #define SELECTABLE_ID_SPAWN_LUMBERJACK 2 +#define SELECTABLE_ID_DRAWING_TILE 30 // Ab dieser ID sind ISOMETRICMAP_TILE_TEXTURE_AMOUNT IDs reserviert für Map Tiles!!! #define UNSELECT_SELECTABLE_ON_SELECT 1 +// Definitions for IsometricMap tiles + +#define ISOMETRICMAP_TILE_TEXTURE_AMOUNT 8 // in IsometricMapInit werden TILE_TEXTURE_AMOUNT Texturen geladen + #endif diff --git a/game.c b/game.c index 8fb4eb4..4ae4561 100644 --- a/game.c +++ b/game.c @@ -28,6 +28,7 @@ Game *GameInit() game->inputHandler->cursorWorldPos.y = 0; game->inputHandler->cursorWorldTile.x = 0; game->inputHandler->cursorWorldTile.y = 0; + game->inputHandler->drawTileId = 0; game->mouseOnUI = 0;