libtcod 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -4
- data/LICENSE +21 -21
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/bin/libtcod-ruby-test +344 -344
- data/clib/i686/libSDL.dylib +0 -0
- data/clib/i686/libtcod.dylib +0 -0
- data/clib/powerpc/libSDL.dylib +0 -0
- data/clib/powerpc/libtcod.dylib +0 -0
- data/lib/libtcod.rb +11 -11
- data/lib/libtcod/bindings.rb +657 -654
- data/lib/libtcod/color_consts.rb +225 -225
- data/lib/libtcod/consts.rb +218 -218
- data/lib/libtcod/struct.rb +34 -34
- data/lib/libtcod/system.rb +7 -7
- data/lib/libtcod/version.rb +1 -1
- data/libtcod.gemspec +21 -21
- data/test/color.rb +39 -39
- data/test/console.rb +8 -8
- metadata +14 -12
data/lib/libtcod/struct.rb
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
module TCOD
|
2
|
-
# Wrapper for FFI::Struct which allows access of
|
3
|
-
# properties by method as well as indexing.
|
4
|
-
|
5
|
-
class MethodStruct < FFI::Struct
|
6
|
-
class << self
|
7
|
-
alias_method :old_layout, :layout
|
8
|
-
|
9
|
-
def layout(*keys)
|
10
|
-
old_layout(*keys)
|
11
|
-
keys.each_slice(2).each do |key,type|
|
12
|
-
define_method(key) do
|
13
|
-
self[key]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class MethodUnion < FFI::Union
|
21
|
-
class << self
|
22
|
-
alias_method :old_layout, :layout
|
23
|
-
|
24
|
-
def layout(*keys)
|
25
|
-
old_layout(*keys)
|
26
|
-
keys.each_slice(2).each do |key,type|
|
27
|
-
define_method(key) do
|
28
|
-
self[key]
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
1
|
+
module TCOD
|
2
|
+
# Wrapper for FFI::Struct which allows access of
|
3
|
+
# properties by method as well as indexing.
|
4
|
+
|
5
|
+
class MethodStruct < FFI::Struct
|
6
|
+
class << self
|
7
|
+
alias_method :old_layout, :layout
|
8
|
+
|
9
|
+
def layout(*keys)
|
10
|
+
old_layout(*keys)
|
11
|
+
keys.each_slice(2).each do |key,type|
|
12
|
+
define_method(key) do
|
13
|
+
self[key]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class MethodUnion < FFI::Union
|
21
|
+
class << self
|
22
|
+
alias_method :old_layout, :layout
|
23
|
+
|
24
|
+
def layout(*keys)
|
25
|
+
old_layout(*keys)
|
26
|
+
keys.each_slice(2).each do |key,type|
|
27
|
+
define_method(key) do
|
28
|
+
self[key]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/libtcod/system.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
module TCOD
|
2
|
-
module System
|
3
|
-
def self.register_sdl_renderer(&b)
|
4
|
-
TCOD.sys_register_SDL_renderer(&b)
|
5
|
-
end
|
6
|
-
end
|
7
|
-
end
|
1
|
+
module TCOD
|
2
|
+
module System
|
3
|
+
def self.register_sdl_renderer(&b)
|
4
|
+
TCOD.sys_register_SDL_renderer(&b)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
data/lib/libtcod/version.rb
CHANGED
data/libtcod.gemspec
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path('../lib/libtcod/version', __FILE__)
|
3
|
-
|
4
|
-
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = ["Jaiden Mispy"]
|
6
|
-
gem.email = ["mispy@staff.draftable.com"]
|
7
|
-
gem.description = %q{Ruby bindings for the libtcod roguelike library}
|
8
|
-
gem.summary = %q{Ruby bindings for the libtcod roguelike library}
|
9
|
-
gem.homepage = ""
|
10
|
-
|
11
|
-
gem.files = `git ls-files`.split($\)
|
12
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
-
gem.name = "libtcod"
|
15
|
-
gem.require_paths = ["lib"]
|
16
|
-
gem.version = TCOD::VERSION
|
17
|
-
|
18
|
-
gem.add_development_dependency 'minitest'
|
19
|
-
|
20
|
-
gem.add_runtime_dependency 'ffi'
|
21
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/libtcod/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Jaiden Mispy"]
|
6
|
+
gem.email = ["mispy@staff.draftable.com"]
|
7
|
+
gem.description = %q{Ruby bindings for the libtcod roguelike library}
|
8
|
+
gem.summary = %q{Ruby bindings for the libtcod roguelike library}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "libtcod"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = TCOD::VERSION
|
17
|
+
|
18
|
+
gem.add_development_dependency 'minitest'
|
19
|
+
|
20
|
+
gem.add_runtime_dependency 'ffi', '~> 1.9.3'
|
21
|
+
end
|
data/test/color.rb
CHANGED
@@ -1,39 +1,39 @@
|
|
1
|
-
require_relative 'helpers'
|
2
|
-
require 'libtcod'
|
3
|
-
require 'minitest/autorun'
|
4
|
-
|
5
|
-
class TestColor < Minitest::Test
|
6
|
-
def setup
|
7
|
-
@c1 = TCOD::Color.rgb(255,0,1)
|
8
|
-
@c2 = TCOD::Color.rgb(100,4,58)
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_create_colors
|
12
|
-
c = TCOD::Color.rgb(5,5,5)
|
13
|
-
c2 = TCOD::Color.hsv(5,5,5)
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_compare_colors
|
17
|
-
c1 = TCOD::Color.rgb(2, 4, 8)
|
18
|
-
c2 = TCOD::Color.rgb(2, 4, 8)
|
19
|
-
c3 = TCOD::Color.rgb(8, 16, 32)
|
20
|
-
assert_equal c1, c2
|
21
|
-
refute_equal c1, c3
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_multiply_colors
|
25
|
-
c1 = TCOD::Color.rgb(55,100,250)
|
26
|
-
c2 = TCOD::Color.rgb(70, 130, 224)
|
27
|
-
c3 = c1 * c2
|
28
|
-
assert_equal c3, TCOD::Color.rgb(15, 50, 219)
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_multiply_colors_float
|
32
|
-
c1 = TCOD::Color.rgb(55,100,250)
|
33
|
-
c2 = c1*2
|
34
|
-
assert_equal c2, TCOD::Color.rgb(110, 200, 255)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_adding_colors
|
38
|
-
end
|
39
|
-
end
|
1
|
+
require_relative 'helpers'
|
2
|
+
require 'libtcod'
|
3
|
+
require 'minitest/autorun'
|
4
|
+
|
5
|
+
class TestColor < Minitest::Test
|
6
|
+
def setup
|
7
|
+
@c1 = TCOD::Color.rgb(255,0,1)
|
8
|
+
@c2 = TCOD::Color.rgb(100,4,58)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_create_colors
|
12
|
+
c = TCOD::Color.rgb(5,5,5)
|
13
|
+
c2 = TCOD::Color.hsv(5,5,5)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_compare_colors
|
17
|
+
c1 = TCOD::Color.rgb(2, 4, 8)
|
18
|
+
c2 = TCOD::Color.rgb(2, 4, 8)
|
19
|
+
c3 = TCOD::Color.rgb(8, 16, 32)
|
20
|
+
assert_equal c1, c2
|
21
|
+
refute_equal c1, c3
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_multiply_colors
|
25
|
+
c1 = TCOD::Color.rgb(55,100,250)
|
26
|
+
c2 = TCOD::Color.rgb(70, 130, 224)
|
27
|
+
c3 = c1 * c2
|
28
|
+
assert_equal c3, TCOD::Color.rgb(15, 50, 219)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_multiply_colors_float
|
32
|
+
c1 = TCOD::Color.rgb(55,100,250)
|
33
|
+
c2 = c1*2
|
34
|
+
assert_equal c2, TCOD::Color.rgb(110, 200, 255)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_adding_colors
|
38
|
+
end
|
39
|
+
end
|
data/test/console.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require_relative 'helpers'
|
2
|
-
require 'libtcod'
|
3
|
-
require 'minitest/autorun'
|
4
|
-
|
5
|
-
class TestConsole < Minitest::Test
|
6
|
-
def setup
|
7
|
-
end
|
8
|
-
end
|
1
|
+
require_relative 'helpers'
|
2
|
+
require 'libtcod'
|
3
|
+
require 'minitest/autorun'
|
4
|
+
|
5
|
+
class TestConsole < Minitest::Test
|
6
|
+
def setup
|
7
|
+
end
|
8
|
+
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libtcod
|
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
|
- Jaiden Mispy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ffi
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.9.3
|
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:
|
40
|
+
version: 1.9.3
|
41
41
|
description: Ruby bindings for the libtcod roguelike library
|
42
42
|
email:
|
43
43
|
- mispy@staff.draftable.com
|
@@ -47,7 +47,7 @@ executables:
|
|
47
47
|
extensions: []
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
|
-
- .gitignore
|
50
|
+
- ".gitignore"
|
51
51
|
- Gemfile
|
52
52
|
- LICENSE
|
53
53
|
- README.md
|
@@ -64,6 +64,8 @@ files:
|
|
64
64
|
- clib/i686/libtcod-mingw.dll
|
65
65
|
- clib/i686/libtcod.dylib
|
66
66
|
- clib/i686/libtcod.so
|
67
|
+
- clib/powerpc/libSDL.dylib
|
68
|
+
- clib/powerpc/libtcod.dylib
|
67
69
|
- examples/python_tutorial_part_1/arial10x10.png
|
68
70
|
- examples/python_tutorial_part_1/main.rb
|
69
71
|
- examples/python_tutorial_part_1/terminal.png
|
@@ -92,17 +94,17 @@ require_paths:
|
|
92
94
|
- lib
|
93
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
96
|
requirements:
|
95
|
-
- -
|
97
|
+
- - ">="
|
96
98
|
- !ruby/object:Gem::Version
|
97
99
|
version: '0'
|
98
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
101
|
requirements:
|
100
|
-
- -
|
102
|
+
- - ">="
|
101
103
|
- !ruby/object:Gem::Version
|
102
104
|
version: '0'
|
103
105
|
requirements: []
|
104
106
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.
|
107
|
+
rubygems_version: 2.2.2
|
106
108
|
signing_key:
|
107
109
|
specification_version: 4
|
108
110
|
summary: Ruby bindings for the libtcod roguelike library
|