summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViljami Ilola <+@hix.fi>2024-04-08 18:47:32 +0300
committerViljami Ilola <+@hix.fi>2024-04-08 18:47:32 +0300
commitda33fc2f82a2919f9af7c7d1c8510c37435c5181 (patch)
treeb23636b4560e1ae3479880cc07e91c3f38321bc7
parent74a735a7878bc76d01b644505f674cfe7bebd058 (diff)
background
-rw-r--r--README.txt (renamed from README.md)0
-rw-r--r--pyproject.toml13
-rw-r--r--src/sliceitoff/display/display.py14
3 files changed, 18 insertions, 9 deletions
diff --git a/README.md b/README.txt
index 917ae41..917ae41 100644
--- a/README.md
+++ b/README.txt
diff --git a/pyproject.toml b/pyproject.toml
index 2109569..fb01158 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -3,32 +3,29 @@ name = "sliceitoff"
version = "0.3-alpha"
description = "Arcade game where one slices play area off avoiding enemies."
authors = ["Viljami Ilola <+@hix.fi>"]
-readme = "README.md"
+readme = "README.txt"
packages = [{include = "sliceitoff", from = "src"}]
[tool.poetry.dependencies]
python = "^3.10"
pygame = "^2.5.2"
-
[tool.poetry.group.dev.dependencies]
pylint = "^3.1.0"
pytest = "^8.1.1"
coverage = "^7.4.4"
-[build-system]
-requires = ["poetry-core"]
-build-backend = "poetry.core.masonry.api"
-
[tool.poetry.scripts]
sliceitoff = 'sliceitoff.main:main'
-
-
[tool.pytest.ini_options]
pythonpath = [ "src/sliceitoff" ]
+[build-system]
+requires = ["poetry-core"]
+build-backend = "poetry.core.masonry.api"
+
[tool.pylint.main]
recursive = true
diff --git a/src/sliceitoff/display/display.py b/src/sliceitoff/display/display.py
index 65b4713..a161dc4 100644
--- a/src/sliceitoff/display/display.py
+++ b/src/sliceitoff/display/display.py
@@ -7,6 +7,14 @@ from .static import CGA_COLORS
DEBUG = os.getenv("DEBUG")
+def gen_backdrop(color, color2):
+ """ generates backdrop with 50% dithering """
+ srfc = pygame.Surface((320, 240))
+ for x in range(320):
+ for y in range(240):
+ srfc.set_at((x,y),color if (x+y)%2 else color2)
+ return srfc
+
class Display():
"""display.Display - Handles graphics. Init, clear, draw, borders... """
@@ -18,6 +26,9 @@ class Display():
pygame.FULLSCREEN | pygame.SCALED,
vsync = 1 )
Scaling.update_scaling(self.screen.get_size())
+ self.backdrop = pygame.transform.scale_by(
+ gen_backdrop(CGA_COLORS[1], CGA_COLORS[8]),
+ 1_000 * Scaling.factor)
if DEBUG:
print(
"DISPLAY: \n"
@@ -30,7 +41,8 @@ class Display():
def update(self, groups = None):
""" Updates the screen: clear, blit gropus and flip """
- self.screen.fill(CGA_COLORS[4], rect=Scaling.active)
+ self.screen.blit(self.backdrop, (Scaling.left,Scaling.top))
+ # fill(CGA_COLORS[4], rect=Scaling.active)
for group in groups:
group.draw(self.screen)
self.screen.fill(0, rect=Scaling.borders[0])