Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp Assets #306

Merged
merged 30 commits into from
Jul 14, 2019
Merged

Revamp Assets #306

merged 30 commits into from
Jul 14, 2019

Conversation

AstraLuma
Copy link
Member

@AstraLuma AstraLuma commented Jul 11, 2019

Totally revamp how PPB handles assets.

Depends on #313 because life was just easier that way.

Part of #147

@AstraLuma AstraLuma requested a review from a team as a code owner July 11, 2019 03:36
@AstraLuma AstraLuma changed the title Revamp Assets [WIP] Revamp Assets Jul 11, 2019
tests/test_sprites.py Outdated Show resolved Hide resolved
if image_name not in self.resources:
self.register_renderable(game_object)
if isinstance(image, str):
logger.warn(f"Using string resources is deprecated, use ppb.Image instead. Got {image!r}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only thing about this is that it's extremely verbose (every frame).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could throw in a tracking variable and only throw it once? (Or once per object?) Would lru_cache wrapped around a print statement make it run once per object passed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, all of those things. It's just annoying, though?

import io


class Image(Asset):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno on adding new things to systems.__init__. If we're making changes to the renderer and adding new things they should move to its own file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was wondering if we wanted to move the renderer to its own module.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's one of the places we deal with pygame, so probably needs to go to systems.pg. (There's even argument for making pg.py into a subpackage of its own, but uh. . . not right now.)

@AstraLuma AstraLuma mentioned this pull request Jul 11, 2019
@AstraLuma
Copy link
Member Author

This still needs tests.

@AstraLuma AstraLuma changed the title [WIP] Revamp Assets Revamp Assets Jul 11, 2019
@AstraLuma
Copy link
Member Author

@pathunstrom I think this is ready for review & merge.

Copy link
Collaborator

@pathunstrom pathunstrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works just fine. We definitely need a "how to" for it, but not going to block the work on that. Going to open that as an issue.

@pathunstrom
Copy link
Collaborator

bors r+

bors bot added a commit that referenced this pull request Jul 14, 2019
306: Revamp Assets r=pathunstrom a=astronouth7303

Totally revamp how PPB handles assets.

Depends on #313 because life was just easier that way.

Part of #147 

Co-authored-by: Jamie Bliss <jamie@ivyleav.es>
@pathunstrom pathunstrom added the bors Someone has bors r+ this PR label Jul 14, 2019
@bors
Copy link
Contributor

bors bot commented Jul 14, 2019

Build succeeded

  • docs
  • Linux python:3.6-slim
  • Linux python:3.7-slim
  • macOS PYTHON:3.6.8
  • macOS PYTHON:3.7.2
  • pep517
  • Windows python:3.6-windowsservercore-1809
  • Windows python:3.7-windowsservercore-1809

@bors bors bot merged commit 1165de7 into ppb:master Jul 14, 2019
@AstraLuma AstraLuma deleted the resources branch July 14, 2019 17:47
bors bot added a commit that referenced this pull request Jul 15, 2019
308: Apply Assets to Animation r=pathunstrom a=astronouth7303

Depends on #306

Part of #147

Co-authored-by: Jamie Bliss <jamie@ivyleav.es>
bors bot added a commit that referenced this pull request Jul 18, 2019
316: Move things, break loops r=pathunstrom a=astronouth7303

Grab a u-haul! 🚚 

Generally moving things and reducing imports to improve the import loop situation

* Break up "the machinery implementing a thing" and "a pile of things that use the thing"
* Prefer module imports to individual imports, so any unavoidable loops don't wreck everything.

Depends on #306 because I didn't feel like dealing with the merge conflict.

No docs changes because this doesn't touch anything publicly documented.

Co-authored-by: Jamie Bliss <jamie@ivyleav.es>
bors bot added a commit that referenced this pull request Jul 18, 2019
316: Move things, break loops r=pathunstrom a=astronouth7303

Grab a u-haul! 🚚 

Generally moving things and reducing imports to improve the import loop situation

* Break up "the machinery implementing a thing" and "a pile of things that use the thing"
* Prefer module imports to individual imports, so any unavoidable loops don't wreck everything.

Depends on #306 because I didn't feel like dealing with the merge conflict.

No docs changes because this doesn't touch anything publicly documented.

Co-authored-by: Jamie Bliss <jamie@ivyleav.es>
bors bot added a commit that referenced this pull request Jul 18, 2019
316: Move things, break loops r=pathunstrom a=astronouth7303

Grab a u-haul! 🚚 

Generally moving things and reducing imports to improve the import loop situation

* Break up "the machinery implementing a thing" and "a pile of things that use the thing"
* Prefer module imports to individual imports, so any unavoidable loops don't wreck everything.

Depends on #306 because I didn't feel like dealing with the merge conflict.

No docs changes because this doesn't touch anything publicly documented.

Co-authored-by: Jamie Bliss <jamie@ivyleav.es>
bors bot added a commit that referenced this pull request Jul 18, 2019
316: Move things, break loops r=pathunstrom a=astronouth7303

Grab a u-haul! 🚚 

Generally moving things and reducing imports to improve the import loop situation

* Break up "the machinery implementing a thing" and "a pile of things that use the thing"
* Prefer module imports to individual imports, so any unavoidable loops don't wreck everything.

Depends on #306 because I didn't feel like dealing with the merge conflict.

No docs changes because this doesn't touch anything publicly documented.

Co-authored-by: Jamie Bliss <jamie@ivyleav.es>
bors bot added a commit that referenced this pull request Jul 19, 2019
316: Move things, break loops r=pathunstrom a=astronouth7303

Grab a u-haul! 🚚 

Generally moving things and reducing imports to improve the import loop situation

* Break up "the machinery implementing a thing" and "a pile of things that use the thing"
* Prefer module imports to individual imports, so any unavoidable loops don't wreck everything.

Depends on #306 because I didn't feel like dealing with the merge conflict.

No docs changes because this doesn't touch anything publicly documented.

Co-authored-by: Jamie Bliss <jamie@ivyleav.es>
bors bot added a commit that referenced this pull request Jul 23, 2019
315: Add AssetLoaded event r=pathunstrom a=astronouth7303

Fire an event when an asset finishes loading and becomes available.

Depends on #306, #316 

328: Manual Testing r=pathunstrom a=astronouth7303

Initial version of manual/visual tests.

Co-authored-by: Jamie Bliss <jamie@ivyleav.es>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bors Someone has bors r+ this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants