[planetblupi] 20/29: Add support for all drivers (renderers)

Didier Raboud odyx at moszumanska.debian.org
Tue Jan 2 08:38:43 UTC 2018


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository planetblupi.

commit 9543ebb60fe516d5de4f6030e711ddb27d70efac
Author: Mathieu Schroeter <mathieu at schroetersa.ch>
Date:   Thu Dec 14 23:42:54 2017 +0100

    Add support for all drivers (renderers)
---
 src/blupi.cxx | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/blupi.cxx b/src/blupi.cxx
index 3833f70..71b57df 100644
--- a/src/blupi.cxx
+++ b/src/blupi.cxx
@@ -22,6 +22,7 @@
 #include <fstream>
 #include <iostream>
 #include <iterator>
+#include <regex>
 #include <sstream>
 #include <stdio.h>
 #include <stdlib.h>
@@ -168,10 +169,10 @@ ReadConfig ()
     !(g_settingsOverload & SETTING_DRIVER) && j.find ("driver") != j.end () &&
     (!g_rendererType || g_rendererType == SDL_RENDERER_ACCELERATED))
   {
-    if (j["driver"] == "direct3d")
-      SDL_SetHint (SDL_HINT_RENDER_DRIVER, "direct3d");
-    else if (j["driver"] == "opengl")
-      SDL_SetHint (SDL_HINT_RENDER_DRIVER, "opengl");
+    std::string input = j["driver"];
+    if (std::regex_match (
+          input, std::regex ("direct3d|direct3d11|opengl|opengles2|opengles")))
+      SDL_SetHint (SDL_HINT_RENDER_DRIVER, input.c_str ());
   }
 
   if (
@@ -573,7 +574,8 @@ parseArgs (int argc, char * argv[], bool & exit)
       1},
      {"driver",
       {"-d", "--driver"},
-      "set a driver [auto;direct3d;opengl] (default: auto, ignored with "
+      "set a driver [auto;direct3d;direct3d11;opengl;opengles2;opengles] "
+      "(default: auto, ignored with "
       "software renderer)",
       1},
      {"enablerecorder",
@@ -661,10 +663,10 @@ parseArgs (int argc, char * argv[], bool & exit)
     args["driver"] &&
     (!g_rendererType || g_rendererType == SDL_RENDERER_ACCELERATED))
   {
-    if (args["driver"].as<std::string> () == "direct3d")
-      SDL_SetHint (SDL_HINT_RENDER_DRIVER, "direct3d");
-    else if (args["driver"].as<std::string> () == "opengl")
-      SDL_SetHint (SDL_HINT_RENDER_DRIVER, "opengl");
+    std::string input = args["driver"].as<std::string> ();
+    if (std::regex_match (
+          input, std::regex ("direct3d|direct3d11|opengl|opengles2|opengles")))
+      SDL_SetHint (SDL_HINT_RENDER_DRIVER, input.c_str ());
     g_settingsOverload |= SETTING_DRIVER;
   }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/planetblupi.git



More information about the Pkg-games-commits mailing list