remove zoom effect and dependency on SDL_rotozoom.h
This commit is contained in:
parent
8c40f4fdbf
commit
ea8857d122
2 changed files with 13 additions and 21 deletions
33
src/x48.c
33
src/x48.c
|
@ -2185,10 +2185,9 @@ int showkeylastx, showkeylasty, showkeylastkey;
|
||||||
// Show the hp key which is being pressed
|
// Show the hp key which is being pressed
|
||||||
void SDLUIShowKey( int hpkey ) {
|
void SDLUIShowKey( int hpkey ) {
|
||||||
SDL_Rect /* rect, */ srect, drect;
|
SDL_Rect /* rect, */ srect, drect;
|
||||||
SDL_Surface *ssurf, *zsurf;
|
SDL_Surface *ssurf;
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
double zoomfactor = 0.9;
|
|
||||||
|
|
||||||
// If we're called with the same key as before, do nothing
|
// If we're called with the same key as before, do nothing
|
||||||
if ( showkeylastkey == hpkey )
|
if ( showkeylastkey == hpkey )
|
||||||
|
@ -2208,29 +2207,26 @@ void SDLUIShowKey( int hpkey ) {
|
||||||
else
|
else
|
||||||
ssurf = buttons[ hpkey ].surfaceup;
|
ssurf = buttons[ hpkey ].surfaceup;
|
||||||
|
|
||||||
// Zoomed surface
|
|
||||||
zsurf = zoomSurface( ssurf, zoomfactor, zoomfactor, 0 );
|
|
||||||
|
|
||||||
// Background backup
|
// Background backup
|
||||||
showkeylastsurf =
|
showkeylastsurf =
|
||||||
SDL_CreateRGBSurface( SDL_SWSURFACE, zsurf->w, zsurf->h, 32, 0x00ff0000,
|
SDL_CreateRGBSurface( SDL_SWSURFACE, ssurf->w, ssurf->h, 32, 0x00ff0000,
|
||||||
0x0000ff00, 0x000000ff, 0xff000000 );
|
0x0000ff00, 0x000000ff, 0xff000000 );
|
||||||
|
|
||||||
// Where to
|
// Where to
|
||||||
x = KEYBOARD_OFFSET_X + buttons[ hpkey ].x -
|
x = KEYBOARD_OFFSET_X + buttons[ hpkey ].x -
|
||||||
( zsurf->w - ssurf->w + 1 ) / 2;
|
( ssurf->w - ssurf->w + 1 ) / 2;
|
||||||
y = KEYBOARD_OFFSET_Y + buttons[ hpkey ].y -
|
y = KEYBOARD_OFFSET_Y + buttons[ hpkey ].y -
|
||||||
( zsurf->h - ssurf->h + 1 ) / 2;
|
( ssurf->h - ssurf->h + 1 ) / 2;
|
||||||
// blitting does not clip to screen, so if we are out of the screen we
|
// blitting does not clip to screen, so if we are out of the screen we
|
||||||
// shift the button to fit
|
// shift the button to fit
|
||||||
if ( x < 0 )
|
if ( x < 0 )
|
||||||
x = 0;
|
x = 0;
|
||||||
if ( y < 0 )
|
if ( y < 0 )
|
||||||
y = 0;
|
y = 0;
|
||||||
if ( x + zsurf->w > sdlwindow->w )
|
if ( x + ssurf->w > sdlwindow->w )
|
||||||
x = sdlwindow->w - zsurf->w;
|
x = sdlwindow->w - ssurf->w;
|
||||||
if ( y + zsurf->h > sdlwindow->h )
|
if ( y + ssurf->h > sdlwindow->h )
|
||||||
y = sdlwindow->h - zsurf->h;
|
y = sdlwindow->h - ssurf->h;
|
||||||
|
|
||||||
// Backup where to
|
// Backup where to
|
||||||
showkeylastx = x;
|
showkeylastx = x;
|
||||||
|
@ -2239,22 +2235,19 @@ void SDLUIShowKey( int hpkey ) {
|
||||||
// Backup old surface
|
// Backup old surface
|
||||||
srect.x = x;
|
srect.x = x;
|
||||||
srect.y = y;
|
srect.y = y;
|
||||||
srect.w = zsurf->w;
|
srect.w = ssurf->w;
|
||||||
srect.h = zsurf->h;
|
srect.h = ssurf->h;
|
||||||
drect.x = 0;
|
drect.x = 0;
|
||||||
drect.y = 0;
|
drect.y = 0;
|
||||||
SDL_BlitSurface( sdlwindow, &srect, showkeylastsurf, &drect );
|
SDL_BlitSurface( sdlwindow, &srect, showkeylastsurf, &drect );
|
||||||
|
|
||||||
// Blit the zoomed button
|
// Blit the button
|
||||||
drect.x = x;
|
drect.x = x;
|
||||||
drect.y = y;
|
drect.y = y;
|
||||||
SDL_BlitSurface( zsurf, 0, sdlwindow, &drect );
|
SDL_BlitSurface( ssurf, 0, sdlwindow, &drect );
|
||||||
|
|
||||||
// Free zoomed surface
|
|
||||||
SDL_FreeSurface( zsurf );
|
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
SDL_UpdateRect( sdlwindow, x, y, zsurf->w, zsurf->h );
|
SDL_UpdateRect( sdlwindow, x, y, ssurf->w, ssurf->h );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLUIHideKey( void ) {
|
void SDLUIHideKey( void ) {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#include <SDL/SDL_gfxPrimitives.h>
|
#include <SDL/SDL_gfxPrimitives.h>
|
||||||
#include <SDL/SDL_rotozoom.h>
|
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
#define WHITE 0
|
#define WHITE 0
|
||||||
|
|
Loading…
Reference in a new issue