Class: GamePlay::Movie

Inherits:
BaseCleanUpdate::FrameBalanced show all
Defined in:
scripts/01450 Systems/10000 Movie/00099 Movie.rb

Overview

Scene responsive of playing a movie (video file)

Constant Summary collapse

AUTO_STOP_BGM =

Constant telling if the BGM should automatically be stopped

true
AUTO_HIDE_MAP =

Constant telling if the map scene should automatically be hidden

true

Constants inherited from BaseCleanUpdate

BaseCleanUpdate::AIU_KEY2METHOD

Constants inherited from Base

Base::DEFAULT_TRANSITION, Base::DEFAULT_TRANSITION_PARAMETER

Constants included from Input

Input::ALIAS_KEYS, Input::AXIS_MAPPING, Input::AXIS_SENSITIVITY, Input::DEAD_ZONE, Input::Keyboard, Input::Keys, Input::NON_TRIGGER_ZONE, Input::REPEAT_COOLDOWN, Input::REPEAT_SPACE

Constants included from DisplayMessage

DisplayMessage::MESSAGE_ERROR, DisplayMessage::MESSAGE_PROCESS_ERROR

Instance Attribute Summary

Attributes inherited from Base

#__last_scene, #__result_process, #running, #viewport

Attributes included from DisplayMessage

#message_window

Instance Method Summary collapse

Methods inherited from BaseCleanUpdate::FrameBalanced

#update

Methods included from Graphics::FPSBalancer::Marker

#frame_balanced?

Methods inherited from BaseCleanUpdate

#automatic_input_update, #update

Methods inherited from Base

#add_disposable, #call_scene, #dispose, #find_parent, #main, #return_to_scene, #snap_to_bitmap, #update, #visible, #visible=

Methods included from Input

dir4, dir8, get_text, joy_axis_position, press?, register_events, released?, repeat?, swap_states, trigger?

Methods included from DisplayMessage

#can_display_message_be_called?, #close_message_window, #display_message, #display_message_and_wait, #message_class, #message_processing?, #message_visible, #message_visible=

Constructor Details

#initialize(filename, aliased = false, skip_delay = Float::INFINITY) ⇒ Movie

Create a new Movie scene

Parameters:

  • filename (String)

    name of the file to play

  • aliased (Boolean) (defaults to: false)

    if the scene should use a viewport to ensure the video gets played in native resolution

  • skip_delay (Float) (defaults to: Float::INFINITY)

    number of seconds the player has to wait before being able to skip the video



12
13
14
15
16
17
18
19
20
# File 'scripts/01450 Systems/10000 Movie/00099 Movie.rb', line 12

def initialize(filename, aliased = false, skip_delay = Float::INFINITY)
  super(true)
  auto_require_movie_player
  @video = SFE::Movie.new
  @video.open_from_file(filename)
  @skip_delay = skip_delay
  @aliased = aliased
  @mutex = Mutex.new
end

Instance Method Details

#update_graphics



34
35
36
37
38
39
# File 'scripts/01450 Systems/10000 Movie/00099 Movie.rb', line 34

def update_graphics
  return start_video unless @start_time
  return @running = false unless @video.playing?
  @mutex.synchronize { @video.update_bitmap(@sprite.bitmap) }
  @video_thread.wakeup if @video_thread.status
end

#update_inputs



22
23
24
25
26
27
28
29
30
31
32
# File 'scripts/01450 Systems/10000 Movie/00099 Movie.rb', line 22

def update_inputs
  return false unless @start_time

  dt = Graphics.current_time - @start_time
  if dt > @skip_delay && (Input.trigger?(:A) || Input.trigger?(:B) || Mouse.trigger?(:LEFT))
    @video.stop
    @running = false
  end

  return false
end