refactor: cleaner constants

This commit is contained in:
korzepadawid 2022-03-04 21:01:05 +01:00
parent 9c23ea4a3d
commit e81dd05024
3 changed files with 11 additions and 16 deletions

9
constants.py Normal file
View File

@ -0,0 +1,9 @@
GAME_TITLE = 'WMICraft'
WINDOW_HEIGHT = 900
WINDOW_WIDTH = 900
GRID_CELL_PADDING = 3
GRID_CELL_WIDTH = 42
GRID_CELL_HEIGHT = 42
ROWS = 20
COLUMNS = 20
FPS_COUNT = 60

12
game.py
View File

@ -2,17 +2,7 @@ import pygame
from glob import glob from glob import glob
from grid import Grid from grid import Grid
from constants import GAME_TITLE, WINDOW_WIDTH, WINDOW_HEIGHT, FPS_COUNT
GAME_TITLE = 'WMICraft'
WINDOW_HEIGHT = 900
WINDOW_WIDTH = 900
GRID_CELL_PADDING = 3
GRID_CELL_WIDTH = 42
GRID_CELL_HEIGHT = 42
ROWS = 20
COLUMNS = 20
FPS_COUNT = 60
GREEN = (0, 255, 0)
class Game: class Game:

View File

@ -2,11 +2,7 @@ import pygame
import random import random
from field import Field from field import Field
GRID_CELL_PADDING = 3 from constants import ROWS, COLUMNS, GRID_CELL_PADDING, GRID_CELL_WIDTH, GRID_CELL_HEIGHT
GRID_CELL_WIDTH = 42
GRID_CELL_HEIGHT = 42
ROWS = 20
COLUMNS = 20
class Grid: class Grid: