Module: Graphics
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
-
.current_time ⇒ Time
readonly
Get the current time.
-
.frame_count ⇒ Integer
Get the global frame count.
-
.frame_rate ⇒ Integer
Get the framerate.
-
.fullscreen_toggle_enabled
Tell if it is allowed to go fullscreen with ALT+ENTER.
-
.last_time ⇒ Time
readonly
Get the time when the last frame was executed.
-
.window ⇒ LiteRGSS::DisplayWindow
readonly
Get the game window.
Class Method Summary collapse
-
.brightness ⇒ Integer
Get the brightness of the main game window.
-
.brightness=(brightness)
Set the brightness of the main game window.
-
.delta ⇒ Float
Tell how much time there was since last frame.
-
.focus? ⇒ Boolean
Tell if the graphics window has focus.
-
.frame_reset
Reset frame counter (for FPS reason).
-
.freeze
Freeze the graphics.
-
.frozen? ⇒ Boolean
Tell if the graphics are frozen.
-
.height ⇒ Integer
Get the height of the graphics.
-
.init_sprite
Init the Sprite used by the Graphics module.
-
.load_icon
Load the window icon.
-
.on_start(&block)
Register an event on start of graphics.
-
.original_swap_fullscreen
Swap the fullscreen state.
-
.original_update
Update graphics window content & events.
-
.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.
-
.register_viewport(viewport) ⇒ self
Register a viewport to the graphics (for special handling).
-
.reset_mouse_viewport
Function that resets the mouse viewport.
-
.resize_screen(width, height)
Resize the window screen.
-
.screen_scale=(scale)
Set the screen scale factor.
-
.shader ⇒ Shader
Get the shader of the graphics.
-
.shader=(shader)
Set the shader of the graphics.
-
.snap_to_bitmap ⇒ LiteRGSS::Bitmap
Snap the graphics to bitmap.
-
.sort_z
Sort the graphics in z.
-
.start
Start the graphics.
-
.stop
Stop the graphics.
-
.swap_fullscreen
Define swap_fullscreen so the icon is taken in account.
-
.transition(frame_count_or_sec = 8, texture = nil)
Transition the graphics between a scene to another.
-
.unregitser_viewport(viewport) ⇒ self
Unregister a viewport.
-
.update
Update with fps balancing.
-
.update_no_input
Update the graphics window content.
-
.update_only_input
Update the graphics window event without drawing anything.
-
.wait(frame_count_or_sec) { ... }
Make the graphics wait for an amout of time.
-
.width ⇒ Integer
Get the width of the graphics.
Methods included from Hooks
exec_hooks, force_return, included, register, remove, remove_without_name
Class Attribute Details
.current_time ⇒ Time (readonly)
Get the current time
654 655 656 |
# File 'docs/0_Dependencies.rb', line 654 def current_time @current_time end |
.frame_count ⇒ Integer
Get the global frame count
648 649 650 |
# File 'docs/0_Dependencies.rb', line 648 def frame_count @frame_count end |
.frame_rate ⇒ Integer
Get the framerate
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_time ⇒ Time (readonly)
Get the time when the last frame was executed
657 658 659 |
# File 'docs/0_Dependencies.rb', line 657 def last_time @last_time end |
.window ⇒ LiteRGSS::DisplayWindow (readonly)
Get the game window
645 646 647 |
# File 'docs/0_Dependencies.rb', line 645 def window @window end |
Class Method Details
.brightness ⇒ Integer
Get the brightness of the main game window
674 675 |
# File 'docs/0_Dependencies.rb', line 674 def brightness end |
.brightness=(brightness)
Set the brightness of the main game window
678 679 |
# File 'docs/0_Dependencies.rb', line 678 def brightness=(brightness) end |
.delta ⇒ Float
Tell how much time there was since last frame
670 671 |
# File 'docs/0_Dependencies.rb', line 670 def delta end |
.focus? ⇒ Boolean
Tell if the graphics window has focus
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
666 667 |
# File 'docs/0_Dependencies.rb', line 666 def frozen? end |
.height ⇒ Integer
Get the height of the graphics
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
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
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)
745 746 |
# File 'docs/0_Dependencies.rb', line 745 def () end |
.reset_mouse_viewport
Function that resets the mouse viewport
788 789 |
# File 'docs/0_Dependencies.rb', line 788 def end |
.resize_screen(width, height)
Resize the window screen
702 703 |
# File 'docs/0_Dependencies.rb', line 702 def resize_screen(width, height) end |
.screen_scale=(scale)
Set the screen scale factor
766 767 |
# File 'docs/0_Dependencies.rb', line 766 def screen_scale=(scale) end |
.shader ⇒ Shader
Get the shader of the graphics
690 691 |
# File 'docs/0_Dependencies.rb', line 690 def shader end |
.shader=(shader)
Set the shader of the graphics
694 695 |
# File 'docs/0_Dependencies.rb', line 694 def shader=(shader) end |
.snap_to_bitmap ⇒ LiteRGSS::Bitmap
Snap the graphics to bitmap
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
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
750 751 |
# File 'docs/0_Dependencies.rb', line 750 def () 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
736 737 |
# File 'docs/0_Dependencies.rb', line 736 def wait(frame_count_or_sec) end |
.width ⇒ Integer
Get the width of the graphics
686 687 |
# File 'docs/0_Dependencies.rb', line 686 def width end |