about summary refs log tree commit diff homepage
path: root/brutalmaze
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2018-03-07 16:13:34 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2018-03-07 16:13:34 +0700
commit97d4a43ec7e8a3619c54b09afde1f108183332f1 (patch)
tree058b111421919aa0027fd63b88a2192a6e8155c3 /brutalmaze
parentb5039285d5a95d1921d1d4428032c16fe94da897 (diff)
downloadbrutalmaze-97d4a43ec7e8a3619c54b09afde1f108183332f1.tar.gz
Drop (trivial) OpenGL support
Diffstat (limited to 'brutalmaze')
-rw-r--r--brutalmaze/game.py15
-rw-r--r--brutalmaze/maze.py7
-rw-r--r--brutalmaze/settings.ini2
3 files changed, 7 insertions, 17 deletions
diff --git a/brutalmaze/game.py b/brutalmaze/game.py
index f6acb99..95d782c 100644
--- a/brutalmaze/game.py
+++ b/brutalmaze/game.py
@@ -17,7 +17,7 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with Brutal Maze.  If not, see <https://www.gnu.org/licenses/>.
 
-__version__ = '0.6.0'
+__version__ = '0.6.1'
 
 import re
 from argparse import ArgumentParser, FileType, RawTextHelpFormatter
@@ -33,7 +33,7 @@ from sys import stdout
 from threading import Thread
 
 import pygame
-from pygame import DOUBLEBUF, KEYDOWN, OPENGL, QUIT, RESIZABLE, VIDEORESIZE
+from pygame import KEYDOWN, QUIT, VIDEORESIZE
 from pygame.time import Clock, get_ticks
 from appdirs import AppDirs
 
@@ -67,7 +67,6 @@ class ConfigReader:
         """Parse configurations."""
         self.size = (self.config.getint('Graphics', 'Screen width'),
                      self.config.getint('Graphics', 'Screen height'))
-        self.opengl = self.config.getboolean('Graphics', 'OpenGL')
         self.max_fps = self.config.getint('Graphics', 'Maximum FPS')
         self.muted = self.config.getboolean('Sound', 'Muted')
         self.musicvol = self.config.getfloat('Sound', 'Music volume')
@@ -95,7 +94,7 @@ class ConfigReader:
 
     def read_args(self, arguments):
         """Read and parse a ArgumentParser.Namespace."""
-        for option in ('size', 'opengl', 'max_fps', 'muted', 'musicvol',
+        for option in ('size', 'max_fps', 'muted', 'musicvol',
                        'server', 'host', 'port', 'headless'):
             value = getattr(arguments, option)
             if value is not None: setattr(self, option, value)
@@ -131,8 +130,7 @@ class Game:
         self.max_fps, self.fps = config.max_fps, float(config.max_fps)
         self.musicvol = config.musicvol
         self.key, self.mouse = config.key, config.mouse
-        scrtype = (config.opengl and DOUBLEBUF|OPENGL) | RESIZABLE
-        self.maze = Maze(config.max_fps, config.size, scrtype, config.headless)
+        self.maze = Maze(config.max_fps, config.size, config.headless)
         self.hero = self.maze.hero
         self.clock, self.paused = Clock(), False
 
@@ -336,11 +334,6 @@ def main():
         '-s', '--size', type=int, nargs=2, metavar=('X', 'Y'),
         help='the desired screen size (fallback: {}x{})'.format(*config.size))
     parser.add_argument(
-        '--opengl', action='store_true', default=None,
-        help='enable OpenGL (fallback: {})'.format(config.opengl))
-    parser.add_argument('--no-opengl', action='store_false', dest='opengl',
-                        help='disable OpenGL')
-    parser.add_argument(
         '-f', '--max-fps', type=int, metavar='FPS',
         help='the desired maximum FPS (fallback: {})'.format(config.max_fps))
     parser.add_argument(
diff --git a/brutalmaze/maze.py b/brutalmaze/maze.py
index c3d1ff7..14e17d2 100644
--- a/brutalmaze/maze.py
+++ b/brutalmaze/maze.py
@@ -80,14 +80,13 @@ class Maze:
         sfx_slash (pygame.mixer.Sound): sound effect of slashed enemy
         sfx_lose (pygame.mixer.Sound): sound effect to be played when you lose
     """
-    def __init__(self, fps, size, scrtype, headless):
+    def __init__(self, fps, size, headless):
         self.fps = fps
         self.w, self.h = size
-        self.scrtype = scrtype
         if headless:
             self.surface = None
         else:
-            self.surface = pygame.display.set_mode(size, self.scrtype)
+            self.surface = pygame.display.set_mode(size, pygame.RESIZABLE)
 
         self.distance = (self.w * self.h / 416) ** 0.5
         self.x, self.y = self.w // 2, self.h // 2
@@ -334,7 +333,7 @@ class Maze:
     def resize(self, size):
         """Resize the maze."""
         self.w, self.h = size
-        self.surface = pygame.display.set_mode(size, self.scrtype)
+        self.surface = pygame.display.set_mode(size, pygame.RESIZABLE)
         self.hero.resize(size)
 
         offsetx = (self.centerx-self.x) / self.distance
diff --git a/brutalmaze/settings.ini b/brutalmaze/settings.ini
index cd31696..a2bde8f 100644
--- a/brutalmaze/settings.ini
+++ b/brutalmaze/settings.ini
@@ -1,8 +1,6 @@
 [Graphics]
 Screen width: 640
 Screen height: 480
-# OpenGL should be supported on all machines with hardware acceleration.
-OpenGL: yes
 # FPS should not be greater than refresh rate.
 Maximum FPS: 60