-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added 'raylib' module (experimental)
- Loading branch information
Showing
656 changed files
with
371,003 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"module":"raylib", | ||
"about":"raylib is a simple and easy-to-use library to enjoy videogames programming.", | ||
"author":"Ramon Santamaria (raysan5), Wonkey Coders", | ||
"version":"1.0.0", | ||
"support":"https://github.com/raysan5/raylib, https://github.com/wonkey-coders", | ||
"depends":["libc"] | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Copyright (c) 2013-2021 Ramon Santamaria (@raysan5) | ||
|
||
This software is provided "as-is", without any express or implied warranty. In no event | ||
will the authors be held liable for any damages arising from the use of this software. | ||
|
||
Permission is granted to anyone to use this software for any purpose, including commercial | ||
applications, and to alter it and redistribute it freely, subject to the following restrictions: | ||
|
||
1. The origin of this software must not be misrepresented; you must not claim that you | ||
wrote the original software. If you use this software in a product, an acknowledgment | ||
in the product documentation would be appreciated but is not required. | ||
|
||
2. Altered source versions must be plainly marked as such, and must not be misrepresented | ||
as being the original software. | ||
|
||
3. This notice may not be removed or altered from any source distribution. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
<img align="left" src="https://github.com/raysan5/raylib/blob/master/logo/raylib_logo_animation.gif" width="288px"> | ||
|
||
**raylib is a simple and easy-to-use library to enjoy videogames programming.** | ||
|
||
raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's specially well suited for prototyping, tooling, graphical applications, embedded systems and education. | ||
|
||
*NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no auto-debugging... just coding in the most pure spartan-programmers way.* | ||
|
||
Ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html) | ||
|
||
--- | ||
|
||
<br> | ||
|
||
[](https://github.com/raysan5/raylib/graphs/contributors) | ||
[](https://github.com/raysan5/raylib/releases) | ||
[](https://github.com/raysan5/raylib/commits/master) | ||
[](LICENSE) | ||
|
||
[](https://discord.gg/raylib) | ||
[](https://github.com/raysan5/raylib/stargazers) | ||
[](https://twitter.com/raysan5) | ||
[](https://www.reddit.com/r/raylib/) | ||
|
||
[](https://github.com/raysan5/raylib/actions?query=workflow%3AWindows) | ||
[](https://github.com/raysan5/raylib/actions?query=workflow%3ALinux) | ||
[](https://github.com/raysan5/raylib/actions?query=workflow%3AmacOS) | ||
[](https://github.com/raysan5/raylib/actions?query=workflow%3AAndroid) | ||
[](https://github.com/raysan5/raylib/actions?query=workflow%3AWebAssembly) | ||
|
||
[](https://github.com/raysan5/raylib/actions?query=workflow%3ACMakeBuilds) | ||
[](https://github.com/raysan5/raylib/actions/workflows/windows_examples.yml) | ||
[](https://github.com/raysan5/raylib/actions/workflows/linux_examples.yml) | ||
|
||
features | ||
-------- | ||
- **NO external dependencies**, all required libraries are [bundled into raylib](https://github.com/raysan5/raylib/tree/master/src/external) | ||
- Multiple platforms supported: **Windows, Linux, MacOS, RPI, Android, HTML5... and more!** | ||
- Written in plain C code (C99) in PascalCase/camelCase notation | ||
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3 or ES 2.0**) | ||
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) | ||
- Multiple **Fonts** formats supported (TTF, XNA fonts, AngelCode fonts) | ||
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC) | ||
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more! | ||
- Flexible Materials system, supporting classic maps and **PBR maps** | ||
- **Animated 3D models** supported (skeletal bones animation) (IQM, glTF) | ||
- Shaders support, including model and **postprocessing** shaders. | ||
- **Powerful math module** for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h) | ||
- Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD) | ||
- **VR stereo rendering** support with configurable HMD device parameters | ||
- Huge examples collection with [+120 code examples](https://github.com/raysan5/raylib/tree/master/examples)! | ||
- Bindings to [+50 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)! | ||
- **Free and open source**. | ||
|
||
raylib uses internally some libraries for window/graphics/inputs management and also to support different fileformats loading, all those libraries are embedded with raylib and are available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib dependencies](https://github.com/raysan5/raylib/wiki/raylib-dependencies) on [raylib Wiki](https://github.com/raysan5/raylib/wiki) for a detailed list. | ||
|
||
basic example | ||
-------------- | ||
This is a basic raylib example, it creates a window and it draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/web/core/loader.html?name=core_basic_window). | ||
```c | ||
#include "raylib.h" | ||
|
||
int main(void) | ||
{ | ||
InitWindow(800, 450, "raylib [core] example - basic window"); | ||
|
||
while (!WindowShouldClose()) | ||
{ | ||
BeginDrawing(); | ||
ClearBackground(RAYWHITE); | ||
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); | ||
EndDrawing(); | ||
} | ||
|
||
CloseWindow(); | ||
|
||
return 0; | ||
} | ||
``` | ||
build and installation | ||
---------------------- | ||
raylib binary releases for Windows, Linux and macOS are available at the [Github Releases page](https://github.com/raysan5/raylib/releases). | ||
raylib is also available via multiple [package managers](https://github.com/raysan5/raylib/issues/613) on multiple OS distributions. | ||
#### Installing and building raylib via vcpkg | ||
You can download and install raylib using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager: | ||
git clone https://github.com/Microsoft/vcpkg.git | ||
cd vcpkg | ||
./bootstrap-vcpkg.sh | ||
./vcpkg integrate install | ||
vcpkg install raylib | ||
*The raylib port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.* | ||
#### Installing and building raylib via conan | ||
You can download and install raylib using the [conan](https://conan.io) dependency manager: | ||
https://docs.conan.io/en/latest/getting_started.html | ||
*The raylib recipe in conan is kept up to date by conan team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/conan-io/conan-center-index) on the conan-center-index repository.* | ||
#### Installing and building raylib on multiple platforms | ||
[raylib Wiki](https://github.com/raysan5/raylib/wiki#development-platforms) contains detailed instructions on building and usage on multiple platforms. | ||
- [Working on Windows](https://github.com/raysan5/raylib/wiki/Working-on-Windows) | ||
- [Working on macOS](https://github.com/raysan5/raylib/wiki/Working-on-macOS) | ||
- [Working on GNU Linux](https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux) | ||
- [Working on FreeBSD](https://github.com/raysan5/raylib/wiki/Working-on-FreeBSD) | ||
- [Working on Raspberry Pi](https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi) | ||
- [Working for Android](https://github.com/raysan5/raylib/wiki/Working-for-Android) | ||
- [Working for Web (HTML5)](https://github.com/raysan5/raylib/wiki/Working-for-Web-(HTML5)) | ||
- [Working anywhere with CMake](https://github.com/raysan5/raylib/wiki/Working-with-CMake) | ||
*Note that Wiki is open for edit, if you find some issue while building raylib for your target platform, feel free to edit the Wiki or open and issue related to it.* | ||
#### Setup raylib with multiple IDEs | ||
raylib has been developed on Windows platform using [Notepad++](https://notepad-plus-plus.org/) and [MinGW GCC](http://mingw-w64.org/doku.php) compiler but it can be used with other IDEs on multiple platforms. | ||
[Projects directory](https://github.com/raysan5/raylib/tree/master/projects) contains several ready-to-use **project templates** to build raylib and code examples with multiple IDEs. | ||
*Note that there are lots of IDEs supported, some of the provided templates could require some review, please, if you find some issue with some template or you think they could be improved, feel free to send a PR or open a related issue.* | ||
learning and docs | ||
------------------ | ||
raylib is designed to be learned using [the examples](https://github.com/raysan5/raylib/tree/master/examples) as the main reference. There is no standard API documentation but there is a [**cheatsheet**](https://www.raylib.com/cheatsheet/cheatsheet.html) containing all the functions available on the library and a short description of each one of them, input parameters and result value names should be intuitive enough to understand how each function works. | ||
Some additional documentation about raylib design can be found in raylib GitHub Wiki. Here the more relevant links: | ||
- [raylib cheatsheet](https://www.raylib.com/cheatsheet/cheatsheet.html) | ||
- [raylib architecture](https://github.com/raysan5/raylib/wiki/raylib-architecture) | ||
- [raylib library design](https://github.com/raysan5/raylib/wiki) | ||
- [raylib examples collection](https://github.com/raysan5/raylib/tree/master/examples) | ||
- [raylib games collection](https://github.com/raysan5/raylib-games) | ||
contact and networks | ||
--------------------- | ||
raylib is present in several networks and raylib community is growing everyday. If you are using raylib and enjoying it, feel free to join us in any of these networks. The most active network is our [Discord server](https://discord.gg/raylib)! :) | ||
- Webpage: [http://www.raylib.com](http://www.raylib.com) | ||
- Discord: [https://discord.gg/raylib](https://discord.gg/raylib) | ||
- Twitter: [http://www.twitter.com/raysan5](http://www.twitter.com/raysan5) | ||
- Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5) | ||
- Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib) | ||
- Patreon: [https://www.patreon.com/raylib](https://www.patreon.com/raylib) | ||
- YouTube: [https://www.youtube.com/channel/raylib](https://www.youtube.com/c/raylib) | ||
license | ||
------- | ||
raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# Setup the project and settings | ||
project(examples) | ||
|
||
# Directories that contain examples | ||
set(example_dirs | ||
audio | ||
core | ||
models | ||
others | ||
shaders | ||
shapes | ||
text | ||
textures | ||
) | ||
|
||
# Next few lines will check for existence of symbols or header files | ||
# They are needed for the physac example and threads examples | ||
set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=199309L) | ||
include(CheckSymbolExists) | ||
check_symbol_exists(CLOCK_MONOTONIC time.h HAVE_CLOCK_MONOTONIC) | ||
check_symbol_exists(QueryPerformanceCounter windows.h HAVE_QPC) | ||
set(CMAKE_REQUIRED_DEFINITIONS) | ||
|
||
if (HAVE_QPC OR HAVE_CLOCK_MONOTONIC) | ||
set(example_dirs ${example_dirs} physac) | ||
endif () | ||
|
||
include(CheckIncludeFile) | ||
CHECK_INCLUDE_FILE("stdatomic.h" HAVE_STDATOMIC_H) | ||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE) | ||
find_package(Threads) | ||
if (CMAKE_USE_PTHREADS_INIT AND HAVE_STDATOMIC_H) | ||
add_if_flag_compiles("-std=c11" CMAKE_C_FLAGS) | ||
if (THREADS_HAVE_PTHREAD_ARG) | ||
add_if_flag_compiles("-pthread" CMAKE_C_FLAGS) | ||
endif () | ||
if (CMAKE_THREAD_LIBS_INIT) | ||
link_libraries("${CMAKE_THREAD_LIBS_INIT}") | ||
endif () | ||
endif () | ||
|
||
if (APPLE AND NOT CMAKE_SYSTEM STRLESS "Darwin-18.0.0") | ||
add_definitions(-DGL_SILENCE_DEPRECATION) | ||
MESSAGE(AUTHOR_WARNING "OpenGL is deprecated starting with macOS 10.14 (Mojave)!") | ||
endif () | ||
|
||
# Collect all source files and resource files | ||
# into a CMake variable | ||
set(example_sources) | ||
set(example_resources) | ||
foreach (example_dir ${example_dirs}) | ||
# Get the .c files | ||
file(GLOB sources ${example_dir}/*.c) | ||
list(APPEND example_sources ${sources}) | ||
|
||
# Any any resources | ||
file(GLOB resources ${example_dir}/resources/*) | ||
list(APPEND example_resources ${resources}) | ||
endforeach () | ||
|
||
if(NOT CMAKE_USE_PTHREADS_INIT OR NOT HAVE_STDATOMIC_H) | ||
# Items requiring pthreads | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_loading_thread.c) | ||
endif () | ||
|
||
if (${PLATFORM} MATCHES "Android") | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/standard_lighting.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_picking.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_vr_simulator.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_camera_free.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_camera_first_person.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_world_screen.c) | ||
|
||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_material_pbr.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_cubicmap.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_skybox.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_generation.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_heightmap.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_billboard.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_rlgl_solar_system.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_rlgl_full_solar_system.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_solar_system.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_obj_viewer.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_animation.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_first_person_maze.c) | ||
|
||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_custom_uniform.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_model_shader.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_postprocessing.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_raymarching.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_palette_switch.c) | ||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_basic_lighting.c) | ||
|
||
elseif (${PLATFORM} MATCHES "Web") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY") | ||
# Since WASM is used, ALLOW_MEMORY_GROWTH has no extra overheads | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s ALLOW_MEMORY_GROWTH=1 --no-heap-copy") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --shell-file ${CMAKE_SOURCE_DIR}/src/shell.html") | ||
set(CMAKE_EXECUTABLE_SUFFIX ".html") | ||
|
||
# Remove the -rdynamic flag because otherwise emscripten | ||
# does not generate HTML+JS+WASM files, only a non-working | ||
# and fat HTML | ||
string(REPLACE "-rdynamic" "" CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}") | ||
endif () | ||
|
||
include_directories(BEFORE SYSTEM others/external/include) | ||
|
||
if (NOT TARGET raylib) | ||
find_package(raylib 2.0 REQUIRED) | ||
endif () | ||
|
||
# Do each example | ||
foreach (example_source ${example_sources}) | ||
# Create the basename for the example | ||
get_filename_component(example_name ${example_source} NAME) | ||
string(REPLACE ".c" "" example_name ${example_name}) | ||
|
||
# Setup the example | ||
add_executable(${example_name} ${example_source}) | ||
|
||
target_link_libraries(${example_name} raylib) | ||
|
||
string(REGEX MATCH ".*/.*/" resources_dir ${example_source}) | ||
string(APPEND resources_dir "resources") | ||
|
||
if (${PLATFORM} MATCHES "Web" AND EXISTS ${resources_dir}) | ||
# The local resources path needs to be mapped to /resources virtual path | ||
string(APPEND resources_dir "@resources") | ||
set_target_properties(${example_name} PROPERTIES LINK_FLAGS "--preload-file ${resources_dir}") | ||
endif () | ||
endforeach () | ||
|
||
# Copy all of the resource files to the destination | ||
file(COPY ${example_resources} DESTINATION "resources/") |
Oops, something went wrong.