Module: Graphics

Extended by:
Hooks
Includes:
Hooks
Defined in:
docs/0_Dependencies.rb

Overview

Module responsive of showing graphics into the main window

Defined Under Namespace

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 Hooks

exec_hooks, force_return, included, register, remove, remove_without_name

Class Attribute Details

.current_timeTime (readonly)

Get the current time

Returns:

  • (Time)


654
655
656
# File 'docs/0_Dependencies.rb', line 654

def current_time
  @current_time
end

.frame_countInteger

Get the global frame count

Returns:

  • (Integer)


648
649
650
# File 'docs/0_Dependencies.rb', line 648

def frame_count
  @frame_count
end

.frame_rateInteger

Get the framerate

Returns:

  • (Integer)


651
652
653
# File 'docs/0_Dependencies.rb', line 651

def frame_rate
  @frame_rate
end

.fullscreen_toggle_enabled

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



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

def fullscreen_toggle_enabled
  @fullscreen_toggle_enabled
end

.last_timeTime (readonly)

Get the time when the last frame was executed

Returns:

  • (Time)


657
658
659
# File 'docs/0_Dependencies.rb', line 657

def last_time
  @last_time
end

.windowLiteRGSS::DisplayWindow (readonly)

Get the game window



645
646
647
# File 'docs/0_Dependencies.rb', line 645

def window
  @window
end

Class Method Details

.brightnessInteger

Get the brightness of the main game window

Returns:

  • (Integer)


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

def brightness
end

.brightness=(brightness)

Set the brightness of the main game window

Parameters:

  • brightness (Integer)


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

def brightness=(brightness)
end

.deltaFloat

Tell how much time there was since last frame

Returns:

  • (Float)


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

def delta
end

.focus?Boolean

Tell if the graphics window has focus

Returns:

  • (Boolean)


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

def focus?
end

.frame_reset

Reset frame counter (for FPS reason)



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

def frame_reset
end

.freeze

Freeze the graphics



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

def freeze
end

.frozen?Boolean

Tell if the graphics are frozen

Returns:

  • (Boolean)


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

def frozen?
end

.heightInteger

Get the height of the graphics

Returns:

  • (Integer)


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

def height
end

.init_sprite

Init the Sprite used by the Graphics module



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

def init_sprite
end

.load_icon

Load the window icon



834
835
# File 'docs/0_Dependencies.rb', line 834

def load_icon
end

.on_start(&block)

Register an event on start of graphics

Parameters:

  • block (Proc)


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

def on_start(&block)
end

.original_swap_fullscreen

Swap the fullscreen state



836
837
# File 'docs/0_Dependencies.rb', line 836

def swap_fullscreen
end

.original_update

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



887
888
# File 'docs/0_Dependencies.rb', line 887

def update
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)



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

def player_view_screenshot(filename, scale)
end

.register_viewport(viewport) ⇒ self

Register a viewport to the graphics (for special handling)

Parameters:

Returns:

  • (self)


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

def register_viewport(viewport)
end

.reset_mouse_viewport

Function that resets the mouse viewport



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

def reset_mouse_viewport
end

.resize_screen(width, height)

Resize the window screen

Parameters:

  • width (Integer)
  • height (Integer)


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

def resize_screen(width, height)
end

.screen_scale=(scale)

Set the screen scale factor

Parameters:

  • scale (Float)

    scale of the screen



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

def screen_scale=(scale)
end

.shaderShader

Get the shader of the graphics

Returns:



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

def shader
end

.shader=(shader)

Set the shader of the graphics

Parameters:



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

def shader=(shader)
end

.snap_to_bitmapLiteRGSS::Bitmap

Snap the graphics to bitmap

Returns:



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

def snap_to_bitmap
end

.sort_z

Sort the graphics in z



759
760
# File 'docs/0_Dependencies.rb', line 759

def sort_z
end

.start

Start the graphics



714
715
# File 'docs/0_Dependencies.rb', line 714

def start
end

.stop

Stop the graphics



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

def stop
end

.swap_fullscreen

Define swap_fullscreen so the icon is taken in account



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

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)



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

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

.unregitser_viewport(viewport) ⇒ self

Unregister a viewport

Parameters:

Returns:

  • (self)


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

def unregitser_viewport(viewport)
end

.update

Update with fps balancing



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

def update
end

.update_no_input

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



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

def update_no_input
end

.update_only_input

Update the graphics window event without drawing anything.



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

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:



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

def wait(frame_count_or_sec)
end

.widthInteger

Get the width of the graphics

Returns:

  • (Integer)


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

def width
end