ehb_game_lib 0.0.6 → 0.3.0

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
  SHA256:
3
- metadata.gz: d643f13e6d8b07eaa4619f06e90dc4560ad05cecb7fa87bda94d1ddb929ac608
4
- data.tar.gz: fecab868437c73851309abed83e4baa9090c6b8e460c9e96e9e3722af0c690aa
3
+ metadata.gz: bed38ad4e4913133709910358b6cefecc19b31806dbebf56fa0634436854df16
4
+ data.tar.gz: 6f5f10d50d575fd6318fb46ef148b779b2cb1dae36f221f9bb1f8c1c49af9ae4
5
5
  SHA512:
6
- metadata.gz: 2860f3c38dbce468873ea6c2802c4175c69af94f245c5a3c151ca52863e7f5320cb5c1bed61a94c5a0a7a6d5dc8031e3ba034a1a2fe6c50b8f7bfe86aecdb52e
7
- data.tar.gz: 03e53f34ec987f63960fc5e046d364603df4c3ccaec23482ac1e5aaebaa9db3e4c09214c44a9e96262a10a06fdf982a2b7bf5d6fd9a9953f644c8c44390bc4ae
6
+ metadata.gz: 56b31e0d389e0623a6eac2cef4b665b97f0bca16b3130c7f191d7d66186c5d35fd8f24e28bd1ce329433441edfffa64a77c839e5cdadefa0514abd6c1052681d
7
+ data.tar.gz: 49d76a3c978287e715977ec2c1117a437b698e1ede1a8de4c6e8f3340037198fcf8900d3459931db172e0a7011050b5be0f4c3163886b215c13f6c326db48eba
@@ -1,26 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support'
4
- require 'active_support/core_ext'
5
3
  require 'chingu'
6
- require 'ehb_game_lib/version'
7
- require 'ehb_game_lib/globals'
8
- require 'ehb_game_lib/gfx'
9
- require 'ehb_game_lib/math/circle'
10
- require 'ehb_game_lib/math/line'
11
- require 'ehb_game_lib/math/line_segment'
12
- require 'ehb_game_lib/math/quadratic_equation'
13
- require 'ehb_game_lib/math/rectable_object'
14
- require 'ehb_game_lib/math/vector'
15
- require 'ehb_game_lib/math/intersection/circle_line'
16
- require 'ehb_game_lib/math/intersection/circle_line_segment'
17
- require 'ehb_game_lib/nes/all_colors_palette'
18
- require 'ehb_game_lib/nes/color'
19
- require 'ehb_game_lib/nes/palette'
20
- require 'ehb_game_lib/patches/chingu/basic_game_object'
21
- require 'ehb_game_lib/patches/gosu/font'
22
- require 'ehb_game_lib/traits/bounding_line_segment'
23
- require 'ehb_game_lib/utils/cursor'
4
+ require 'eac_ruby_utils/core_ext'
5
+ require 'opengl'
24
6
 
25
7
  module EhbGameLib
8
+ require_sub __FILE__
26
9
  end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EhbGameLib
