rgss3 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b5c1106c06327ffdfbb23dd66a62ce472a1be6e
4
- data.tar.gz: 615feaa87d056a45c13a0fef50fb3357ce1cc198
3
+ metadata.gz: 139cb21454b86af111586ecdef898ccf17598221
4
+ data.tar.gz: 8abad362c2b9f1e5ed257f6111aff593dd54c2c0
5
5
  SHA512:
6
- metadata.gz: 309bf1442812626385755d7a0b106f922f1e6711ac48f0edcbd96ebdc777db77edf65f589dc37ea487dc41f4c50ee72630e5101b8befc0304a1806595f3d3741
7
- data.tar.gz: 753682b250cdcf4d8d6344a319bb006f7372ce2e239950e10a08ae483f0a49760a47415997417c640e43bf3406a61d5c64ba2beb1092428703955e75a99b9d8b
6
+ metadata.gz: 48467765ea9118bd6acb7a6cb8ebdc71d349d523963d572a606cbe4535dc364240988f584cb1188a0e5a8afb696a5acdf49b8a50c57f7cf72c79529560d631ff
7
+ data.tar.gz: 290e1826984ae211019d9f268007b372cbc822a0efb7f7918abc86c33392ec4af7013e786eb6316a326ece35988133f2be0989dab888652151f95e7119fd8714
data/README.md CHANGED
@@ -4,7 +4,7 @@ An attempt to maintain https://github.com/CaptainJet/RM-Gosu.
4
4
 
5
5
  NOT READY TO USE!
6
6
 
7
- At least Ruby 2.3 is required.
7
+ Ruby 2.3 or above is required.
8
8
 
9
9
  Depend on:
10
10
  * rmagick
@@ -30,7 +30,8 @@ end
30
30
  Or with more options:
