Removed SDL_gfx dependency.

At first I was going to just not bother with the resizing thing, but
then I found out that SDL actually has a scaling function built-in.
So rather than depending on SDL_gfx for this one purpose that never
sees the light of day in practice, I have handed that job over to
that function.
This commit is contained in:
onpon4 2017-02-20 21:46:35 -05:00
parent 427f92ce2b
commit 6c1e59d434
4 changed files with 10 additions and 12 deletions

View File

@ -52,7 +52,6 @@ Project: Starfighter depends on the following libraries to build:
* SDL2 <http://libsdl.org>
* SDL2_image <http://www.libsdl.org/projects/SDL_image/>
* SDL2_mixer <http://www.libsdl.org/projects/SDL_mixer/>
* SDL2_gfx <https://sourceforge.net/projects/sdl2gfx/>
Once you have all dependencies installed, you can do the following:

View File

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

View File

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

View File

@ -426,13 +426,13 @@ int title_show()
if (!skip)
{
gfx_renderString("Copyright Parallel Realities 2003",
5, screen->h - 60, FONT_WHITE, 0, gfx_background);
5, gfx_background->h - 60, FONT_WHITE, 0, gfx_background);
gfx_renderString("Copyright Guus Sliepen, Astrid S. de Wijn and others 2012",
5, screen->h - 40, FONT_WHITE, 0, gfx_background);
5, gfx_background->h - 40, FONT_WHITE, 0, gfx_background);
gfx_renderString("Copyright 2015-2017 Julie Marchant",
5, screen->h - 20, FONT_WHITE, 0, gfx_background);
gfx_renderString(buildVersion, screen->w - 6 - strlen(buildVersion) * 9,
screen->h - 20, FONT_WHITE, 0, gfx_background);
5, gfx_background->h - 20, FONT_WHITE, 0, gfx_background);
gfx_renderString(buildVersion, gfx_background->w - 6 - strlen(buildVersion) * 9,
gfx_background->h - 20, FONT_WHITE, 0, gfx_background);
screen_addBuffer(0, 0, screen->w, screen->h);
skip = 1;
}