├── README.md ├── SDL2 Isometric Tutorial Series Part 1 (4youtube).cbp ├── SDL2 Isometric Tutorial Series Part 1 (4youtube).depend ├── SDL2 Isometric Tutorial Series Part 1.depend ├── SDL2 Isometric Tutorial Series Part 1.exe ├── SDL2 Isometric Tutorial Series Part 1.layout ├── SDL2.dll ├── SDL2_image.dll ├── SDL2_mixer.dll ├── data └── isotiles.png ├── initclose.c ├── initclose.h ├── isoEngine.c ├── isoEngine.h ├── isoTutorialPart1.c ├── libpng16-16.dll ├── renderer.c ├── renderer.h ├── texture.c ├── texture.h └── zlib1.dll /README.md: -------------------------------------------------------------------------------- 1 | Isometric Game Tutorial with SDL 2 - Part 1 2 | 3 | I searched for some time after a good isometric tutorial to get me started, but only found some articles (which led me in the right direction). However, these did not cover picking tiles with cartesian coordinates (pick tiles just as you do on a square map), so I had to find that out myself, and here I share it with the rest of the world! Sharing is caring as they say! :) This tutorial serie is posted on www.indiegamedev.se, a swedish game development site. This tutorial covers: - 2 hours of coding, describing all steps. - Single layer map rendering - Smooth map scrolling - Mouse tile picking with cartesian screen coordinates - how to get smooth scrolling to work together with cartesian coordinate tile picking. 4 | 5 | Watch The Youtube Tutorial Here: 6 | 7 | https://www.youtube.com/watch?v=8xf_ouTpd1c 8 | 9 | -------------------------------------------------------------------------------- /SDL2 Isometric Tutorial Series Part 1 (4youtube).cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 66 | 67 | -------------------------------------------------------------------------------- /SDL2 Isometric Tutorial Series Part 1 (4youtube).depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1506967909 source:d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric game tutorial series part 1 - copy\initclose.c 3 | 4 | 5 | 6 | 7 | "initclose.h" 8 | "renderer.h" 9 | 10 | 1506967343 d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric game tutorial series part 1 - copy\initclose.h 11 | 12 | 1506967973 d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric game tutorial series part 1 - copy\renderer.h 13 | 14 | 1507055960 source:d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric game tutorial series part 1 - copy\isoengine.c 15 | 16 | 17 | "isoEngine.h" 18 | 19 | 1507056155 source:d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric game tutorial series part 1 - copy\isotutorialpart1.c 20 | 21 | 22 | 23 | "initclose.h" 24 | "renderer.h" 25 | "texture.h" 26 | "isoEngine.h" 27 | 28 | 1506967926 source:d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric game tutorial series part 1 - copy\renderer.c 29 | 30 | 31 | 32 | "renderer.h" 33 | 34 | 1507041758 source:d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric game tutorial series part 1 - copy\texture.c 35 | 36 | 37 | 38 | 39 | "renderer.h" 40 | "texture.h" 41 | 42 | 1507040780 d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric game tutorial series part 1 - copy\texture.h 43 | 44 | 1507055934 d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric game tutorial series part 1 - copy\isoengine.h 45 | 46 | -------------------------------------------------------------------------------- /SDL2 Isometric Tutorial Series Part 1.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1506886498 source:d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric tutorial series part 1\initclose.c 3 | 4 | 5 | 6 | 7 | 8 | "initclose.h" 9 | "renderer.h" 10 | 11 | 1506885884 d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric tutorial series part 1\initclose.h 12 | 13 | 1503717319 d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric tutorial series part 1\renderer.h 14 | "SDL2/SDL.h" 15 | 16 | 1506882808 source:d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric tutorial series part 1\isoengine.c 17 | 18 | 19 | "IsoEngine.h" 20 | 21 | 1506882711 d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric tutorial series part 1\isoengine.h 22 | 23 | 1497934812 source:d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric tutorial series part 1\renderer.c 24 | 25 | 26 | 27 | "renderer.h" 28 | 29 | 1506889337 source:d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric tutorial series part 1\isotutorialpart1.c 30 | 31 | 32 | 33 | "initclose.h" 34 | "isoEngine.h" 35 | "texture.h" 36 | "renderer.h" 37 | 38 | 1506885732 d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric tutorial series part 1\texture.h 39 | 40 | 1506886831 source:d:\programmering\sdl2 isometric tutorial serie\sdl2 isometric tutorial series part 1\texture.c 41 | 42 | 43 | 44 | "texture.h" 45 | "renderer.h" 46 | 47 | -------------------------------------------------------------------------------- /SDL2 Isometric Tutorial Series Part 1.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solarstrings/SDL2-Isometric-Game-Tutorial-Part-1/ff86eafa50b64afb6792d4142bb7c1aff3261ebe/SDL2 Isometric Tutorial Series Part 1.exe -------------------------------------------------------------------------------- /SDL2 Isometric Tutorial Series Part 1.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solarstrings/SDL2-Isometric-Game-Tutorial-Part-1/ff86eafa50b64afb6792d4142bb7c1aff3261ebe/SDL2.dll -------------------------------------------------------------------------------- /SDL2_image.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solarstrings/SDL2-Isometric-Game-Tutorial-Part-1/ff86eafa50b64afb6792d4142bb7c1aff3261ebe/SDL2_image.dll -------------------------------------------------------------------------------- /SDL2_mixer.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solarstrings/SDL2-Isometric-Game-Tutorial-Part-1/ff86eafa50b64afb6792d4142bb7c1aff3261ebe/SDL2_mixer.dll -------------------------------------------------------------------------------- /data/isotiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solarstrings/SDL2-Isometric-Game-Tutorial-Part-1/ff86eafa50b64afb6792d4142bb7c1aff3261ebe/data/isotiles.png -------------------------------------------------------------------------------- /initclose.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "initclose.h" 6 | #include "renderer.h" 7 | 8 | void initSDL(char *windowName) 9 | { 10 | if(SDL_Init(SDL_INIT_VIDEO)< 0){ 11 | fprintf(stderr,"Could not initialize SDL! SDL Error:%s\n",SDL_GetError()); 12 | exit(1); 13 | } 14 | 15 | SDL_SetHint(SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING,"1"); 16 | 17 | if(SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY,"0")){ 18 | fprintf(stdout,"Warning: Linear texture filtering was not enabled!"); 19 | } 20 | 21 | initRenderer(windowName); 22 | 23 | if( !(IMG_Init(IMG_INIT_PNG) & IMG_INIT_PNG)) 24 | { 25 | fprintf(stderr,"Could not initialize SDL_Image!) SDL_image error:%s\n",IMG_GetError()); 26 | exit(1); 27 | } 28 | } 29 | 30 | void closeDownSDL() 31 | { 32 | closeRenderer(); 33 | IMG_Quit(); 34 | SDL_Quit(); 35 | } 36 | -------------------------------------------------------------------------------- /initclose.h: -------------------------------------------------------------------------------- 1 | #ifndef __INIT_CLOSE_H_ 2 | #define __INIT_CLOSE_H_ 3 | 4 | void initSDL(char *windowName); 5 | 6 | void closeDownSDL(); 7 | 8 | #endif // __INIT_CLOSE_H_ 9 | -------------------------------------------------------------------------------- /isoEngine.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "isoEngine.h" 4 | 5 | void InitIsoEngine(isoEngineT *isoEngine, int tileSizeInPixels) 6 | { 7 | if(isoEngine == NULL) 8 | { 9 | fprintf(stderr,"Error in InitIsoEngine(...): isoEngine parameter is NULL!\n"); 10 | return; 11 | } 12 | 13 | if(tileSizeInPixels<=0){ 14 | TILESIZE = 32; 15 | } 16 | else{ 17 | TILESIZE = tileSizeInPixels; 18 | } 19 | 20 | isoEngine->mapHeight = 0; 21 | isoEngine->mapWidth = 0; 22 | isoEngine->scrollX = 0; 23 | isoEngine->scrollY = 0; 24 | } 25 | 26 | void IsoEngineSetMapSize(isoEngineT *isoEngine,int width, int height) 27 | { 28 | if(isoEngine == NULL) 29 | { 30 | return; 31 | } 32 | isoEngine->mapHeight = height; 33 | isoEngine->mapWidth = width; 34 | } 35 | 36 | void Convert2dToIso(point2DT *point) 37 | { 38 | int tmpX = point->x - point->y; 39 | int tmpY = (point->x + point->y)*0.5; 40 | point->x = tmpX; 41 | point->y = tmpY; 42 | } 43 | 44 | void ConvertIsoTo2D(point2DT *point) 45 | { 46 | int tmpX = (2 * point->y + point->x)*0.5; 47 | int tmpY = (2 * point->y - point->x)*0.5; 48 | point->x = tmpX; 49 | point->y = tmpY; 50 | } 51 | 52 | void GetTileCoordinates(point2DT *point,point2DT *point2DCoord) 53 | { 54 | float tempX = (float)point->x / (float)TILESIZE; 55 | float tempY = (float)point->y / (float)TILESIZE; 56 | 57 | //convert back to integer 58 | point2DCoord->x = (int)tempX; 59 | point2DCoord->y = (int)tempY; 60 | } 61 | -------------------------------------------------------------------------------- /isoEngine.h: -------------------------------------------------------------------------------- 1 | #ifndef ISOENGINE_H_ 2 | #define ISOENGINE_H_ 3 | 4 | unsigned int TILESIZE; 5 | 6 | typedef struct isoEngineT 7 | { 8 | int scrollX; 9 | int scrollY; 10 | int mapHeight; 11 | int mapWidth; 12 | }isoEngineT; 13 | 14 | typedef struct point2DT 15 | { 16 | int x; 17 | int y; 18 | }point2DT; 19 | 20 | void InitIsoEngine(isoEngineT *isoEngine, int tileSizeInPixels); 21 | void IsoEngineSetMapSize(isoEngineT *isoEngine,int width, int height); 22 | void Convert2dToIso(point2DT *point); 23 | void ConvertIsoTo2D(point2DT *point); 24 | void GetTileCoordinates(point2DT *point,point2DT *point2DCoord); 25 | #endif // ISOENGINE_H_ 26 | -------------------------------------------------------------------------------- /isoTutorialPart1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Isometric Game Tutorial Part 1 3 | * Author: Johan Forsblom 4 | * Date: 1st October 2017 5 | * 6 | * This tutorial covers the following: 7 | * 8 | * * Single layer map rendering (multiple layer rendering in future tutorial if i get to it :D) 9 | * * Smooth map scrolling (scrolling with less than the tile size) 10 | * * Mouse tile picking with cartesian screen coordinates 11 | * 12 | * Usage: 13 | * Scroll the map with w,a,s,d 14 | * Click on the map for "tile picking" (shows the selected tile up in the top left corner of the screen) 15 | * 16 | ****************************************************************************************************************** 17 | * 18 | * Copyright 2017 Johan Forsblom 19 | * 20 | * You may use the code for whatever reason you want. If you do a commercial project and took inspiration from or 21 | * copied this code, please do put my name in the credits section of your game :) 22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 24 | * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 25 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 27 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | * 29 | */ 30 | #include 31 | #include 32 | #include 33 | #include "initclose.h" 34 | #include "renderer.h" 35 | #include "texture.h" 36 | #include "isoEngine.h" 37 | 38 | #define NUM_ISOMETRIC_TILES 5 39 | #define MAP_HEIGHT 16 40 | #define MAP_WIDTH 16 41 | 42 | int worldTest[MAP_HEIGHT][MAP_WIDTH] = { 43 | {1,1,2,2,2,2,2,2,1,1,2,2,2,2,2,1}, 44 | {1,1,1,1,2,1,1,2,1,1,2,2,2,2,2,1}, 45 | {2,1,1,1,2,2,2,2,1,1,2,2,2,2,2,1}, 46 | {2,1,1,2,2,1,1,2,1,1,2,2,2,2,2,1}, 47 | {2,1,1,4,4,4,1,2,1,1,2,2,2,2,4,1}, 48 | {2,1,1,4,4,4,1,2,1,1,2,2,2,2,2,1}, 49 | {2,1,1,4,4,4,1,2,1,1,2,2,4,2,2,1}, 50 | {2,2,2,4,4,4,2,1,2,3,3,3,4,2,2,1}, 51 | {1,1,2,2,2,2,2,3,4,3,3,3,4,2,2,2}, 52 | {1,1,1,1,2,1,1,2,1,3,3,3,2,2,2,3}, 53 | {2,1,1,1,2,2,2,2,1,1,2,2,2,2,2,1}, 54 | {2,1,1,2,2,1,1,2,1,1,3,2,2,2,4,4}, 55 | {2,1,1,4,2,1,1,2,1,1,3,2,2,2,2,4}, 56 | {2,1,1,1,2,1,1,2,1,1,3,3,3,3,3,4}, 57 | {2,1,1,1,1,1,1,2,1,1,2,2,2,2,4,4}, 58 | {2,2,2,2,2,2,2,2,1,1,2,2,2,2,2,1} 59 | }; 60 | 61 | typedef struct gameT 62 | { 63 | SDL_Event event; 64 | int loopDone; 65 | SDL_Rect mouseRect; 66 | point2DT mousePoint; 67 | point2DT mapScroll2Dpos; 68 | int mapScrolllSpeed; 69 | isoEngineT isoEngine; 70 | int lastTileClicked; 71 | 72 | }gameT; 73 | 74 | gameT game; 75 | textureT tilesTex; 76 | SDL_Rect tilesRects[NUM_ISOMETRIC_TILES]; 77 | 78 | 79 | void setupRect(SDL_Rect *rect,int x,int y,int w,int h){ 80 | rect->x = x; 81 | rect->y = y; 82 | rect->w = w; 83 | rect->h = h; 84 | } 85 | 86 | void initTileClip() 87 | { 88 | int x=0,y=0; 89 | int i; 90 | 91 | textureInit(&tilesTex,0,0,0,NULL,NULL,SDL_FLIP_NONE); 92 | for(i=0;imapHeight;++i) 145 | { 146 | for(j=0;jmapWidth;++j) 147 | { 148 | point.x = (j *TILESIZE) + isoEngine->scrollX; 149 | point.y = (i *TILESIZE) + isoEngine->scrollY; 150 | 151 | tile = worldTest[i][j]; 152 | 153 | Convert2dToIso(&point); 154 | 155 | textureRenderXYClip(&tilesTex,point.x,point.y,&tilesRects[tile]); 156 | } 157 | } 158 | } 159 | 160 | void getMouseTileClick(isoEngineT *isoEngine) 161 | { 162 | point2DT point; 163 | point2DT tileShift, mouse2IsoPOint; 164 | 165 | int correctX =(game.mapScroll2Dpos.x%32)*2; 166 | int correctY = game.mapScroll2Dpos.y%32; 167 | 168 | //copy mouse point 169 | mouse2IsoPOint = game.mousePoint; 170 | ConvertIsoTo2D(&mouse2IsoPOint); 171 | 172 | //get tile coordinates 173 | GetTileCoordinates(&mouse2IsoPOint,&point); 174 | 175 | tileShift.x = correctX; 176 | tileShift.y = correctY; 177 | Convert2dToIso(&tileShift); 178 | 179 | point.x-=((float)isoEngine->scrollX+(float)tileShift.x)/(float)TILESIZE; 180 | point.y-=((float)isoEngine->scrollY-(float)tileShift.y)/(float)TILESIZE; 181 | 182 | if(point.x>=0 && point.y>=0 && point.x0){ 249 | game.mapScroll2Dpos.y=0; 250 | game.isoEngine.scrollX-=game.mapScrolllSpeed; 251 | game.isoEngine.scrollY-=game.mapScrolllSpeed; 252 | } 253 | } 254 | if(keystate[SDL_SCANCODE_A]){ 255 | game.isoEngine.scrollX+=game.mapScrolllSpeed; 256 | game.isoEngine.scrollY-=game.mapScrolllSpeed; 257 | game.mapScroll2Dpos.x-=game.mapScrolllSpeed; 258 | } 259 | if(keystate[SDL_SCANCODE_S]){ 260 | game.isoEngine.scrollX-=game.mapScrolllSpeed; 261 | game.isoEngine.scrollY-=game.mapScrolllSpeed; 262 | game.mapScroll2Dpos.y-=game.mapScrolllSpeed; 263 | 264 | } 265 | if(keystate[SDL_SCANCODE_D]){ 266 | game.isoEngine.scrollX-=game.mapScrolllSpeed; 267 | game.isoEngine.scrollY+=game.mapScrolllSpeed; 268 | game.mapScroll2Dpos.x+=game.mapScrolllSpeed; 269 | } 270 | } 271 | 272 | int main(int argc, char *argv[]) 273 | { 274 | initSDL("Isometric Tutorial Series Part 1!"); 275 | init(); 276 | 277 | while(!game.loopDone){ 278 | update(); 279 | updateInput(); 280 | draw(); 281 | } 282 | 283 | closeDownSDL(); 284 | return 0; 285 | } 286 | -------------------------------------------------------------------------------- /libpng16-16.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solarstrings/SDL2-Isometric-Game-Tutorial-Part-1/ff86eafa50b64afb6792d4142bb7c1aff3261ebe/libpng16-16.dll -------------------------------------------------------------------------------- /renderer.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "renderer.h" 5 | 6 | static SDL_Window *window = NULL; 7 | static SDL_Renderer *renderer = NULL; 8 | 9 | void initRenderer(char *windowCaption) 10 | { 11 | window = SDL_CreateWindow(windowCaption,SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED, 12 | WINDOW_WIDTH,WINDOW_HEIGHT,SDL_WINDOW_RESIZABLE); 13 | if(window == NULL){ 14 | fprintf(stderr,"SDL_CreateWindow failed:%s",SDL_GetError()); 15 | exit(1); 16 | } 17 | 18 | renderer = SDL_CreateRenderer(window,-1,SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE | SDL_RENDERER_PRESENTVSYNC); 19 | if(renderer == NULL) 20 | { 21 | fprintf(stderr,"SDL_CreateRenderer failed:%s",SDL_GetError()); 22 | exit(1); 23 | } 24 | } 25 | 26 | SDL_Renderer *getRenderer() 27 | { 28 | return renderer; 29 | } 30 | 31 | SDL_Window *getWindow() 32 | { 33 | return window; 34 | } 35 | 36 | void closeRenderer() 37 | { 38 | SDL_DestroyRenderer(renderer); 39 | SDL_DestroyWindow(window); 40 | } 41 | -------------------------------------------------------------------------------- /renderer.h: -------------------------------------------------------------------------------- 1 | #ifndef __RENDERER_H 2 | #define __RENDERER_H 3 | 4 | #define WINDOW_WIDTH 1200 5 | #define WINDOW_HEIGHT 720 6 | 7 | void initRenderer(char *windowCaption); 8 | SDL_Renderer *getRenderer(); 9 | SDL_Window *getWindow(); 10 | void closeRenderer(); 11 | 12 | 13 | #endif // __RENDERER_H 14 | -------------------------------------------------------------------------------- /texture.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "renderer.h" 6 | #include "texture.h" 7 | 8 | int loadTexture(textureT *texture, char *filename) 9 | { 10 | SDL_Surface *tmpSurface = IMG_Load(filename); 11 | 12 | if(tmpSurface == NULL){ 13 | fprintf(stderr,"Texture error: Could not load image:%s! SDL_image Error:%s\n",filename,IMG_GetError()); 14 | return 0; 15 | } 16 | else{ 17 | texture->texture = SDL_CreateTextureFromSurface(getRenderer(),tmpSurface); 18 | 19 | if(texture->texture == NULL){ 20 | fprintf(stderr,"Texture error: Could not load image:%s! SDL_image Error:%s\n",filename,IMG_GetError()); 21 | SDL_FreeSurface(tmpSurface); 22 | return 0; 23 | } 24 | else{ 25 | texture->width = tmpSurface->w; 26 | texture->height = tmpSurface->h; 27 | } 28 | SDL_FreeSurface(tmpSurface); 29 | return 1; 30 | } 31 | return 0; 32 | } 33 | 34 | void textureInit(textureT *texture, int x,int y, double angle, SDL_Point *center, SDL_Rect *cliprect, SDL_RendererFlip fliptype) 35 | { 36 | texture->x = x; 37 | texture->y = y; 38 | texture->angle = angle; 39 | texture->center = center; 40 | texture->fliptype = fliptype; 41 | texture->cliprect = cliprect; 42 | } 43 | 44 | void textureRenderXYClip(textureT *texture, int x, int y, SDL_Rect *cliprect) 45 | { 46 | if(texture==NULL){ 47 | fprintf(stderr,"Warning: passed texture was null!\n"); 48 | return; 49 | } 50 | texture->x = x; 51 | texture->y = y; 52 | texture->cliprect = cliprect; 53 | SDL_Rect quad = { texture->x, texture->y, texture->width, texture->height }; 54 | if(texture->cliprect != NULL) 55 | { 56 | quad.w = texture->cliprect->w; 57 | quad.h = texture->cliprect->h; 58 | } 59 | 60 | SDL_RenderCopyEx(getRenderer(),texture->texture,texture->cliprect,&quad,texture->angle, texture->center,texture->fliptype); 61 | } 62 | -------------------------------------------------------------------------------- /texture.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXTURE_H_ 2 | #define TEXTURE_H_ 3 | 4 | typedef struct textureT 5 | { 6 | int x; 7 | int y; 8 | int width; 9 | int height; 10 | double angle; 11 | SDL_Point *center; 12 | SDL_Rect *cliprect; 13 | SDL_RendererFlip fliptype; 14 | SDL_Texture *texture; 15 | }textureT; 16 | 17 | int loadTexture(textureT *texture, char *filename); 18 | void textureInit(textureT *texture, int x,int y, double angle, SDL_Point *center, SDL_Rect *cliprect, SDL_RendererFlip fliptype); 19 | void textureRenderXYClip(textureT *texture, int x, int y, SDL_Rect *cliprect); 20 | 21 | #endif // TEXTURE_H_ 22 | -------------------------------------------------------------------------------- /zlib1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solarstrings/SDL2-Isometric-Game-Tutorial-Part-1/ff86eafa50b64afb6792d4142bb7c1aff3261ebe/zlib1.dll --------------------------------------------------------------------------------