summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2005-05-16 16:19:32 +0000
committerDarkvater <darkvater@openttd.org>2005-05-16 16:19:32 +0000
commit7daaf1f100319be93b534a926bb83efbe6733014 (patch)
treecd512d1e77be75c8bca61a3bb1f91db36815a124
parenteffbba74f549ecb8699bf073b3b096a03751fe04 (diff)
downloadopenttd-7daaf1f100319be93b534a926bb83efbe6733014.tar.xz
(svn r2334) - Fix (regression): moved togglefullscreen into the video-driver, now windows works, dedicated works and sdl works. Also reverted the change to the makefile.
-rw-r--r--Makefile5
-rw-r--r--dedicated.c4
-rw-r--r--gfx.c2
-rw-r--r--gfx.h2
-rw-r--r--hal.h1
-rw-r--r--sdl.c8
-rw-r--r--ttd.c3
-rw-r--r--win32.c3
8 files changed, 18 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 6200c2b6c..214fdee53 100644
--- a/Makefile
+++ b/Makefile
@@ -687,10 +687,13 @@ C_SOURCES += water_cmd.c
C_SOURCES += waypoint.c
C_SOURCES += widget.c
C_SOURCES += window.c
-C_SOURCES += sdl.c
CXX_SOURCES =
+ifdef WITH_SDL
+C_SOURCES += sdl.c
+endif
+
ifdef WIN32
C_SOURCES += win32.c w32dm.c
else
diff --git a/dedicated.c b/dedicated.c
index 2ce1a7fa4..11c83fc0c 100644
--- a/dedicated.c
+++ b/dedicated.c
@@ -167,6 +167,7 @@ static void DedicatedVideoStop(void)
static void DedicatedVideoMakeDirty(int left, int top, int width, int height) {}
static bool DedicatedVideoChangeRes(int w, int h) { return false; }
+static void DedicatedVideoFullScreen(bool fs) {}
#if defined(UNIX) || defined(__OS2__)
static bool InputWaiting(void)
@@ -322,6 +323,7 @@ const HalVideoDriver _dedicated_video_driver = {
DedicatedVideoMakeDirty,
DedicatedVideoMainLoop,
DedicatedVideoChangeRes,
+ DedicatedVideoFullScreen,
};
#else
@@ -339,6 +341,7 @@ void DedicatedFork(void) {}
static void DedicatedVideoStop(void) { free(_dedicated_video_mem); }
static void DedicatedVideoMakeDirty(int left, int top, int width, int height) {}
static bool DedicatedVideoChangeRes(int w, int h) { return false; }
+static void DedicatedVideoFullScreen(bool fs) {}
static int DedicatedVideoMainLoop(void) { return ML_QUIT; }
const HalVideoDriver _dedicated_video_driver = {
@@ -347,6 +350,7 @@ const HalVideoDriver _dedicated_video_driver = {
DedicatedVideoMakeDirty,
DedicatedVideoMainLoop,
DedicatedVideoChangeRes,
+ DedicatedVideoFullScreen,
};
#endif /* ENABLE_NETWORK */
diff --git a/gfx.c b/gfx.c
index 6a306c3bc..6c81b4216 100644
--- a/gfx.c
+++ b/gfx.c
@@ -1979,6 +1979,8 @@ bool ChangeResInGame(int w, int h)
return true;
}
+void ToggleFullScreen(bool fs) {_video_driver->toggle_fullscreen(fs);}
+
static int CDECL compare_res(const void *pa, const void *pb)
{
int x = ((const uint16*)pa)[0] - ((const uint16*)pb)[0];
diff --git a/gfx.h b/gfx.h
index e52cbdbba..2572ddea0 100644
--- a/gfx.h
+++ b/gfx.h
@@ -67,7 +67,7 @@ void ScreenSizeChanged(void);
void UndrawMouseCursor(void);
bool ChangeResInGame(int w, int h);
void SortResolutions(int count);
-void ToggleFullScreen(bool full_screen);
+void ToggleFullScreen(bool fs);
/* gfx.c */
#define ASCII_LETTERSTART 32
diff --git a/hal.h b/hal.h
index 261ed0383..e643ecda2 100644
--- a/hal.h
+++ b/hal.h
@@ -12,6 +12,7 @@ typedef struct {
void (*make_dirty)(int left, int top, int width, int height);
int (*main_loop)(void);
bool (*change_resolution)(int w, int h);
+ void (*toggle_fullscreen)(bool fullscreen);
} HalVideoDriver;
enum {
diff --git a/sdl.c b/sdl.c
index c81fb66d6..92548d603 100644
--- a/sdl.c
+++ b/sdl.c
@@ -636,7 +636,7 @@ static bool SdlVideoChangeRes(int w, int h)
return true;
}
-void ToggleFullScreen(bool full_screen)
+static void SdlVideoFullScreen(bool full_screen)
{
_fullscreen = full_screen;
GetVideoModes(); // get the list of available video modes
@@ -650,6 +650,7 @@ const HalVideoDriver _sdl_video_driver = {
SdlVideoMakeDirty,
SdlVideoMainLoop,
SdlVideoChangeRes,
+ SdlVideoFullScreen,
};
static void CDECL fill_sound_buffer(void *userdata, Uint8 *stream, int len)
@@ -706,9 +707,4 @@ static void DbgRedraw()
}
#endif
-#else
-
-/* Stub for dedicated server */
-void ToggleFullScreen(bool full_screen) {}
-
#endif /* WITH_SDL */
diff --git a/ttd.c b/ttd.c
index 92470e6ec..c7cb42f02 100644
--- a/ttd.c
+++ b/ttd.c
@@ -148,7 +148,7 @@ static int NullVideoMainLoop(void)
}
static bool NullVideoChangeRes(int w, int h) { return false; }
-
+static void NullVideoFullScreen(bool fs) {}
const HalVideoDriver _null_video_driver = {
NullVideoStart,
@@ -156,6 +156,7 @@ const HalVideoDriver _null_video_driver = {
NullVideoMakeDirty,
NullVideoMainLoop,
NullVideoChangeRes,
+ NullVideoFullScreen,
};
// NULL sound driver
diff --git a/win32.c b/win32.c
index 6382ae0bf..6f2a746b3 100644
--- a/win32.c
+++ b/win32.c
@@ -783,7 +783,7 @@ static bool Win32GdiChangeRes(int w, int h)
return true;
}
-void ToggleFullScreen(bool full_screen) {MakeWindow(full_screen);}
+static void Win32GdiFullScreen(bool full_screen) {MakeWindow(full_screen);}
const HalVideoDriver _win32_video_driver = {
Win32GdiStart,
@@ -791,6 +791,7 @@ const HalVideoDriver _win32_video_driver = {
Win32GdiMakeDirty,
Win32GdiMainLoop,
Win32GdiChangeRes,
+ Win32GdiFullScreen,
};