31
31
  ```ruby
32
32
  require 'rgss3'
33
- RGSS3.run(width: 544, height: 416, frame_rate: 60, title: "Game") do
33
+ RGSS3::RTP.path = 'path/to/RTP'
34
+ RGSS3.run(width: 544, height: 416, frame_rate: 60, title: 'Game', rtp: 'path/to/rtp') do
34
35
  # TODO: Add your code here
35
36
  # loop { Graphics.update }
36
37
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "rgss3/version"
2
3
 
3
4
  require 'gosu'
@@ -24,6 +25,7 @@ require_relative 'rgss3/tilemap'
24
25
  require_relative 'rgss3/tone'
25
26
  require_relative 'rgss3/viewport'
26
27
  require_relative 'rgss3/window'
28
+ require_relative 'rgss3/rtp'
27
29
 
28
30
  module RGSS3
29
31
  class << self
@@ -1,21 +1,20 @@
1
+ # frozen_string_literal: true
1
2
  module Audio
2
3
 
3
- module_function
4
-
5
- def setup_midi
4
+ def self.setup_midi
6
5
  end
7
6
 
8
- def bgm_play(filename, volume = 100, pitch = 100, pos = 0)
7
+ def self.bgm_play(filename, volume = 100, pitch = 100, pos = 0)
9
8
  bgm_stop
10
- @bgm = Gosu::Sample.new(filename).play(volume / 100.0, pitch / 100.0, true)
9
+ @bgm = new_sample(filename).play(volume / 100.0, pitch / 100.0, true)
11
10
  @bgm_volume = volume / 100.0
12
11
  end
13
12
 
14
- def bgm_stop
13
+ def self.bgm_stop
15
14
  @bgm.stop if @bgm
16
15
  end
17
16
 
18
- def bgm_fade(time)
17
+ def self.bgm_fade(time)
19
18
  bgm_stop
20
19
  # return unless @bgm
21
20
  # Thread.new {
@@ -29,21 +28,21 @@ module Audio
29
28
  # }
30
29
  end
31
30
 
32
- def bgm_pos
31
+ def self.bgm_pos
33
32
  0 # Incapable of integration at the time
34
33
  end
35
34
 
36
- def bgs_play(filename, volume = 100, pitch = 100, pos = 0)
35
+ def self.bgs_play(filename, volume = 100, pitch = 100, pos = 0)
37
36
  bgs_stop
38
- @bgs = Gosu::Sample.new(filename).play(volume / 100.0, pitch / 100.0, true)
37
+ @bgs = new_sample.play(volume / 100.0, pitch / 100.0, true)
39
38
  @bgs_volume = volume / 100.0
40
39
  end
41
40
 
42
- def bgs_stop
41
+ def self.bgs_stop
43
42
  @bgs.stop if @bgs
44
43
  end
45
44
 
46
- def bgs_fade(time)
45
+ def self.bgs_fade(time)
47
46
  bgs_stop
48
47
  # return unless @bgs
49
48
  # Thread.new {
@@ -57,23 +56,23 @@ module Audio
57
56
  # }
58
57
  end
59
58
 
60
- def bgs_pos
59
+ def self.bgs_pos
61
60
  0 # Incapable of integration at the time
62
61
  end
63
62
 
64
- def me_play(filename, volume = 100, pitch = 100)
63
+ def self.me_play(filename, volume = 100, pitch = 100)
65
64
  me_stop
66
65
  @bgm.pause if @bgm
67
- @me = Gosu::Sample.new(filename).play(volume / 100.0, pitch / 100.0, false)
66
+ @me = new_sample.play(volume / 100.0, pitch / 100.0, false)
68
67
  @me_volume = volume / 100.0
69
68
  end
70
69
 
71
- def me_stop
70
+ def self.me_stop
72
71
  @me.stop if @me
73
72
  @bgm.resume if @bgm && @bgm.paused?
74
73
  end
75
74
 
76
- def me_fade(time)
75
+ def self.me_fade(time)
77
76
  me_stop
78
77
  # return unless @me
79
78
  # Thread.new {
@@ -87,10 +86,17 @@ module Audio
87
86
  # }
88
87
  end
89
88
 
90
- def se_play(filename, volume = 100, pitch = 100)
91
- Gosu::Sample.new(filename).play(volume / 100.0, pitch / 100.0, false)
89
+ def self.se_play(filename, volume = 100, pitch = 100)
90
+ new_sample(filename).play(volume / 100.0, pitch / 100.0, false)
91
+ end
92
+
93
+ def self.se_stop
92
94
  end
93
95
 
94
- def se_stop
96
+ private
97
+
98
+ def self.new_sample(filename)
99
+ filename = RGSS3::RTP.find!(filename, ['', '.ogg', '.wav', '.mp3', '.midi'])
100
+ Gosu::Sample.new(filename)
95
101
  end
96
102
  end
@@ -1,4 +1,4 @@
1
-
1
+ # frozen_string_literal: true
2
2
  class Bitmap
3
3
 
4
4
  attr_reader :rect, :gosu_image
@@ -8,14 +8,8 @@ class Bitmap
8
8
  case args.size
9
9
  when 1
10
10
  basename, = args
11
- basename = basename.to_str # raise error if argument is not string compatible
12
- ["".freeze, ".png".freeze, ".jpg".freeze].each do |ext|
13
- filename = basename + ext
14
- if File.exist?(filename)
15
- return initialize_with_gosu_image(Gosu::Image.new(filename))
16
- end
17
- end
18
- raise "File not found: #{basename}"
11
+ filename = RGSS3::RTP.find!(basename, ['', '.png', 'jpg'])
12
+ initialize_with_gosu_image Gosu::Image.new(filename)
19
13
  when 2
20
14
  initialize_with_rmagick_image Magick::Image.new(*args) { self.background_color = 'none' }
21
15
  else
@@ -157,7 +151,7 @@ class Bitmap
157
151
  end
158
152
 
159
153
  def blur
160
- self.rmagick_image = rmagick_image.blur_image
154
+ # self.rmagick_image = rmagick_image.blur_image
161
155
  end
162
156
 
163
157
  def radial_blur(angle, division)
@@ -185,6 +179,8 @@ class Bitmap
185
179
  string.prepend("<i>") << "</i>"
186
180
  end
187
181
  text_image = Gosu::Image.from_text(string, @font.size, font: @font.first_existant_name)
182
+ x += (width - text_image.width) * (align || 0) / 2
183
+ y += (height - text_image.height) / 2
188
184
  text_image = Bitmap.gosu_to_rmagick(text_image)
189
185
  image = text_image.dup
190
186
  font_pixel = @font.color.to_pixel
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class Color
2
3
 
3
4
  attr_accessor :gosu_color
@@ -1,4 +1,4 @@
1
-
1
+ # frozen_string_literal: true
2
2
  module RGSS3
3
3
  # common methods for Plane, Sprite and Window
4
4
  module Container
@@ -14,6 +14,7 @@ module RGSS3
14
14
  @ox = 0
15
15
  @oy = 0
16
16
  @opacity = 255
17
+ @tone = Tone.new
17
18
  Graphics.add_container(self)
18
19
  end
19
20
 
@@ -1,11 +1,12 @@
1
+ # frozen_string_literal: true
1
2
  class Font
2
-
3
+
3
4
  class << self
4
-
5
+
5
6
  attr_accessor :default_name, :default_size, :default_bold
6
7
  attr_accessor :default_italic, :default_shadow, :default_outline
7
8
  attr_accessor :default_color, :default_out_color
8
-
9
+
9
10
  def exist?(name)
10
11
  f = (Gosu::Font.new(Graphics.gosu_window, "./Fonts/#{name}.ttf", 8) rescue false)
11
12
  Gosu::Font.new(Graphics.gosu_window, name, 8) unless f
@@ -14,7 +15,7 @@ class Font
14
15
  return false
15
16
  end
16
17
  end
17
-
18
+
18
19
  self.default_name = ["Verdana", "Arial", "Courier New"]
19
20
  self.default_size = 24
20
21
  self.default_bold = false
@@ -23,9 +24,9 @@ class Font
23
24
  self.default_outline = true
24
25
  self.default_color = Color.new(255, 255, 255, 255)
25
26
  self.default_out_color = Color.new(0, 0, 0, 128)
26
-
27
+
27
28
  attr_accessor :name, :size, :bold, :italic, :shadow, :outline, :color, :out_color
28
-
29
+
29
30
  def initialize(name = Font.default_name, size = Font.default_size)
30
31
  @name = name.dup
31
32
  @size = size
@@ -36,9 +37,9 @@ class Font
36
37
  @color = Font.default_color.dup
37
38
  @out_color = Font.default_out_color.dup
38
39
  end
39
-
40
+
40
41
  # NEW
41
-
42
+
42
43
  def first_existant_name
43
44
  if @name.is_a?(Array)
44
45
  @name.each {|a| return a if Font.exist?(a) }
@@ -47,4 +48,4 @@ class Font
47
48
  end
48
49
  return "Verdana"
49
50
  end
50
- end
51
+ end
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+ require 'fiber'
1
3
  module RGSS3
2
4
  class GameWindow < Gosu::Window
3
5
  attr_reader :frame_rate
4
- def initialize(width: 544, height: 416, full_screen: false, frame_rate: 60, title: "Game")
6
+ def initialize(width: 544, height: 416, full_screen: false, frame_rate: 60, title: "Game", rtp: nil)
5
7
  @frame_rate = frame_rate
8
+ RTP.path = rtp if rtp
6
9
  super(width, height, full_screen, 1000.0 / frame_rate)
7
10
  self.caption = title
8
11
  end
@@ -1,4 +1,4 @@
1
-
1
+ # frozen_string_literal: true
2
2
  require 'set'
3
3
  module Graphics
4
4
 
@@ -1,4 +1,4 @@
1
-
1
+ # frozen_string_literal: true
2
2
  # Usage:
3
3
  # Input.trigger?(2)
4
4
  # Input.trigger?(:DOWN)
@@ -1,4 +1,5 @@
1
- module Kernel
1
+ # frozen_string_literal: true
2
+ module ::Kernel
2
3
 
3
4
  def rgss_main#(&block)
4
5
  begin
@@ -13,23 +14,19 @@ module Kernel
13
14
  end
14
15
 
15
16
  def load_data(filename)
16
- RGSSAD.files {|a|
17
- if a.filename == filename
18
- return Marshal.load(a)
19
- end
20
- }
17
+ # RGSSAD.files {|a|
18
+ # if a.filename == filename
19
+ # return Marshal.load(a)
20
+ # end
21
+ # }
21
22
  File.open(filename, "rb") { |f|
22
23
  Marshal.load(f)
23
24
  }
24
25
  end
25
26
 
26
27
  def save_data(obj, filename)
27
- if RGSSAD.files.size != 0
28
- RGSSAD.add_file(Marshal.dump(obj), filename)
29
- else
30
- File.open(filename, "wb") { |f|
31
- Marshal.dump(obj, f)
32
- }
28
+ File.open(filename, "wb") do |f|
29
+ Marshal.dump(obj, f)
33
30
  end
34
31
  end
35
32
 
@@ -1,4 +1,4 @@
1
-
1
+ # frozen_string_literal: true
2
2
  require_relative 'sprite_container'
3
3
  class Plane
4
4
  include RGSS3::SpriteContainer
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class Rect
2
3
 
3
4
  attr_accessor :x, :y, :width, :height
@@ -1,2 +1,3 @@
1
+ # frozen_string_literal: true
1
2
  class RGSSError < StandardError
2
- end
3
+ end
@@ -1,2 +1,3 @@
1
+ # frozen_string_literal: true
1
2
  class RGSSReset < Exception
2
- end
3
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module RPG; end
2
3
 
3
4
  class RPG::AudioFile
@@ -11,7 +12,7 @@ class RPG::AudioFile
11
12
  attr_accessor :pitch
12
13
  end
13
14
 
14
-
15
+
15
16
  class RPG::BGM < RPG::AudioFile
16
17
  @@last = RPG::BGM.new
17
18
  def play(pos = 0)
@@ -119,7 +120,7 @@ class RPG::Tileset
119
120
  attr_accessor :tileset_names
120
121
  attr_accessor :flags
121
122
  attr_accessor :note
122
- end
123
+ end
123
124
  class RPG::Map
124
125
  def initialize(width, height)
125
126
  @display_name = ''
@@ -994,4 +995,4 @@ class RPG::System::TestBattler
994
995
  attr_accessor :actor_id
995
996
  attr_accessor :level
996
997
  attr_accessor :equips
997
- end
998
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+ module RGSS3
3
+ module RTP
4
+ class << self
5
+ # The RTP path
6
+ attr_accessor :path
7
+ end
8
+
9
+ # find file in current directory and RTP directory
10
+ def self.find(basename, extnames)
11
+ basename = basename.to_str
12
+ extnames.each do |ext|
13
+ filename = basename + ext
14
+ if File.exist?(filename)
15
+ return filename
16
+ elsif @path && File.exist?(filename = File.absolute_path(filename, @path))
17
+ return filename
18
+ end
19
+ end
20
+ nil
21
+ end
22
+
23
+ # same as find, except that find! raise error when not found
24
+ def self.find!(basename, extnames)
25
+ result = find(basename, extnames)
26
+ if result
27
+ result
28
+ else
29
+ raise "File not found: #{basename}"
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,4 +1,4 @@
1
-
1
+ # frozen_string_literal: true
2
2
  require_relative 'sprite_container'
3
3
  class Sprite
4
4
 
@@ -52,6 +52,6 @@ class Sprite
52
52
 
53
53
  def draw
54
54
  return if !@visible || @opacity == 0 || @bitmap == nil
55
- @bitmap.gosu_image.draw_rot(@x, @y, @z, @angle, 0.0, 0.0, @zoom_x * (@mirror ? -1 : 1), @zoom_y, 0xffffffff, BLEND[@blend_type])
55
+ @bitmap.gosu_image.draw_rot(@x, @y, @z, @angle, ox.fdiv(width), oy.fdiv(height), @zoom_x * (@mirror ? -1 : 1), @zoom_y, 0xffffffff, BLEND[@blend_type])
56
56
  end
57
57
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'container'
2
3
  module RGSS3
3
4
  # common methods for Plane and Sprite
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class Table
2
3
 
3
4
  attr_accessor :data
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
1
2
  class Tilemap
2
-
3
+
3
4
  TILESIZE = 32
4
5
 
5
6
  attr_accessor :bitmaps
@@ -10,7 +11,7 @@ class Tilemap
10
11
  attr_accessor :visible
11
12
  attr_reader :ox
12
13
  attr_reader :oy
13
-
14
+
14
15
  def initialize(viewport = nil)
15
16
  @bitmaps = []
16
17
  @viewport = viewport
@@ -43,12 +44,12 @@ class Tilemap
43
44
  def disposed?
44
45
  @disposed
45
46
  end
46
-
47
+
47
48
  def update
48
49
  @anim_count = (@anim_count + 1) % (@animated_layer.size * 30)
49
50
  @layers[0].bitmap = @animated_layer[@anim_count/30]
50
51
  end
51
-
52
+
52
53
  def refresh
53
54
  return if @map_data.nil? || @flags.nil?
54
55
  for layer in @layers
@@ -57,7 +58,7 @@ class Tilemap
57
58
  draw_animated_layer
58
59
  draw_upper_layers
59
60
  end
60
-
61
+
61
62
  def draw_animated_layer
62
63
  bitmap = Bitmap.new(@map_data.xsize * TILESIZE, @map_data.ysize * TILESIZE)
63
64
  if need_animated_layer?
@@ -82,14 +83,14 @@ class Tilemap
82
83
  end
83
84
  end
84
85
  end
85
-
86
+
86
87
  def bitmap_for_autotile(autotile)
87
88
  return 0 if autotile.between?(0,15)
88
89
  return 1 if autotile.between?(16,47)
89
90
  return 2 if autotile.between?(48,79)
90
91
  return 3 if autotile.between?(80,127)
91
92
  end
92
-
93
+
93
94
  A1 = [
94
95
  [13,14,17,18], [2,14,17,18], [13,3,17,18], [2,3,17,18],
95
96
  [13,14,17,7], [2,14,17,7], [13,3,17,7], [2,3,17,7],
@@ -104,14 +105,14 @@ class Tilemap
104
105
  [16,17,20,21], [16,3,20,21], [8,11,12,15], [8,9,20,21],
105
106
  [16,19,20,23], [10,11,22,23], [8,11,20,23], [0,1,4,5]
106
107
  ]
107
-
108
+
108
109
  A1POS = [
109
110
  [0,0],[0,TILESIZE*3],[TILESIZE*6,0],[TILESIZE*6,TILESIZE*3],
110
111
  [TILESIZE*8,0],[TILESIZE*14,0],[TILESIZE*8,TILESIZE*3],[TILESIZE*14,TILESIZE*3],
111
112
  [0,TILESIZE*6],[TILESIZE*6,TILESIZE*6],[0,TILESIZE*9],[TILESIZE*6,TILESIZE*9],
112
113
  [TILESIZE*8,TILESIZE*6],[TILESIZE*14,TILESIZE*6],[TILESIZE*8,TILESIZE*9],[TILESIZE*14,TILESIZE*9]
113
114
  ]
114
-
115
+
115
116
  def draw_A1tile(x,y,id,animated = false)
116
117
  autotile = (id - 2048) / 48
117
118
  return draw_waterfalltile(x,y,id) if [5,7,9,11,13,15].include?(autotile)
@@ -149,11 +150,11 @@ class Tilemap
149
150
  x2 += TILESIZE * 2 if animated && ![2,3].include?(autotile)
150
151
  end
151
152
  end
152
-
153
+
153
154
  A1E = [
154
155
  [0,1,6,7],[0,1,4,5],[2,3,6,7],[1,2,5,6]
155
156
  ]
156
-
157
+
157
158
  def draw_waterfalltile(x,y,id)
158
159
  autotile = (id - 2048) / 48
159
160
  index = (id - 2048) % 48
@@ -178,18 +179,18 @@ class Tilemap
178
179
  y2 += TILESIZE
179
180
  end
180
181
  end
181
-
182
+
182
183
  def draw_A2tile(x,y,id)
183
184
  draw_A1tile(x,y,id)
184
185
  end
185
-
186
+
186
187
  A3 = [
187
188
  [5,6,9,10], [4,5,8,9], [1,2,5,6], [0,1,4,5],
188
189
  [6,7,10,11], [4,7,8,11], [2,3,6,7], [0,3,4,7],
189
190
  [9,10,13,14], [8,9,12,13], [1,2,13,14], [0,1,12,13],
190
191
  [10,11,14,15], [8,11,12,13], [2,3,14,15], [0,3,12,15]
191
192
  ]
192
-
193
+
193
194
  def draw_A3tile(x,y,id)
194
195
  autotile = (id - 2048) / 48
195
196
  index = (id - 2048) % 48
@@ -230,7 +231,7 @@ class Tilemap
230
231
  end
231
232
  end
232
233
  end
233
-
234
+
234
235
  def draw_A4tile(x,y,id)
235
236
  autotile = (id - 2048) / 48
236
237
  case autotile
@@ -244,7 +245,7 @@ class Tilemap
244
245
  draw_A3tile(x,y,id)
245
246
  end
246
247
  end
247
-
248
+
248
249
  def draw_A5tile(x,y,id)
249
250
  id -= 1536
250
251
  rect = Rect.new(TILESIZE * (id % 8),TILESIZE * ((id % 128) / 8),TILESIZE,TILESIZE)
@@ -252,7 +253,7 @@ class Tilemap
252
253
  layer.blt(x * TILESIZE, y * TILESIZE,@bitmaps[4],rect)
253
254
  end
254
255
  end
255
-
256
+
256
257
  def need_animated_layer?
257
258
  for x in 0..@map_data.xsize - 1
258
259
  for y in 0..@map_data.ysize - 1
@@ -263,7 +264,7 @@ class Tilemap
263
264
  end
264
265
  return false
265
266
  end
266
-
267
+
267
268
  def draw_upper_layers
268
269
  bitmap = Bitmap.new(@map_data.xsize * TILESIZE, @map_data.ysize * TILESIZE)
269
270
  @layers[1].bitmap = bitmap
@@ -282,29 +283,29 @@ class Tilemap
282
283
  end
283
284
  end
284
285
  end
285
-
286
+
286
287
  def map_data=(data)
287
288
  return if @map_data == data
288
289
  @map_data = data
289
290
  refresh
290
291
  end
291
-
292
+
292
293
  def flags=(data)
293
294
  @flags = data
294
295
  refresh
295
296
  end
296
-
297
+
297
298
  def ox=(value)
298
299
  @ox = value
299
300
  for layer in @layers
300
301
  layer.ox = @ox
301
302
  end
302
303
  end
303
-
304
+
304
305
  def oy=(value)
305
306
  @oy = value
306
307
  for layer in @layers
307
308
  layer.oy = @oy
308
309
  end
309
310
  end
310
- end
311
+ end
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
1
2
  class Tone
2
-
3
+
3
4
  attr_reader :red, :green, :blue, :gray
4
-
5
+
5
6
  def initialize(*args)
6
7
  case args.size
7
8
  when 0
@@ -15,7 +16,7 @@ class Tone
15
16
  raise ArgumentError
16
17
  end
17
18
  end
18
-
19
+
19
20
  def set(*args)
20
21
  case args.size
21
22
  when 1
@@ -36,34 +37,34 @@ class Tone
36
37
  raise ArgumentError
37
38
  end
38
39
  end
39
-
40
+
40
41
  def red=(int)
41
42
  @red = [[255, int].min, -255].max.to_f
42
43
  end
43
-
44
+
44
45
  def green=(int)
45
46
  @green = [[255, int].min, -255].max.to_f
46
47
  end
47
-
48
+
48
49
  def blue=(int)
49
50
  @blue = [[255, int].min, -255].max.to_f
50
51
  end
51
-
52
+
52
53
  def gray=(int)
53
54
  @gray = [[255, int].min, 0].max.to_f
54
55
  end
55
-
56
+
56
57
  def _dump(d = 0)
57
58
  [@red, @green, @blue, @gray].pack('d4')
58
59
  end
59
-
60
+
60
61
  def self._load(s)
61
62
  Tone.new(*s.unpack('d4'))
62
63
  end
63
-
64
+
64
65
  # NEW
65
-
66
+
66
67
  def to_a
67
68
  [red, green, blue, gray]
68
69
  end
69
- end
70
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module RGSS3
2
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
3
4
  end
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
1
2
  class Viewport
2
-
3
+
3
4
  attr_accessor :color, :tone, :rect, :visible, :z, :ox, :oy
4
-
5
+
5
6
  def initialize(*args)
6
7
  case args.size
7
8
  when 0
@@ -22,22 +23,22 @@ class Viewport
22
23
  @ox = 0
23
24
  @oy = 0
24
25
  end
25
-
26
+
26
27
  def dispose
27
28
  @disposed = true
28
29
  end
29
-
30
+
30
31
  def disposed?
31
32
  @disposed
32
33
  end
33
-
34
+
34
35
  def flash(color, duration)
35
36
  @flash_color = color || Color.new(0, 0, 0, 0)
36
37
  @flash_duration = duration
37
38
  end
38
-
39
+
39
40
  def update
40
41
  @flash_duration = [@flash_duration - 1, 0].max
41
42
  @flash_color = nil if @flash_duration == 0
42
43
  end
43
- end
44
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'container'
2
3
  class Window
3
4
 
@@ -19,7 +20,7 @@ class Window
19
20
  attr_accessor :opacity
20
21
  attr_accessor :back_opacity
21
22
  attr_accessor :contents_opacity
22
- attr_accessor :openness
23
+ attr_reader :openness
23
24
 
24
25
  def initialize(*args)
25
26
  case args.size
@@ -31,6 +32,14 @@ class Window
31
32
  when 4
32
33
  @x, @y, @width, @height = args
33
34
  end
35
+ @contents = Bitmap.new(1, 1)
36
+ @cursor_rect = Rect.new
37
+ @padding = 12
38
+ @padding_bottom = 8
39
+ @pause = false
40
+ @arrows_visible = true
41
+ @active = true
42
+ @openness = 255
34
43
  super()
35
44
  end
36
45
 
@@ -45,11 +54,15 @@ class Window
45
54
  end
46
55
 
47
56
  def open?
48
- openness == 255
57
+ @openness == 255
49
58
  end
50
59
 
51
60
  def close?
52
- openness == 0
61
+ @openness == 0
62
+ end
63
+
64
+ def openness=(value)
65
+ @openness = [[value, 0].max, 255].min
53
66
  end
54
67
 
55
68
  def draw
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgss3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - taroxd
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-12 00:00:00.000000000 Z
11
+ date: 2017-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gosu
@@ -96,6 +96,7 @@ files:
96
96
  - lib/rgss3/rgss_error.rb
97
97
  - lib/rgss3/rgss_reset.rb
98
98
  - lib/rgss3/rpg.rb
99
+ - lib/rgss3/rtp.rb
99
100
  - lib/rgss3/sprite.rb
100
101
  - lib/rgss3/sprite_container.rb
101
102
  - lib/rgss3/table.rb