4
+ class BaseState < ::Chingu::GameState
5
+ end
6
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'ehb_game_lib/math/rectable_object'
5
+
6
+ module EhbGameLib
7
+ class Canvas
8
+ include ::EhbGameLib::Math::RectableObject
9
+
10
+ common_constructor :width, :height
11
+
12
+ def x
13
+ 0
14
+ end
15
+
16
+ def y
17
+ 0
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbGameLib
6
+ module Math
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'ehb_game_lib/palettes/sprite'
5
+ require 'ehb_game_lib/text/bitmap_font'
6
+
7
+ module EhbGameLib
8
+ class MediaPath
9
+ class << self
10
+ # @return [EhbGameLib::MediaPath]
11
+ def default
12
+ @default ||= new
13
+ end
14
+ end
15
+
16
+ # @return [Array]
17
+ def paths
18
+ @paths ||= []
19
+ end
20
+
21
+ # @return [Pathname]
22
+ def find(subpath)
23
+ paths.each do |path|
24
+ full_path = path.to_pathname.expand_path.join(subpath)
25
+ return full_path if full_path.exist?
26
+ end
27
+ raise "Subpath \"#{subpath}\" not found (Searched in: #{paths})"
28
+ end
29
+
30
+ # @return [EhbGameLib::Text::BitmapFont]
31
+ def load_bitmap_font(subpath, line_height)
32
+ ::EhbGameLib::Text::BitmapFont.new(find(subpath).to_path, line_height)
33
+ end
34
+
35
+ # @return [Gosu::Image]
36
+ def load_gosu_image(subpath)
37
+ ::Gosu::Image.new(find(subpath).to_path, ::EhbGameLib::Palettes::Sprite.to_gosu_image_options)
38
+ end
39
+
40
+ # @return [EhbGameLib::Palettes::Sprite]
41
+ def load_sprite(subpath)
42
+ ::EhbGameLib::Palettes::Sprite.from_file(find(subpath))
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbGameLib
6
+ module Nes
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -1,20 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'ehb_game_lib/palettes/palette'
4
+
3
5
  module EhbGameLib
4
6
  module Nes
5
- class Palette
6
- COLORS_COUNT = 16
7
+ # Reference: http://www.firebrandx.com/nespalette.html
8
+ class Palette < ::EhbGameLib::Palettes::Palette
9
+ COLUMNS = %w[grey blue indigo purple violet red brown orange yellow lawn_green lime_green
10
+ sea_green cyan black].freeze
11
+ ROWS = %w[dd d l ll].freeze
7
12
 
8
- def initialize(all_colors)
9
- @colors = Array.new(COLORS_COUNT) { |i| ::EhbGameLib::Nes::Color.new(all_colors, i) }
13
+ COLUMNS.each_with_index do |c_name, c_index|
14
+ ROWS.each_with_index do |r_name, r_index|
15
+ const_set("#{c_name}_#{r_name}".upcase, r_index * 0x10 + c_index)
16
+ end
10
17
  end
11
18
 
12
- def [](index)
13
- @colors[index % @colors.length]
14
- end
19
+ BLACK = BLACK_DD
20
+ WHITE = GREY_LL
21
+ TRANSPARENT = 0x3F
15
22
 
16
- def []=(index, value)
17
- @colors[index % @colors.length].color_index = value
23
+ def initialize
24
+ colors = ::EhbGameLib::Palettes::Color.array_from_file(
25
+ ::File.join(__dir__, 'pvm_style_d93_palette.pal')
26
+ )
27
+ colors[TRANSPARENT] = ::EhbGameLib::Palettes::Color.new(0x00, 0x00, 0x00, 0x00)
28
+ super(colors)
18
29
  end
19
30
  end
