diff options
Diffstat (limited to 'backends/platform/sdl/sdl.h')
-rw-r--r-- | backends/platform/sdl/sdl.h | 74 |
1 files changed, 70 insertions, 4 deletions
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h index 7498f48b08..b8ab2f6d97 100644 --- a/backends/platform/sdl/sdl.h +++ b/backends/platform/sdl/sdl.h @@ -81,9 +81,64 @@ public: void beginGFXTransaction(void); TransactionError endGFXTransaction(void); - // Set the size of the video bitmap. - // Typically, 320x200 - virtual void initSize(uint w, uint h); // overloaded by CE backend +#ifdef ENABLE_RGB_COLOR + // Game screen + virtual Graphics::PixelFormat getScreenFormat() const { return _screenFormat; } + + // Highest supported + virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const { + //TODO determine hardware color component order + Common::List<Graphics::PixelFormat> list; + SDL_PixelFormat *HWFormat = SDL_GetVideoInfo()->vfmt; +#ifdef ENABLE_32BIT + if (HWFormat->BitsPerPixel >= 32) + { + list.push_back(Graphics::PixelFormat::createFormatRGBA8888()); + list.push_back(Graphics::PixelFormat(4, 0, 0, 0, 0, 16, 8, 0, 24) +); + list.push_back(Graphics::PixelFormat(4, 0, 0, 0, 0, 0, 8, 16, 24) +); + list.push_back(Graphics::PixelFormat(4, 0, 0, 0, 0, 8, 16, 24, 0) +); } + if (HWFormat->BitsPerPixel >= 24) + { + list.push_back(Graphics::PixelFormat(3, 0, 0, 0, 8, 16, 8, 0, 0) +); + list.push_back(Graphics::PixelFormat(3, 0, 0, 0, 8, 0, 8, 16, 0) +); + } +#endif //ENABLE_32BIT + if (HWFormat->BitsPerPixel >= 16) + { + list.push_back(Graphics::PixelFormat(2, 3, 2, 3, 8, 11, 5, 0, 0) +); + list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 7, 10, 5, 0, 15) +); + list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 8, 10, 5, 0, 0) +); + list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0) +); + list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 8, 4, 0, 12) +); + list.push_back(Graphics::PixelFormat(2, 3, 2, 3, 8, 0, 5, 11, 0) +); + list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 7, 0, 5, 10, 15) +); + list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 8, 0, 5, 10, 0) +); + list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 0, 4, 8, 12) +); + list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 4, 8, 12, 0) +); + } + list.push_back(Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0)); + return list; + } +#endif + + // Set the size and format of the video bitmap. + // Typically, 320x200 CLUT8 + virtual void initSize(uint w, uint h, const Graphics::PixelFormat *format); // overloaded by CE backend virtual int getScreenChangeID() const { return _screenChangeCount; } @@ -112,7 +167,7 @@ public: virtual void warpMouse(int x, int y); // overloaded by CE backend (FIXME) // Set the bitmap that's used when drawing the cursor. - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor, int cursorTargetScale); // overloaded by CE backend (FIXME) + virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format); // overloaded by CE backend (FIXME) // Set colors of cursor palette void setCursorPalette(const byte *colors, uint start, uint num); @@ -174,6 +229,7 @@ public: // Overlay virtual Graphics::PixelFormat getOverlayFormat() const { return _overlayFormat; } + virtual void showOverlay(); virtual void hideOverlay(); virtual void clearOverlay(); @@ -227,6 +283,10 @@ protected: // unseen game screen SDL_Surface *_screen; +#ifdef ENABLE_RGB_COLOR + Graphics::PixelFormat _screenFormat; + Graphics::PixelFormat _cursorFormat; +#endif // temporary screen (for scalers) SDL_Surface *_tmpscreen; @@ -260,6 +320,9 @@ protected: bool needHotswap; bool needUpdatescreen; bool normal1xScaler; +#ifdef ENABLE_RGB_COLOR + bool formatChanged; +#endif }; TransactionDetails _transactionDetails; @@ -274,6 +337,9 @@ protected: int screenWidth, screenHeight; int overlayWidth, overlayHeight; +#ifdef ENABLE_RGB_COLOR + Graphics::PixelFormat format; +#endif }; VideoState _videoMode, _oldVideoMode; |