Module: Graphics
- Defined in:
- lib/rgss3/graphics.rb
Class Attribute Summary collapse
-
.brightness ⇒ Object
Returns the value of attribute brightness.
-
.frame_count ⇒ Object
Returns the value of attribute frame_count.
-
.frame_rate ⇒ Object
Returns the value of attribute frame_rate.
-
.needs_redraw ⇒ Object
readonly
Returns the value of attribute needs_redraw.
Class Method Summary collapse
- .add_container(container) ⇒ Object
- .draw ⇒ Object
- .fadein(duration) ⇒ Object
- .fadeout(duration) ⇒ Object
- .frame_reset ⇒ Object
- .freeze ⇒ Object
- .gosu_window ⇒ Object
- .height ⇒ Object
- .play_movie(filename) ⇒ Object
- .reform_window(width: RGSS3.window.width, height: RGSS3.window.height, full_screen: RGSS3.window.fullscreen?, frame_rate: @frame_rate, title: RGSS3.window.caption, rtp: nil) ⇒ Object
- .remove_container(container) ⇒ Object
- .resize_screen(width, height) ⇒ Object
- .snap_to_bitmap ⇒ Object
- .transition(duration = 10, filename = "", vague = 40) ⇒ Object
- .update ⇒ Object
- .wait(duration) ⇒ Object
- .width ⇒ Object
Class Attribute Details
.brightness ⇒ Object
Returns the value of attribute brightness.
7 8 9 |
# File 'lib/rgss3/graphics.rb', line 7 def brightness @brightness end |
.frame_count ⇒ Object
Returns the value of attribute frame_count.
6 7 8 |
# File 'lib/rgss3/graphics.rb', line 6 def frame_count @frame_count end |
.frame_rate ⇒ Object
Returns the value of attribute frame_rate.
7 8 9 |
# File 'lib/rgss3/graphics.rb', line 7 def frame_rate @frame_rate end |
.needs_redraw ⇒ Object (readonly)
Returns the value of attribute needs_redraw.
8 9 10 |
# File 'lib/rgss3/graphics.rb', line 8 def needs_redraw @needs_redraw end |
Class Method Details
.add_container(container) ⇒ Object
95 96 97 |
# File 'lib/rgss3/graphics.rb', line 95 def self.add_container(container) @containers.add(container) end |
.draw ⇒ Object
103 104 105 106 107 108 109 110 |
# File 'lib/rgss3/graphics.rb', line 103 def self.draw @needs_redraw = false @containers.each(&:do_draw) if @brightness < 255 c = @draw_color RGSS3.window.draw_quad(0, 0, c, 0, height, c, width, 0, c, width, height, c, 1) end end |
.fadein(duration) ⇒ Object
36 37 38 |
# File 'lib/rgss3/graphics.rb', line 36 def self.fadein(duration) @brightness = 255 end |
.fadeout(duration) ⇒ Object
32 33 34 |
# File 'lib/rgss3/graphics.rb', line 32 def self.fadeout(duration) @brightness = 0 end |
.frame_reset ⇒ Object
53 54 55 |
# File 'lib/rgss3/graphics.rb', line 53 def self.frame_reset Fiber.yield end |
.freeze ⇒ Object
40 41 42 |
# File 'lib/rgss3/graphics.rb', line 40 def self.freeze @frozen = true end |
.gosu_window ⇒ Object
69 70 71 |
# File 'lib/rgss3/graphics.rb', line 69 def self.gosu_window RGSS3.window end |
.height ⇒ Object
61 62 63 |
# File 'lib/rgss3/graphics.rb', line 61 def self.height RGSS3.window.height end |
.play_movie(filename) ⇒ Object
92 93 |
# File 'lib/rgss3/graphics.rb', line 92 def self.play_movie(filename) end |
.reform_window(width: RGSS3.window.width, height: RGSS3.window.height, full_screen: RGSS3.window.fullscreen?, frame_rate: @frame_rate, title: RGSS3.window.caption, rtp: nil) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/rgss3/graphics.rb', line 112 def self.reform_window( width: RGSS3.window.width, height: RGSS3.window.height, full_screen: RGSS3.window.fullscreen?, frame_rate: @frame_rate, title: RGSS3.window.caption, rtp: nil) RGSS3.window.close RGSS3.window = RGSS3::GameWindow.new( width: width, height: height, fullscreen: fullscreen, frame_rate: frame_rate, title: title, rtp: rtp) RGSS3.window.show end |
.remove_container(container) ⇒ Object
99 100 101 |
# File 'lib/rgss3/graphics.rb', line 99 def self.remove_container(container) @containers.delete(container) end |
.resize_screen(width, height) ⇒ Object
65 66 67 |
# File 'lib/rgss3/graphics.rb', line 65 def self.resize_screen(width, height) reform_window(width: width, height: height) end |
.snap_to_bitmap ⇒ Object
49 50 51 |
# File 'lib/rgss3/graphics.rb', line 49 def self.snap_to_bitmap Bitmap.new(width, height) end |
.transition(duration = 10, filename = "", vague = 40) ⇒ Object
44 45 46 47 |
# File 'lib/rgss3/graphics.rb', line 44 def self.transition(duration = 10, filename = "", vague = 40) @frozen = false @brightness = 255 end |
.update ⇒ Object
17 18 19 20 21 |
# File 'lib/rgss3/graphics.rb', line 17 def self.update @needs_redraw = true unless @frozen @frame_count += 1 Fiber.yield end |
.wait(duration) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/rgss3/graphics.rb', line 23 def self.wait(duration) @needs_redraw = true unless @frozen # no need to redraw during wait duration.times do @frame_count += 1 Fiber.yield end end |