From da33fc2f82a2919f9af7c7d1c8510c37435c5181 Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Mon, 8 Apr 2024 18:47:32 +0300 Subject: background --- README.md | 30 ------------------------------ README.txt | 30 ++++++++++++++++++++++++++++++ pyproject.toml | 13 +++++-------- src/sliceitoff/display/display.py | 14 +++++++++++++- 4 files changed, 48 insertions(+), 39 deletions(-) delete mode 100644 README.md create mode 100644 README.txt diff --git a/README.md b/README.md deleted file mode 100644 index 917ae41..0000000 --- a/README.md +++ /dev/null @@ -1,30 +0,0 @@ --- Slice It Off! -- - -Description: - - Small game where goal is to beat hiscores. Score is gained by - slicing parts of playing area off. Faster you do it more score you - get. If you hit enemies while slicing you lose healt. There will be - also bonuses to boost the scores. - -Installing: - - One can use provided `./dev.sh` shell script to buid and install any - versionof game: - - `git clone https://git.hix.fi/scliceitoff.git` - - `cd sliceitoff` - - `./dev.sh install` - - Distribution package can be installed normally: - - `pipx install sliceitoff.*.tar.gz` - -Developement: - - Project makes heavy use of poetry build and dependencies control - system. Many shortcuts can be run easily from `./dev.sh` script: - - `./dev.sh` - - `./dev.sh dev` - - `./dev.sh pytest` - - `./dev.sh covff` - - `./dev.sh all` - - etc diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..917ae41 --- /dev/null +++ b/README.txt @@ -0,0 +1,30 @@ +-- Slice It Off! -- + +Description: + + Small game where goal is to beat hiscores. Score is gained by + slicing parts of playing area off. Faster you do it more score you + get. If you hit enemies while slicing you lose healt. There will be + also bonuses to boost the scores. + +Installing: + + One can use provided `./dev.sh` shell script to buid and install any + versionof game: + - `git clone https://git.hix.fi/scliceitoff.git` + - `cd sliceitoff` + - `./dev.sh install` + + Distribution package can be installed normally: + - `pipx install sliceitoff.*.tar.gz` + +Developement: + + Project makes heavy use of poetry build and dependencies control + system. Many shortcuts can be run easily from `./dev.sh` script: + - `./dev.sh` + - `./dev.sh dev` + - `./dev.sh pytest` + - `./dev.sh covff` + - `./dev.sh all` + - etc 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]) -- cgit v1.2.3