Module: Graphics

Extended by:
Hooks
Includes:
Hooks
Defined in:
docs/00000_Dependencies.rb,
docs/00700_Ajout_PSDK.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)


188
189
190
# File 'docs/00000_Dependencies.rb', line 188

def current_time
  @current_time
end

.frame_countInteger

Get the global frame count

Returns:

  • (Integer)


182
183
184
# File 'docs/00000_Dependencies.rb', line 182

def frame_count
  @frame_count
end

.frame_rateInteger

Get the framerate

Returns:

  • (Integer)


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_timeTime (readonly)

Get the time when the last frame was executed

Returns:

  • (Time)


191
192
193
# File 'docs/00000_Dependencies.rb', line 191

def last_time
  @last_time
end

.windowLiteRGSS::DisplayWindow (readonly)

Get the game window



179
180
181
# File 'docs/00000_Dependencies.rb', line 179

def window
  @window
end

Class Method Details

.brightnessInteger

Get the brightness of the main game window

Returns:

  • (Integer)


208
209
# File 'docs/00000_Dependencies.rb', line 208

def brightness
end

.brightness=(brightness)

Set the brightness of the main game window

Parameters:

  • brightness (Integer)


212
213
# File 'docs/00000_Dependencies.rb', line 212

def brightness=(brightness)
end

.deltaFloat

Tell how much time there was since last frame

Returns:

  • (Float)


204
205
# File 'docs/00000_Dependencies.rb', line 204

def delta
end

.focus?Boolean

Tell if the graphics window has focus

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


200
201
# File 'docs/00000_Dependencies.rb', line 200

def frozen?
end

.heightInteger

Get the height of the graphics

Returns:

  • (Integer)


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

Parameters:

  • block (Proc)


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

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)



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)

Parameters:

Returns:

  • (self)


279
280
# File 'docs/00000_Dependencies.rb', line 279

def register_viewport(viewport)
end

.reset_mouse_viewport

Function that resets the mouse viewport



17
18
# File 'docs/00700_Ajout_PSDK.rb', line 17

def reset_mouse_viewport
end

.resize_screen(width, height)

Resize the window screen

Parameters:

  • width (Integer)
  • height (Integer)


236
237
# File 'docs/00000_Dependencies.rb', line 236

def resize_screen(width, height)
end

.screen_scale=(scale)

Set the screen scale factor

Parameters:

  • scale (Float)

    scale of the screen



300
301
# File 'docs/00000_Dependencies.rb', line 300

def screen_scale=(scale)
end

.shaderShader

Get the shader of the graphics

Returns:



224
225
# File 'docs/00000_Dependencies.rb', line 224

def shader
end

.shader=(shader)

Set the shader of the graphics

Parameters:



228
229
# File 'docs/00000_Dependencies.rb', line 228

def shader=(shader)
end

.snap_to_bitmapLiteRGSS::Bitmap

Snap the graphics to bitmap

Returns:



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

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)



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

Parameters:

Returns:

  • (self)


284
285
# File 'docs/00000_Dependencies.rb', line 284

def unregitser_viewport(viewport)
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

Parameters:

  • frame_count_or_sec (Integer, Float)

    Integer => frames, Float = actual time

Yields:



270
271
# File 'docs/00000_Dependencies.rb', line 270

def wait(frame_count_or_sec)
end

.widthInteger

Get the width of the graphics

Returns:

  • (Integer)


220
221
# File 'docs/00000_Dependencies.rb', line 220

def width
end