gbtiles 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/bin/gbm +0 -3
- data/bin/gbr +0 -3
- data/lib/gbtiles/gbm/cli/convert.rb +8 -17
- data/lib/gbtiles/gbm/export/asm/asm.h.erb +3 -3
- data/lib/gbtiles/gbm/export/asm/asm.rb +7 -1
- data/lib/gbtiles/gbm/export/asm/asm.s.erb +4 -4
- data/lib/gbtiles/gbm/import/gbm_file.rb +24 -13
- data/lib/gbtiles/gbm/layer.rb +9 -0
- data/lib/gbtiles/gbm/map/map_set.rb +22 -11
- data/lib/gbtiles/gbm/map/object.rb +0 -5
- data/lib/gbtiles/gbm/map/object_type.rb +8 -8
- data/lib/gbtiles/gbm/map/objects/map.rb +1 -14
- data/lib/gbtiles/gbm/map/objects/map_export_settings.rb +1 -28
- data/lib/gbtiles/gbm/map/objects/map_settings.rb +1 -26
- data/lib/gbtiles/gbm/map/objects/map_tile_data.rb +1 -2
- data/lib/gbtiles/gbm/map/objects/map_tile_data_record.rb +0 -9
- data/lib/gbtiles/gbm/map/objects/producer.rb +2 -7
- data/lib/gbtiles/gbm/map/objects/unknown.rb +0 -1
- data/lib/gbtiles/gbr/cli/convert.rb +2 -19
- data/lib/gbtiles/gbr/export/asm/asm.rb +0 -1
- data/lib/gbtiles/gbr/import/gbr_file.rb +37 -21
- data/lib/gbtiles/gbr/tile_set/color_set.rb +6 -6
- data/lib/gbtiles/gbr/tile_set/export_type.rb +7 -7
- data/lib/gbtiles/gbr/tile_set/object.rb +0 -3
- data/lib/gbtiles/gbr/tile_set/object_type.rb +10 -10
- data/lib/gbtiles/gbr/tile_set/objects/palettes.rb +1 -10
- data/lib/gbtiles/gbr/tile_set/objects/producer.rb +1 -6
- data/lib/gbtiles/gbr/tile_set/objects/tile_data.rb +2 -13
- data/lib/gbtiles/gbr/tile_set/objects/tile_export.rb +1 -42
- data/lib/gbtiles/gbr/tile_set/objects/tile_import.rb +1 -18
- data/lib/gbtiles/gbr/tile_set/objects/tile_pal.rb +1 -10
- data/lib/gbtiles/gbr/tile_set/objects/tile_settings.rb +1 -22
- data/lib/gbtiles/gbr/tile_set/objects/unknown.rb +0 -1
- data/lib/gbtiles/gbr/tile_set/sgb_palettes.rb +7 -7
- data/lib/gbtiles/gbr/tile_set/split_order.rb +6 -6
- data/lib/gbtiles/gbr/tile_set/tile_set.rb +20 -9
- data/lib/gbtiles/{data_type.rb → helpers/data_type.rb} +19 -11
- data/lib/gbtiles/version.rb +1 -1
- metadata +47 -4
@@ -5,34 +5,17 @@ module GBTiles
|
|
5
5
|
class TileImport < GBTiles::GBR::TileSet::Object
|
6
6
|
|
7
7
|
attr_accessor :tile_id
|
8
|
-
@tile_id
|
9
|
-
|
10
8
|
attr_accessor :file_name
|
11
|
-
@file_name
|
12
|
-
|
13
9
|
attr_accessor :file_type
|
14
|
-
@file_type
|
15
|
-
|
16
10
|
attr_accessor :from_tile
|
17
|
-
@from_tile
|
18
|
-
|
19
11
|
attr_accessor :to_tile
|
20
|
-
@to_tile
|
21
|
-
|
22
12
|
attr_accessor :tile_count
|
23
|
-
@tile_count
|
24
|
-
|
25
13
|
attr_accessor :color_conversion
|
26
|
-
@color_conversion
|
27
|
-
|
28
14
|
attr_accessor :first_byte
|
29
|
-
@first_byte
|
30
|
-
|
31
15
|
attr_accessor :binary_file_type
|
32
|
-
@binary_file_type
|
33
16
|
|
34
17
|
def initialize
|
35
|
-
super GBTiles::GBR::TileSet::
|
18
|
+
super GBTiles::GBR::TileSet::OBJECT_TYPE[:tile_import]
|
36
19
|
end
|
37
20
|
|
38
21
|
def self.initFromBitString src
|
@@ -5,22 +5,13 @@ module GBTiles
|
|
5
5
|
class TilePal < GBTiles::GBR::TileSet::Object
|
6
6
|
|
7
7
|
attr_accessor :id
|
8
|
-
@id
|
9
|
-
|
10
8
|
attr_accessor :count
|
11
|
-
@count
|
12
|
-
|
13
9
|
attr_accessor :color_set
|
14
|
-
@color_set
|
15
|
-
|
16
10
|
attr_accessor :sgb_count
|
17
|
-
@sgb_count
|
18
|
-
|
19
11
|
attr_accessor :sgb_color_set
|
20
|
-
@sgb_color_set
|
21
12
|
|
22
13
|
def initialize
|
23
|
-
super GBTiles::GBR::TileSet::
|
14
|
+
super GBTiles::GBR::TileSet::OBJECT_TYPE[:tile_pal]
|
24
15
|
end
|
25
16
|
|
26
17
|
def self.initFromBitString src
|
@@ -5,40 +5,19 @@ module GBTiles
|
|
5
5
|
class TileSettings < GBTiles::GBR::TileSet::Object
|
6
6
|
|
7
7
|
attr_accessor :tile_id
|
8
|
-
@tile_id
|
9
|
-
|
10
8
|
attr_accessor :simple
|
11
|
-
@simple
|
12
|
-
|
13
9
|
attr_accessor :flags
|
14
|
-
@flags
|
15
|
-
|
16
10
|
attr_accessor :left_color
|
17
|
-
@left_color
|
18
|
-
|
19
11
|
attr_accessor :right_color
|
20
|
-
@right_color
|
21
|
-
|
22
12
|
attr_accessor :split_width
|
23
|
-
@split_width
|
24
|
-
|
25
13
|
attr_accessor :split_height
|
26
|
-
@split_height
|
27
|
-
|
28
14
|
attr_accessor :split_order
|
29
|
-
@split_order
|
30
|
-
|
31
15
|
attr_accessor :color_set
|
32
|
-
@color_set
|
33
|
-
|
34
16
|
attr_accessor :bookmarks
|
35
|
-
@bookmarks
|
36
|
-
|
37
17
|
attr_accessor :auto_update
|
38
|
-
@auto_update
|
39
18
|
|
40
19
|
def initialize
|
41
|
-
super GBTiles::GBR::TileSet::
|
20
|
+
super GBTiles::GBR::TileSet::OBJECT_TYPE[:tile_settings]
|
42
21
|
end
|
43
22
|
|
44
23
|
def self.initFromBitString src
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module GBTiles
|
2
2
|
module GBR
|
3
3
|
module TileSet
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
SGB_PALETTES = {
|
5
|
+
:none => 0,
|
6
|
+
:constant_per_entry => 1,
|
7
|
+
:per_entry_2_bits => 2, # 2_bits_per_entry
|
8
|
+
:per_entry_4_bits => 3, # 4_bits_per_entry
|
9
|
+
:per_entry_1_byte => 4 # 1_byte_per_entry
|
10
|
+
}
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -4,51 +4,62 @@ module GBTiles
|
|
4
4
|
class TileSet
|
5
5
|
|
6
6
|
attr_accessor :objects
|
7
|
-
@objects
|
8
7
|
|
9
8
|
def initialize
|
10
9
|
@objects = []
|
11
10
|
end
|
12
11
|
|
13
|
-
def
|
12
|
+
def producer
|
14
13
|
@objects.select{ |a|
|
15
|
-
a.
|
14
|
+
a.object_type == GBTiles::GBR::TileSet::OBJECT_TYPE[:producer]
|
16
15
|
}
|
17
16
|
end
|
18
17
|
|
19
18
|
def tile_data
|
20
19
|
@objects.select{ |a|
|
21
|
-
a.
|
20
|
+
a.object_type == GBTiles::GBR::TileSet::OBJECT_TYPE[:tile_data]
|
22
21
|
}
|
23
22
|
end
|
24
23
|
|
25
24
|
def tile_settings
|
26
25
|
@objects.select{ |a|
|
27
|
-
a.
|
26
|
+
a.object_type == GBTiles::GBR::TileSet::OBJECT_TYPE[:tile_settings]
|
28
27
|
}
|
29
28
|
end
|
30
29
|
|
31
30
|
def tile_export
|
32
31
|
@objects.select{ |a|
|
33
|
-
a.
|
32
|
+
a.object_type == GBTiles::GBR::TileSet::OBJECT_TYPE[:tile_export]
|
34
33
|
}
|
35
34
|
end
|
36
35
|
|
37
36
|
def tile_import
|
38
37
|
@objects.select{ |a|
|
39
|
-
a.
|
38
|
+
a.object_type == GBTiles::GBR::TileSet::OBJECT_TYPE[:tile_import]
|
40
39
|
}
|
41
40
|
end
|
42
41
|
|
43
42
|
def palettes
|
44
43
|
@objects.select{ |a|
|
45
|
-
a.
|
44
|
+
a.object_type == GBTiles::GBR::TileSet::OBJECT_TYPE[:palettes]
|
46
45
|
}
|
47
46
|
end
|
48
47
|
|
49
48
|
def tile_pal
|
50
49
|
@objects.select{ |a|
|
51
|
-
a.
|
50
|
+
a.object_type == GBTiles::GBR::TileSet::OBJECT_TYPE[:tile_pal]
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
def deleted
|
55
|
+
@objects.select{ |a|
|
56
|
+
a.object_type == GBTiles::GBR::TileSet::OBJECT_TYPE[:deleted]
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
def unknown
|
61
|
+
@objects.select{ |a|
|
62
|
+
GBTiles::GBR::TileSet::OBJECT_TYPE.key(a.object_type).nil?
|
52
63
|
}
|
53
64
|
end
|
54
65
|
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
module GBTiles
|
2
2
|
module DataType
|
3
|
-
def self.string
|
3
|
+
def self.string src, length = nil
|
4
|
+
if src.nil? then
|
5
|
+
return nil
|
6
|
+
end
|
7
|
+
|
4
8
|
if !length.nil? then
|
5
9
|
string = src.slice(0, length)
|
6
10
|
else
|
@@ -11,14 +15,18 @@ module GBTiles
|
|
11
15
|
string = string.split(/\0/).first
|
12
16
|
end
|
13
17
|
|
14
|
-
if !string.nil?
|
18
|
+
if !string.nil? then
|
15
19
|
string = string.unpack("A*")[0]
|
16
20
|
end
|
17
21
|
|
18
22
|
string
|
19
23
|
end
|
20
24
|
|
21
|
-
def self.string!
|
25
|
+
def self.string! src, length = nil
|
26
|
+
if src.nil? then
|
27
|
+
return nil
|
28
|
+
end
|
29
|
+
|
22
30
|
if !length.nil? then
|
23
31
|
string = src.slice!(0, length)
|
24
32
|
else
|
@@ -31,42 +39,42 @@ module GBTiles
|
|
31
39
|
# WORD
|
32
40
|
# LITTLE ENDIAN
|
33
41
|
# 2 BYTES
|
34
|
-
def self.word
|
42
|
+
def self.word src
|
35
43
|
src.slice(0, 2).unpack("v*")[0]
|
36
44
|
end
|
37
45
|
|
38
|
-
def self.word!
|
46
|
+
def self.word! src
|
39
47
|
self.word(src.slice!(0, 2))
|
40
48
|
end
|
41
49
|
|
42
50
|
# BYTE
|
43
51
|
# 1 BYTE
|
44
|
-
def self.byte
|
52
|
+
def self.byte src
|
45
53
|
src.slice(0, 1).unpack("C*")[0]
|
46
54
|
end
|
47
55
|
|
48
|
-
def self.byte!
|
56
|
+
def self.byte! src
|
49
57
|
self.byte(src.slice!(0, 1))
|
50
58
|
end
|
51
59
|
|
52
60
|
# BOOLEAN
|
53
61
|
# 1 BYTE
|
54
|
-
def self.boolean
|
62
|
+
def self.boolean src
|
55
63
|
src.slice!(0, 1).unpack("C")[0].eql? 1
|
56
64
|
end
|
57
65
|
|
58
|
-
def self.boolean!
|
66
|
+
def self.boolean! src
|
59
67
|
self.boolean(src.slice!(0, 1))
|
60
68
|
end
|
61
69
|
|
62
70
|
# LITTLE ENDIAN
|
63
71
|
# 32 BIT INTEGER
|
64
72
|
# 4 BYTES
|
65
|
-
def self.long
|
73
|
+
def self.long src
|
66
74
|
src.slice(0, 4).unpack("V*")[0]
|
67
75
|
end
|
68
76
|
|
69
|
-
def self.long!
|
77
|
+
def self.long! src
|
70
78
|
self.long(src.slice!(0, 4))
|
71
79
|
end
|
72
80
|
end
|
data/lib/gbtiles/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gbtiles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bashkim Isai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -24,6 +24,48 @@ dependencies:
|
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.12.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.3.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.3.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: simplecov
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.10.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.10.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: codeclimate-test-reporter
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
27
69
|
description: 'Allows files created by Harry Mulder''s Game Boy Map Builder and Game
|
28
70
|
Boy Tile Designer to be converted in to different file formats for use in Game Boy
|
29
71
|
game development (e.g.: with GBDK)'
|
@@ -38,12 +80,12 @@ files:
|
|
38
80
|
- README.md
|
39
81
|
- bin/gbm
|
40
82
|
- bin/gbr
|
41
|
-
- lib/gbtiles/data_type.rb
|
42
83
|
- lib/gbtiles/gbm/cli/convert.rb
|
43
84
|
- lib/gbtiles/gbm/export/asm/asm.h.erb
|
44
85
|
- lib/gbtiles/gbm/export/asm/asm.rb
|
45
86
|
- lib/gbtiles/gbm/export/asm/asm.s.erb
|
46
87
|
- lib/gbtiles/gbm/import/gbm_file.rb
|
88
|
+
- lib/gbtiles/gbm/layer.rb
|
47
89
|
- lib/gbtiles/gbm/map/map_set.rb
|
48
90
|
- lib/gbtiles/gbm/map/object.rb
|
49
91
|
- lib/gbtiles/gbm/map/object_type.rb
|
@@ -74,6 +116,7 @@ files:
|
|
74
116
|
- lib/gbtiles/gbr/tile_set/sgb_palettes.rb
|
75
117
|
- lib/gbtiles/gbr/tile_set/split_order.rb
|
76
118
|
- lib/gbtiles/gbr/tile_set/tile_set.rb
|
119
|
+
- lib/gbtiles/helpers/data_type.rb
|
77
120
|
- lib/gbtiles/helpers/fixnum.rb
|
78
121
|
- lib/gbtiles/version.rb
|
79
122
|
homepage: http://github.com/bashaus/gbtiles
|
@@ -97,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
140
|
version: '0'
|
98
141
|
requirements: []
|
99
142
|
rubyforge_project:
|
100
|
-
rubygems_version: 2.
|
143
|
+
rubygems_version: 2.4.6
|
101
144
|
signing_key:
|
102
145
|
specification_version: 4
|
103
146
|
summary: Converts .GBR and .GBM files to different Game Boy formats
|