Fixed some things.

In particular, sizes larger than the background work properly now
(in general; there are of course some things positioned badly still,
but everything updates correctly at any rate).
This commit is contained in:
onpon4 2017-02-04 18:29:44 -05:00
parent a615f52b84
commit 3ef498df97
4 changed files with 11 additions and 6 deletions

View File

@ -22,9 +22,9 @@ STARFIGHTER_CFLAGS="-DVERSION=\\\"$PACKAGE_VERSION\\\""
# Checks for libraries. # Checks for libraries.
PKG_CHECK_EXISTS([SDL2_mixer], [ PKG_CHECK_EXISTS([SDL2_mixer], [
PKG_CHECK_MODULES([SDL], [sdl2 SDL2_image SDL2_mixer]) PKG_CHECK_MODULES([SDL], [sdl2 SDL2_image SDL2_gfx SDL2_mixer])
], [ ], [
PKG_CHECK_MODULES([SDL], [sdl2 SDL2_image]) PKG_CHECK_MODULES([SDL], [sdl2 SDL2_image SDL2_gfx])
STARFIGHTER_CFLAGS="$STARFIGHTER_CFLAGS -DNOSOUND" STARFIGHTER_CFLAGS="$STARFIGHTER_CFLAGS -DNOSOUND"
echo "Note: SDL_mixer not found; audio will not be supported." echo "Note: SDL_mixer not found; audio will not be supported."
]) ])

View File

@ -452,7 +452,7 @@ void cutscene_init(int scene)
if ((showMessage) && (gfx_messageBox != NULL)) if ((showMessage) && (gfx_messageBox != NULL))
screen_blit(gfx_messageBox, (screen->w - gfx_messageBox->w) / 2, screen->h - 100); screen_blit(gfx_messageBox, (screen->w - gfx_messageBox->w) / 2, screen->h - 100);
screen_renderString("Press [Escape] to skip", -1, 580, FONT_WHITE); screen_renderString("Press [Escape] to skip", -1, screen->h - 20, FONT_WHITE);
game_delayFrame(); game_delayFrame();

View File

@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "SDL.h" #include "SDL.h"
#include "SDL_image.h" #include "SDL_image.h"
#include "SDL2_rotozoom.h"
#include "defs.h" #include "defs.h"
#include "structs.h" #include "structs.h"
@ -488,13 +489,17 @@ void gfx_free()
void gfx_loadBackground(const char *filename) void gfx_loadBackground(const char *filename)
{ {
SDL_Surface *new_bg;
if (gfx_background != NULL) if (gfx_background != NULL)
{ {
SDL_FreeSurface(gfx_background); SDL_FreeSurface(gfx_background);
gfx_background = NULL; gfx_background = NULL;
} }
gfx_background = gfx_loadImage(filename); new_bg = gfx_loadImage(filename);
SDL_SetColorKey(gfx_background, 0, 0); SDL_SetColorKey(new_bg, 0, 0);
gfx_background = zoomSurface(new_bg, (double)screen->w / new_bg->w, (double)screen->h / new_bg->h, 0);
SDL_FreeSurface(new_bg);
} }
void gfx_loadSprites() void gfx_loadSprites()

View File

@ -453,7 +453,7 @@ int title_show()
5, screen->h - 20, FONT_WHITE, 0, gfx_background); 5, screen->h - 20, FONT_WHITE, 0, gfx_background);
gfx_renderString(buildVersion, screen->w - 6 - strlen(buildVersion) * 9, gfx_renderString(buildVersion, screen->w - 6 - strlen(buildVersion) * 9,
screen->h - 20, FONT_WHITE, 0, gfx_background); screen->h - 20, FONT_WHITE, 0, gfx_background);
screen_addBuffer(0, 560, 800, 40); screen_addBuffer(0, screen->h - 40, screen->w, 40);
skip = 1; skip = 1;
} }
else else