raylib-bindings-tileson 0.6.0pre-x86_64-darwin
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 +7 -0
- data/ChangeLog +3 -0
- data/LICENSE.txt +25 -0
- data/README.md +74 -0
- data/examples/test.rb +24 -0
- data/lib/tileson.rb +59 -0
- data/lib/tileson.x86_64.dylib +0 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ba0588942785f819822690639a2b41361d45abfa73108dd601a199b45f9be992
|
4
|
+
data.tar.gz: 169baae0d8dc32e4fb4672aa944d70d742f265c34cc7ec461f2559331525ef49
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 922ec2336bf4a7cd7ac65a905925f9ce432ebea85c065bf20da499d0235e2fc1dee630ba05758523e5e7b47a496d6acf4ae8cdd7321d58a132d3736e908a2b86
|
7
|
+
data.tar.gz: 01a9295935212a9f53d75defd25a50e9bc8fc6e99ad6d03289e26118632ccd97067bc12373fe3ee2ef4e8fb2d6d33c826adaab062cefbaaeac888026f63f8b0e
|
data/ChangeLog
ADDED
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
|
Binary file
|
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: x86_64-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.rb
|
56
|
+
- lib/tileson.x86_64.dylib
|
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: []
|