diff options
author | P. J. McDermott <pjm@nac.net> | 2013-02-15 15:28:42 (EST) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2013-02-15 15:28:42 (EST) |
commit | c978f746058497ddd9ddc9cf3e156c4453e487f1 (patch) | |
tree | b7855dd65c735c54ad535f31d4fbd645ca29fc1b /src/main.c | |
parent | 80191b41352ad20493fb62e8f3683d69133d0d24 (diff) | |
download | overworld-rpg-c978f746058497ddd9ddc9cf3e156c4453e487f1.zip overworld-rpg-c978f746058497ddd9ddc9cf3e156c4453e487f1.tar.gz overworld-rpg-c978f746058497ddd9ddc9cf3e156c4453e487f1.tar.bz2 |
Add resource manager and move src/image.*.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 27 |
1 files changed, 18 insertions, 9 deletions
@@ -1,20 +1,29 @@ #include <SDL.h> #include "init.h" #include "logging.h" -#include "image.h" +#include "resources/image.h" #include "tmx.h" int main(void) { - SDL_Surface *img; + struct image *img; SDL_Rect imgrect, surfacerect; init(); tmx_load("data/forest1.tmx"); - img = load_png("../forest-6-layer-test_ground.png"); + img = img_png_get("../forest-6-layer-test_ground.png"); + img_png_free(img); + img = img_png_get("../forest-6-layer-test_ground.png"); + img = img_png_get("../forest-6-layer-test_ground.png"); + img = img_png_get("../forest-6-layer-test_ground.png"); + img = img_png_get("../forest-6-layer-test_ground.png"); + img_png_free(img); + img_png_free(img); + img_png_free(img); + img = img_png_get("../forest-6-layer-test_ground.png"); imgrect.w = 240; imgrect.h = 160; surfacerect.x = 0; @@ -24,37 +33,37 @@ main(void) imgrect.x = 208; imgrect.y = 480; - SDL_BlitSurface(img, &imgrect, screen, &surfacerect); + SDL_BlitSurface(img->image, &imgrect, screen, &surfacerect); SDL_Flip(screen); SDL_Delay(500); imgrect.x = 208; imgrect.y = 464; - SDL_BlitSurface(img, &imgrect, screen, &surfacerect); + SDL_BlitSurface(img->image, &imgrect, screen, &surfacerect); SDL_Flip(screen); SDL_Delay(500); imgrect.x = 224; imgrect.y = 464; - SDL_BlitSurface(img, &imgrect, screen, &surfacerect); + SDL_BlitSurface(img->image, &imgrect, screen, &surfacerect); SDL_Flip(screen); SDL_Delay(500); imgrect.x = 240; imgrect.y = 464; - SDL_BlitSurface(img, &imgrect, screen, &surfacerect); + SDL_BlitSurface(img->image, &imgrect, screen, &surfacerect); SDL_Flip(screen); SDL_Delay(500); imgrect.x = 256; imgrect.y = 464; - SDL_BlitSurface(img, &imgrect, screen, &surfacerect); + SDL_BlitSurface(img->image, &imgrect, screen, &surfacerect); SDL_Flip(screen); SDL_Delay(500); imgrect.x = 256; imgrect.y = 448; - SDL_BlitSurface(img, &imgrect, screen, &surfacerect); + SDL_BlitSurface(img->image, &imgrect, screen, &surfacerect); SDL_Flip(screen); SDL_Delay(500); |