mirror of
https://github.com/csd4ni3l/shatterstack.git
synced 2026-01-01 04:23:48 +01:00
Fix display mode crash
This commit is contained in:
@@ -27,16 +27,15 @@ class Shape():
|
||||
tile.visible = False
|
||||
|
||||
for offset_col, offset_row in SHAPES[self.shape_type]:
|
||||
x = self.x + (offset_col * (CELL_SIZE + OUTLINE_WIDTH))
|
||||
y = self.y + (offset_row * (CELL_SIZE + OUTLINE_WIDTH))
|
||||
tile_x = self.x + (offset_col * (CELL_SIZE + OUTLINE_WIDTH))
|
||||
tile_y = self.y + (offset_row * (CELL_SIZE + OUTLINE_WIDTH))
|
||||
|
||||
if n < len(self.tiles):
|
||||
self.tiles[n].position = x, y, 0
|
||||
self.tiles[n].position = tile_x, tile_y, 0
|
||||
self.tiles[n].color = color
|
||||
self.tiles[n].visible = True
|
||||
else:
|
||||
self.tiles.append(arcade.SpriteSolidColor(width=CELL_SIZE, height=CELL_SIZE,
|
||||
color=color, center_x=x, center_y=y))
|
||||
self.tiles.append(arcade.SpriteSolidColor(width=CELL_SIZE, height=CELL_SIZE, color=color, center_x=tile_x, center_y=tile_y))
|
||||
self.sprite_list.append(self.tiles[-1])
|
||||
|
||||
n += 1
|
||||
@@ -45,6 +44,5 @@ class Shape():
|
||||
for offset_col, offset_row in SHAPES[self.shape_type]:
|
||||
x = self.x + (offset_col * (CELL_SIZE + OUTLINE_WIDTH))
|
||||
y = self.y + (offset_row * (CELL_SIZE + OUTLINE_WIDTH))
|
||||
self.tiles.append(arcade.SpriteSolidColor(width=CELL_SIZE, height=CELL_SIZE,
|
||||
color=self.shape_color, center_x=x, center_y=y))
|
||||
self.tiles.append(arcade.SpriteSolidColor(width=CELL_SIZE, height=CELL_SIZE, color=self.shape_color, center_x=x, center_y=y))
|
||||
self.sprite_list.append(self.tiles[-1])
|
||||
|
||||
@@ -160,7 +160,10 @@ class Settings(arcade.gui.UIView):
|
||||
if self.settings_dict['vsync']:
|
||||
self.window.set_vsync(True)
|
||||
display_mode = self.window.display.get_default_screen().get_mode()
|
||||
if display_mode:
|
||||
refresh_rate = display_mode.rate
|
||||
else:
|
||||
refresh_rate = 60
|
||||
self.window.set_update_rate(1 / refresh_rate)
|
||||
self.window.set_draw_rate(1 / refresh_rate)
|
||||
|
||||
@@ -215,7 +218,6 @@ class Settings(arcade.gui.UIView):
|
||||
file.write(json.dumps(self.settings_dict, indent=4))
|
||||
|
||||
def update(self, setting=None, button_state=None, setting_type="bool"):
|
||||
setting_dict = settings[self.current_category][setting]
|
||||
config_key = settings[self.current_category][setting]["config_key"]
|
||||
|
||||
if setting_type == "option":
|
||||
|
||||
3
run.py
3
run.py
@@ -77,7 +77,10 @@ window = arcade.Window(width=resolution[0], height=resolution[1], title='Shatter
|
||||
if vsync:
|
||||
window.set_vsync(True)
|
||||
display_mode = window.display.get_default_screen().get_mode()
|
||||
if display_mode:
|
||||
refresh_rate = display_mode.rate
|
||||
else:
|
||||
refresh_rate = 60
|
||||
window.set_update_rate(1 / refresh_rate)
|
||||
window.set_draw_rate(1 / refresh_rate)
|
||||
elif not fps_limit == 0:
|
||||
|
||||
Reference in New Issue
Block a user