raylib-bindings-tileson 0.6.0pre-arm64-darwin

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: 45b1741a3cbd2d3254fa9ba2541dde45c4ad08d46ea869d7b2c66c8c47b96eb9
4
+ data.tar.gz: 7ec1dba14da575ba9fba28bc312714e15f47bd43576a1270b1e0d9521d2d2433
5
+ SHA512:
6
+ metadata.gz: 3bb5c65419a9f8bddd2855752778dc9c55c0d4ac3f9eed5ec8aae2af20b494b66b791a4e1a90eac82215c49cb4c851a418ab5c88b7a1e05635aae9e7e4d6a88f
7
+ data.tar.gz: 9ec0a2d1829a9276918ebfb6de9bbbbf08125228995bd70bba15c70833a26ca280d2d26fada6a0991e1a542d4b73540752f445dc79c375a88b4ef9b9159ad39e
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
Binary file
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,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: raylib-bindings-tileson
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.0pre
5
+ platform: arm64-darwin
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.arm64.dylib
56
+ - lib/tileson.rb
57
+ homepage: https://github.com/vaiorabbit/raylib-bindings-tileson
58
+ licenses:
59
+ - BSD 2-Clause License
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 3.0.0
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubygems_version: 3.5.3
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: Ruby bindings for raylib-tileson
80
+ test_files: []