shithub: choc

Download patch

ref: 456e87433a1b642b84ac4161332da502c2d9a79f
parent: f49a12791fc4a4b20a1c4a15784f2f2a4b62fcb9
author: Simon Howard <[email protected]>
date: Fri Feb 23 18:41:58 EST 2007

Add an extra option to chocolate-setup on Windows to allow the video
driver to be selected from directx and windib.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 839

--- a/setup/configfile.c
+++ b/setup/configfile.c
@@ -263,6 +263,7 @@
 #ifdef FEATURE_MULTIPLAYER
     {"player_name",                 &net_player_name,          DEFAULT_STRING, 0, 0},
 #endif
+    {"video_driver",                &video_driver,             DEFAULT_STRING, 0, 0},
 };
 
 static default_collection_t extra_defaults =
--- a/setup/display.c
+++ b/setup/display.c
@@ -56,6 +56,7 @@
 
 static int vidmode = 0;
 
+char *video_driver = "";
 int autoadjust_video_settings = 1;
 int aspect_ratio_correct = RATIO_CORRECT_NONE;
 int fullscreen = 1;
@@ -63,6 +64,41 @@
 int startup_delay = 0;
 int show_endoom = 1;
 
+#ifdef _WIN32
+
+static int win32_video_driver = 0;
+
+static char *win32_video_drivers[] = 
+{
+    "DirectX",
+    "Windows GDI",
+};
+
+static void SetWin32VideoDriver(void)
+{
+    if (!strcmp(video_driver, "windib"))
+    {
+        win32_video_driver = 1;
+    }
+    else
+    {
+        win32_video_driver = 0;
+    }
+}
+
+static void UpdateVideoDriver(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
+{
+    char *drivers[] = 
+    {
+        "",
+        "windib",
+    };
+
+    video_driver = drivers[win32_video_driver];
+}
+
+#endif
+
 // Given the video settings (fullscreen, screenmultiply, etc), find the
 // current video mode
 
@@ -122,6 +158,21 @@
     // Open the window
     
     window = TXT_NewWindow("Display Configuration");
+
+#ifdef _WIN32
+    {
+        txt_dropdown_list_t *driver_list;
+
+        driver_list = TXT_NewDropdownList(&win32_video_driver,
+                                          win32_video_drivers,
+                                          2));
+
+        TXT_SignalConnect(driver_list, "changed", UpdateVideoDriver, NULL);
+        SetWin32VideoDriver();
+
+        TXT_AddWidget(window, driver_list);
+    }
+#endif
 
     TXT_AddWidgets(window, 
                    TXT_NewCheckBox("Fullscreen", &fullscreen),
--- a/setup/display.h
+++ b/setup/display.h
@@ -28,6 +28,7 @@
 extern int screenmultiply;
 extern int startup_delay;
 extern int show_endoom;
+extern char *video_driver;
 
 void ConfigDisplay(void);