pymasep.interface.cut_scene_interface_state
Classes
Interface state to handle a cut scene with video |
Module Contents
- class pymasep.interface.cut_scene_interface_state.CutSceneInterfaceState(sub_application, video_path, audio_path, scene_name)
Bases:
pymasep.interface.interface_state.InterfaceStateInterface state to handle a cut scene with video
EXPERIMENTAL: because of performance issues, caused by cv2 random access video, only small video (small resolution and/or old format) are fully supported Otherwise, the video will be displayed, but the user event would be delayed/not handled during video playing. Wait for the pygame sdl video support.
Helped from https://www.reddit.com/r/pygame/comments/12kl1m6/playing_video_and_sound_simultaneously/# and https://forum.opencv.org/t/cap-set-cv2-cap-prop-pos-msec-changes-to-unreachable-timestamp/6561. Thanks!
- Parameters:
sub_application (pymasep.interface.Interface) – the interface to display the video on
video_path (str) – the path to the video file
audio_path (str) – the path to the audio file
scene_name (str)
- Scene_name:
the name of the game phase when the video is played
- video_path
the path to the video file
- audio_path
the path to the audio file
- scene_name
the name of the game phase when the video is played
- video = None
the video object
- ended = False
the video has finished
- current_ts = 0
current timestamp of the video
- image = None
image used to display the video
- init()
Initialisation of the state
- Return type:
None
- clean()
The state is destroyed. Clean all elements of the state (including ui_container)
- Return type:
None
- handle_event(event)
Handle events to close the cut scene :param event: the event
- Return type:
None
- render(time_delta)
Render the cut scene
- Parameters:
time_delta – The time delta since the last call
- Return type:
None
- update()
The update phase of the state. For interface, it corresponds to choose action, send action and receive observation.
- Return type:
None