display.view_controller documentation - wladekpal/The-Lazy-Snek GitHub Wiki
class ApplicationView
Abstract class representing all application views handled by ViewController() class.
ApplicationView(screen)
All views handled by ApplicationView will be displayed on screen
.
handle_pygame_event(event)
Abstract method. Implementation should handle any pygame event in a way expected from displayed view. Should return None
if current view won't be replaced after handling action. Otherwise, returns two elements tuple: first one is optional new view to display, second is ViewInitAction
type value that indicates how should view replacing be handled by view controller.
refresh()
abstract method. Implementation should update visual content of displayed view.
Class ViewInitAction(enum.Enum)
Enum class representing all possible actions view controller should handle when getting request of changing currently displayed view. Possible values are:
PUSH
- new view to display is pushed to views stack.REPLACE
- new view to display replaces current view on top of views stack.POP
- there's no new view given. Currently displayed view is popped from views stack and new view from stack's top will be displayed instead.EMPTY_STACK
- all views are deleted from views stack and new view to display is pushed to stack after that.
class ViewController
Class for handling all application views displayed by application.
ViewController(screen, initial_view)
All views handled by ViewController will be displayed on screen
with initial_view
to be displayed after running application. Views are pushed to views stack and swapping after handle_pygame_event
method of currently displayed view returns value other than None
.
handle_events()
Processes and properly handles all pygame events queued.
refresh()
Refreshes currently displayed view.