raylib-bindings-tileson 0.6.0pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 98b967797b7796c2f9e552b92fc2d4a7f082115a4c7a1ca81abf2e593e0d517d
4
+ data.tar.gz: 48bd5b0a3a7b392a2bf44a05b61f8810db5a99a9dbcb8ac845dfaf8dc5ef3dfe
5
+ SHA512:
6
+ metadata.gz: bbd90c62fe0297c6ff8b21f77735f57700c9aca173b3105aeb052118c06319d701fccd3b979050abc2837a87953f5faa3b1b766dd93795f1586e39f64d1d125c
7
+ data.tar.gz: ae4568c21c18221604ec084af82d373f7658686d2447056a947dcccc50bd1a4bd3e4f2cbff0d2c9acebf3c27258016c7e5f3cb806f771c26e02a3388ba19e7c4
data/ChangeLog ADDED
@@ -0,0 +1,3 @@
1
+ 2023-12-29 vaiorabbit <http://twitter.com/vaiorabbit>
2
+
3
+ * v0.6.0
data/LICENSE.txt ADDED
@@ -0,0 +1,25 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2023 vaiorabbit <http://twitter.com/vaiorabbit>
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,74 @@
1
+ <!-- -*- mode:markdown; coding:utf-8; -*- -->
2
+
3
+ # raylib-tileson wrapper for Ruby #
4
+
5
+ * Created : 2023-12-23
6
+ * Last modified : 2023-12-29
7
+
8
+ Provides Ruby bindings for raylib-tileson ( https://github.com/RobLoach/raylib-tileson )
9
+
10
+ ## Features ##
11
+
12
+ * Based on Ruby/FFI ( https://github.com/ffi/ffi )
13
+ * Pre-built binaries are inside:
14
+ * Windows (x86_64)
15
+ * macOS (x86_64, ARM64)
16
+ * Linux (x86_64, ARM64)
17
+
18
+ ## Quick Start ##
19
+
20
+ ```
21
+ D:\> gem install raylib-bindings
22
+ D:\> gem install raylib-bindings-tileson
23
+ ...
24
+ D:\> cd examples
25
+ D:\> ruby test.rb
26
+ ```
27
+
28
+ ## Prerequisites ##
29
+
30
+ * Ruby interpreter
31
+ * Tested on:
32
+ * [macOS] https://rvm.io
33
+ * ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
34
+ * [Windows] https://rubyinstaller.org/downloads/ Ruby+Devkit
35
+ * ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x64-mingw-ucrt]
36
+ * [Linux/x86_64 WSL] https://github.com/rvm/ubuntu_rvm
37
+ * ruby 3.2.0preview1 (2022-04-03 master f801386f0c) [x86_64-linux]
38
+ * [Linux/ARM64 Chromebook] https://github.com/rvm/ubuntu_rvm
39
+ * ruby 3.2.0 (2022-12-25 revision a528908271) [aarch64-linux]
40
+
41
+ ## License ##
42
+
43
+ Shared libraries in `lib` directory are built on top of these products and are available under the terms of these licenses:
44
+
45
+ * raylib-tileson
46
+ * <https://github.com/RobLoach/raylib-tileson/blob/master/LICENSE>
47
+
48
+ All ruby codes here are available under the terms of the 2-clause BSD License:
49
+
50
+ BSD 2-Clause License
51
+
52
+ Copyright (c) 2023 vaiorabbit <http://twitter.com/vaiorabbit>
53
+ All rights reserved.
54
+
55
+ Redistribution and use in source and binary forms, with or without
56
+ modification, are permitted provided that the following conditions are met:
57
+
58
+ 1. Redistributions of source code must retain the above copyright notice, this
59
+ list of conditions and the following disclaimer.
60
+
61
+ 2. Redistributions in binary form must reproduce the above copyright notice,
62
+ this list of conditions and the following disclaimer in the documentation
63
+ and/or other materials provided with the distribution.
64
+
65
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
66
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
67
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
68
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
69
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
70
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
71
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
72
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
73
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
74
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/examples/test.rb ADDED
@@ -0,0 +1,24 @@
1
+ require_relative 'util/setup_dll'
2
+ require_relative 'util/resource_path'
3
+
4
+ if __FILE__ == $PROGRAM_NAME
5
+ screen_width = 800
6
+ screen_height = 450
7
+ position = Vector2.create
8
+
9
+ InitWindow(screen_width, screen_height, "Yet Another Ruby-raylib bindings")
10
+ SetTargetFPS(60)
11
+
12
+ map = LoadTiled("#{RAYLIB_TILESON_RESOURCE_PATH}resources/desert.json")
13
+
14
+ until WindowShouldClose()
15
+ BeginDrawing()
16
+ ClearBackground(RAYWHITE)
17
+ DrawTiled(map, position.x, position.y, WHITE)
18
+ EndDrawing()
19
+ end
20
+
21
+ UnloadMap(map)
22
+
23
+ CloseWindow()
24
+ end
data/lib/tileson.rb ADDED
@@ -0,0 +1,59 @@
1
+ # Yet another raylib wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/raylib-bindings-tileson
4
+
5
+ require 'ffi'
6
+ require 'raylib'
7
+
8
+ module Raylib
9
+ extend FFI::Library
10
+
11
+ # Struct
12
+
13
+ class Map < FFI::Struct
14
+ layout(
15
+ :width, :int,
16
+ :height, :int,
17
+ :tileWidth, :int,
18
+ :tileHeight, :int,
19
+ :data, :pointer,
20
+ )
21
+ def width = self[:width]
22
+ def width=(v) self[:width] = v end
23
+ def height = self[:height]
24
+ def height=(v) self[:height] = v end
25
+ def tileWidth = self[:tileWidth]
26
+ def tileWidth=(v) self[:tileWidth] = v end
27
+ def tileHeight = self[:tileHeight]
28
+ def tileHeight=(v) self[:tileHeight] = v end
29
+ def data = self[:data]
30
+ def data=(v) self[:data] = v end
31
+ end
32
+
33
+
34
+ # Function
35
+
36
+ def self.setup_tileson_symbols
37
+ entries = [
38
+ [:LoadTiledFromMemory, :LoadTiledFromMemory, [:pointer, :int, :pointer], Map.by_value],
39
+ [:LoadTiled, :LoadTiled, [:pointer], Map.by_value],
40
+ [:IsTiledReady, :IsTiledReady, [], :bool],
41
+ [:DrawTiled, :DrawTiled, [Map.by_value, :int, :int, Color.by_value], :bool],
42
+ [:UnloadMap, :UnloadMap, [Map.by_value], :void],
43
+ ]
44
+ entries.each do |entry|
45
+ attach_function entry[0], entry[1], entry[2], entry[3]
46
+ rescue FFI::NotFoundError => e
47
+ warn "[Warning] Failed to import #{entry[0]} (#{e})."
48
+ end
49
+ end
50
+
51
+ def self.load_tileson_lib(libpath)
52
+ ffi_lib_flags :now, :global
53
+ ffi_lib(libpath)
54
+ setup_tileson_symbols
55
+ rescue LoadError => e
56
+ warn e
57
+ end
58
+
59
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: raylib-bindings-tileson
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.0pre
5
+ platform: ruby
6
+ authors:
7
+ - vaiorabbit
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-12-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ffi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: raylib-bindings
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.6.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.6.0
41
+ description: 'Ruby bindings for raylib-tileson ( https://github.com/RobLoach/raylib-tileson
42
+ )
43
+
44
+ '
45
+ email:
46
+ - vaiorabbit@gmail.com
47
+ executables: []
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - ChangeLog
52
+ - LICENSE.txt
53
+ - README.md
54
+ - examples/test.rb
55
+ - lib/tileson.rb
56
+ homepage: https://github.com/vaiorabbit/raylib-bindings-tileson
57
+ licenses:
58
+ - BSD 2-Clause License
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 3.0.0
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubygems_version: 3.5.3
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: Ruby bindings for raylib-tileson
79
+ test_files: []