Drop (trivial) OpenGL support
This commit is contained in:
parent
b5039285d5
commit
97d4a43ec7
|
@ -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
|
||||
|
||||
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
2
setup.py
2
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',
|
||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
|||
Subproject commit bcb956351f06ad378add2e65f43644fdae110ae9
|
||||
Subproject commit d0221ed371d98d52173d57b71c6302b5ffb21ec6
|
Loading…
Reference in New Issue