libtcod 0.0.1 → 0.0.2

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.
@@ -0,0 +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,3 +1,3 @@
1
- module Libtcod
2
- VERSION = "0.0.1"
1
+ module TCOD
2
+ VERSION = "0.0.2"
3
3
  end
@@ -13,5 +13,9 @@ Gem::Specification.new do |gem|
13
13
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
14
  gem.name = "libtcod"
15
15
  gem.require_paths = ["lib"]
16
- gem.version = Libtcod::VERSION
16
+ gem.version = TCOD::VERSION
17
+
18
+ gem.add_development_dependency 'minitest'
19
+
20
+ gem.add_runtime_dependency 'ffi'
17
21
  end
Binary file
@@ -0,0 +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
@@ -0,0 +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
@@ -0,0 +1,2 @@
1
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
2
+ $: << File.join(APP_ROOT, 'lib')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libtcod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,40 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-30 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2013-06-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: minitest
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: ffi
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
14
46
  description: Ruby bindings for the libtcod roguelike library
15
47
  email:
16
48
  - mispy@staff.draftable.com
@@ -23,9 +55,25 @@ files:
23
55
  - LICENSE
24
56
  - README.md
25
57
  - Rakefile
58
+ - clib/amd64/libSDL.so
59
+ - clib/amd64/libtcod.so
60
+ - clib/i686/libSDL.so
61
+ - clib/i686/libtcod.so
62
+ - examples/python_tutorial_part_1/arial10x10.png
63
+ - examples/python_tutorial_part_1/main.rb
64
+ - examples/python_tutorial_part_1/terminal.png
26
65
  - lib/libtcod.rb
66
+ - lib/libtcod/bindings.rb
67
+ - lib/libtcod/color_consts.rb
68
+ - lib/libtcod/console.rb
69
+ - lib/libtcod/consts.rb
70
+ - lib/libtcod/struct.rb
27
71
  - lib/libtcod/version.rb
28
72
  - libtcod.gemspec
73
+ - terminal.png
74
+ - test/color.rb
75
+ - test/console.rb
76
+ - test/helpers.rb
29
77
  homepage: ''
30
78
  licenses: []
31
79
  post_install_message:
@@ -50,4 +98,7 @@ rubygems_version: 1.8.24
50
98
  signing_key:
51
99
  specification_version: 3
52
100
  summary: Ruby bindings for the libtcod roguelike library
53
- test_files: []
101
+ test_files:
102
+ - test/color.rb
103
+ - test/console.rb
104
+ - test/helpers.rb