X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Flibgame%2Fsdl.h;h=838be3ad467ca6e96cbd5293fbb8e3428b740fe8;hp=254b9927166fc33d126911e9898c49b803610369;hb=0d214d4e314f6f42df24be140bb433e980319767;hpb=307f92e3ee14cdab72466e5998eef66c0ef3ae38 diff --git a/src/libgame/sdl.h b/src/libgame/sdl.h index 254b9927..838be3ad 100644 --- a/src/libgame/sdl.h +++ b/src/libgame/sdl.h @@ -1,15 +1,13 @@ -/*********************************************************** -* Artsoft Retro-Game Library * -*----------------------------------------------------------* -* (c) 1994-2006 Artsoft Entertainment * -* Holger Schemel * -* Detmolder Strasse 189 * -* 33604 Bielefeld * -* Germany * -* e-mail: info@artsoft.org * -*----------------------------------------------------------* -* sdl.h * -***********************************************************/ +// ============================================================================ +// Artsoft Retro-Game Library +// ---------------------------------------------------------------------------- +// (c) 1995-2014 by Artsoft Entertainment +// Holger Schemel +// info@artsoft.org +// http://www.artsoft.org/ +// ---------------------------------------------------------------------------- +// sdl.h +// ============================================================================ #ifndef SDL_H #define SDL_H @@ -47,7 +45,16 @@ #define TARGET_STRING "SDL" #endif +#if defined(PLATFORM_ANDROID) +#define WINDOW_SCALING_STATUS WINDOW_SCALING_NOT_AVAILABLE #define FULLSCREEN_STATUS FULLSCREEN_AVAILABLE +#elif defined(TARGET_SDL2) +#define WINDOW_SCALING_STATUS WINDOW_SCALING_AVAILABLE +#define FULLSCREEN_STATUS FULLSCREEN_AVAILABLE +#else // SDL 1.2 +#define WINDOW_SCALING_STATUS WINDOW_SCALING_NOT_AVAILABLE +#define FULLSCREEN_STATUS FULLSCREEN_AVAILABLE +#endif #define CURSOR_MAX_WIDTH 32 #define CURSOR_MAX_HEIGHT 32 @@ -73,20 +80,17 @@ typedef SDL_Event Event; typedef SDL_MouseButtonEvent ButtonEvent; typedef SDL_MouseMotionEvent MotionEvent; #if defined(TARGET_SDL2) +typedef SDL_MouseWheelEvent WheelEvent; typedef SDL_TouchFingerEvent FingerEvent; typedef SDL_TextInputEvent TextEvent; +typedef SDL_Event PauseResumeEvent; +typedef SDL_WindowEvent WindowEvent; #endif typedef SDL_KeyboardEvent KeyEvent; typedef SDL_Event ExposeEvent; typedef SDL_Event FocusChangeEvent; typedef SDL_Event ClientMessageEvent; -typedef int GC; -typedef int Pixmap; -typedef int Display; -typedef int Visual; -typedef int Colormap; - /* structure definitions */ @@ -97,8 +101,10 @@ struct SDLSurfaceInfo int width, height; SDL_Surface *surface; SDL_Surface *surface_masked; - GC gc; - GC stored_clip_gc; +#if defined(TARGET_SDL2) + SDL_Texture *texture; + SDL_Texture *texture_masked; +#endif }; struct MouseCursorInfo @@ -122,6 +128,7 @@ struct MouseCursorInfo #define EVENT_BUTTONRELEASE SDL_MOUSEBUTTONUP #define EVENT_MOTIONNOTIFY SDL_MOUSEMOTION #if defined(TARGET_SDL2) +#define EVENT_WHEELMOTION SDL_MOUSEWHEEL #define EVENT_FINGERPRESS SDL_FINGERDOWN #define EVENT_FINGERRELEASE SDL_FINGERUP #define EVENT_FINGERMOTION SDL_FINGERMOTION @@ -194,6 +201,11 @@ struct MouseCursorInfo #if defined(TARGET_SDL2) #define KSYM_Menu SDLK_MENU #define KSYM_Back SDLK_AC_BACK +#define KSYM_PlayPause SDLK_AUDIOPLAY +#if defined(PLATFORM_ANDROID) +#define KSYM_Rewind SDLK_AUDIORWND +#define KSYM_FastForward SDLK_AUDIOFFWD +#endif #endif #define KSYM_space SDLK_SPACE @@ -201,7 +213,13 @@ struct MouseCursorInfo #define KSYM_quotedbl SDLK_QUOTEDBL #define KSYM_numbersign SDLK_HASH #define KSYM_dollar SDLK_DOLLAR -#define KSYM_percent KSYM_UNDEFINED /* undefined */ + +#if defined(TARGET_SDL2) +#define KSYM_percent SDLK_PERCENT +#else +#define KSYM_percent 37 /* undefined in SDL */ +#endif + #define KSYM_ampersand SDLK_AMPERSAND #define KSYM_apostrophe SDLK_QUOTE #define KSYM_parenleft SDLK_LEFTPAREN @@ -411,21 +429,42 @@ struct MouseCursorInfo #define KMOD_Meta (KMOD_Meta_L | KMOD_Meta_R) #define KMOD_Alt (KMOD_Alt_L | KMOD_Alt_R) +#if defined(TARGET_SDL2) +#define KMOD_TextInput (KMOD_Shift | KMOD_Alt_R) +#endif /* SDL function definitions */ +boolean SDLSetNativeSurface(SDL_Surface **); +SDL_Surface *SDLGetNativeSurface(SDL_Surface *); +void SDLCreateBitmapTextures(Bitmap *); +void SDLFreeBitmapTextures(Bitmap *); + #if defined(TARGET_SDL2) SDL_Surface *SDL_DisplayFormat(SDL_Surface *); +void SDLSetWindowScaling(int); +void SDLSetWindowScalingQuality(char *); +void SDLSetWindowFullscreen(boolean); +void SDLSetDisplaySize(void); +void SDLSetScreenSizeAndOffsets(int, int); +void SDLSetScreenSizeForRenderer(int, int); +void SDLSetScreenProperties(void); #endif +void SDLSetScreenRenderingMode(char *); +void SDLRedrawWindow(); +void SDLSetWindowTitle(void); + +void SDLLimitScreenUpdates(boolean); void SDLInitVideoDisplay(void); -void SDLInitVideoBuffer(DrawBuffer **, DrawWindow **, boolean); -boolean SDLSetVideoMode(DrawBuffer **, boolean); +void SDLInitVideoBuffer(boolean); +boolean SDLSetVideoMode(boolean); void SDLCreateBitmapContent(Bitmap *, int, int, int); void SDLFreeBitmapPointers(Bitmap *); void SDLCopyArea(Bitmap *, Bitmap *, int, int, int, int, int, int, int); +void SDLBlitTexture(Bitmap *, int, int, int, int, int, int, int); void SDLFillRectangle(Bitmap *, int, int, int, int, Uint32); -void SDLFadeRectangle(Bitmap *, int, int, int, int, int, int, int, +void SDLFadeRectangle(int, int, int, int, int, int, int, void (*draw_border_function)(void)); void SDLDrawSimpleLine(Bitmap *, int, int, int, int, Uint32); void SDLDrawLine(Bitmap *, int, int, int, int, Uint32); @@ -435,7 +474,7 @@ void SDLPutPixel(Bitmap *, int, int, Pixel); void SDLInvertArea(Bitmap *, int, int, int, int, Uint32); void SDLCopyInverseMasked(Bitmap *, Bitmap *, int, int, int, int, int, int); -void SDLZoomBitmap(Bitmap *, Bitmap *); +Bitmap *SDLZoomBitmap(Bitmap *, int, int); Bitmap *SDLLoadImage(char *); @@ -450,5 +489,8 @@ void SDLHandleWindowManagerEvent(Event *); void HandleJoystickEvent(Event *); void SDLInitJoysticks(void); boolean SDLReadJoystick(int, int *, int *, boolean *, boolean *); +boolean SDLCheckJoystickOpened(int); + +void PrepareFadeBitmap(int); #endif /* SDL_H */