Module: Graphics

Includes:
FPSAndMouse, GraphicsFPSBalancer, Touch, TouchViewport
Defined in:
docs/0_Dependencies.rb,
docs/0_Dependencies.rb,
docs/0_Dependencies.rb

Overview

Module responsive of showing graphics into the main window

Defined Under Namespace

Modules: FPSAndMouse, GraphicsFPSBalancer, Touch, TouchViewport Classes: FPSBalancer

Constant Summary collapse

TRANSITION_FRAG_SHADER =

Shader used to perform transition

"uniform float param;\nuniform sampler2D texture;\nuniform sampler2D transition;\nuniform sampler2D nextFrame;\nconst float sensibilite = 0.05;\nconst float scale = 1.0 + sensibilite;\nvoid main()\n{\n  vec4 frag = texture2D(texture, gl_TexCoord[0].xy);\n  vec4 tran = texture2D(transition, gl_TexCoord[0].xy);\n  float pixel = max(max(tran.r, tran.g), tran.b);\n  pixel -= (param * scale);\n  if(pixel < sensibilite)\n  {\n    vec4 nextFrag = texture2D(nextFrame, gl_TexCoord[0].xy);\n    frag = mix(frag, nextFrag, max(0.0, sensibilite + pixel / sensibilite));\n  }\n  gl_FragColor = frag;\n}\n"
STATIC_TRANSITION_FRAG_SHADER =

Shader used to perform static transition

"uniform float param;\nuniform sampler2D texture;\nuniform sampler2D nextFrame;\nvoid main()\n{\n  vec4 frag = texture2D(texture, gl_TexCoord[0].xy);\n  vec4 nextFrag = texture2D(nextFrame, gl_TexCoord[0].xy);\n  frag = mix(frag, nextFrag, max(0.0, param));\n  gl_FragColor = frag;\n}\n"

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from FPSAndMouse

#frame_reset, #init_sprite, #post_update_internal, #pre_update_internal, #reset_mouse_viewport, #transition, #update_freeze, #update_transition_internal

Methods included from GraphicsFPSBalancer

#transition, #update

Methods included from Touch

#init_sprite, #pre_update_internal

Methods included from TouchViewport

#init_sprite, #post_update_internal

Class Attribute Details

.current_time ⇒ Time (readonly)

Get the current time

Returns:

  • (Time)


669
670
671
# File 'docs/0_Dependencies.rb', line 669

def current_time
  @current_time
end

.frame_count ⇒ Integer

Get the global frame count

Returns:

  • (Integer)


663
664
665
# File 'docs/0_Dependencies.rb', line 663

def frame_count
  @frame_count
end

.frame_rate ⇒ Integer

Get the framerate

Returns:

  • (Integer)


666
667
668
# File 'docs/0_Dependencies.rb', line 666

def frame_rate
  @frame_rate
end

.fullscreen_toggle_enabled

Tell if it is allowed to go fullscreen with ALT+ENTER



674
675
676
# File 'docs/0_Dependencies.rb', line 674

def fullscreen_toggle_enabled
  @fullscreen_toggle_enabled
end

.last_time ⇒ Time (readonly)

Get the time when the last frame was executed

Returns:

  • (Time)


672
673
674
# File 'docs/0_Dependencies.rb', line 672

def last_time
  @last_time
end

.window ⇒ LiteRGSS::DisplayWindow (readonly)

Get the game window



660
661
662
# File 'docs/0_Dependencies.rb', line 660

def window
  @window
end

Class Method Details

.brightness ⇒ Integer

Get the brightness of the main game window

Returns:

  • (Integer)


689
690
# File 'docs/0_Dependencies.rb', line 689

def brightness
end

.brightness=(brightness)

Set the brightness of the main game window

Parameters:

  • brightness (Integer)


693
694
# File 'docs/0_Dependencies.rb', line 693

def brightness=(brightness)
end

.delta ⇒ Float

Tell how much time there was since last frame

Returns:

  • (Float)


685
686
# File 'docs/0_Dependencies.rb', line 685

def delta
end

.focus? ⇒ Boolean

Tell if the graphics window has focus

Returns:

  • (Boolean)


677
678
# File 'docs/0_Dependencies.rb', line 677

def focus?
end

.frame_reset

Reset frame counter (for FPS reason)



774
775
# File 'docs/0_Dependencies.rb', line 774

def frame_reset
end

.freeze

Freeze the graphics



712
713
# File 'docs/0_Dependencies.rb', line 712

def freeze
end

.frozen? ⇒ Boolean

Tell if the graphics are frozen

Returns:

  • (Boolean)


681
682
# File 'docs/0_Dependencies.rb', line 681

def frozen?
end

.height ⇒ Integer

Get the height of the graphics

Returns:

  • (Integer)