20
31
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbGameLib
6
+ module Palettes
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'gosu'
5
+ require 'rmagick'
6
+
7
+ module EhbGameLib
8
+ module Palettes
9
+ class Color
10
+ QUANTUM_MIN = 0
11
+ QUANTUM_MAX = 255
12
+ QUANTUM_RANGE = (QUANTUM_MIN..QUANTUM_MAX).freeze
13
+
14
+ class << self
15
+ def validate_quantum(quantum)
16
+ raise "Not a integer: #{quantum}" unless quantum.is_a?(::Integer)
17
+ raise 'Out of bounds' unless QUANTUM_RANGE.include?(quantum)
18
+
19
+ quantum
20
+ end
21
+
22
+ def quantum_to_magick_range(quantum)
23
+ ((quantum / QUANTUM_MAX.to_f) * ::Magick::QuantumRange).floor
24
+ end
25
+
26
+ # @return [Array<EhbGameLib::Palettes::Color>]
27
+ def array_from_file(file_path)
28
+ r = []
29
+ ::File.open(file_path.to_s) do |file|
30
+ while (b = file.read(3))
31
+ b = b.bytes.to_a
32
+ r << ::EhbGameLib::Palettes::Color.new(b[0], b[1], b[2])
33
+ end
34
+ end
35
+ r
36
+ end
37
+ end
38
+
39
+ enable_simple_cache
40
+ attr_reader :red, :green, :blue, :alpha
41
+
42
+ def initialize(red, green, blue, alpha = QUANTUM_MAX)
43
+ @red = self.class.validate_quantum(red)
44
+ @green = self.class.validate_quantum(green)
45
+ @blue = self.class.validate_quantum(blue)
46
+ @alpha = self.class.validate_quantum(alpha)
47
+ end
48
+
49
+ # @return [Gosu::Color]
50
+ def gosu_color
51
+ @gosu_color ||= ::Gosu::Color.rgba(red, green, blue, alpha)
52
+ end
53
+
54
+ # @return [Magick::Pixel]
55
+ def magick_pixel
56
+ @magick_pixel ||= ::Magick::Pixel.new(
57
+ *[red, green, blue, alpha].map { |n| self.class.quantum_to_magick_range(n) }
58
+ )
59
+ end
60
+
61
+ def names
62
+ Array(::Colorname.find(red, green, blue))
63
+ end
64
+
65
+ def rgb_to_s
66
+ values_to_s(red, green, blue)
67
+ end
68
+
69
+ def rgba_to_s
70
+ rgb_to_s + '|' + values_to_s(alpha)
71
+ end
72
+
73
+ def to_a
74
+ [red, green, blue, alpha]
75
+ end
76
+
77
+ def to_s
78
+ rgba_to_s
79
+ end
80
+
81
+ def to_html
82
+ '#' + rgb_to_s
83
+ end
84
+
85
+ private
86
+
87
+ def values_to_s(*values)
88
+ values.map { |i| i.to_s(16).rjust(2, '0') }.join.upcase
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'gosu'
4
+ require 'ehb_game_lib/palettes/color'
5
+
6
+ module EhbGameLib
7
+ module Palettes
8
+ class Palette
9
+ class << self
10
+ # @return [EhbGameLib::Palettes::Palette]
11
+ def from_file(file_path)
12
+ new(::EhbGameLib::Palettes::Color.array_from_file(file_path))
13
+ end
14
+ end
15
+
16
+ # @return [Array<Gosu::Color>]
17
+ attr_reader :colors
18
+
19
+ def initialize(colors)
20
+ colors.each_with_index do |color, index|
21
+ unless color.is_a?(::EhbGameLib::Palettes::Color)
22
+ raise "\##{index} is not a Palette::Color (#{color})"
23
+ end
24
+ end
25
+ @colors = colors.to_a.freeze
26
+ end
27
+
28
+ # @return [EhbGameLib::Palettes::Color]
29
+ def color(index)
30
+ colors.fetch(index)
31
+ end
32
+
33
+ # @return [EhbGameLib::Palettes::Color]
34
+ def [](index)
35
+ colors.fetch(index)
36
+ end
37
+
38
+ # @return [EhbGameLib::Palettes::Palette]
39
+ def sub(*indexes)
40
+ sub_class.new(indexes.map { |index| color(index) })
41
+ end
42
+
43
+ def sub_class
44
+ ::EhbGameLib::Palettes::Palette
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ehb_game_lib/media_path'
4
+ require 'rmagick'
5
+
6
+ module EhbGameLib
7
+ module Palettes
8
+ class Sprite
9
+ class << self
10
+ def from_file(file_path)
11
+ new(::Magick::Image.read(file_path.to_s).first)
12
+ end
13
+
14
+ def to_gosu_image_options
15
+ { retro: true, tileable: true }
16
+ end
17
+ end
18
+
19
+ common_constructor :magick_image
20
+
21
+ # @return Gosu::Image
22
+ def gosu_image
23
+ @gosu_image ||= begin
24
+ the_path = '/tmp/temp_magick_image.png'
25
+ magick_image.write(the_path)
26
+ ::Gosu::Image.new(the_path, self.class.to_gosu_image_options)
27
+ end
28
+ end
29
+
30
+ # @return [EhbGameLib::Palettes::Sprite]
31
+ def palette_image(palette)
32
+ r = magick_image.dup
33
+ r.colors.times.each do |index|
34
+ r.colormap(index, palette.color(index).magick_pixel)
35
+ end
36
+ self.class.new(r)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbGameLib
6
+ module Palettes
7
+ module SpriteSet
8
+ class Paletted
9
+ common_constructor :palette, :source_set
10
+
11
+ def [](name)
12
+ sprite(name)
13
+ end
14
+
15
+ def sprite(name)
16
+ sprites_hash[name.to_sym] ||= source_set.sprite(name).palette_image(palette)
17
+ end
18
+
19
+ def sprites
20
+ source_set.sprites.keys.map { |name| [name, sprite(name)] }.to_h
21
+ end
22
+
23
+ private
24
+
25
+ def sprites_hash
26
+ @sprites_hash ||= {}
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'ehb_game_lib/media_path'
5
+ require 'ehb_game_lib/palettes/sprite'
6
+
7
+ module EhbGameLib
8
+ module Palettes
9
+ module SpriteSet
10
+ class Source
11
+ enable_simple_cache
12
+ common_constructor :media_path, default: [::EhbGameLib::MediaPath.default]
13
+
14
+ def add(name, sprite)
15
+ sprites_hash[name.to_sym] = sprite
16
+ reset_cache :sprites
17
+ end
18
+
19
+ def load(subpath, name = nil)
20
+ name ||= ::File.basename(subpath, '.*')
21
+
22
+ add(name, media_path.load_sprite(subpath))
23
+ end
24
+
25
+ def [](name)
26
+ sprite(name)
27
+ end
28
+
29
+ def sprite(name)
30
+ sprites_hash.fetch(name.to_sym)
31
+ end
32
+
33
+ private
34
+
35
+ def sprites_uncached
36
+ sprites_hash.dup.freeze
37
+ end
38
+
39
+ def sprites_hash
40
+ @sprites_hash ||= {}
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbGameLib
6
+ module Text
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EhbGameLib
4
+ module Text
5
+ class BitmapFont
6
+ attr_reader :name, :line_height
7
+
8
+ def initialize(name, line_height)
9
+ @name = name
10
+ @line_height = line_height
11
+ end
12
+
13
+ def image(text)
14
+ ::Gosu::Image.from_text(text, line_height, retro: true, font: name)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EhbGameLib
4
+ module Text
5
+ class BitmapText
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbGameLib
6
+ module Utils
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EhbGameLib
4
- VERSION = '0.0.6'
4
+ VERSION = '0.3.0'
5
5
  end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/require_sub'
