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
- .original_update
-
.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
Swap the fullscreen state.
-
.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 graphics window content & events.
-
.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
188 189 190 |
# File 'docs/00000_Dependencies.rb', line 188 def current_time @current_time end |
.frame_count ⇒ Integer
Get the global frame count
182 183 184 |
# File 'docs/00000_Dependencies.rb', line 182 def frame_count @frame_count end |
.frame_rate ⇒ Integer
Get the framerate
185 186 187 |
# File 'docs/00000_Dependencies.rb', line 185 def frame_rate @frame_rate end |
.fullscreen_toggle_enabled
Tell if it is allowed to go fullscreen with ALT+ENTER
193 194 195 |
# File 'docs/00000_Dependencies.rb', line 193 def fullscreen_toggle_enabled @fullscreen_toggle_enabled end |
.last_time ⇒ Time (readonly)
Get the time when the last frame was executed
191 192 193 |
# File 'docs/00000_Dependencies.rb', line 191 def last_time @last_time end |
.window ⇒ LiteRGSS::DisplayWindow (readonly)
Get the game window
179 180 181 |
# File 'docs/00000_Dependencies.rb', line 179 def window @window end |
Class Method Details
.brightness ⇒ Integer
Get the brightness of the main game window
208 209 |
# File 'docs/00000_Dependencies.rb', line 208 def brightness end |
.brightness=(brightness)
Set the brightness of the main game window
212 213 |
# File 'docs/00000_Dependencies.rb', line 212 def brightness=(brightness) end |
.delta ⇒ Float
Tell how much time there was since last frame
204 205 |
# File 'docs/00000_Dependencies.rb', line 204 def delta end |
.focus? ⇒ Boolean
Tell if the graphics window has focus
196 197 |
# File 'docs/00000_Dependencies.rb', line 196 def focus? end |
.frame_reset
Reset frame counter (for FPS reason)
287 288 |
# File 'docs/00000_Dependencies.rb', line 287 def frame_reset end |
.freeze
Freeze the graphics
231 232 |
# File 'docs/00000_Dependencies.rb', line 231 def freeze end |
.frozen? ⇒ Boolean
Tell if the graphics are frozen
200 201 |
# File 'docs/00000_Dependencies.rb', line 200 def frozen? end |
.height ⇒ Integer
Get the height of the graphics
216 217 |
# File 'docs/00000_Dependencies.rb', line 216 def height end |
.init_sprite
Init the Sprite used by the Graphics module
290 291 |
# File 'docs/00000_Dependencies.rb', line 290 def init_sprite end |
.load_icon
Load the window icon
63 64 |
# File 'docs/00700_Ajout_PSDK.rb', line 63 def load_icon end |
.on_start(&block)
Register an event on start of graphics
274 275 |
# File 'docs/00000_Dependencies.rb', line 274 def on_start(&block) end |
.original_swap_fullscreen
65 |
# File 'docs/00700_Ajout_PSDK.rb', line 65 alias original_swap_fullscreen swap_fullscreen |
.original_update
116 |
# File 'docs/00700_Ajout_PSDK.rb', line 116 alias original_update update |
.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
245 246 |
# File 'docs/00000_Dependencies.rb', line 245 def player_view_screenshot(filename, scale) end |
.register_viewport(viewport) ⇒ self
Register a viewport to the graphics (for special handling)
279 280 |
# File 'docs/00000_Dependencies.rb', line 279 def () end |
.reset_mouse_viewport
Function that resets the mouse viewport
17 18 |
# File 'docs/00700_Ajout_PSDK.rb', line 17 def end |
.resize_screen(width, height)
Resize the window screen
236 237 |
# File 'docs/00000_Dependencies.rb', line 236 def resize_screen(width, height) end |
.screen_scale=(scale)
Set the screen scale factor
300 301 |
# File 'docs/00000_Dependencies.rb', line 300 def screen_scale=(scale) end |
.shader ⇒ Shader
Get the shader of the graphics
224 225 |
# File 'docs/00000_Dependencies.rb', line 224 def shader end |
.shader=(shader)
Set the shader of the graphics
228 229 |
# File 'docs/00000_Dependencies.rb', line 228 def shader=(shader) end |
.snap_to_bitmap ⇒ LiteRGSS::Bitmap
Snap the graphics to bitmap
240 241 |
# File 'docs/00000_Dependencies.rb', line 240 def snap_to_bitmap end |
.sort_z
Sort the graphics in z
293 294 |
# File 'docs/00000_Dependencies.rb', line 293 def sort_z end |
.start
Start the graphics
248 249 |
# File 'docs/00000_Dependencies.rb', line 248 def start end |
.stop
Stop the graphics
251 252 |
# File 'docs/00000_Dependencies.rb', line 251 def stop end |
.swap_fullscreen
Swap the fullscreen state
67 68 |
# File 'docs/00700_Ajout_PSDK.rb', line 67 def swap_fullscreen end |
.transition(frame_count_or_sec = 8, texture = nil)
Transition the graphics between a scene to another
256 257 |
# File 'docs/00000_Dependencies.rb', line 256 def transition(frame_count_or_sec = 8, texture = nil) end |
.unregitser_viewport(viewport) ⇒ self
Unregister a viewport
284 285 |
# File 'docs/00000_Dependencies.rb', line 284 def () end |
.update
Update graphics window content & events. This method might wait for vsync before updating events
118 119 |
# File 'docs/00700_Ajout_PSDK.rb', line 118 def update end |
.update_no_input
Update the graphics window content. This method might wait for vsync before returning
262 263 |
# File 'docs/00000_Dependencies.rb', line 262 def update_no_input end |
.update_only_input
Update the graphics window event without drawing anything.
265 266 |
# File 'docs/00000_Dependencies.rb', line 265 def update_only_input end |
.wait(frame_count_or_sec) { ... }
Make the graphics wait for an amout of time
270 271 |
# File 'docs/00000_Dependencies.rb', line 270 def wait(frame_count_or_sec) end |
.width ⇒ Integer
Get the width of the graphics
220 221 |
# File 'docs/00000_Dependencies.rb', line 220 def width end |