raylib-spinel 0.1.0
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/LICENSE.md +16 -0
- data/README.md +135 -0
- data/lib/physac.h +1987 -0
- data/lib/physac_compat.rb +43 -0
- data/lib/physac_ffi.rb +128 -0
- data/lib/raygui.h +6479 -0
- data/lib/raygui_compat.rb +116 -0
- data/lib/raygui_ffi.rb +714 -0
- data/lib/raylib_audio_fields.rb +115 -0
- data/lib/raylib_camera_fields.rb +16 -0
- data/lib/raylib_compat.rb +72 -0
- data/lib/raylib_ffi.rb +4093 -0
- data/lib/raylib_field_index.rb +593 -0
- data/lib/raylib_handles.rb +427 -0
- data/lib/raylib_handles_ffi.rb +255 -0
- data/lib/raylib_include.rb +2414 -0
- data/lib/raylib_model_ref.rb +99 -0
- data/lib/raylib_pointer_fields.rb +153 -0
- data/lib/raylib_ruby.rb +614 -0
- data/lib/raylib_sizes.rb +128 -0
- data/lib/raylib_struct_fields.rb +102 -0
- data/lib/raylib_structs.rb +174 -0
- data/lib/raymath_ffi.rb +1014 -0
- data/lib/rcamera_ffi.rb +113 -0
- data/lib/rl_handle_views.h +83 -0
- data/lib/rlgl_constants.rb +382 -0
- data/lib/rlgl_ffi.rb +1016 -0
- data/raylib-spinel/physac.rb +13 -0
- data/raylib-spinel/raygui.rb +14 -0
- data/raylib-spinel/raymath.rb +15 -0
- data/raylib-spinel/rcamera.rb +15 -0
- data/raylib-spinel/rlgl.rb +13 -0
- data/raylib-spinel.rb +56 -0
- data/raylib.rb +37 -0
- data/spin.toml +21 -0
- metadata +97 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Opt-in physac loader for Spinel AOT.
|
|
4
|
+
#
|
|
5
|
+
# `require "raylib-spinel/physac"` splices in lib/physac_ffi.rb; physac itself is
|
|
6
|
+
# compiled into lib/physac_adapter.o + lib/physac_impl.o (linked into the physics
|
|
7
|
+
# scene). Under CRuby the raylib-bindings gem already binds physac.
|
|
8
|
+
if RUBY_ENGINE == "spinel"
|
|
9
|
+
require_relative "../lib/physac_ffi"
|
|
10
|
+
require_relative "../lib/physac_compat"
|
|
11
|
+
else
|
|
12
|
+
# no-op under CRuby
|
|
13
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Opt-in raygui loader for Spinel AOT.
|
|
4
|
+
#
|
|
5
|
+
# `require "raylib-spinel/raygui"` splices in lib/raygui_ffi.rb; raygui itself
|
|
6
|
+
# is compiled into lib/raygui_adapter.o (linked into the gui scenes). Under
|
|
7
|
+
# CRuby the raylib-bindings gem already binds raygui.
|
|
8
|
+
if RUBY_ENGINE == "spinel"
|
|
9
|
+
require_relative "../lib/raygui_ffi"
|
|
10
|
+
# Gem-shaped RGui* helpers (Rectangle bounds, value-first returns).
|
|
11
|
+
require_relative "../lib/raygui_compat"
|
|
12
|
+
else
|
|
13
|
+
# no-op under CRuby
|
|
14
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Opt-in raymath loader.
|
|
2
|
+
#
|
|
3
|
+
# `require "raylib-spinel/raymath"` exposes the raymath math functions under
|
|
4
|
+
# Raylib (Vector2Add, Vector2Scale, ...) on both backends.
|
|
5
|
+
# - MRI: the raylib-bindings gem already binds every raymath function onto
|
|
6
|
+
# Raylib, so there is nothing to do; the gem's raymath.rb is loaded as
|
|
7
|
+
# part of `require "raylib-spinel"`.
|
|
8
|
+
# - Spinel: the literal require_relative below is spliced at compile time and
|
|
9
|
+
# drags in lib/raymath_ffi.rb, whose module Raylib blocks declare the same
|
|
10
|
+
# PascalCase surface (the rl_* pointer shims live in raylib_adapter.c).
|
|
11
|
+
if RUBY_ENGINE == "spinel"
|
|
12
|
+
require_relative "../lib/raymath_ffi"
|
|
13
|
+
else
|
|
14
|
+
# no-op under CRuby
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Opt-in rcamera loader.
|
|
2
|
+
#
|
|
3
|
+
# `require "raylib-spinel/rcamera"` exposes the rcamera camera helpers under
|
|
4
|
+
# Raylib (GetCameraForward, CameraYaw, ...) on both backends.
|
|
5
|
+
# - MRI: the raylib-bindings gem already binds every rcamera function onto
|
|
6
|
+
# Raylib, so there is nothing to do.
|
|
7
|
+
# - Spinel: the literal require_relative below is spliced at compile time and
|
|
8
|
+
# drags in lib/rcamera_ffi.rb, whose module Raylib block declares the same
|
|
9
|
+
# PascalCase surface (the rl_* pointer shims live in rcamera_adapter.c;
|
|
10
|
+
# link it with --link lib/rcamera_adapter.o).
|
|
11
|
+
if RUBY_ENGINE == "spinel"
|
|
12
|
+
require_relative "../lib/rcamera_ffi"
|
|
13
|
+
else
|
|
14
|
+
# no-op under CRuby
|
|
15
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Opt-in rlgl loader for Spinel AOT.
|
|
4
|
+
#
|
|
5
|
+
# `require "raylib-spinel/rlgl"` splices in lib/rlgl_ffi.rb, whose Rlgl module
|
|
6
|
+
# declares the immediate-mode rl* functions (resolved against libraylib) plus
|
|
7
|
+
# the rl_* matrix/renderbatch shims. Under CRuby the raylib-bindings gem already
|
|
8
|
+
# exposes rlgl via its Rlgl module.
|
|
9
|
+
if RUBY_ENGINE == "spinel"
|
|
10
|
+
require_relative "../lib/rlgl_ffi"
|
|
11
|
+
else
|
|
12
|
+
# no-op under CRuby
|
|
13
|
+
end
|
data/raylib-spinel.rb
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# raylib-spinel.rb — the package core behind both entry points.
|
|
2
|
+
#
|
|
3
|
+
# `require "raylib-spinel"` loads this file directly; raylib.rb — the
|
|
4
|
+
# `require "raylib"` entry — requires it too and adds the Spinel-side
|
|
5
|
+
# extras (the per-library loaders and the include-able instance methods).
|
|
6
|
+
#
|
|
7
|
+
# Under Spinel AOT the package's raylib_ffi.rb provides the FFI declarations and
|
|
8
|
+
# the spinel-side object wrappers; the carried raylib_adapter.c (auto-compiled
|
|
9
|
+
# and linked by spin) supplies the struct/bool shims.
|
|
10
|
+
#
|
|
11
|
+
# Under CRuby the raylib-bindings gem provides the same PascalCase surface;
|
|
12
|
+
# raylib_ruby.rb loads the system gem by its full path and adds the few helpers
|
|
13
|
+
# that mirror our spinel-side additions.
|
|
14
|
+
#
|
|
15
|
+
# RUBY_ENGINE is the discriminator: a compile-time constant under AOT
|
|
16
|
+
# ("spinel", so this branch is the one that runs and the CRuby branch's
|
|
17
|
+
# require is blanked before the textual splice), "ruby" under CRuby.
|
|
18
|
+
#
|
|
19
|
+
# Spinel supports compiling to multiple raylib libraries: raylib, physac,
|
|
20
|
+
# raymath, rcamera, and rlgl. The FFI declarations for each library are
|
|
21
|
+
# generated by tools/<lib>_gen.py and appended to this file.
|
|
22
|
+
#
|
|
23
|
+
# Under MRI, ffi_func/ffi_lib/ffi_cflags are no-ops defined in main.rb.
|
|
24
|
+
|
|
25
|
+
if RUBY_ENGINE == "spinel"
|
|
26
|
+
require_relative "lib/raylib_ffi"
|
|
27
|
+
require_relative "lib/raylib_handles_ffi"
|
|
28
|
+
require_relative "lib/raylib_camera_fields"
|
|
29
|
+
require_relative "lib/raylib_struct_fields"
|
|
30
|
+
require_relative "lib/raylib_audio_fields"
|
|
31
|
+
require_relative "lib/raylib_handles"
|
|
32
|
+
require_relative "lib/raylib_pointer_fields"
|
|
33
|
+
require_relative "lib/raylib_model_ref"
|
|
34
|
+
require_relative "lib/raylib_sizes"
|
|
35
|
+
require_relative "lib/raylib_field_index"
|
|
36
|
+
require_relative "lib/rlgl_constants"
|
|
37
|
+
else
|
|
38
|
+
# Kept as a computed argument on purpose: the dead branch still compiles as
|
|
39
|
+
# a runtime call under Spinel's fold, and dropping the call entirely (a
|
|
40
|
+
# literal require blanks before analysis) changes TU shape enough to tip
|
|
41
|
+
# over the context-sensitive struct-setter boxization (issues/0002 class) in
|
|
42
|
+
# struct-heavy programs like the gem corpus' 01_structs.rb.
|
|
43
|
+
require_relative File.join("lib","raylib_ruby")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Load additional library FFI if available (for multi-library support)
|
|
47
|
+
lib_dir = File.join(__dir__, "lib")
|
|
48
|
+
required_libs = ENV.fetch("SPINEL_RAYLIBS", "").split(",").reject(&:empty?)
|
|
49
|
+
required_libs.each do |lib_name|
|
|
50
|
+
ffi_path = File.join(lib_dir, "#{lib_name}_ffi.rb")
|
|
51
|
+
if File.exist?(ffi_path)
|
|
52
|
+
require_relative ffi_path
|
|
53
|
+
else
|
|
54
|
+
warn "raylib-spinel: #{lib_name}_ffi.rb not found, skipping"
|
|
55
|
+
end
|
|
56
|
+
end
|
data/raylib.rb
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# raylib.rb — MRI-compatible entry point for `require "raylib"`.
|
|
4
|
+
#
|
|
5
|
+
# raylib-bindings projects start with `require "raylib"`. This file is the
|
|
6
|
+
# raylib-spinel package's entry under that name, so unmodified gem code builds
|
|
7
|
+
# with `spin`:
|
|
8
|
+
#
|
|
9
|
+
# MRI: raylib-spinel.rb is a no-op (the gem provides the API); loading it
|
|
10
|
+
# is all that is needed.
|
|
11
|
+
# Spinel: load the full gem-shaped surface — all six libraries, the bundled
|
|
12
|
+
# ffi package, and the include-able instance methods from
|
|
13
|
+
# lib/raylib_include.rb — so `include Raylib` and bare calls work.
|
|
14
|
+
#
|
|
15
|
+
# RUBY_ENGINE is the discriminator ("spinel" under AOT, "ruby" under CRuby);
|
|
16
|
+
# it is a compile-time constant under Spinel, so both branches are parsed and
|
|
17
|
+
# only the live one survives the fold.
|
|
18
|
+
if RUBY_ENGINE == "spinel"
|
|
19
|
+
require "ffi"
|
|
20
|
+
require_relative "raylib-spinel"
|
|
21
|
+
require_relative "raylib-spinel/raymath"
|
|
22
|
+
require_relative "raylib-spinel/rcamera"
|
|
23
|
+
require_relative "raylib-spinel/rlgl"
|
|
24
|
+
require_relative "raylib-spinel/raygui"
|
|
25
|
+
require_relative "raylib-spinel/physac"
|
|
26
|
+
require_relative "lib/raylib_include"
|
|
27
|
+
require_relative "lib/raylib_compat"
|
|
28
|
+
require_relative "lib/raylib_structs"
|
|
29
|
+
require_relative "lib/raylib_pointer_fields"
|
|
30
|
+
require_relative "lib/raylib_model_ref"
|
|
31
|
+
require_relative "lib/raylib_camera_fields"
|
|
32
|
+
require_relative "lib/raylib_struct_fields"
|
|
33
|
+
require_relative "lib/raylib_audio_fields"
|
|
34
|
+
require_relative "lib/raygui_compat"
|
|
35
|
+
else
|
|
36
|
+
require_relative "raylib-spinel"
|
|
37
|
+
end
|
data/spin.toml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "raylib"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
sources = ["lib/raylib_adapter.c", "lib/raymath_adapter.c", "lib/rlgl_adapter.c", "lib/raygui_adapter.c", "lib/raygui_impl.c", "lib/physac_adapter.c", "lib/physac_impl.c", "lib/rcamera_adapter.c"]
|
|
5
|
+
# Development tree, not carried C. spin sweeps the package for .c files and
|
|
6
|
+
# warns about every one that sources does not name, so without this a consumer
|
|
7
|
+
# build prints five warnings for the repro programs under tools/repro (and
|
|
8
|
+
# those nested projects' own thing.c would be compiled into every binary that
|
|
9
|
+
# depends on us). Globs are relative to the package root; naming a directory
|
|
10
|
+
# prunes its subtree (spinel tools/spin.rb, native_excludes).
|
|
11
|
+
exclude = ["tools", "reference"]
|
|
12
|
+
|
|
13
|
+
[native]
|
|
14
|
+
# The carried C includes <raylib.h> & co, and spin compiles that C itself; the
|
|
15
|
+
# flags from `pkg-config --cflags raylib` are the one mechanism that reaches
|
|
16
|
+
# that compile (ffi_cflags reach only the program's own compile+link, whose
|
|
17
|
+
# TU includes no raylib header). Consumers whose pkg-config does not know
|
|
18
|
+
# raylib get a warning and compile without the flags -- their raylib headers
|
|
19
|
+
# must then be on the compiler's default include path, which is where a
|
|
20
|
+
# distro raylib-dev package puts them.
|
|
21
|
+
pkg_config = ["raylib"]
|
metadata
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: raylib-spinel
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- rebuilt
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: raylib-bindings
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 0.8.4
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: 0.8.4
|
|
26
|
+
description: |
|
|
27
|
+
raylib-spinel is the package behind `require "raylib"` under the Spinel AOT
|
|
28
|
+
compiler: FFI declarations, native struct views, and C adapters that are
|
|
29
|
+
compiled together with the program. Under CRuby the same require delegates
|
|
30
|
+
to raylib-bindings, so a game written for that gem runs on either engine
|
|
31
|
+
unmodified.
|
|
32
|
+
email: memoryman51@hotmail.com
|
|
33
|
+
executables: []
|
|
34
|
+
extensions: []
|
|
35
|
+
extra_rdoc_files: []
|
|
36
|
+
files:
|
|
37
|
+
- LICENSE.md
|
|
38
|
+
- README.md
|
|
39
|
+
- lib/physac.h
|
|
40
|
+
- lib/physac_compat.rb
|
|
41
|
+
- lib/physac_ffi.rb
|
|
42
|
+
- lib/raygui.h
|
|
43
|
+
- lib/raygui_compat.rb
|
|
44
|
+
- lib/raygui_ffi.rb
|
|
45
|
+
- lib/raylib_audio_fields.rb
|
|
46
|
+
- lib/raylib_camera_fields.rb
|
|
47
|
+
- lib/raylib_compat.rb
|
|
48
|
+
- lib/raylib_ffi.rb
|
|
49
|
+
- lib/raylib_field_index.rb
|
|
50
|
+
- lib/raylib_handles.rb
|
|
51
|
+
- lib/raylib_handles_ffi.rb
|
|
52
|
+
- lib/raylib_include.rb
|
|
53
|
+
- lib/raylib_model_ref.rb
|
|
54
|
+
- lib/raylib_pointer_fields.rb
|
|
55
|
+
- lib/raylib_ruby.rb
|
|
56
|
+
- lib/raylib_sizes.rb
|
|
57
|
+
- lib/raylib_struct_fields.rb
|
|
58
|
+
- lib/raylib_structs.rb
|
|
59
|
+
- lib/raymath_ffi.rb
|
|
60
|
+
- lib/rcamera_ffi.rb
|
|
61
|
+
- lib/rl_handle_views.h
|
|
62
|
+
- lib/rlgl_constants.rb
|
|
63
|
+
- lib/rlgl_ffi.rb
|
|
64
|
+
- raylib-spinel.rb
|
|
65
|
+
- raylib-spinel/physac.rb
|
|
66
|
+
- raylib-spinel/raygui.rb
|
|
67
|
+
- raylib-spinel/raymath.rb
|
|
68
|
+
- raylib-spinel/rcamera.rb
|
|
69
|
+
- raylib-spinel/rlgl.rb
|
|
70
|
+
- raylib.rb
|
|
71
|
+
- spin.toml
|
|
72
|
+
homepage: https://github.com/rebuilt/raylib-spinel
|
|
73
|
+
licenses:
|
|
74
|
+
- Zlib
|
|
75
|
+
metadata:
|
|
76
|
+
homepage_uri: https://github.com/rebuilt/raylib-spinel
|
|
77
|
+
source_code_uri: https://github.com/rebuilt/raylib-spinel
|
|
78
|
+
bug_tracker_uri: https://github.com/rebuilt/raylib-spinel/issues
|
|
79
|
+
rdoc_options: []
|
|
80
|
+
require_paths:
|
|
81
|
+
- "."
|
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
|
+
requirements:
|
|
84
|
+
- - ">="
|
|
85
|
+
- !ruby/object:Gem::Version
|
|
86
|
+
version: '3.0'
|
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
|
+
requirements:
|
|
89
|
+
- - ">="
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: '0'
|
|
92
|
+
requirements: []
|
|
93
|
+
rubygems_version: 3.7.2
|
|
94
|
+
specification_version: 4
|
|
95
|
+
summary: 'raylib bindings for the Spinel AOT compiler: raylib-bindings'' API, compiled
|
|
96
|
+
games'
|
|
97
|
+
test_files: []
|