pgzero-plus 0.1.0a1__tar.gz → 0.1.0a2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/PKG-INFO +1 -1
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/pyproject.toml +1 -1
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/runner.py +2 -2
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero_plus.egg-info/PKG-INFO +1 -1
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_actor_features.py +2 -2
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_screen.py +1 -1
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_sprites.py +23 -23
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_tilemaps.py +3 -3
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/COPYING +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/README.md +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/setup.cfg +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/__init__.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/__main__.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/actor.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/animation.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/builtins.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/clock.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/constants.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/data/icon.png +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/data/joypad.png +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/game.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/keyboard.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/loaders.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/music.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/ptext.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/rect.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/screen.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/soundfmt.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/spellcheck.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/sprites.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/storage.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/tilemaps.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero/tone.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero_plus.egg-info/SOURCES.txt +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero_plus.egg-info/dependency_links.txt +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero_plus.egg-info/entry_points.txt +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero_plus.egg-info/requires.txt +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzero_plus.egg-info/top_level.txt +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/src/pgzrun.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_actor.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_animation.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_builtins.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_event_dispatch.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_game_state.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_keyboard.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_music.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_rect_actor.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_runner.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_sound_formats.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_spellcheck.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_storage.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_tone.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_transform_anchor.py +0 -0
- {pgzero_plus-0.1.0a1 → pgzero_plus-0.1.0a2}/test/test_webp_loader.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pgzero-plus
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.0a2
|
|
4
4
|
Summary: An enhanced fork of Pygame Zero with additional features for teaching and developing 2D games
|
|
5
5
|
Author-email: Michael D'Argenio <mjdargen@gmail.com>
|
|
6
6
|
License-Expression: LGPL-3.0-or-later
|
|
@@ -217,7 +217,7 @@ def open_loading_window():
|
|
|
217
217
|
still be fast.
|
|
218
218
|
|
|
219
219
|
run_mod() closes this window before opening the real one. Resizing it
|
|
220
|
-
instead would leave the game window off-
|
|
220
|
+
instead would leave the game window off-center on the screen.
|
|
221
221
|
|
|
222
222
|
"""
|
|
223
223
|
# An icon needs to exist before the window is created.
|
|
@@ -230,7 +230,7 @@ def open_loading_window():
|
|
|
230
230
|
|
|
231
231
|
def run_mod(mod, **kwargs):
|
|
232
232
|
"""Run the module."""
|
|
233
|
-
# Start from a fresh display so the game window opens
|
|
233
|
+
# Start from a fresh display so the game window opens centered, rather
|
|
234
234
|
# than reusing the hidden loading window from prepare_mod().
|
|
235
235
|
pygame.display.quit()
|
|
236
236
|
pygame.display.init()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pgzero-plus
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.0a2
|
|
4
4
|
Summary: An enhanced fork of Pygame Zero with additional features for teaching and developing 2D games
|
|
5
5
|
Author-email: Michael D'Argenio <mjdargen@gmail.com>
|
|
6
6
|
License-Expression: LGPL-3.0-or-later
|
|
@@ -232,12 +232,12 @@ class CollisionRectTest(ActorTestBase):
|
|
|
232
232
|
self.assertEqual((a.width, a.height), (20, 30))
|
|
233
233
|
self.assertEqual(a.pos, (100, 100))
|
|
234
234
|
self.assertEqual(a.center, (100, 100))
|
|
235
|
-
# The image is drawn
|
|
235
|
+
# The image is drawn centered on the body.
|
|
236
236
|
self.assertEqual(a._image_topleft(),
|
|
237
237
|
(100 - ALIEN_W / 2, 100 - ALIEN_H / 2))
|
|
238
238
|
|
|
239
239
|
def test_offset_body(self):
|
|
240
|
-
"""The 4-tuple offset moves the body
|
|
240
|
+
"""The 4-tuple offset moves the body center relative to the image."""
|
|
241
241
|
a = Actor("alien", pos=(100, 100), collision_rect=(20, 30, 10, 5))
|
|
242
242
|
self.assertEqual(a.center, (100, 100))
|
|
243
243
|
self.assertEqual(a._image_topleft(),
|
|
@@ -213,7 +213,7 @@ class ScreenTest(unittest.TestCase):
|
|
|
213
213
|
assert_screen_match(self.surf, 'filled_rect')
|
|
214
214
|
|
|
215
215
|
def test_rect_positional_color(self):
|
|
216
|
-
"""rect(rect, color) still works with a positional
|
|
216
|
+
"""rect(rect, color) still works with a positional color."""
|
|
217
217
|
yellow = (255, 255, 0)
|
|
218
218
|
self.screen.draw.rect(Rect((20, 20), (100, 100)), yellow, width=9)
|
|
219
219
|
assert_screen_match(self.surf, 'rect')
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""Tests for sprite sheets, Sprites, and Actors playing Sprites.
|
|
2
2
|
|
|
3
3
|
The fixture ``sprites/walk.png`` is a 64x32 sheet of 16x16 frames laid out
|
|
4
|
-
in 4 columns and 2 rows. Each frame is a solid
|
|
4
|
+
in 4 columns and 2 rows. Each frame is a solid color
|
|
5
5
|
``(col * 60, 100 + row * 100, 50)`` except for pixel (0, 0), which is magenta
|
|
6
|
-
so that
|
|
6
|
+
so that color-key handling can be tested.
|
|
7
7
|
|
|
8
8
|
``sprites/spaced.png`` (a copy of ``maps/tiles.png``) has 3x2 frames of 8x8
|
|
9
9
|
pixels with a 1 pixel margin and 2 pixels of spacing. Each frame is filled
|
|
@@ -11,7 +11,7 @@ with ``(col * 100, row * 200, 77)``.
|
|
|
11
11
|
|
|
12
12
|
``sprites/padded.png`` has 4x2 frames of 8x8 pixels, some left empty: row 0 is
|
|
13
13
|
frame, empty, frame, empty and row 1 is frame, frame, empty, empty. Filled
|
|
14
|
-
frames are ``
|
|
14
|
+
frames are ``frame_color(col, row)``.
|
|
15
15
|
|
|
16
16
|
"""
|
|
17
17
|
import unittest
|
|
@@ -29,12 +29,12 @@ SCREEN_SIZE = {"get_size.return_value": (800, 600)}
|
|
|
29
29
|
MAGENTA = (255, 0, 255, 255)
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
def
|
|
32
|
+
def frame_color(col, row):
|
|
33
33
|
return (col * 60, 100 + row * 100, 50, 255)
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
def
|
|
37
|
-
"""The
|
|
36
|
+
def drawn_color(image, pos):
|
|
37
|
+
"""The color a pixel of image comes out as when drawn on black."""
|
|
38
38
|
surf = pygame.Surface(image.get_size())
|
|
39
39
|
surf.blit(image, (0, 0))
|
|
40
40
|
return tuple(surf.get_at(pos))[:3]
|
|
@@ -96,35 +96,35 @@ class SpriteSheetTest(SpriteTestBase):
|
|
|
96
96
|
sheet = SpriteSheet("walk")
|
|
97
97
|
img = sheet.image_at((16, 16, 16, 16))
|
|
98
98
|
self.assertEqual(img.get_size(), (16, 16))
|
|
99
|
-
self.assertEqual(tuple(img.get_at((5, 5))),
|
|
99
|
+
self.assertEqual(tuple(img.get_at((5, 5))), frame_color(1, 1))
|
|
100
100
|
|
|
101
101
|
def test_image_at_no_color_key(self):
|
|
102
102
|
sheet = SpriteSheet("walk")
|
|
103
103
|
img = sheet.image_at((0, 0, 16, 16))
|
|
104
|
-
self.assertEqual(
|
|
104
|
+
self.assertEqual(drawn_color(img, (0, 0)), MAGENTA[:3])
|
|
105
105
|
|
|
106
106
|
def test_image_at_color_key_is_transparent(self):
|
|
107
|
-
"""Pixels of the color key's
|
|
107
|
+
"""Pixels of the color key's color are not drawn."""
|
|
108
108
|
sheet = SpriteSheet("walk")
|
|
109
109
|
for color_key in [MAGENTA[:3], 'magenta']:
|
|
110
110
|
with self.subTest(color_key=color_key):
|
|
111
111
|
img = sheet.image_at((0, 0, 16, 16), color_key=color_key)
|
|
112
|
-
self.assertEqual(
|
|
113
|
-
self.assertEqual(
|
|
112
|
+
self.assertEqual(drawn_color(img, (0, 0)), (0, 0, 0))
|
|
113
|
+
self.assertEqual(drawn_color(img, (5, 5)), frame_color(0, 0)[:3])
|
|
114
114
|
|
|
115
115
|
def test_image_at_color_key_minus_one_uses_top_left_pixel(self):
|
|
116
|
-
"""A color_key of -1 means 'use the
|
|
116
|
+
"""A color_key of -1 means 'use the color of pixel (0, 0)'."""
|
|
117
117
|
sheet = SpriteSheet("walk")
|
|
118
118
|
img = sheet.image_at((0, 0, 16, 16), color_key=-1)
|
|
119
|
-
self.assertEqual(
|
|
120
|
-
self.assertEqual(
|
|
119
|
+
self.assertEqual(drawn_color(img, (0, 0)), (0, 0, 0))
|
|
120
|
+
self.assertEqual(drawn_color(img, (5, 5)), frame_color(0, 0)[:3])
|
|
121
121
|
|
|
122
122
|
def test_images_at(self):
|
|
123
123
|
sheet = SpriteSheet("walk")
|
|
124
124
|
imgs = sheet.images_at([(0, 0, 16, 16), (48, 16, 16, 16)])
|
|
125
125
|
self.assertEqual(len(imgs), 2)
|
|
126
|
-
self.assertEqual(tuple(imgs[0].get_at((5, 5))),
|
|
127
|
-
self.assertEqual(tuple(imgs[1].get_at((5, 5))),
|
|
126
|
+
self.assertEqual(tuple(imgs[0].get_at((5, 5))), frame_color(0, 0))
|
|
127
|
+
self.assertEqual(tuple(imgs[1].get_at((5, 5))), frame_color(3, 1))
|
|
128
128
|
|
|
129
129
|
def test_load_strip(self):
|
|
130
130
|
"""load_strip() returns consecutive frames moving to the right."""
|
|
@@ -132,7 +132,7 @@ class SpriteSheetTest(SpriteTestBase):
|
|
|
132
132
|
imgs = sheet.load_strip((0, 16, 16, 16), 4)
|
|
133
133
|
self.assertEqual(
|
|
134
134
|
[tuple(i.get_at((5, 5))) for i in imgs],
|
|
135
|
-
[
|
|
135
|
+
[frame_color(c, 1) for c in range(4)],
|
|
136
136
|
)
|
|
137
137
|
|
|
138
138
|
def test_missing_sheet(self):
|
|
@@ -146,20 +146,20 @@ class SpriteTest(SpriteTestBase):
|
|
|
146
146
|
self.assertEqual(len(s.images), 3)
|
|
147
147
|
self.assertEqual(
|
|
148
148
|
[tuple(i.get_at((5, 5))) for i in s.images],
|
|
149
|
-
[
|
|
149
|
+
[frame_color(c, 1) for c in range(3)],
|
|
150
150
|
)
|
|
151
151
|
|
|
152
152
|
def test_defaults_to_every_frame_in_the_top_row(self):
|
|
153
153
|
s = Sprite("walk", 16, 16)
|
|
154
154
|
self.assertEqual(
|
|
155
155
|
[tuple(i.get_at((5, 5))) for i in s.images],
|
|
156
|
-
[
|
|
156
|
+
[frame_color(c, 0) for c in range(4)],
|
|
157
157
|
)
|
|
158
158
|
|
|
159
159
|
def test_transparent_color_applies_to_every_frame(self):
|
|
160
160
|
s = self.make_sprite(transparent_color=-1)
|
|
161
161
|
for img in s.images:
|
|
162
|
-
self.assertEqual(
|
|
162
|
+
self.assertEqual(drawn_color(img, (0, 0)), (0, 0, 0))
|
|
163
163
|
|
|
164
164
|
def test_list_of_image_names(self):
|
|
165
165
|
"""A Sprite can be made from separate images in the images folder."""
|
|
@@ -188,7 +188,7 @@ class SpriteTest(SpriteTestBase):
|
|
|
188
188
|
s = self.make_sprite(frames=6)
|
|
189
189
|
self.assertEqual(
|
|
190
190
|
[tuple(i.get_at((5, 5))) for i in s.images],
|
|
191
|
-
[
|
|
191
|
+
[frame_color(c, 0) for c in range(4)] + [frame_color(c, 1) for c in range(2)],
|
|
192
192
|
)
|
|
193
193
|
|
|
194
194
|
def test_too_many_frames(self):
|
|
@@ -214,7 +214,7 @@ class SpriteTest(SpriteTestBase):
|
|
|
214
214
|
"""Leaving out frames skips empty padding at the end of the row."""
|
|
215
215
|
s = Sprite("padded", 8, 8, row=1)
|
|
216
216
|
self.assertEqual([tuple(i.get_at((5, 5))) for i in s.images],
|
|
217
|
-
[
|
|
217
|
+
[frame_color(0, 1), frame_color(1, 1)])
|
|
218
218
|
|
|
219
219
|
def test_empty_frames_in_the_middle_are_kept(self):
|
|
220
220
|
s = Sprite("padded", 8, 8, row=0)
|
|
@@ -227,7 +227,7 @@ class SpriteTest(SpriteTestBase):
|
|
|
227
227
|
self.assertEqual(len(s.images), 4)
|
|
228
228
|
|
|
229
229
|
def test_row_with_no_visible_frames(self):
|
|
230
|
-
# The frames are solid
|
|
230
|
+
# The frames are solid colors, so making each frame's own color
|
|
231
231
|
# see-through leaves the whole row empty.
|
|
232
232
|
with self.assertRaisesRegex(ValueError, "Row 1 of the sprite sheet 'padded' has no visible frames"):
|
|
233
233
|
Sprite("padded", 8, 8, row=1, transparent_color=-1)
|
|
@@ -35,7 +35,7 @@ from pgzero.tilemaps import (
|
|
|
35
35
|
WHITE = (255, 255, 255, 255)
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
def
|
|
38
|
+
def tile_color(col, row):
|
|
39
39
|
return (col * 100, row * 200, 77, 255)
|
|
40
40
|
|
|
41
41
|
|
|
@@ -308,7 +308,7 @@ class LoadTileMapActorsTest(TilemapTestBase):
|
|
|
308
308
|
|
|
309
309
|
def test_tile_pixels(self):
|
|
310
310
|
t = self.by_cell()[2, 0]
|
|
311
|
-
self.assertEqual(tuple(t._orig_surf.get_at((8, 8))),
|
|
311
|
+
self.assertEqual(tuple(t._orig_surf.get_at((8, 8))), tile_color(2, 1))
|
|
312
312
|
self.assertEqual(tuple(t._orig_surf.get_at((0, 0))), WHITE)
|
|
313
313
|
|
|
314
314
|
def test_margin_and_spacing_respected(self):
|
|
@@ -431,7 +431,7 @@ class TileTest(TilemapTestBase):
|
|
|
431
431
|
self.assertEqual(t.tile_id, 5)
|
|
432
432
|
self.assertEqual(t.tile_gid, 6)
|
|
433
433
|
self.assertEqual(tuple(t._orig_surf.get_at((8, 8))),
|
|
434
|
-
|
|
434
|
+
tile_color(2, 1))
|
|
435
435
|
self.assertEqual(t.topleft, (0, 0))
|
|
436
436
|
|
|
437
437
|
def test_set_tile_image_invalid_leaves_tile_unchanged(self):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|