summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViljami Ilola <+@hix.fi>2024-04-27 16:26:22 +0300
committerViljami Ilola <+@hix.fi>2024-04-27 16:26:22 +0300
commit9f8247dc4da89219b6eede08d58d96964391a077 (patch)
treea6f7dc46275a3988fc528072f5e70caba461fae0
parentd64c6b122eacd7b33bbda3a62093b492c786b1f9 (diff)
refactor menus and screen showing under menu subpkg
-rw-r--r--pyproject.toml3
-rw-r--r--src/sliceitoff/game/__init__.py1
-rw-r--r--src/sliceitoff/game/game.py10
-rw-r--r--src/sliceitoff/game/level.py2
-rw-r--r--src/sliceitoff/menu/__init__.py5
-rw-r--r--src/sliceitoff/menu/anykey.py (renamed from src/sliceitoff/game/anykey.py)2
-rw-r--r--src/sliceitoff/menu/explodeout.py (renamed from src/sliceitoff/game/explodeout.py)2
-rw-r--r--src/sliceitoff/menu/initials.py (renamed from src/sliceitoff/game/initials.py)2
-rw-r--r--src/sliceitoff/menu/mainmenu.py (renamed from src/sliceitoff/game/mainmenu.py)2
-rw-r--r--src/sliceitoff/menu/menu.py (renamed from src/sliceitoff/game/menu.py)2
-rw-r--r--src/sliceitoff/menu/settings.py (renamed from src/sliceitoff/game/settings.py)2
-rw-r--r--src/sliceitoff/menu/show.py (renamed from src/sliceitoff/game/show.py)2
12 files changed, 21 insertions, 14 deletions
diff --git a/pyproject.toml b/pyproject.toml
index 1b15c84..6f7a108 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -33,7 +33,8 @@ branch = true
source = ["src/sliceitoff/"]
omit = [
"**/__????__.py", # __init__.py and __main__.py files
- "src/sliceitoff/game/*" # Needs input and graphics.
+ "src/sliceitoff/game/*", # Needs input and graphics.
+ "src/sliceitoff/menu/*" # Needs input. Easy to test manually.
]
[tool.pylint.main]
diff --git a/src/sliceitoff/game/__init__.py b/src/sliceitoff/game/__init__.py
index 221acd3..7785623 100644
--- a/src/sliceitoff/game/__init__.py
+++ b/src/sliceitoff/game/__init__.py
@@ -1,3 +1,2 @@
""" game - All the game logic and user inputs """
from .game import Game
-from .explodeout import ExplodeOutGroup
diff --git a/src/sliceitoff/game/game.py b/src/sliceitoff/game/game.py
index e25a6a6..72b5749 100644
--- a/src/sliceitoff/game/game.py
+++ b/src/sliceitoff/game/game.py
@@ -16,12 +16,14 @@ from sliceitoff.screens import (
from sliceitoff.hiscores import hi_scores
from sliceitoff.text import fonts
from sliceitoff.sfx import sfx
+from sliceitoff.menu import (
+ Show,
+ MainMenu,
+ MainMenuItems,
+ Initials,
+ SettingsMenu)
-from .mainmenu import MainMenu, MainMenuItems
from .level import Level
-from .show import Show
-from .initials import Initials
-from .settings import SettingsMenu
class Game:
""" This is the whole game. """
diff --git a/src/sliceitoff/game/level.py b/src/sliceitoff/game/level.py
index 08e4495..421a1eb 100644
--- a/src/sliceitoff/game/level.py
+++ b/src/sliceitoff/game/level.py
@@ -7,8 +7,8 @@ from sliceitoff.field import Field
from sliceitoff.enemies import Enemies
from sliceitoff.screens import levelup_screen, gameover_screen, level_screen
from sliceitoff.sfx import sfx
+from sliceitoff.menu import Show
from .gameplay import Gameplay
-from .show import Show
class Level(pygame.sprite.Group):
""" One level that can be played """
diff --git a/src/sliceitoff/menu/__init__.py b/src/sliceitoff/menu/__init__.py
new file mode 100644
index 0000000..f26089f
--- /dev/null
+++ b/src/sliceitoff/menu/__init__.py
@@ -0,0 +1,5 @@
+""" menu - Menus, ScreenShow, Initial input... """
+from .mainmenu import MainMenu, MainMenuItems
+from .settings import SettingsMenu
+from .show import Show
+from .initials import Initials
diff --git a/src/sliceitoff/game/anykey.py b/src/sliceitoff/menu/anykey.py
index bd2a3c7..0916ec3 100644
--- a/src/sliceitoff/game/anykey.py
+++ b/src/sliceitoff/menu/anykey.py
@@ -1,4 +1,4 @@
-""" game.anykey - Event waiting. Used for skipping screens. """
+""" menu.anykey - Event waiting. Used for skipping screens. """
import pygame
def anykey():
diff --git a/src/sliceitoff/game/explodeout.py b/src/sliceitoff/menu/explodeout.py
index 0349b09..7732781 100644
--- a/src/sliceitoff/game/explodeout.py
+++ b/src/sliceitoff/menu/explodeout.py
@@ -1,4 +1,4 @@
-""" game.explodeout - For showing explogind effect and waiting for a key """
+""" menu.explodeout - For showing explogind effect and waiting for a key """
import pygame
from sliceitoff.sfx import sfx
diff --git a/src/sliceitoff/game/initials.py b/src/sliceitoff/menu/initials.py
index 385562c..ca52b16 100644
--- a/src/sliceitoff/game/initials.py
+++ b/src/sliceitoff/menu/initials.py
@@ -1,4 +1,4 @@
-""" game.initials - Use will be asked for initials """
+""" menu.initials - Use will be asked for initials """
import pygame
from sliceitoff.screens import initials_screen
diff --git a/src/sliceitoff/game/mainmenu.py b/src/sliceitoff/menu/mainmenu.py
index fbd91c9..9ba9096 100644
--- a/src/sliceitoff/game/mainmenu.py
+++ b/src/sliceitoff/menu/mainmenu.py
@@ -1,4 +1,4 @@
-""" game.mainmenu - Let's user choose """
+""" menu.mainmenu - Let's user choose """
from enum import IntEnum
from sliceitoff.screens import mainmenu_screen
diff --git a/src/sliceitoff/game/menu.py b/src/sliceitoff/menu/menu.py
index 446e37f..c0d63af 100644
--- a/src/sliceitoff/game/menu.py
+++ b/src/sliceitoff/menu/menu.py
@@ -1,4 +1,4 @@
-""" game.menu - Skeleton for menus """
+""" menu.menu - Skeleton for menus """
import pygame
from sliceitoff.display import Scaling
diff --git a/src/sliceitoff/game/settings.py b/src/sliceitoff/menu/settings.py
index 0b3bed8..2d3f594 100644
--- a/src/sliceitoff/game/settings.py
+++ b/src/sliceitoff/menu/settings.py
@@ -1,4 +1,4 @@
-""" game.settings - Settings dialog """
+""" menu.settings - Settings dialog """
from enum import IntEnum
from sliceitoff.sfx import sfx
diff --git a/src/sliceitoff/game/show.py b/src/sliceitoff/menu/show.py
index 32a87cf..5c122d8 100644
--- a/src/sliceitoff/game/show.py
+++ b/src/sliceitoff/menu/show.py
@@ -1,4 +1,4 @@
-""" game.show - Sprite group that show sprites and skips if key is pressed """
+""" menu.show - Sprite group that show sprites and skips if key is pressed """
from .anykey import anykey
from .explodeout import ExplodeOutGroup