summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
Diffstat (limited to 'src/video')
-rw-r--r--src/video/cocoa/cocoa_v.mm6
-rw-r--r--src/video/cocoa/event.mm2
-rw-r--r--src/video/sdl_v.cpp2
-rw-r--r--src/video/video_driver.hpp8
-rw-r--r--src/video/win32_v.cpp2
5 files changed, 13 insertions, 7 deletions
diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm
index d87fa10b2..5665abb5b 100644
--- a/src/video/cocoa/cocoa_v.mm
+++ b/src/video/cocoa/cocoa_v.mm
@@ -597,16 +597,16 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
_cocoa_video_dialog = true;
bool wasstarted = _cocoa_video_started;
- if (_video_driver == NULL) {
+ if (VideoDriver::GetInstance() == NULL) {
setupApplication(); // Setup application before showing dialog
- } else if (!_cocoa_video_started && _video_driver->Start(NULL) != NULL) {
+ } else if (!_cocoa_video_started && VideoDriver::GetInstance()->Start(NULL) != NULL) {
fprintf(stderr, "%s: %s\n", title, message);
return;
}
NSRunAlertPanel([ NSString stringWithUTF8String:title ], [ NSString stringWithUTF8String:message ], [ NSString stringWithUTF8String:buttonLabel ], nil, nil);
- if (!wasstarted && _video_driver != NULL) _video_driver->Stop();
+ if (!wasstarted && VideoDriver::GetInstance() != NULL) VideoDriver::GetInstance()->Stop();
_cocoa_video_dialog = false;
}
diff --git a/src/video/cocoa/event.mm b/src/video/cocoa/event.mm
index b4f171a98..78785f8d0 100644
--- a/src/video/cocoa/event.mm
+++ b/src/video/cocoa/event.mm
@@ -287,7 +287,7 @@ static bool QZ_KeyEvent(unsigned short keycode, unsigned short unicode, BOOL dow
case QZ_RETURN:
case QZ_f:
if (down && (_current_mods & NSCommandKeyMask)) {
- _video_driver->ToggleFullscreen(!_fullscreen);
+ VideoDriver::GetInstance()->ToggleFullscreen(!_fullscreen);
}
break;
}
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index d34f5e6db..d59ab20d4 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -411,7 +411,7 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h)
break;
case Blitter::PALETTE_ANIMATION_BLITTER:
- if (_video_driver != NULL) blitter->PaletteAnimate(_local_palette);
+ if (VideoDriver::GetInstance() != NULL) blitter->PaletteAnimate(_local_palette);
break;
default:
diff --git a/src/video/video_driver.hpp b/src/video/video_driver.hpp
index 190bfcc10..916044d35 100644
--- a/src/video/video_driver.hpp
+++ b/src/video/video_driver.hpp
@@ -78,9 +78,15 @@ public:
* An edit box lost the input focus. Abort character compositing if necessary.
*/
virtual void EditBoxLostFocus() {}
+
+ /**
+ * Get the currently active instance of the video driver.
+ */
+ static VideoDriver *GetInstance() {
+ return static_cast<VideoDriver*>(*DriverFactoryBase::GetActiveDriver(Driver::DT_VIDEO));
+ }
};
-extern VideoDriver *_video_driver;
extern char *_ini_videodriver;
extern int _num_resolutions;
extern Dimension _resolutions[32];
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index 3774f3c0f..a7487bfb5 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -1002,7 +1002,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
if (active && minimized) {
/* Restore the game window */
ShowWindow(hwnd, SW_RESTORE);
- static_cast<VideoDriver_Win32 *>(_video_driver)->MakeWindow(true);
+ static_cast<VideoDriver_Win32 *>(VideoDriver::GetInstance())->MakeWindow(true);
} else if (!active && !minimized) {
/* Minimise the window and restore desktop */
ShowWindow(hwnd, SW_MINIMIZE);