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

Remove DoNotRender. #477

Merged
merged 2 commits into from
May 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ppb/features/loadingscene.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ProgressBarLoadingScene(BaseLoadingScene):
#: Image to use for sprites in the "loaded" state (left side)
loaded_image: "ppb.Image"
#: Image to use for sprites in the "unloaded" state (right side)
unloaded_image: "ppb.Image" = ppb.flags.DoNotRender
unloaded_image: "ppb.Image" = None

def update_progress(self, progress):
"""
Expand Down
8 changes: 1 addition & 7 deletions ppb/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MyFlag(MyFlagType):
"This is a flag to indicate a thing."
"""

__all__ = 'Flag', 'DoNotRender'
__all__ = 'Flag',


class FlagMeta(type):
Expand Down Expand Up @@ -52,12 +52,6 @@ class Flag(metaclass=FlagMeta, abstract=True):
"""


class DoNotRender(Flag):
"""
Inform the renderer to ignore this object.
"""


class BlendMode(Flag, abstract=True):
"""
A flag indicating a blend mode, changing how translucent sprites are drawn
Expand Down
4 changes: 2 additions & 2 deletions ppb/sprites.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class RenderableMixin:
:mod:`ppb.assets`.
"""
#: (:py:class:`ppb.Image`): The image asset
image = None # TODO: Type hint appropriately
image = ... # TODO: Type hint appropriately
size = 1
blend_mode: 'ppb.flags.BlendMode' # One of four blending modes
opacity: int # An opacity value from 0-255
Expand All @@ -117,7 +117,7 @@ def __image__(self):
Returns the sprite's image attribute if provided, or sets a default
one.
"""
if self.image is None:
if self.image is ...:
klass = type(self)
prefix = Path(klass.__module__.replace('.', '/'))
try:
Expand Down
2 changes: 1 addition & 1 deletion ppb/systems/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def prepare_resource(self, game_object):
return

image = game_object.__image__()
if image is flags.DoNotRender or image is None:
if image is None:
return None

surface = image.load()
Expand Down