summaryrefslogtreecommitdiff
path: root/src/video/dedicated_v.cpp
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-06-12 20:24:12 +0000
committertruelight <truelight@openttd.org>2007-06-12 20:24:12 +0000
commitf3f744d36a60431a6845d2b7e3ce17e64ee2e4f5 (patch)
treebed173ca279e1556489d31b0b8aa873a6d1cf110 /src/video/dedicated_v.cpp
parent381b11c9796d6b40653f8b4c319c33f9920f047a (diff)
downloadopenttd-f3f744d36a60431a6845d2b7e3ce17e64ee2e4f5.tar.xz
(svn r10121) -Codechange: split renderer from rest of code; no longer any code directly accesses the video-buffer
-Add: added NULL blitter and renderer, which are always used for -vnull -Add: dedicated driver doesn't blit nor render by default. Can be overruled by user. (-D -b 8bpp-optimized) -Remove: removed CTRL+D from win32, which is incompatible with above -Add: extended screenshot support for PNG and BMP -Codechange: remove all hardcoded 8bpp references and replace them with more dynamic ones -Codechange: minor stuff in blitters
Diffstat (limited to 'src/video/dedicated_v.cpp')
-rw-r--r--src/video/dedicated_v.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp
index 046dc2ac8..4aa6b9f20 100644
--- a/src/video/dedicated_v.cpp
+++ b/src/video/dedicated_v.cpp
@@ -13,6 +13,7 @@
#include "../console.h"
#include "../variables.h"
#include "../genworld.h"
+#include "../blitter/blitter.hpp"
#include "dedicated_v.h"
#ifdef BEOS_NET_SERVER
@@ -112,7 +113,7 @@ static void CloseWindowsConsoleThread()
#endif
-static Pixel *_dedicated_video_mem;
+static void *_dedicated_video_mem;
extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm);
extern void SwitchMode(int new_mode);
@@ -120,9 +121,14 @@ extern void SwitchMode(int new_mode);
static const char *DedicatedVideoStart(const char * const *parm)
{
+ int bpp = BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth();
+ if (bpp == 0) _dedicated_video_mem = NULL;
+ else _dedicated_video_mem = malloc(_cur_resolution[0] * _cur_resolution[1] * (bpp / 8));
+
_screen.width = _screen.pitch = _cur_resolution[0];
_screen.height = _cur_resolution[1];
- _dedicated_video_mem = (Pixel *)malloc(_cur_resolution[0] * _cur_resolution[1] * sizeof(Pixel));
+ _screen.renderer = RendererFactoryBase::SelectRenderer(BlitterFactoryBase::GetCurrentBlitter()->GetRenderer());
+ if (_screen.renderer == NULL) error("Couldn't load the renderer '%s' the selected blitter depends on", BlitterFactoryBase::GetCurrentBlitter()->GetRenderer());
SetDebugString("net=6");