697
698
# File 'docs/0_Dependencies.rb', line 697

def height
end

.init_sprite

Init the Sprite used by the Graphics module



777
778
# File 'docs/0_Dependencies.rb', line 777

def init_sprite
end

.load_icon

Load the window icon



883
884
# File 'docs/0_Dependencies.rb', line 883

def load_icon
end

.on_start(&block)

Register an event on start of graphics

Parameters:

  • block (Proc)


761
762
# File 'docs/0_Dependencies.rb', line 761

def on_start(&block)
end

.original_swap_fullscreen

Swap the fullscreen state



885
886
# File 'docs/0_Dependencies.rb', line 885

def swap_fullscreen
end

.player_view_screenshot(filename, scale)

Take a screenshot of what's currently displayed on the player's screen and save it as a png file

Parameters:

  • filename (String) —

    the filename of the png file (will automatically increment if filename contains '%d')

  • scale (Integer) —

    the scale of the final screenshot (between 1 and 3, this helps to multiply 320*240 by a factor)



726
727
# File 'docs/0_Dependencies.rb', line 726

def player_view_screenshot(filename, scale)
end

.post_update_internal

Execute everything that happens after internal update proceeds



746
747
# File 'docs/0_Dependencies.rb', line 746

def post_update_internal
end

.pre_update_internal

Execute everything that happens before internal update proceeds



743
744
# File 'docs/0_Dependencies.rb', line 743

def pre_update_internal
end

.register_viewport(viewport) ⇒ self

Register a viewport to the graphics (for special handling)

Parameters:

Returns:

  • (self)


766
767
# File 'docs/0_Dependencies.rb', line 766

def register_viewport(viewport)
end

.resize_screen(width, height)

Resize the window screen

Parameters:

  • width (Integer)
  • height (Integer)


717
718
# File 'docs/0_Dependencies.rb', line 717

def resize_screen(width, height)
end

.screen_scale=(scale)

Set the screen scale factor

Parameters:

  • scale (Float) —

    scale of the screen



787
788
# File 'docs/0_Dependencies.rb', line 787

def screen_scale=(scale)
end

.shader ⇒ Shader

Get the shader of the graphics

Returns:



705
706
# File 'docs/0_Dependencies.rb', line 705

def shader
end

.shader=(shader)

Set the shader of the graphics

Parameters:



709
710
# File 'docs/0_Dependencies.rb', line 709

def shader=(shader)
end

.snap_to_bitmap ⇒ LiteRGSS::Bitmap

Snap the graphics to bitmap

Returns:



721
722
# File 'docs/0_Dependencies.rb', line 721

def snap_to_bitmap
end

.sort_z

Sort the graphics in z



780
781
# File 'docs/0_Dependencies.rb', line 780

def sort_z
end

.start

Start the graphics



729
730
# File 'docs/0_Dependencies.rb', line 729

def start
end

.stop

Stop the graphics



732
733
# File 'docs/0_Dependencies.rb', line 732

def stop
end

.swap_fullscreen

Define swap_fullscreen so the icon is taken in account



783
784
# File 'docs/0_Dependencies.rb', line 783

def swap_fullscreen
end

.transition(frame_count_or_sec = 8, texture = nil)

Transition the graphics between a scene to another

Parameters:

  • frame_count_or_sec (Integer, Float) (defaults to: 8) —

    integer = frames, float = seconds; duration of the transition

  • texture (Texture) (defaults to: nil) —

    texture used to perform the transition (optional)



737
738
# File 'docs/0_Dependencies.rb', line 737

def transition(frame_count_or_sec = 8, texture = nil)
end

.unregitser_viewport(viewport) ⇒ self

Unregister a viewport

Parameters:

Returns:

  • (self)


771
772
# File 'docs/0_Dependencies.rb', line 771

def unregitser_viewport(viewport)
end

.update

Update graphics window content & events. This method might wait for vsync before updating events



740
741
# File 'docs/0_Dependencies.rb', line 740

def update
end

.update_no_input

Update the graphics window content. This method might wait for vsync before returning



749
750
# File 'docs/0_Dependencies.rb', line 749

def update_no_input
end

.update_only_input

Update the graphics window event without drawing anything.



752
753
# File 'docs/0_Dependencies.rb', line 752

def update_only_input
end

.wait(frame_count_or_sec) { ... }

Make the graphics wait for an amout of time

Parameters:

  • frame_count_or_sec (Integer, Float) —

    Integer => frames, Float = actual time

Yields:



757
758
# File 'docs/0_Dependencies.rb', line 757

def wait(frame_count_or_sec)
end

.width ⇒ Integer

Get the width of the graphics

Returns:

  • (Integer)


701
702
# File 'docs/0_Dependencies.rb', line 701

def width
end