diff --git a/.gitignore b/.gitignore index 48048f3..98f8068 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ blobwarsAttrition .DS_Store dist/* /blobwarsAttrition.exe +/.errors diff --git a/gfx/atlas/atlas.png b/gfx/atlas/atlas.png index 0249774..bf91126 100644 Binary files a/gfx/atlas/atlas.png and b/gfx/atlas/atlas.png differ diff --git a/gfx/hub/clouds.png b/gfx/hub/clouds.png new file mode 100644 index 0000000..461b440 Binary files /dev/null and b/gfx/hub/clouds.png differ diff --git a/makefile b/makefile index 2753798..dbf19e4 100644 --- a/makefile +++ b/makefile @@ -20,9 +20,11 @@ _OBJS += unixInit.o include common.mk CXXFLAGS += `sdl2-config --cflags` -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDATA_DIR=\"$(DATA_DIR)\" -DLOCALE_DIR=\"$(LOCALE_DIR)\" -CXXFLAGS += -Wall -Wempty-body -ansi -pedantic -Wstrict-prototypes -Werror=maybe-uninitialized -Warray-bounds CXXFLAGS += -g -lefence CXXFLAGS += -fms-extensions -std=gnu11 +ifneq ("$(wildcard .errors)","") +CXXFLAGS += -Wall -Wempty-body -Werror -Wstrict-prototypes -Werror=maybe-uninitialized -Warray-bounds +endif LDFLAGS += `sdl2-config --libs` -lSDL2_mixer -lSDL2_image -lSDL2_ttf -lm -lz -lpng diff --git a/src/hub/hub.c b/src/hub/hub.c index b5b7361..e06eef9 100644 --- a/src/hub/hub.c +++ b/src/hub/hub.c @@ -52,7 +52,7 @@ static HubMission *hubMissionTail; static HubMission *selectedMission; static Atlas *worldMap; static Atlas *alert; -static Atlas *clouds; +static Texture *clouds; static Sprite *cursorSpr; static Sprite *keySprites[MAX_KEY_TYPES]; static Texture *atlasTexture; @@ -84,7 +84,7 @@ void initHub(void) atlasTexture = getTexture("gfx/atlas/atlas.png"); worldMap = getImageFromAtlas("gfx/hub/worldMap.jpg"); alert = getImageFromAtlas("gfx/hub/alert.png"); - clouds = getImageFromAtlas("gfx/hub/clouds.png"); + clouds = getTexture("gfx/hub/clouds.png"); cursorSpr = getSprite("Cursor"); for (i = 0 ; i < MAX_KEY_TYPES ; i++) @@ -377,7 +377,7 @@ static void draw(void) { blitRectScaled(atlasTexture->texture, 0, 0, app.config.winWidth, app.config.winHeight, &worldMap->rect, 0); - drawBackground(atlasTexture->texture, &clouds->rect); + drawBackground(clouds->texture); drawMissions(); diff --git a/src/hub/hub.h b/src/hub/hub.h index a431111..c3437ea 100644 --- a/src/hub/hub.h +++ b/src/hub/hub.h @@ -39,7 +39,7 @@ extern int clearControl(int type); extern void doStats(void); extern void doTrophies(void); extern void doWidgets(void); -extern void drawBackground(SDL_Texture *texture, SDL_Rect *srcRect); +extern void drawBackground(SDL_Texture *texture); extern void drawOutlineRect(int x, int y, int w, int h, int r, int g, int b, int a); extern void drawRect(int x, int y, int w, int h, int r, int g, int b, int a); extern void drawStats(void); diff --git a/src/system/draw.c b/src/system/draw.c index 10f10d9..2edbddc 100644 --- a/src/system/draw.c +++ b/src/system/draw.c @@ -254,13 +254,19 @@ void scrollBackground(float x, float y) } } -void drawBackground(SDL_Texture *texture, SDL_Rect *srcRect) +void drawBackground(SDL_Texture *texture) { int i; + SDL_Rect dstRect; for (i = 0 ; i < 4 ; i++) { - blitRectScaled(texture, backgroundPoint[i].x, backgroundPoint[i].y, app.config.winWidth - 1, app.config.winHeight - 1, srcRect, 0); + dstRect.x = backgroundPoint[i].x; + dstRect.y = backgroundPoint[i].y; + dstRect.w = app.config.winWidth - 1; + dstRect.h = app.config.winHeight - 1; + + SDL_RenderCopy(app.renderer, texture, NULL, &dstRect); } }