Skip to content

Commit

Permalink
give everything wicked cool names
Browse files Browse the repository at this point in the history
  • Loading branch information
kawa-kokosowa committed Aug 9, 2016
1 parent cf15a52 commit 71baa0a
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions demo/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import config
import pygame

from sappho.collisionsprite import CollisionSprite, Collision
from sappho.animatedsprite import AnimatedSprite
from sappho.tilemap import TileMap, Tilesheet, tmx_file_to_tilemaps
from sappho.collide import CollisionSprite, Collision
from sappho.animate import AnimatedSprite
from sappho.tiles import TileMap, Tilesheet, tmx_file_to_tilemaps
from sappho.layers import SurfaceLayers
from sappho.camera import Camera, CameraCenterBehavior

Expand Down
6 changes: 3 additions & 3 deletions sappho/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
if __name__ == "__main__":
__version__ = "0.13.0"
else:
from . import animatedsprite
from . import collisionsprite
from . import tilemap
from . import animate
from . import collide
from . import tiles
from . import layers
from . import camera
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions tests/test_animatedsprite.py → tests/test_animate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pygame

from ..sappho import animatedsprite
from ..sappho import animate
# this isn't very law of demeter...
from .common import compare_surfaces

Expand All @@ -25,7 +25,7 @@ def test_gif_loading(self):
clock = MockClock()

# Create the AnimatedSprite object from the test GIF file
animsprite = animatedsprite.AnimatedSprite.from_gif(path)
animsprite = animate.AnimatedSprite.from_gif(path)

# Test getting the dimensions of the largest frame
assert animsprite.largest_frame_size() == (10, 10)
Expand Down Expand Up @@ -59,8 +59,8 @@ def test_animation(self):
frametwo_surface.fill((0, 255, 0))

# Create frames from these surfaces
frameone = animatedsprite.Frame(frameone_surface, 0, 1000)
frametwo = animatedsprite.Frame(frametwo_surface, 1000, 2000)
frameone = animate.Frame(frameone_surface, 0, 1000)
frametwo = animate.Frame(frametwo_surface, 1000, 2000)

assert (frameone.__repr__()
== "<Frame duration(1000) start_time(0) end_time(1000)>")
Expand All @@ -69,7 +69,7 @@ def test_animation(self):
clock = MockClock()

# Create the AnimatedSprite with our frames
animsprite = animatedsprite.AnimatedSprite([frameone, frametwo])
animsprite = animate.AnimatedSprite([frameone, frametwo])

# Blit the AnimatedSprite (which should give us our first frame)
outputsurface = pygame.surface.Surface((10, 10))
Expand Down
8 changes: 4 additions & 4 deletions tests/test_collisionsprite.py → tests/test_collide.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pygame

from ..sappho import collisionsprite, animatedsprite
from ..sappho import collide, animate


class TestCollisionSprites(object):
Expand All @@ -17,9 +17,9 @@ def test_basic_attributes(self):
"..",
"resources",
"animatedsprite.gif"))
animsprite = animatedsprite.AnimatedSprite.from_gif(path,
mask_threshold=254)
collision_sprite = collisionsprite.CollisionSprite(animsprite)
animsprite = animate.AnimatedSprite.from_gif(path,
mask_threshold=254)
collision_sprite = collide.CollisionSprite(animsprite)

assert collision_sprite.rect.size == (10, 10)
assert hasattr(collision_sprite, 'mask')
Expand Down
28 changes: 14 additions & 14 deletions tests/test_tilemap.py → tests/test_tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class TestTile(object):
def test_tile_instantiation(self):
surface = pygame.surface.Surface((1, 1))
tile = sappho.tilemap.Tile(0, surface)
tile = sappho.tiles.Tile(0, surface)

assert(tile.id_ == 0)
assert(len(tile.flags) == 0)
Expand All @@ -25,10 +25,10 @@ def test_from_file(self):
"resources",
"tilesheet.png"))

tilesheet = sappho.tilemap.Tilesheet.from_file(path, 1, 1)
tilesheet = sappho.tiles.Tilesheet.from_file(path, 1, 1)

# Test that tile rules are loaded correctly
assert(sappho.tilemap.Flags.SOLID in
assert(sappho.tiles.Flags.SOLID in
tilesheet.tiles[0].flags)

def test_subsurface(self):
Expand All @@ -38,7 +38,7 @@ def test_subsurface(self):
"resources",
"tilesheet.png"))

tilesheet = sappho.tilemap.Tilesheet.from_file(path, 1, 1)
tilesheet = sappho.tiles.Tilesheet.from_file(path, 1, 1)

# Grab the tile at (0, 0) and blit it's subsurface to another surface,
# then compare it against a master surface to ensure it's the color we
Expand All @@ -59,13 +59,13 @@ def test_parse_rules(self):
"resources",
"tilesheet.png.rules"))

rules = sappho.tilemap.Tilesheet.parse_rules(path)
rules = sappho.tiles.Tilesheet.parse_rules(path)

assert(rules[0] == set([sappho.tilemap.Flags.SOLID]))
assert(rules[1] == set([sappho.tilemap.Flags.SOLID]))
assert(rules[2] == set([sappho.tilemap.Flags.SOLID]))
assert(rules[3] == set([sappho.tilemap.Flags.SOLID]))
assert(rules[4] == set([sappho.tilemap.Flags.SOLID]))
assert(rules[0] == set([sappho.tiles.Flags.SOLID]))
assert(rules[1] == set([sappho.tiles.Flags.SOLID]))
assert(rules[2] == set([sappho.tiles.Flags.SOLID]))
assert(rules[3] == set([sappho.tiles.Flags.SOLID]))
assert(rules[4] == set([sappho.tiles.Flags.SOLID]))


class TestTilemap(object):
Expand All @@ -83,11 +83,11 @@ def setup(self):
"resources",
"tilesheet.png"))

self.tilesheet = sappho.tilemap.Tilesheet.from_file(path, 1, 1)
self.tilesheet = sappho.tiles.Tilesheet.from_file(path, 1, 1)

def test_from_csv(self):
csv = textwrap.dedent(self.TILEMAP_CSV).strip()
tilemap = (sappho.tilemap.TileMap.
tilemap = (sappho.tiles.TileMap.
from_csv_string_and_tilesheet(csv, self.tilesheet))

# The tile ID 0 is set as a solid block, and this is at (0, 0)
Expand All @@ -102,15 +102,15 @@ def test_from_tmx(self):
"resources",
"tilemap.tmx"))

tilemaps = sappho.tilemap.tmx_file_to_tilemaps(path, self.tilesheet)
tilemaps = sappho.tiles.tmx_file_to_tilemaps(path, self.tilesheet)
tilemap = tilemaps[0]

# Same as the above test, check for the solid block
assert(len(tilemap.collision_group) == 5)

def test_render(self):
csv = textwrap.dedent(self.TILEMAP_CSV).strip()
tilemap = (sappho.tilemap.TileMap.
tilemap = (sappho.tiles.TileMap.
from_csv_string_and_tilesheet(csv, self.tilesheet))

# Create a surface that has 1x2 strips of red, green, and
Expand Down

0 comments on commit 71baa0a

Please sign in to comment.