Module: Graphics

Defined in:
lib/rgss3/graphics.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.brightnessObject

Returns the value of attribute brightness.



7
8
9
# File 'lib/rgss3/graphics.rb', line 7

def brightness
  @brightness
end

.frame_countObject

Returns the value of attribute frame_count.



6
7
8
# File 'lib/rgss3/graphics.rb', line 6

def frame_count
  @frame_count
end

.frame_rateObject

Returns the value of attribute frame_rate.



7
8
9
# File 'lib/rgss3/graphics.rb', line 7

def frame_rate
  @frame_rate
end

.needs_redrawObject (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

.drawObject



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_resetObject



53
54
55
# File 'lib/rgss3/graphics.rb', line 53

def self.frame_reset
  Fiber.yield
end

.freezeObject



40
41
42
# File 'lib/rgss3/graphics.rb', line 40

def self.freeze
  @frozen = true
end

.gosu_windowObject



69
70
71
# File 'lib/rgss3/graphics.rb', line 69

def self.gosu_window
  RGSS3.window
end

.heightObject



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_bitmapObject



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

.updateObject



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

.widthObject



57
58
59
# File 'lib/rgss3/graphics.rb', line 57

def self.width
  RGSS3.window.width
end