5
+ require 'ehb_game_lib/canvas'
6
+ ::EacRubyUtils.require_sub(__FILE__)
7
+
8
+ module EhbGameLib
9
+ class Window < ::Chingu::Window
10
+ attr_accessor :fit_canvas_to_window, :draw_retro
11
+ attr_reader :canvas, :canvas_factor
12
+
13
+ def initialize(canvas_width, canvas_height)
14
+ @canvas = ::EhbGameLib::Canvas.new(canvas_width, canvas_height)
15
+ @canvas_factor = 1
16
+ self.fit_canvas_to_window = true
17
+ self.draw_retro = true
18
+ super calculated_width, calculated_height
19
+ dimensions_reset
20
+ end
21
+
22
+ def calculated_width
23
+ canvas.width * canvas_factor
24
+ end
25
+
26
+ def calculated_height
27
+ canvas.height * canvas_factor
28
+ end
29
+
30
+ def canvas_factor=(factor)
31
+ @canvas_factor = factor
32
+ dimensions_reset
33
+ end
34
+
35
+ def fullscreen=(value)
36
+ super(value)
37
+ dimensions_reset
38
+ end
39
+
40
+ def draw
41
+ super if ::EhbGameLib::Globals.window
42
+ draw_resized
43
+ end
44
+
45
+ private
46
+
47
+ def dimensions_reset
48
+ if fullscreen?
49
+ self.width = canvas.width
50
+ self.height = canvas.height
51
+ else
52
+ self.width = calculated_width
53
+ self.height = calculated_height
54
+ end
55
+ end
56
+
57
+ def draw_resized
58
+ return unless fit_canvas_to_window && !fullscreen?
59
+
60
+ ::Gosu::Image.new(canvas_image_source, retro: draw_retro)
61
+ .draw(0, 0, 100, canvas_factor, canvas_factor)
62
+ end
63
+
64
+ def canvas_image_source
65
+ image_source(0, height - canvas.height, canvas.width, canvas.height)
66
+ end
67
+
68
+ def image_source(x, y, w, h)
69
+ GlReadPixelsImage.new(x, y, w, h)
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'chingu'
4
+
5
+ module EhbGameLib
6
+ class Window < ::Chingu::Window
7
+ class GlReadPixelsImage
8
+ attr_reader :columns, :rows
9
+
10
+ DEPTH = 4
11
+
12
+ def initialize(x, y, width, height)
13
+ @columns = width
14
+ @rows = height
15
+ Gosu.flush
16
+ Gosu.gl do
17
+ @blob = ::Gl.glReadPixels(x, y, width, height, Gl::GL_RGBA, Gl::GL_UNSIGNED_BYTE)
18
+ end
19
+ end
20
+
21
+ def to_blob
22
+ @blob.force_encoding('binary').scan(/.{#{columns * 4}}/m).reverse.join
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'ehb_game_lib/math/circle'
4
+ require 'ehb_game_lib/math/intersection/circle_line'
5
+ require 'ehb_game_lib/math/intersection/circle_line_segment'
3
6
  require 'test_helper'
4
7
 
5
8
  module EhbGameLib
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ehb_game_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo H. Bogoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-29 00:00:00.000000000 Z
11
+ date: 2021-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activesupport
14
+ name: chingu
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.0.0
19
+ version: 0.8.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 5.0.0
26
+ version: 0.8.1
27
27
  - !ruby/object:Gem::Dependency
28
- name: chingu
28
+ name: eac_ruby_utils
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.8.1
33
+ version: '0.57'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.8.1
40
+ version: '0.57'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: gosu
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,13 +53,13 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.13.1
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: opengl
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
- type: :development
62
+ type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
@@ -67,19 +67,59 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rubocop
70
+ name: rmagick
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '4.1'
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 4.1.2
79
+ type: :runtime
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - "~>"
84
+ - !ruby/object:Gem::Version
85
+ version: '4.1'
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 4.1.2
89
+ - !ruby/object:Gem::Dependency
90
+ name: eac_ruby_gem_support
71
91
  requirement: !ruby/object:Gem::Requirement
72
92
  requirements:
73
93
  - - "~>"
74
94
  - !ruby/object:Gem::Version
75
- version: 0.79.0
95
+ version: '0.1'
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 0.1.2
76
99
  type: :development
77
100
  prerelease: false
78
101
  version_requirements: !ruby/object:Gem::Requirement
79
102
  requirements:
80
103
  - - "~>"
81
104
  - !ruby/object:Gem::Version
82
- version: 0.79.0
105
+ version: '0.1'
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: 0.1.2
109
+ - !ruby/object:Gem::Dependency
110
+ name: rake
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
83
123
  - !ruby/object:Gem::Dependency
84
124
  name: test-unit
85
125
  requirement: !ruby/object:Gem::Requirement
@@ -102,8 +142,11 @@ extensions: []
102
142
  extra_rdoc_files: []
103
143
  files:
104
144
  - lib/ehb_game_lib.rb
145
+ - lib/ehb_game_lib/base_state.rb
146
+ - lib/ehb_game_lib/canvas.rb
105
147
  - lib/ehb_game_lib/gfx.rb
106
148
  - lib/ehb_game_lib/globals.rb
149
+ - lib/ehb_game_lib/math.rb
107
150
  - lib/ehb_game_lib/math/circle.rb
108
151
  - lib/ehb_game_lib/math/intersection/circle_line.rb
109
152
  - lib/ehb_game_lib/math/intersection/circle_line_segment.rb
@@ -112,14 +155,27 @@ files:
112
155
  - lib/ehb_game_lib/math/quadratic_equation.rb
113
156
  - lib/ehb_game_lib/math/rectable_object.rb
114
157
  - lib/ehb_game_lib/math/vector.rb
115
- - lib/ehb_game_lib/nes/all_colors_palette.rb
116
- - lib/ehb_game_lib/nes/color.rb
158
+ - lib/ehb_game_lib/media_path.rb
159
+ - lib/ehb_game_lib/nes.rb
117
160
  - lib/ehb_game_lib/nes/palette.rb
161
+ - lib/ehb_game_lib/nes/pvm_style_d93_palette.pal
162
+ - lib/ehb_game_lib/palettes.rb
163
+ - lib/ehb_game_lib/palettes/color.rb
164
+ - lib/ehb_game_lib/palettes/palette.rb
165
+ - lib/ehb_game_lib/palettes/sprite.rb
166
+ - lib/ehb_game_lib/palettes/sprite_set/paletted.rb
167
+ - lib/ehb_game_lib/palettes/sprite_set/source.rb
118
168
  - lib/ehb_game_lib/patches/chingu/basic_game_object.rb
119
169
  - lib/ehb_game_lib/patches/gosu/font.rb
170
+ - lib/ehb_game_lib/text.rb
171
+ - lib/ehb_game_lib/text/bitmap_font.rb
172
+ - lib/ehb_game_lib/text/bitmap_text.rb
120
173
  - lib/ehb_game_lib/traits/bounding_line_segment.rb
174
+ - lib/ehb_game_lib/utils.rb
121
175
  - lib/ehb_game_lib/utils/cursor.rb
122
176
  - lib/ehb_game_lib/version.rb
177
+ - lib/ehb_game_lib/window.rb
178
+ - lib/ehb_game_lib/window/gl_read_pixels_image.rb
123
179
  - test/lib/ehb_game_lib/math/circle_test.rb
124
180
  - test/lib/ehb_game_lib/math/intersection/circle_line_segment_test.rb
125
181
  - test/lib/ehb_game_lib/math/intersection/circle_line_test.rb
@@ -146,8 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
202
  - !ruby/object:Gem::Version
147
203
  version: '0'
148
204
  requirements: []
149
- rubyforge_project:
150
- rubygems_version: 2.7.7
205
+ rubygems_version: 3.0.8
151
206
  signing_key:
152
207
  specification_version: 4
153
208
  summary: EHB's game library for Ruby
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module EhbGameLib
4
- module Nes
5
- class AllColorsPalette
6
- def initialize(pal_file)
7
- @colors = []
8
- File.open(pal_file) do |file|
9
- while (b = file.read(3))
10
- b = b.bytes.to_a
11
- @colors << Gosu::Color.rgba(b[0], b[1], b[2], 0xFF)
12
- end
13
- end
14
- @colors.freeze
15
- end
16
-
17
- def gosu_color(i)
18
- @colors[i]
19
- end
20
-
21
- def draw(x, y)
22
- s = 32
23
- @colors.each_with_index do |c, i|
24
- cx = x + (i % 16) * s
25
- cy = y + (i / 16) * s
26
- Gosu.draw_rect(cx, cy, s, s, c)
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module EhbGameLib
4
- module Nes
5
- class Color
6
- attr_accessor :color_index
7
-
8
- BLACK = 0x0F
9
- YELLOW = 0x28
10
- RED = 0x05
11
- WHITE = 0x30
12
-
13
- def initialize(all_colors, color_index)
14
- @all_colors = all_colors
15
- @color_index = color_index
16
- end
17
-
18
- def gosu_color
19
- @all_colors.gosu_color(color_index)
20
- end
21
- end
22
- end
23
- end