Skip to content

Artist Redraw and Clear #51

@Brian-Jiang

Description

@Brian-Jiang

Here are some properties and methods of an artist to control the rendering:

  • is_visible: if this is false, the artist is not visible on the screen. Internally, the updating should also stopped.
  • is_updating: if this is true, the artist's drawing will update every frame; otherwise, it will remain static in the world, meaning the position/size will not changing
  • update_drawing: only needs to call this method when is_updating is False, this will update the drawing of the artist
  • clear: only needs to call this method when is_updating is False, this will clear the drawing of the artist
class IArtist(ABC):
    @abstractmethod
    def set_visible(self, visible: bool) -> None:
        """
        Set the visibility of the artist.

        Args:
            visible (bool): The visibility state to set.
        """
        pass

    @abstractmethod
    def get_visible(self) -> bool:
        """
        Get the visibility of the artist.

        Returns:
            bool: The current visibility state of the artist.
        """
        pass

    @abstractmethod
    def get_is_updating(self) -> bool:
        """
        Get whether the artist is updating the drawing every frame.

        Returns:
            bool: True if the artist is updating the drawing every frame, False otherwise.
        """
        pass

    @abstractmethod
    def set_is_updating(self, is_updating: bool) -> None:
        """
        Set whether the artist is updating the drawing every frame.

        Args:
            is_updating(bool): The is_updating state to set.
        """
        pass

    @abstractmethod
    def update_drawing(self) -> None:
        """
        Update the drawing of the artist immediately. Should only call this method when the artist is not updating.
        """
        pass

    @abstractmethod
    def clear(self) -> None:
        """
        Clear the artist drawing immediately. Should only call this method when the artist is not updating.
        """
        pass

    # ...other artist APIs

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions