Don't use atlas for clouds. Helps to eliminate texture seam.

This commit is contained in:
Steve 2018-12-28 11:00:45 +00:00
parent a7310e43b1
commit a064e3ed4c
7 changed files with 16 additions and 7 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ blobwarsAttrition
.DS_Store
dist/*
/blobwarsAttrition.exe
/.errors

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 MiB

After

Width:  |  Height:  |  Size: 3.6 MiB

BIN
gfx/hub/clouds.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 KiB

View File

@ -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

View File

@ -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();

View File

@ -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);

View File

@ -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);
}
}