diff options
author | Einar Johan Trøan Sømåen | 2012-05-09 15:37:53 +0200 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-06-02 12:42:09 +0200 |
commit | 620b45e517a79371c1b1937f9f9a041285c22df0 (patch) | |
tree | e4e6e46cfeb74708f54378cff47a28d5b9fadee6 /engines | |
parent | 66602bcd9cecdfbb2d7f1088d96f8c744f602f31 (diff) | |
download | scummvm-rg350-620b45e517a79371c1b1937f9f9a041285c22df0.tar.gz scummvm-rg350-620b45e517a79371c1b1937f9f9a041285c22df0.tar.bz2 scummvm-rg350-620b45e517a79371c1b1937f9f9a041285c22df0.zip |
WINTERMUTE: Start work on porting BRenderSDL away from SDL2
In particular this stubs away a few troublesome SDL-calls, that stopped us
from getting the engine to start right now.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/wintermute/BRenderSDL.cpp | 27 | ||||
-rw-r--r-- | engines/wintermute/BRenderSDL.h | 15 | ||||
-rw-r--r-- | engines/wintermute/BSurfaceSDL.h | 1 | ||||
-rw-r--r-- | engines/wintermute/PlatformSDL.cpp | 2 |
4 files changed, 30 insertions, 15 deletions
diff --git a/engines/wintermute/BRenderSDL.cpp b/engines/wintermute/BRenderSDL.cpp index f287403091..78c68c0cea 100644 --- a/engines/wintermute/BRenderSDL.cpp +++ b/engines/wintermute/BRenderSDL.cpp @@ -36,14 +36,17 @@ #include "engines/wintermute/BGame.h"
#include "engines/wintermute/BSprite.h"
+#include "SDL.h"
+
namespace WinterMute {
// TODO: Redo everything here.
//////////////////////////////////////////////////////////////////////////
CBRenderSDL::CBRenderSDL(CBGame *inGame) : CBRenderer(inGame) {
- _renderer = NULL;
- _win = NULL;
+/* _renderer = NULL;
+ _win = NULL;*/
+ _renderSurface = NULL;
_borderLeft = _borderRight = _borderTop = _borderBottom = 0;
_ratioX = _ratioY = 1.0f;
@@ -140,8 +143,9 @@ HRESULT CBRenderSDL::InitRenderer(int width, int height, bool windowed) { SDL_WINDOWPOS_UNDEFINED,
_realWidth, _realHeight,
flags);
-#endif
+
if (!_win) return E_FAIL;
+#endif
SDL_ShowCursor(SDL_DISABLE);
@@ -153,9 +157,12 @@ HRESULT CBRenderSDL::InitRenderer(int width, int height, bool windowed) { #endif
#if 0
_renderer = SDL_CreateRenderer(_win, -1, 0);
-#endif
- if (!_renderer) return E_FAIL;
+ if (!_renderer) return E_FAIL;
+#endif
+ _renderSurface = new Graphics::Surface();
+ Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0);
+ _renderSurface->create(640,480, format); // TODO: Unhardcode this.
_active = true;
@@ -228,6 +235,8 @@ HRESULT CBRenderSDL::Fade(WORD Alpha) { //////////////////////////////////////////////////////////////////////////
HRESULT CBRenderSDL::FadeToColor(uint32 Color, RECT *rect) {
+ warning("Implement CBRenderSDL::FadeToColor");
+#if 0
SDL_Rect fillRect;
if (rect) {
@@ -253,7 +262,7 @@ HRESULT CBRenderSDL::FadeToColor(uint32 Color, RECT *rect) { //SDL_SetRenderDrawColor(_renderer, r, g, b, a);
//SDL_SetRenderDrawBlendMode(_renderer, SDL_BLENDMODE_BLEND);
//SDL_RenderFillRect(_renderer, &fillRect);
-
+#endif
return S_OK;
}
@@ -324,13 +333,13 @@ HRESULT CBRenderSDL::SwitchFullscreen() { //////////////////////////////////////////////////////////////////////////
const char *CBRenderSDL::GetName() {
if (_name.empty()) {
- if (_renderer) {
#if 0
+ if (_renderer) {
SDL_RendererInfo info;
SDL_GetRendererInfo(_renderer, &info);
_name = AnsiString(info.name);
-#endif
}
+#endif
}
return _name.c_str();
}
@@ -351,7 +360,7 @@ HRESULT CBRenderSDL::SetViewport(int left, int top, int right, int bottom) { }
//////////////////////////////////////////////////////////////////////////
-void CBRenderSDL::ModTargetRect(SDL_Rect *rect) {
+void CBRenderSDL::ModTargetRect(Common::Rect *rect) {
#if 0
SDL_Rect viewportRect;
SDL_RenderGetViewport(GetSdlRenderer(), &viewportRect);
diff --git a/engines/wintermute/BRenderSDL.h b/engines/wintermute/BRenderSDL.h index edcafdff96..3ef5cc1cde 100644 --- a/engines/wintermute/BRenderSDL.h +++ b/engines/wintermute/BRenderSDL.h @@ -30,7 +30,9 @@ #define WINTERMUTE_BRENDERER_SDL_H
#include "BRenderer.h"
-#include "SDL.h"
+/*#include "SDL.h"*/
+#include "common/rect.h"
+#include "graphics/surface.h"
class SDL_Window;
class SDL_Renderer;
@@ -58,15 +60,15 @@ public: CBImage *TakeScreenshot();
SDL_Renderer *GetSdlRenderer() const {
- return _renderer;
+// return _renderer;
}
SDL_Window *GetSdlWindow() const {
- return _win;
+// return _win;
}
HRESULT SetViewport(int left, int top, int right, int bottom);
- void ModTargetRect(SDL_Rect *rect);
+ void ModTargetRect(Common::Rect *rect);
void PointFromScreen(POINT *point);
void PointToScreen(POINT *point);
@@ -80,8 +82,9 @@ public: }
private:
- SDL_Renderer *_renderer;
- SDL_Window *_win;
+/* SDL_Renderer *_renderer;
+ SDL_Window *_win;*/
+ Graphics::Surface *_renderSurface;
AnsiString _name;
int _borderLeft;
diff --git a/engines/wintermute/BSurfaceSDL.h b/engines/wintermute/BSurfaceSDL.h index ae5fe154f6..557eefeedf 100644 --- a/engines/wintermute/BSurfaceSDL.h +++ b/engines/wintermute/BSurfaceSDL.h @@ -30,6 +30,7 @@ #define WINTERMUTE_BSURFACESDL_H
#include "BSurface.h"
+#include "SDL.h" // TODO, remove
class SDL_Texture;
class SDL_Surface;
namespace WinterMute {
diff --git a/engines/wintermute/PlatformSDL.cpp b/engines/wintermute/PlatformSDL.cpp index f1a295b443..b80efb3820 100644 --- a/engines/wintermute/PlatformSDL.cpp +++ b/engines/wintermute/PlatformSDL.cpp @@ -34,6 +34,8 @@ THE SOFTWARE. #include "common/str.h"
#include "common/textconsole.h"
+#include "SDL.h" // TODO remove
+
#ifdef __WIN32__
# include <dbghelp.h>
# include <direct.h>
|