raylib 4.5.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +16 -0
- data/README.md +97 -0
- data/lib/raylib/core/callbacks.rb +19 -0
- data/lib/raylib/core/colors.rb +32 -0
- data/lib/raylib/core/enums.rb +694 -0
- data/lib/raylib/core/functions.rb +1552 -0
- data/lib/raylib/core/structs/audio_stream.rb +71 -0
- data/lib/raylib/core/structs/bone_info.rb +38 -0
- data/lib/raylib/core/structs/bounding_box.rb +38 -0
- data/lib/raylib/core/structs/camera2_d.rb +60 -0
- data/lib/raylib/core/structs/camera3_d.rb +74 -0
- data/lib/raylib/core/structs/color.rb +60 -0
- data/lib/raylib/core/structs/file_path_list.rb +51 -0
- data/lib/raylib/core/structs/font.rb +82 -0
- data/lib/raylib/core/structs/glyph_info.rb +71 -0
- data/lib/raylib/core/structs/image.rb +71 -0
- data/lib/raylib/core/structs/material.rb +49 -0
- data/lib/raylib/core/structs/material_map.rb +49 -0
- data/lib/raylib/core/structs/matrix.rb +192 -0
- data/lib/raylib/core/structs/mesh.rb +181 -0
- data/lib/raylib/core/structs/model.rb +115 -0
- data/lib/raylib/core/structs/model_animation.rb +60 -0
- data/lib/raylib/core/structs/music.rb +71 -0
- data/lib/raylib/core/structs/n_patch_info.rb +82 -0
- data/lib/raylib/core/structs/ray.rb +38 -0
- data/lib/raylib/core/structs/ray_collision.rb +60 -0
- data/lib/raylib/core/structs/rectangle.rb +60 -0
- data/lib/raylib/core/structs/render_texture.rb +52 -0
- data/lib/raylib/core/structs/shader.rb +38 -0
- data/lib/raylib/core/structs/sound.rb +38 -0
- data/lib/raylib/core/structs/texture.rb +77 -0
- data/lib/raylib/core/structs/transform.rb +49 -0
- data/lib/raylib/core/structs/vector2.rb +38 -0
- data/lib/raylib/core/structs/vector3.rb +49 -0
- data/lib/raylib/core/structs/vector4.rb +63 -0
- data/lib/raylib/core/structs/vr_device_info.rb +126 -0
- data/lib/raylib/core/structs/vr_stereo_config.rb +104 -0
- data/lib/raylib/core/structs/wave.rb +71 -0
- data/lib/raylib/core/structs.rb +32 -0
- data/lib/raylib/core.rb +5 -0
- data/lib/raylib/dsl.rb +2 -0
- data/lib/raylib/raymath/functions.rb +337 -0
- data/lib/raylib/raymath/structs/float16.rb +27 -0
- data/lib/raylib/raymath/structs/float3.rb +27 -0
- data/lib/raylib/raymath/structs.rb +2 -0
- data/lib/raylib/raymath.rb +2 -0
- data/lib/raylib/rlgl/callbacks.rb +4 -0
- data/lib/raylib/rlgl/enums.rb +270 -0
- data/lib/raylib/rlgl/functions.rb +448 -0
- data/lib/raylib/rlgl/structs/rl_draw_call.rb +60 -0
- data/lib/raylib/rlgl/structs/rl_render_batch.rb +82 -0
- data/lib/raylib/rlgl/structs/rl_vertex_buffer.rb +93 -0
- data/lib/raylib/rlgl/structs.rb +3 -0
- data/lib/raylib/rlgl.rb +4 -0
- data/lib/raylib/version.rb +5 -0
- data/lib/raylib.rb +12 -0
- metadata +162 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f2c22de6faec04769ede1e3a2946cdc6bea0a58719557e36b3feb2ab6e9577be
|
4
|
+
data.tar.gz: aeabc8605d975563c4efa036740a7d1b11064b85e6f0322ab3b8f6e26cda5b05
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 579e07c8d717803cfb6cfcdacef5a916447b37341fa3a670cfd63784c395fbf88e51ce8d281d2483ca209e9b482900a8b93998d6b57891907490f0ffc35daabf
|
7
|
+
data.tar.gz: 0231e47504d467ea3bb4c03c62bc934b71ab54d5395bd5b111669ead36cb7e1481a66536f12509ab663b2e4376cceb38575a972faefcaee862fa7b7ce9cef6b6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Copyright (c) 2023 Wilson Silva (@wilsonsilva)
|
2
|
+
|
3
|
+
This software is provided "as-is", without any express or implied warranty. In no event
|
4
|
+
will the authors be held liable for any damages arising from the use of this software.
|
5
|
+
|
6
|
+
Permission is granted to anyone to use this software for any purpose, including commercial
|
7
|
+
applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
8
|
+
|
9
|
+
1. The origin of this software must not be misrepresented; you must not claim that you
|
10
|
+
wrote the original software. If you use this software in a product, an acknowledgment
|
11
|
+
in the product documentation would be appreciated but is not required.
|
12
|
+
|
13
|
+
2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
14
|
+
as being the original software.
|
15
|
+
|
16
|
+
3. This notice may not be removed or altered from any source distribution.
|
data/README.md
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
# Raylib for Ruby
|
2
|
+
|
3
|
+
![raylib-ruby logo](.github/assets/raylib-ruby.png)
|
4
|
+
|
5
|
+
Ruby bindings for [raylib](https://www.raylib.com/), a simple and easy-to-use library to enjoy videogames programming.
|
6
|
+
|
7
|
+
## Features
|
8
|
+
|
9
|
+
- Feature parity with [raylib 4.5](https://github.com/raysan5/raylib/tree/4.5.0)
|
10
|
+
- **NO external dependencies besides [raylib](https://github.com/raysan5/raylib/tree/4.5.0)**, all required libraries are [bundled into raylib](https://github.com/raysan5/raylib/tree/master/src/external)
|
11
|
+
- Multiple platforms supported: **Windows, Linux, MacOS, RPI... and more!**
|
12
|
+
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3, 4.3 or ES 2.0**)
|
13
|
+
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
|
14
|
+
- Multiple **Fonts** formats supported (TTF, Image fonts, AngelCode fonts)
|
15
|
+
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
|
16
|
+
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
|
17
|
+
- Flexible Materials system, supporting classic maps and **PBR maps**
|
18
|
+
- **Animated 3D models** supported (skeletal bones animation) (IQM)
|
19
|
+
- Shaders support, including model and **postprocessing** shaders.
|
20
|
+
- **Powerful math module** for Vector, Matrix and Quaternion operations: [raymath](https://github.com/wilsonsilva/raylib-ruby/blob/main/lib/raylib/raymath/)
|
21
|
+
- Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD)
|
22
|
+
- **VR stereo rendering** support with configurable HMD device parameters
|
23
|
+
- Huge examples collection with [+20 code examples](https://github.com/wilsonsilva/raylib-ruby/tree/main/examples)!
|
24
|
+
- **Free and open source**.
|
25
|
+
|
26
|
+
## Installation
|
27
|
+
|
28
|
+
1. Follow the instructions on the [native raylib wiki](https://github.com/raysan5/raylib#build-and-installation) to install the __native raylib library__ on your operating
|
29
|
+
system.
|
30
|
+
|
31
|
+
2. Install the gem by executing: `bundle add raylib` or `gem install raylib`
|
32
|
+
|
33
|
+
## Usage
|
34
|
+
|
35
|
+
Raylib can be used in two ways: __namespaced__ or __global__.
|
36
|
+
|
37
|
+
### Namespaced
|
38
|
+
|
39
|
+
The namespaced usage is recommended as it avoids global namespace pollution:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
require 'raylib'
|
43
|
+
|
44
|
+
Raylib.init_window(800, 450, 'My window')
|
45
|
+
|
46
|
+
until Raylib.window_should_close
|
47
|
+
Raylib.begin_drawing
|
48
|
+
Raylib.clear_background(Raylib::RAYWHITE)
|
49
|
+
Raylib.draw_text('Congrats! You created your first window!', 190, 200, 20, Raylib::LIGHTGRAY)
|
50
|
+
Raylib.end_drawing
|
51
|
+
end
|
52
|
+
|
53
|
+
Raylib.close_window
|
54
|
+
```
|
55
|
+
|
56
|
+
### Global
|
57
|
+
|
58
|
+
If you prefer to use Raylib globally, you can require the `raylib/dsl`:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
require 'raylib/dsl'
|
62
|
+
|
63
|
+
init_window(800, 450, 'My window')
|
64
|
+
|
65
|
+
until window_should_close
|
66
|
+
begin_drawing
|
67
|
+
clear_background(RAYWHITE)
|
68
|
+
draw_text('Congrats! You created your first window!', 190, 200, 20, LIGHTGRAY)
|
69
|
+
end_drawing
|
70
|
+
end
|
71
|
+
```
|
72
|
+
|
73
|
+
In the code above, `require 'raylib/dsl` is a shorthand for `require 'raylib'` + `include Raylib`.
|
74
|
+
|
75
|
+
## Development
|
76
|
+
|
77
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can
|
78
|
+
also run `bin/console` for an interactive prompt that will allow you to experiment.
|
79
|
+
|
80
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
|
81
|
+
version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the
|
82
|
+
version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
83
|
+
|
84
|
+
## Contributing
|
85
|
+
|
86
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/wilsonsilva/raylib-ruby. This project is intended
|
87
|
+
to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the
|
88
|
+
[code of conduct](https://github.com/wilsonsilva/raylib-ruby/blob/main/CODE_OF_CONDUCT.md).
|
89
|
+
|
90
|
+
## License
|
91
|
+
|
92
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
93
|
+
|
94
|
+
## Code of Conduct
|
95
|
+
|
96
|
+
Everyone interacting in the Raylib project's codebases, issue trackers, chat rooms and mailing lists is expected to
|
97
|
+
follow the [code of conduct](https://github.com/wilsonsilva/raylib-ruby/blob/main/CODE_OF_CONDUCT.md).
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Logging: Redirect trace log messages
|
3
|
+
callback :TraceLogCallback, [:int, :pointer, :pointer], :void
|
4
|
+
|
5
|
+
# FileIO: Load binary data
|
6
|
+
callback :LoadFileDataCallback, [:pointer, :pointer], :pointer
|
7
|
+
|
8
|
+
# FileIO: Save binary data
|
9
|
+
callback :SaveFileDataCallback, [:pointer, :pointer, :uint], :bool
|
10
|
+
|
11
|
+
# FileIO: Load text data
|
12
|
+
callback :LoadFileTextCallback, [:pointer], :pointer
|
13
|
+
|
14
|
+
# FileIO: Save text data
|
15
|
+
callback :SaveFileTextCallback, [:pointer, :pointer], :bool
|
16
|
+
|
17
|
+
# TODO
|
18
|
+
callback :AudioCallback, [:pointer, :uint], :void
|
19
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Some Basic Colors
|
3
|
+
# NOTE: Custom raylib color palette for amazing visuals on WHITE background
|
4
|
+
|
5
|
+
LIGHTGRAY = Color.create(200, 200, 200, 255) # Light Gray
|
6
|
+
GRAY = Color.create(130, 130, 130, 255) # Gray
|
7
|
+
DARKGRAY = Color.create(80, 80, 80, 255) # Dark Gray
|
8
|
+
YELLOW = Color.create(253, 249, 0, 255) # Yellow
|
9
|
+
GOLD = Color.create(255, 203, 0, 255) # Gold
|
10
|
+
ORANGE = Color.create(255, 161, 0, 255) # Orange
|
11
|
+
PINK = Color.create(255, 109, 194, 255) # Pink
|
12
|
+
RED = Color.create(230, 41, 55, 255) # Red
|
13
|
+
MAROON = Color.create(190, 33, 55, 255) # Maroon
|
14
|
+
GREEN = Color.create(0, 228, 48, 255) # Green
|
15
|
+
LIME = Color.create(0, 158, 47, 255) # Lime
|
16
|
+
DARKGREEN = Color.create(0, 117, 44, 255) # Dark Green
|
17
|
+
SKYBLUE = Color.create(102, 191, 255, 255) # Sky Blue
|
18
|
+
BLUE = Color.create(0, 121, 241, 255) # Blue
|
19
|
+
DARKBLUE = Color.create(0, 82, 172, 255) # Dark Blue
|
20
|
+
PURPLE = Color.create(200, 122, 255, 255) # Purple
|
21
|
+
VIOLET = Color.create(135, 60, 190, 255) # Violet
|
22
|
+
DARKPURPLE = Color.create(112, 31, 126, 255) # Dark Purple
|
23
|
+
BEIGE = Color.create(211, 176, 131, 255) # Beige
|
24
|
+
BROWN = Color.create(127, 106, 79, 255) # Brown
|
25
|
+
DARKBROWN = Color.create(76, 63, 47, 255) # Dark Brown
|
26
|
+
|
27
|
+
WHITE = Color.create(255, 255, 255, 255) # White
|
28
|
+
BLACK = Color.create(0, 0, 0, 255) # Black
|
29
|
+
BLANK = Color.create(0, 0, 0, 0) # Blank (Transparent)
|
30
|
+
MAGENTA = Color.create(255, 0, 255, 255) # Magenta
|
31
|
+
RAYWHITE = Color.create(245, 245, 245, 255) # My own White (raylib logo)
|
32
|
+
end
|