From 97d4a43ec7e8a3619c54b09afde1f108183332f1 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Wed, 7 Mar 2018 16:13:34 +0700 Subject: Drop (trivial) OpenGL support --- brutalmaze/game.py | 15 ++++----------- brutalmaze/maze.py | 7 +++---- brutalmaze/settings.ini | 2 -- setup.py | 2 +- wiki | 2 +- 5 files changed, 9 insertions(+), 19 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 . -__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 @@ -335,11 +333,6 @@ def main(): parser.add_argument( '-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)) 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 diff --git a/setup.py b/setup.py index ba3e88a..48df9cf 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open('README.rst') as f: setup( name='brutalmaze', - version='0.6.0', + version='0.6.1', description='A minimalist hack and slash game with fast-paced action', long_description=long_description, url='https://github.com/McSinyx/brutalmaze', diff --git a/wiki b/wiki index bcb9563..d0221ed 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit bcb956351f06ad378add2e65f43644fdae110ae9 +Subproject commit d0221ed371d98d52173d57b71c6302b5ffb21ec6 -- cgit 1.4.1