Skip to content

Commit

Permalink
Moves show_fog to globals.py + fixes a motion blur config bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
BertrandBordage committed Apr 12, 2013
1 parent 579dfd6 commit 8699a6e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ def __init__(self, window, show_gui=True):
self.block_damage = 0
self.crack = None
self.mouse_pressed = False
self.show_fog = globals.config.getboolean('World', 'show_fog')
self.last_key = None
self.sorted = False

Expand Down Expand Up @@ -204,7 +203,7 @@ def setup(self):
glEnable(GL_BLEND)
glEnable(GL_LINE_SMOOTH)

if self.show_fog:
if globals.SHOW_FOG:
glEnable(GL_FOG)
glFogfv(GL_FOG_COLOR, vec(self.bg_red, self.bg_green, self.bg_blue, 1))
glHint(GL_FOG_HINT, GL_DONT_CARE)
Expand Down Expand Up @@ -398,7 +397,7 @@ def on_resize(self, width, height):

def set_3d(self):
width, height = self.window.get_size()
if self.show_fog:
if globals.SHOW_FOG:
glFogfv(GL_FOG_COLOR, vec(self.bg_red, self.bg_green, self.bg_blue, 1.0))
glEnable(GL_DEPTH_TEST)
glViewport(0, 0, width, height)
Expand Down
2 changes: 2 additions & 0 deletions globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@
FAR_CLIP_DISTANCE = 200.0 # Maximum render distance,
# ignoring effects of sector_size and fog

SHOW_FOG = True

MOTION_BLUR = False


Expand Down
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ def initialize_config():
globals.DRAW_DISTANCE = globals.DRAW_DISTANCE_CHOICES[globals.DRAW_DISTANCE_CHOICE]

globals.MOTION_BLUR = get_or_update_config(
graphics, 'motion_blur', globals.MOTION_BLUR)
graphics, 'motion_blur', globals.MOTION_BLUR, conv=bool)

world = 'World'

get_or_update_config(world, 'flat', False, conv=bool) # dont make mountains, make a flat world
get_or_update_config(world, 'size', 64, conv=int)
get_or_update_config(world, 'show_fog', True, conv=bool)
globals.SHOW_FOG = get_or_update_config(world, 'show_fog', True, conv=bool)

# Adds missing keys to configuration file and converts to pyglet keys.
for control, default_key_name in globals.KEY_BINDINGS.items():
Expand Down

0 comments on commit 8699a6e

Please sign in to comment.