Compare commits
242 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7ef114d1da | ||
![]() |
adb20569be | ||
![]() |
07f3a65a96 | ||
![]() |
6a8b1079c1 | ||
![]() |
703850b341 | ||
![]() |
8da6307456 | ||
![]() |
e469f4ebf7 | ||
![]() |
8941cf3e66 | ||
![]() |
68cad30646 | ||
![]() |
fc7ec5e907 | ||
![]() |
1a948849f3 | ||
![]() |
bba10504e2 | ||
![]() |
ff11a6fbe8 | ||
![]() |
27ebe78313 | ||
![]() |
44961d1975 | ||
![]() |
e8a8d544c5 | ||
![]() |
62cdb2299b | ||
![]() |
9b66883e0b | ||
![]() |
d1b0d6a6dc | ||
![]() |
c47ba58494 | ||
![]() |
41582f0448 | ||
![]() |
3e76d3a3d3 | ||
![]() |
733ed972f7 | ||
![]() |
5d7050bdf9 | ||
![]() |
a025636fa1 | ||
![]() |
3c3dfde3f9 | ||
![]() |
5829fdb73e | ||
![]() |
9b74c40fc2 | ||
![]() |
66e0d774bd | ||
![]() |
a5e1aff99b | ||
![]() |
e333eb415b | ||
![]() |
02df366a7a | ||
![]() |
976a10c891 | ||
![]() |
d28e73849b | ||
![]() |
d7b15ac1cf | ||
![]() |
c0c775e45d | ||
![]() |
b5842434c2 | ||
![]() |
c7e9951795 | ||
![]() |
70ed975b99 | ||
![]() |
7e2b1b4ff0 | ||
![]() |
915b5f370b | ||
![]() |
0c6c421508 | ||
![]() |
bc2c6251f8 | ||
![]() |
b9dd459d5a | ||
![]() |
28da2522fe | ||
![]() |
2528854664 | ||
![]() |
7ae7a87f8a | ||
![]() |
3d41c1b6cd | ||
![]() |
96005f2566 | ||
![]() |
e37d021cd3 | ||
![]() |
133a882556 | ||
![]() |
74339b9fdc | ||
![]() |
2dbcef218c | ||
![]() |
e07281f8bd | ||
![]() |
5e670be239 | ||
![]() |
05abaee0e0 | ||
![]() |
d657537821 | ||
![]() |
5fe0db347c | ||
![]() |
649665eac9 | ||
![]() |
efe359d613 | ||
![]() |
c45fe62abc | ||
![]() |
584e2d664c | ||
![]() |
51a8e1d692 | ||
![]() |
da836a732c | ||
![]() |
6bab884d1d | ||
![]() |
4e6db307e4 | ||
![]() |
0229f9b1a4 | ||
![]() |
6bbaca118f | ||
![]() |
ba3b4b2d08 | ||
![]() |
fcdb120935 | ||
![]() |
8f45370073 | ||
![]() |
502bc61931 | ||
![]() |
5a39b22521 | ||
![]() |
6c44c9d730 | ||
![]() |
a523c64718 | ||
![]() |
5aebd2a16c | ||
![]() |
574c689ff7 | ||
![]() |
b178c992a1 | ||
![]() |
a4d31e1dad | ||
![]() |
e151487fde | ||
![]() |
061848cd0c | ||
![]() |
ab1c12c449 | ||
![]() |
8db8401bc1 | ||
![]() |
58a81dd760 | ||
![]() |
a5838e40d9 | ||
![]() |
78e8fd1c31 | ||
![]() |
2d07d29a1c | ||
![]() |
19bbcbb486 | ||
![]() |
b6ba3dacb9 | ||
![]() |
65d9d0aac1 | ||
![]() |
b9c966f902 | ||
![]() |
d62368f133 | ||
![]() |
3d66a6c93f | ||
![]() |
01e035e28b | ||
![]() |
4af4483f5f | ||
![]() |
2344941974 | ||
![]() |
6f41b9594a | ||
![]() |
3e049c09d5 | ||
![]() |
92e1205f40 | ||
![]() |
71b06caed4 | ||
![]() |
4611406c68 | ||
![]() |
427be604b9 | ||
![]() |
d57b5ac89a | ||
![]() |
82937e1564 | ||
![]() |
7fa12844ed | ||
![]() |
af011bc952 | ||
![]() |
4c728f0b54 | ||
![]() |
5895fb6adc | ||
![]() |
eb6f8bd0ba | ||
![]() |
b7c0d5b6dd | ||
![]() |
680f9d5772 | ||
![]() |
20d8889a03 | ||
![]() |
c67bc02dd1 | ||
![]() |
1b56f7917e | ||
![]() |
7639726193 | ||
![]() |
fb2ed693e4 | ||
![]() |
966e8adcf9 | ||
![]() |
c3386300d3 | ||
![]() |
cb4c676f5d | ||
![]() |
74c486201d | ||
![]() |
6b8f30964d | ||
![]() |
dc2e5c1751 | ||
![]() |
645a5b2507 | ||
![]() |
3a073db029 | ||
![]() |
a6297a2be1 | ||
![]() |
8724cf2ea5 | ||
![]() |
485787059a | ||
![]() |
08615d3247 | ||
![]() |
a1b2d96d9c | ||
![]() |
3c2ee1cc75 | ||
![]() |
117696a893 | ||
![]() |
2f5a7ddcc6 | ||
![]() |
18a9982126 | ||
![]() |
41d3c47ffe | ||
![]() |
7428747ef0 | ||
![]() |
1ee6290fcf | ||
![]() |
572969d8b7 | ||
![]() |
f2247c6f0a | ||
![]() |
05992a6fce | ||
![]() |
c8464bc731 | ||
![]() |
b2098a2d60 | ||
![]() |
ac73e3b5e2 | ||
![]() |
1be68d8cfe | ||
![]() |
eb86d69a38 | ||
![]() |
acfa967e89 | ||
![]() |
5ff0776235 | ||
![]() |
2a408d789c | ||
![]() |
5100cb3e7f | ||
![]() |
b029fb6d31 | ||
![]() |
245ba2a152 | ||
![]() |
89ecad1e29 | ||
![]() |
23bde477e5 | ||
![]() |
2294947660 | ||
![]() |
5aed36e76d | ||
![]() |
e5b5aea998 | ||
![]() |
fadd74358b | ||
![]() |
7912fac815 | ||
![]() |
fa4e0c1a26 | ||
![]() |
1046449339 | ||
![]() |
c5d5d19443 | ||
![]() |
0f783aab34 | ||
![]() |
7849db65e0 | ||
![]() |
9b5a796213 | ||
![]() |
32e374d941 | ||
![]() |
113a580021 | ||
![]() |
a77273d8d8 | ||
![]() |
310fd9b147 | ||
![]() |
01d8642520 | ||
![]() |
30f3e49f3d | ||
![]() |
0b8aded399 | ||
![]() |
d2aeafcf1e | ||
![]() |
81881a120c | ||
![]() |
e7fdf8a13d | ||
![]() |
a750bcceec | ||
![]() |
67d0bf75a7 | ||
![]() |
a8a21312e1 | ||
![]() |
42dad5df95 | ||
![]() |
e176a476c0 | ||
![]() |
19390eaf09 | ||
![]() |
faff512140 | ||
![]() |
946a6cb280 | ||
![]() |
7d789763d6 | ||
![]() |
d62a2f793f | ||
![]() |
9eefcb7939 | ||
![]() |
36bf8a60d8 | ||
![]() |
6d1cdf25a7 | ||
![]() |
51db3b589d | ||
![]() |
b18940d3c6 | ||
![]() |
3f25c52a29 | ||
![]() |
39e73ccc4d | ||
![]() |
df4b55d657 | ||
![]() |
80dbbef0f5 | ||
![]() |
23b75281ad | ||
![]() |
91b2dc2aa9 | ||
![]() |
7459a5c6ef | ||
![]() |
8820baf5cc | ||
![]() |
3b3e163c48 | ||
![]() |
83fb4613c1 | ||
![]() |
1b20182d33 | ||
![]() |
7dfe42d6d0 | ||
![]() |
55f0647213 | ||
![]() |
484c6b360f | ||
![]() |
dec85f741a | ||
![]() |
87d5b51256 | ||
![]() |
aa3b413390 | ||
![]() |
ee43a14f19 | ||
![]() |
64c23f8477 | ||
![]() |
49145e90a2 | ||
![]() |
28e12a6c6a | ||
![]() |
131132f17d | ||
![]() |
884e868e92 | ||
![]() |
eb2483338f | ||
![]() |
becd3c3831 | ||
![]() |
34fafb733f | ||
![]() |
90c129fd61 | ||
![]() |
9922160ab4 | ||
![]() |
1d324d5496 | ||
![]() |
03c38396f3 | ||
![]() |
85cecb2aae | ||
![]() |
d15b93839b | ||
![]() |
b06497cad6 | ||
![]() |
f632e32100 | ||
![]() |
52a6d756f4 | ||
![]() |
f4ca5b378a | ||
![]() |
97054e4e0f | ||
![]() |
86bdf60887 | ||
![]() |
4b4f052fea | ||
![]() |
2de92e3c07 | ||
![]() |
85e7856989 | ||
![]() |
b4293edd70 | ||
![]() |
6c7685da3f | ||
![]() |
ea40bda88c | ||
![]() |
1184db83f7 | ||
![]() |
ca600b44a0 | ||
![]() |
b5fe41f41a | ||
![]() |
3cd9e3896a | ||
![]() |
7024628c65 | ||
![]() |
d2bb6185f1 | ||
![]() |
c3f06b7470 | ||
![]() |
a7afd8de99 | ||
![]() |
cde26c743c | ||
![]() |
40b73a8a91 |
27
.gitignore
vendored
@@ -30,6 +30,7 @@ Thumbs.db
|
|||||||
*.cache
|
*.cache
|
||||||
*.ilk
|
*.ilk
|
||||||
*.log
|
*.log
|
||||||
|
.vs
|
||||||
|
|
||||||
[Bb]in
|
[Bb]in
|
||||||
[Dd]ebug/
|
[Dd]ebug/
|
||||||
@@ -54,7 +55,6 @@ packages/
|
|||||||
*.a
|
*.a
|
||||||
*.bc
|
*.bc
|
||||||
*.so
|
*.so
|
||||||
!raylib.rc.o
|
|
||||||
|
|
||||||
# Ignore all examples files
|
# Ignore all examples files
|
||||||
examples/*
|
examples/*
|
||||||
@@ -76,7 +76,6 @@ games/*
|
|||||||
!games/*/
|
!games/*/
|
||||||
# Unignore all games files with extension
|
# Unignore all games files with extension
|
||||||
!games/*.c
|
!games/*.c
|
||||||
!games/*.lua
|
|
||||||
!games/*.png
|
!games/*.png
|
||||||
# Unignore games makefile
|
# Unignore games makefile
|
||||||
!games/Makefile
|
!games/Makefile
|
||||||
@@ -96,22 +95,9 @@ xcschememanagement.plist
|
|||||||
xcuserdata/
|
xcuserdata/
|
||||||
DerivedData/
|
DerivedData/
|
||||||
|
|
||||||
# Visual Studio project
|
# Jetbrains project
|
||||||
project/VS2015.UWP/packages
|
.idea/
|
||||||
project/VS2017/packages
|
cmake-build-debug/
|
||||||
|
|
||||||
# Web examples
|
|
||||||
docs/examples/web/*.html
|
|
||||||
docs/examples/web/*/*.html
|
|
||||||
!docs/examples/web/loader.html
|
|
||||||
!docs/examples/web/core/loader.html
|
|
||||||
!docs/examples/web/shapes/loader.html
|
|
||||||
!docs/examples/web/text/loader.html
|
|
||||||
!docs/examples/web/textures/loader.html
|
|
||||||
!docs/examples/web/audio/loader.html
|
|
||||||
!docs/examples/web/physac/loader.html
|
|
||||||
!docs/examples/web/shaders/loader.html
|
|
||||||
!docs/examples/web/models/loader.html
|
|
||||||
|
|
||||||
# CMake stuff
|
# CMake stuff
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
@@ -124,17 +110,12 @@ install_manifest.txt
|
|||||||
compile_commands.json
|
compile_commands.json
|
||||||
CTestTestfile.cmake
|
CTestTestfile.cmake
|
||||||
build
|
build
|
||||||
!templates/android_project/Makefile
|
|
||||||
|
|
||||||
# Unignore These makefiles...
|
# Unignore These makefiles...
|
||||||
!examples/CMakeLists.txt
|
!examples/CMakeLists.txt
|
||||||
!games/CMakeLists.txt
|
!games/CMakeLists.txt
|
||||||
|
|
||||||
# Ignore Android generated files and folders
|
|
||||||
templates/android_project/output
|
|
||||||
|
|
||||||
# Ignore GNU global tags
|
# Ignore GNU global tags
|
||||||
GPATH
|
GPATH
|
||||||
GRTAGS
|
GRTAGS
|
||||||
GTAGS
|
GTAGS
|
||||||
.vs
|
|
||||||
|
13
BINDINGS.md
@@ -1,4 +1,4 @@
|
|||||||
### raylib bindings
|
## raylib bindings
|
||||||
|
|
||||||
Some people ported raylib to other languages in form of bindings or wrappers to the library, here is a list with the ones I'm aware of:
|
Some people ported raylib to other languages in form of bindings or wrappers to the library, here is a list with the ones I'm aware of:
|
||||||
|
|
||||||
@@ -17,6 +17,9 @@ Some people ported raylib to other languages in form of bindings or wrappers to
|
|||||||
| raylib-lua | Lua | https://github.com/raysan5/raylib-lua |
|
| raylib-lua | Lua | https://github.com/raysan5/raylib-lua |
|
||||||
| raylib-lua-ffi | Lua | https://github.com/raysan5/raylib/issues/693 |
|
| raylib-lua-ffi | Lua | https://github.com/raysan5/raylib/issues/693 |
|
||||||
| raylib-lua-sol | Lua | https://github.com/RobLoach/raylib-lua-sol |
|
| raylib-lua-sol | Lua | https://github.com/RobLoach/raylib-lua-sol |
|
||||||
|
| raylib-lua (raylua)| Lua | https://github.com/TSnake41/raylib-lua |
|
||||||
|
| raylib-luamore | Lua | https://github.com/HDPLocust/raylib-luamore |
|
||||||
|
| raylib-nelua | Nelua | https://github.com/Andre-LA/raylib-nelua-mirror |
|
||||||
| raylib-Nim | Nim | https://gitlab.com/define-private-public/raylib-Nim |
|
| raylib-Nim | Nim | https://gitlab.com/define-private-public/raylib-Nim |
|
||||||
| raylib-nim | Nim | https://github.com/Skrylar/raylib-nim |
|
| raylib-nim | Nim | https://github.com/Skrylar/raylib-nim |
|
||||||
| raylib-haskell | Haskell | https://github.com/DevJac/raylib-haskell |
|
| raylib-haskell | Haskell | https://github.com/DevJac/raylib-haskell |
|
||||||
@@ -46,14 +49,22 @@ Some people ported raylib to other languages in form of bindings or wrappers to
|
|||||||
| ringraylib | Ring | https://github.com/ringpackages/ringraylib |
|
| ringraylib | Ring | https://github.com/ringpackages/ringraylib |
|
||||||
| cl-raylib | Common Lisp | https://github.com/longlene/cl-raylib |
|
| cl-raylib | Common Lisp | https://github.com/longlene/cl-raylib |
|
||||||
| raylib-scm | Chicken Scheme | https://github.com/yashrk/raylib-scm |
|
| raylib-scm | Chicken Scheme | https://github.com/yashrk/raylib-scm |
|
||||||
|
| raylib-chibi | Chibi-Scheme | https://github.com/VincentToups/raylib-chibi |
|
||||||
| Euraylib | Euphoria | https://github.com/gAndy50/Euraylib |
|
| Euraylib | Euphoria | https://github.com/gAndy50/Euraylib |
|
||||||
| raylib-wren | Wren | https://github.com/TSnake41/raylib-wren |
|
| raylib-wren | Wren | https://github.com/TSnake41/raylib-wren |
|
||||||
| raylib-odin | Odin | https://github.com/kevinw/raylib-odin |
|
| raylib-odin | Odin | https://github.com/kevinw/raylib-odin |
|
||||||
|
| raylib-zig | Zig | https://github.com/G3bE/raylib-zig |
|
||||||
| ray.zig | Zig | https://github.com/BitPuffin/zig-raylib-experiments |
|
| ray.zig | Zig | https://github.com/BitPuffin/zig-raylib-experiments |
|
||||||
| raylib-Ada | Ada | https://github.com/mimo/raylib-Ada |
|
| raylib-Ada | Ada | https://github.com/mimo/raylib-Ada |
|
||||||
| jaylib | Janet | https://github.com/janet-lang/jaylib |
|
| jaylib | Janet | https://github.com/janet-lang/jaylib |
|
||||||
| raykit | Kit | https://github.com/Gamerfiend/raykit |
|
| raykit | Kit | https://github.com/Gamerfiend/raykit |
|
||||||
| vraylib | V | https://github.com/MajorHard/vraylib |
|
| vraylib | V | https://github.com/MajorHard/vraylib |
|
||||||
|
| ray.mod | BlitzMax | https://github.com/bmx-ng/ray.mod |
|
||||||
|
| raylib-mosaic | Mosaic | https://github.com/pluckyporcupine/raylib-mosaic |
|
||||||
|
| raylib-xdpw | XD Pascal | https://github.com/vtereshkov/raylib-xdpw |
|
||||||
|
| raylib-carp | Carp | https://github.com/pluckyporcupine/raylib-carp |
|
||||||
|
| raylib-fb | FreeBasic | https://github.com/IchMagBier/raylib-fb |
|
||||||
|
| raylib-ats2 | ATS2 | https://github.com/mephistopheles-8/raylib-ats2 |
|
||||||
| raylib.cbl | COBOL | *[code examples](https://github.com/Martinfx/Cobol/tree/master/OpenCobol/Games/raylib)* |
|
| raylib.cbl | COBOL | *[code examples](https://github.com/Martinfx/Cobol/tree/master/OpenCobol/Games/raylib)* |
|
||||||
|
|
||||||
Missing some language? Check the [bindings not yet in this list](https://gist.github.com/raysan5/5764cc5b885183f523fce47f098f3d9b#bindings-not-yet-in-the-official-list) or create a new binding! :)
|
Missing some language? Check the [bindings not yet in this list](https://gist.github.com/raysan5/5764cc5b885183f523fce47f098f3d9b#bindings-not-yet-in-the-official-list) or create a new binding! :)
|
||||||
|
169
CHANGELOG
@@ -1,7 +1,174 @@
|
|||||||
changelog
|
changelog
|
||||||
---------
|
---------
|
||||||
|
|
||||||
Current Release: raylib 2.5.0 (31 May 2019)
|
Current Release: raylib 3.0.0 (01 April 2020)
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
Release: raylib 3.0 (01 April 2020)
|
||||||
|
-----------------------------------------------
|
||||||
|
KEY CHANGES:
|
||||||
|
- Global context states used on all modules.
|
||||||
|
- Custom memory allocators for all modules and dependencies.
|
||||||
|
- Centralized file access system and memory data loading.
|
||||||
|
- Structures reviewed to reduce size and always be used as pass-by-value.
|
||||||
|
- Tracelog messages completely reviewed and categorized.
|
||||||
|
- raudio module reviewed to accomodate new Music struct and new miniaudio.
|
||||||
|
- text module reviewed to improve fonts generation and text management functions.
|
||||||
|
- Multiple new examples added and categorized examples table.
|
||||||
|
- GitHub Actions CI implemented for Windows, Linux and macOS.
|
||||||
|
|
||||||
|
Detailed changes:
|
||||||
|
[build] ADDED: VS2017.ANGLE project, by @msmshazan
|
||||||
|
[build] ADDED: VS2017 project support for x64 platform configuration
|
||||||
|
[build] ADDED: Makefile for Android building on macOS, by @Yunoinsky
|
||||||
|
[build] ADDED: Makefile for Android building on Linux, by @pamarcos
|
||||||
|
[build] REMOVED: VS2015 project
|
||||||
|
[build] REVIEWED: VSCode project
|
||||||
|
[build] REVIEWED: Makefile build system
|
||||||
|
[build] REVIEWED: Android building, by @NimbusFox
|
||||||
|
[build] REVIEWED: Compilation with CLion IDE, by @Rover656
|
||||||
|
[build] REVIEWED: Generation of web examples, by @pamarcos
|
||||||
|
[build] REVIEWED: Makefiles path to 'shell.html', by @niorad
|
||||||
|
[build] REVIEWED: VS2017 64bit compilation issues, by @spec-chum
|
||||||
|
[build] REVIEWED: Multiple fixes on projects building, by @ChrisDill, @JuDelCo, @electronstudio
|
||||||
|
[core] ADDED: Support touch/mouse indistinctly
|
||||||
|
[core] ADDED: FLAG_WINDOW_ALWAYS_RUN to avoid pause on minimize
|
||||||
|
[core] ADDED: Config flag SUPPORT_HALFBUSY_WAIT_LOOP
|
||||||
|
[core] ADDED: RPI mouse cursor point support on native mode
|
||||||
|
[core] ADDED: GetWorldToScreen2D()- Get screen space position for a 2d camera world space position, by @arvyy
|
||||||
|
[core] ADDED: GetScreenToWorld2D() - Get world space position for a 2d camera screen space position, by @arvyy
|
||||||
|
[core] ADDED: GetWorldToScreenEx() - Get size position for a 3d world space position
|
||||||
|
[core] ADDED: DirectoryExists() - Check if a directory path exists
|
||||||
|
[core] ADDED: GetPrevDirectoryPath() - Get previous directory path for a given path
|
||||||
|
[core] ADDED: CompressData() - Compress data (DEFLATE algorythm)
|
||||||
|
[core] ADDED: DecompressData() - Decompress data (DEFLATE algorythm)
|
||||||
|
[core] ADDED: GetWindowPosition() - Get window position XY on monitor
|
||||||
|
[core] ADDED: LoadFileData() - Load file data as byte array (read)
|
||||||
|
[core] ADDED: SaveFileData() - Save data to file from byte array (write)
|
||||||
|
[core] ADDED: LoadFileText() - Load text data from file (read), returns a '\0' terminated string
|
||||||
|
[core] ADDED: SaveFileText() - Save text data to file (write), string must be '\0' terminated
|
||||||
|
[core] REMOVED: Show raylib logo at initialization
|
||||||
|
[core] REVIEWED: GetFileName(), security checks
|
||||||
|
[core] REVIEWED: LoadStorageValue(), by @danimartin82
|
||||||
|
[core] REVIEWED: SaveStorageValue(), by @danimartin82
|
||||||
|
[core] REVIEWED: IsMouseButtonReleased(), when press/release events come too fast, by @oswjk
|
||||||
|
[core] REVIEWED: SetWindowMonitor(), by @DropsOfSerenity
|
||||||
|
[core] REVIEWED: IsFileExtension() to be case-insensitive
|
||||||
|
[core] REVIEWED: IsFileExtension() when checking no-extension files
|
||||||
|
[core] REVIEWED: Default font scale filter for HighDPI mode
|
||||||
|
[core] REVIEWED: Touch input scaling for PLATFORM_WEB
|
||||||
|
[core] REVIEWED: RPI input system, by @DarkElvenAngel
|
||||||
|
[core] REVIEWED: RPI input threads issues
|
||||||
|
[core] REVIEWED: OpenGL extensions loading and freeing
|
||||||
|
[core] REVIEWED: GetDirectoryPath()
|
||||||
|
[core] REVIEWED: Camera2D behavior, by @arvyy
|
||||||
|
[core] REVIEWED: OpenGL ES 2.0 extensions check
|
||||||
|
[rlgl] ADDED: Flags to allow frustrum culling near/far distance configuration at compile time
|
||||||
|
[rlgl] ADDED: Flags to sllow MAX_BATCH_BUFFERING config at compile time
|
||||||
|
[rlgl] ADDED: GetMatrixProjection(), by @chriscamacho
|
||||||
|
[rlgl] ADDED: rlUpdateMeshAt() - Update vertex or index data on GPU, at index, by @brankoku
|
||||||
|
[rlgl] REVIEWED: Vertex padding not zeroed for quads, by @kawa-yoiko
|
||||||
|
[rlgl] REVIEWED: Read texture data as RGBA from FBO on GLES 2.0
|
||||||
|
[rlgl] REVIEWED: LoadShaderCode() for const correctness, by @heretique
|
||||||
|
[rlgl] REVIEWED: rlLoadTexture()
|
||||||
|
[rlgl] REVIEWED: rlReadTexturePixels()
|
||||||
|
[rlgl] REVIEWED: rlUpdateMesh() to supports updating indices, by @brankoku
|
||||||
|
[rlgl] REVIEWED: GenTextureCubemap(), renamed parameters for consistency
|
||||||
|
[rlgl] REVIEWED: HDR pixels loading
|
||||||
|
[raymath] ADDED: MatrixRotateXYZ(), by @chriscamacho
|
||||||
|
[raymath] RENAMED: Vector3Multiply() to Vector3Scale()
|
||||||
|
[camera] REVIEWED: Free camera pitch, by @chriscamacho
|
||||||
|
[camera] REVIEWED: Camera not working properly at z-align, by @Ushio
|
||||||
|
[shapes] ADDED: DrawTriangleStrip() - Draw a triangle strip defined by points
|
||||||
|
[shapes] ADDED: DrawEllipse() - Draw ellipse
|
||||||
|
[shapes] ADDED: DrawEllipseLines() - Draw ellipse outline
|
||||||
|
[shapes] ADDED: DrawPolyLines() - Draw a polygon outline of n sides
|
||||||
|
[shapes] REVIEWED: DrawPoly() shape rendering, by @AlexHCC
|
||||||
|
[textures] ADDED: LoadAnimatedGIF() - Load animated GIF file
|
||||||
|
[textures] ADDED: GetImageAlphaBorder() - Get image alpha border rectangle
|
||||||
|
[textures] ADDED: ImageFromImage() - Create an image from another image piece
|
||||||
|
[textures] ADDED: ImageClearBackground(), by @iamsouravgupta
|
||||||
|
[textures] ADDED: ImageDrawPixel(), by @iamsouravgupta
|
||||||
|
[textures] ADDED: ImageDrawCircle(), by @iamsouravgupta
|
||||||
|
[textures] ADDED: ImageDrawLineEx(), by @iamsouravgupta
|
||||||
|
[textures] ADDED: ImageDrawPixelV(), by @RobLoach
|
||||||
|
[textures] ADDED: ImageDrawCircleV(), by @RobLoach
|
||||||
|
[textures] ADDED: ImageDrawLineV(), by @RobLoach
|
||||||
|
[textures] ADDED: ImageDrawRectangleV(), by @RobLoach
|
||||||
|
[textures] ADDED: ImageDrawRectangleRec(), by @RobLoach
|
||||||
|
[textures] REVIEWED: ImageDrawPixel(), by @RobLoach
|
||||||
|
[textures] REVIEWED: ImageDrawLine(), by @RobLoach
|
||||||
|
[textures] REVIEWED: ImageDrawCircle(), by @RobLoach
|
||||||
|
[textures] REVIEWED: ImageDrawRectangle(), by @RobLoach
|
||||||
|
[textures] REVIEWED: ImageDraw(), now it supports color tint parameter
|
||||||
|
[textures] REVIEWED: ImageResizeCanvas()
|
||||||
|
[textures] REVIEWED: ImageCrop() with security checks
|
||||||
|
[textures] REVIEWED: ImageAlphaMask()
|
||||||
|
[textures] REVIEWED: ImageDrawRectangleLines()
|
||||||
|
[textures] REVIEWED: GetImageData()
|
||||||
|
[text] ADDED: TextCopy() - Copy one string to another, returns bytes copied
|
||||||
|
[text] ADDED: GetCodepoints() - Get all codepoints in a string
|
||||||
|
[text] ADDED: CodepointToUtf8() - Encode codepoint into utf8 text
|
||||||
|
[text] ADDED: DrawTextCodepoint() - Draw one character (codepoint)
|
||||||
|
[text] RENAMED: LoadDefaultFont() -> LoadFontDefault()
|
||||||
|
[text] RENAMED: TextCountCodepoints() -> GetCodepointsCount()
|
||||||
|
[text] REVIEWED: TextFormat(), to support caching, by @brankoku
|
||||||
|
[text] REVIEWED: LoadFontData(), generate empty image for space character
|
||||||
|
[text] REVIEWED: TextSplit()
|
||||||
|
[text] REVIEWED: TextToInteger()
|
||||||
|
[text] REVIEWED: GetNextCodepoint(), renamed parameters for clarity
|
||||||
|
[text] REVIEWED: GenImageFontAtlas(), improved atlas size computing
|
||||||
|
[text] REDESIGNED: struct Font, character rectangles have been moved out from CharInfo to Font
|
||||||
|
[text] REDESIGNED: struct CharInfo, now includes directly an Image of the glyph
|
||||||
|
[text] REDESIGNED: GenImageFontAtlas(), additional recs parameter added
|
||||||
|
[text] REDESIGNED: ImageTextEx(), to avoid font retrieval from GPU
|
||||||
|
[models] ADDED: Support rlPushMatrix() and rlPopMatrix() on mesh drawing
|
||||||
|
[models] ADDED: DrawPoint3D() - Draw a point in 3D space, actually a small line, by @ProfJski
|
||||||
|
[models] ADDED: Multi texture support for materials in GLTF format, by @Gamerfiend, @chriscamacho
|
||||||
|
[models] REVIEWED: LoadGLTF(), fixed memory leak, by @jubalh
|
||||||
|
[models] REVIEWED: LoadIQM(), support multiple animations loading, by @culacant
|
||||||
|
[models] REVIEWED: GetCollisionRayModel(), to avoid pointers
|
||||||
|
[models] REVIEWED: CheckCollisionRay*(), parameters renamed
|
||||||
|
[models] REVIEWED: UnloadMesh(), to avoid pointers
|
||||||
|
[models] REVIEWED: LoadModel(), memory initialization
|
||||||
|
[models] REVIEWED: UpdateModelAnimation(), added security checks
|
||||||
|
[models] REVIEWED: Multiple fixes on models loading, by @jubalh
|
||||||
|
[models] REVIEWED: Normals updated when using animated meshes, by @@las3rlars
|
||||||
|
[models] REVIEWED: Compilation when the SUPPORT_MESH_GENERATION not set, by @@Elkantor
|
||||||
|
[raudio] ADDED: Multi-channel audio playing, by @chriscamacho
|
||||||
|
[raudio] REMOVED: LoadWaveEx()
|
||||||
|
[raudio] RENAMED: IsAudioBufferProcessed() to IsAudioStreamProcessed()
|
||||||
|
[raudio] REVIEWED: Ensure .xm playback starts in the right place, by @illegalinstruction
|
||||||
|
[raudio] REVIEWED: Fix short non-looping sounds, by @jbosh
|
||||||
|
[raudio] REVIEWED: Modules playing time to full length
|
||||||
|
[raudio] REDESIGNED: Replaced Music pointer by struct
|
||||||
|
[raudio] REDESIGNED: Removed sampleLeft from Music struct
|
||||||
|
[examples] ADDED: core_scissor_test, by @ChrisDill
|
||||||
|
[examples] ADDED: core_2d_camera_platformer, by @arvyy
|
||||||
|
[examples] ADDED: textures_mouse_painting, by @ChrisDill
|
||||||
|
[examples] ADDED: models_waving_cubes, by @codecat
|
||||||
|
[examples] ADDED: models_solar_system, by @aldrinmartoq
|
||||||
|
[examples] ADDED: shaders_fog, by @chriscamacho
|
||||||
|
[examples] ADDED: shaders_texture_waves, by @Anata
|
||||||
|
[examples] ADDED: shaders_basic_lighting, by @chriscamacho
|
||||||
|
[examples] ADDED: shaders_simple_mask, by @chriscamacho
|
||||||
|
[examples] ADDED: audio_multichannel_sound, by @chriscamacho
|
||||||
|
[examples] ADDED: shaders_spotlight, by @chriscamacho
|
||||||
|
[examples] RENAMED: text_sprite_font > text_font_spritefont
|
||||||
|
[examples] RENAMED: text_ttf_loading > text_font_filters
|
||||||
|
[examples] RENAMED: text_bmfont_ttf > text_font_loading
|
||||||
|
[examples] REMOVED: models_obj_viewer
|
||||||
|
[examples] REMOVED: models_solar_system
|
||||||
|
[examples] REVIEWED: models_obj_loading > models_loading
|
||||||
|
[examples] REVIEWED: models_materials_pbr, shader issues
|
||||||
|
[examples] REVIEWED: core_window_letterbox, detailed explanation, by @jotac0
|
||||||
|
[examples] REVIEWED: core_window_letterbox, virtual mouse, by @anatagawa
|
||||||
|
[games] ADDED: GGJ2020 game - RE-PAIR
|
||||||
|
[*] Misc fixes and tweaks, by @yaram, @oraoto, @zatherz, @piecedigital, @Shylie
|
||||||
|
[*] Update ALL supported projects (Notepad++, VS2017)
|
||||||
|
[*] Update ALL external libraries to latest versions (29.Jan.2020)
|
||||||
|
[*] Update ALL examples and games
|
||||||
|
[*] Update BINDINGS list
|
||||||
|
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
Release: raylib 2.5 (May 2019)
|
Release: raylib 2.5 (May 2019)
|
||||||
|
@@ -6,8 +6,8 @@ Do you enjoy raylib and want to contribute? Nice! You can help with the followin
|
|||||||
|
|
||||||
- C programming - Can you write/review/test/improve the code?
|
- C programming - Can you write/review/test/improve the code?
|
||||||
- Documentation/Tutorials/Example - Can you write some tutorial/example?
|
- Documentation/Tutorials/Example - Can you write some tutorial/example?
|
||||||
- Web Development - Can you help [with the website](https://github.com/raysan5/raylib.com)?
|
|
||||||
- Porting to other platforms - Can you port and compile raylib on other systems?
|
- Porting to other platforms - Can you port and compile raylib on other systems?
|
||||||
|
- Web Development - Can you help [with the website](https://github.com/raysan5/raylib.com)?
|
||||||
- Testing - Can you find some bugs in raylib?
|
- Testing - Can you find some bugs in raylib?
|
||||||
|
|
||||||
This document contains a set of guidelines to contribute to the project. These are mostly guidelines, not rules.
|
This document contains a set of guidelines to contribute to the project. These are mostly guidelines, not rules.
|
||||||
@@ -16,10 +16,10 @@ Use your best judgement, and feel free to propose changes to this document in a
|
|||||||
### raylib philosophy
|
### raylib philosophy
|
||||||
|
|
||||||
- raylib is a tool to enjoy videogames programming, every single function in raylib should be a tutorial on itself.
|
- raylib is a tool to enjoy videogames programming, every single function in raylib should be a tutorial on itself.
|
||||||
- raylib is SIMPLE and EASY-TO-USE, I tried to keep it compact with a small set of functions, if a function is too complex or is not clearly useful, better not to include it.
|
- raylib is **SIMPLE** and **EASY-TO-USE**, I tried to keep it compact with a small set of functions, if a function is too complex or is not clearly useful, better not including it.
|
||||||
- raylib is open source and free; educators and institutions can use this tool to TEACH videogames programming completely by free.
|
- raylib is open source and free; educators and institutions can use this tool to **TEACH** videogames programming completely for free.
|
||||||
- raylib is collaborative; contribution of tutorials / code examples / bug fixes / code comments are highly appreciated.
|
- raylib is collaborative; contribution of tutorials / code examples / bug fixes / code comments are highly appreciated.
|
||||||
- raylib's license (and its external libs respective licenses) allow using it for commercial products.
|
- raylib's license (and its external libs respective licenses) allow using it on commercial projects.
|
||||||
|
|
||||||
### Some interesting reads to start with
|
### Some interesting reads to start with
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ Feel free to review it if required, just take care not to break something.
|
|||||||
Despite being written in C, raylib does not follow the standard Hungarian notation for C,
|
Despite being written in C, raylib does not follow the standard Hungarian notation for C,
|
||||||
it [follows Pascal-case/camel-case notation](https://github.com/raysan5/raylib/wiki/raylib-coding-conventions),
|
it [follows Pascal-case/camel-case notation](https://github.com/raysan5/raylib/wiki/raylib-coding-conventions),
|
||||||
more common on C# language. All code formatting decisions have been carefully taken
|
more common on C# language. All code formatting decisions have been carefully taken
|
||||||
to make it easier for students to read, write and understand code.
|
to make it easier for students/users to read, write and understand code.
|
||||||
|
|
||||||
Source code is extensively commented for that purpose, raylib primary learning method is:
|
Source code is extensively commented for that purpose, raylib primary learning method is:
|
||||||
|
|
||||||
@@ -133,4 +133,4 @@ contributing (in some way or another) to make the raylib project better. Huge th
|
|||||||
- [PompPenguin](https://github.com/PompPenguin) for reviewing 3rd person camera
|
- [PompPenguin](https://github.com/PompPenguin) for reviewing 3rd person camera
|
||||||
- [Mohamed Shazan](https://github.com/msmshazan) for adding support for ANGLE graphics backend
|
- [Mohamed Shazan](https://github.com/msmshazan) for adding support for ANGLE graphics backend
|
||||||
|
|
||||||
Please, if I forget someone in this list, excuse me and send a PR!
|
Please, if I forget someone in this list, excuse me and send me a PR!
|
||||||
|
149
HISTORY.md
@@ -1,19 +1,19 @@
|
|||||||

|

|
||||||
|
|
||||||
history
|
introduction
|
||||||
-------
|
------------
|
||||||
|
|
||||||
I've developed videogames since 2006 and in 2012 I started teaching videogames development to young people with artistic profile, most of them had never written a single line of code.
|
I started developing videogames in 2006 and some years later I started teaching videogames development to young people with artistic profile, most of students had never written a single line of code.
|
||||||
|
|
||||||
I started with C language basis and, after searching for the most simple and easy-to-use library to teach videogames programming, I found WinBGI; it was great and it worked very well with students, in just a couple of weeks that people that had never written a single line of code were able to program (and understand) a simple PONG and some of them even a BREAKOUT!
|
I decided to start with C language basis and, after searching for the most simple and easy-to-use library to teach videogames programming, I found [WinBGI](http://www.codecutter.net/tools/winbgim/); it was great and it worked very well with students, in just a couple of weeks, those students that had never written a single line of code were able to program (and understand) a simple PONG game, some of them even a BREAKOUT!
|
||||||
|
|
||||||
But WinBGI was not the clearer and most organized lib. There were a lot of things I found confusing and some function names were not clear enough for most of the students; not to mention points like no transparencies support or no hardware acceleration.
|
But WinBGI was not the clearer and most organized library for my taste. There were lots of things I found confusing and some function names were not clear enough for most of the students; not to mention the lack of transparencies support and no hardware acceleration.
|
||||||
|
|
||||||
So, I decided to create my own library, hardware accelerated, clear function names, quite organized, well structured, plain C coding and, the most important, primarily intended to learn videogames programming.
|
So, I decided to create my own library, hardware accelerated, clear function names, quite organized, well structured, plain C coding and, the most important, primarily intended to learn videogames programming.
|
||||||
|
|
||||||
Most of my videogames coding experience was in C# and XNA and I really love it (in fact, my students learn C# after C), so, I decided to use C# language notation and XNA naming conventions. That way, students can jump from raylib to XNA, MonoGame or similar libs extremely easily.
|
My previous videogames development experience was mostly in C# and [XNA](https://en.wikipedia.org/wiki/Microsoft_XNA) and I really loved it, so, I decided to use C# language style notation and XNA naming conventions. That way, students were able to move from raylib to XNA, MonoGame or similar libs extremely easily.
|
||||||
|
|
||||||
raylib started as a weekend project and after three months of hard work, raylib 1.0 was published on November 2013.
|
raylib started as a weekend project and after three months of hard work, **raylib 1.0 was published on November 2013**.
|
||||||
|
|
||||||
Enjoy it.
|
Enjoy it.
|
||||||
|
|
||||||
@@ -22,9 +22,9 @@ notes on raylib 1.1
|
|||||||
|
|
||||||
On April 2014, after 6 month of first raylib release, raylib 1.1 has been released. This new version presents a complete internal redesign of the library to support OpenGL 1.1, OpenGL 3.3+ and OpenGL ES 2.0.
|
On April 2014, after 6 month of first raylib release, raylib 1.1 has been released. This new version presents a complete internal redesign of the library to support OpenGL 1.1, OpenGL 3.3+ and OpenGL ES 2.0.
|
||||||
|
|
||||||
A new module named [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been added to the library. This new module translates raylib-OpenGL-style immediate mode functions (i.e. rlVertex3f(), rlBegin(), ...) to different versions of OpenGL (1.1, 3.3+, ES2), selectable by one define.
|
- A new module named [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been added to the library. This new module translates raylib-OpenGL-style immediate mode functions (i.e. rlVertex3f(), rlBegin(), ...) to different versions of OpenGL (1.1, 3.3+, ES2), selectable by one define.
|
||||||
|
|
||||||
[rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) also comes with a second new module named [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h), which includes a bunch of useful functions for 3d-math with vectors, matrices and quaternions.
|
- [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) also comes with a second new module named [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h), which includes a bunch of useful functions for 3d-math with vectors, matrices and quaternions.
|
||||||
|
|
||||||
Some other big changes of this new version have been the support for OGG files loading and stream playing, and the support of DDS texture files (compressed and uncompressed) along with mipmaps support.
|
Some other big changes of this new version have been the support for OGG files loading and stream playing, and the support of DDS texture files (compressed and uncompressed) along with mipmaps support.
|
||||||
|
|
||||||
@@ -37,9 +37,9 @@ On September 2014, after 5 month of raylib 1.1 release, it comes raylib 1.2. Aga
|
|||||||
|
|
||||||
It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the users. On Android, raylib manages internally the activity cicle, as well as the inputs; on Raspberry Pi, a complete raw input system has been written from scratch.
|
It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the users. On Android, raylib manages internally the activity cicle, as well as the inputs; on Raspberry Pi, a complete raw input system has been written from scratch.
|
||||||
|
|
||||||
A new display initialization system has been created to support multiple resolutions, adding black bars if required; user only defines desired screen size and it gets properly displayed.
|
- A new display initialization system has been created to support multiple resolutions, adding black bars if required; user only defines desired screen size and it gets properly displayed.
|
||||||
|
|
||||||
Now raylib can easily deploy games to Android devices and Raspberry Pi (console mode).
|
- Now raylib can easily deploy games to Android devices and Raspberry Pi (console mode).
|
||||||
|
|
||||||
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.2.
|
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.2.
|
||||||
|
|
||||||
@@ -50,15 +50,15 @@ notes on raylib 1.3
|
|||||||
|
|
||||||
On September 2015, after 1 year of raylib 1.2 release, arrives raylib 1.3. This version adds shaders functionality, improves tremendously textures module and also provides some new modules (camera system, gestures system, immediate-mode gui).
|
On September 2015, after 1 year of raylib 1.2 release, arrives raylib 1.3. This version adds shaders functionality, improves tremendously textures module and also provides some new modules (camera system, gestures system, immediate-mode gui).
|
||||||
|
|
||||||
Shaders support is the biggest addition to raylib 1.3, with support for easy shaders loading and use. Loaded shaders can be attached to 3d models or used as fullscreen postrocessing effects. A bunch of postprocessing shaders are also included in this release, check raylib/shaders folder.
|
- Shaders support is the biggest addition to raylib 1.3, with support for easy shaders loading and use. Loaded shaders can be attached to 3d models or used as fullscreen postrocessing effects. A bunch of postprocessing shaders are also included in this release, check raylib/shaders folder.
|
||||||
|
|
||||||
Textures module has grown to support most of the internal texture formats available in OpenGL (RGB565, RGB888, RGBA5551, RGBA4444, etc.), including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT); raylib 1.3 can load .dds, .pkm, .ktx, .astc and .pvr files.
|
- Textures module has grown to support most of the internal texture formats available in OpenGL (RGB565, RGB888, RGBA5551, RGBA4444, etc.), including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT); raylib 1.3 can load .dds, .pkm, .ktx, .astc and .pvr files.
|
||||||
|
|
||||||
A brand new [camera](https://github.com/raysan5/raylib/blob/master/src/camera.c) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person). Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_first_person.c).
|
- A brand new [camera](https://github.com/raysan5/raylib/blob/master/src/camera.c) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person). Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_first_person.c).
|
||||||
|
|
||||||
New [gestures](https://github.com/raysan5/raylib/blob/master/src/gestures.h) module simplifies gestures detection on Android and HTML5 programs.
|
- New [gestures](https://github.com/raysan5/raylib/blob/master/src/gestures.h) module simplifies gestures detection on Android and HTML5 programs.
|
||||||
|
|
||||||
[raygui](https://github.com/raysan5/raylib/blob/master/src/raygui.h), the new immediate-mode GUI module offers a set of functions to create simple user interfaces, primary intended for tools development. It's still in experimental state but already fully functional.
|
- [raygui](https://github.com/raysan5/raylib/blob/master/src/raygui.h), the new immediate-mode GUI module offers a set of functions to create simple user interfaces, primary intended for tools development. It's still in experimental state but already fully functional.
|
||||||
|
|
||||||
Most of the examples have been completely rewritten and +10 new examples have been added to show the new raylib features.
|
Most of the examples have been completely rewritten and +10 new examples have been added to show the new raylib features.
|
||||||
|
|
||||||
@@ -69,17 +69,17 @@ notes on raylib 1.4
|
|||||||
|
|
||||||
On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For this new version, lots of parts of the library have been reviewed, lots of bugs have been solved and some interesting features have been added.
|
On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For this new version, lots of parts of the library have been reviewed, lots of bugs have been solved and some interesting features have been added.
|
||||||
|
|
||||||
First big addition is a set of [Image manipulation functions](https://github.com/raysan5/raylib/blob/master/src/raylib.h#L673) have been added to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image. Now a basic image processing can be done before converting the image to texture for usage.
|
- First big addition is a set of [Image manipulation functions](https://github.com/raysan5/raylib/blob/master/src/raylib.h#L673) have been added to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image. Now a basic image processing can be done before converting the image to texture for usage.
|
||||||
|
|
||||||
SpriteFonts system has been improved, adding support for AngelCode fonts (.fnt) and TrueType Fonts (using [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) helper library). Now raylib can read standard .fnt font data and also generate at loading a SpriteFont from a TTF file.
|
- SpriteFonts system has been improved, adding support for AngelCode fonts (.fnt) and TrueType Fonts (using [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) helper library). Now raylib can read standard .fnt font data and also generate at loading a SpriteFont from a TTF file.
|
||||||
|
|
||||||
New [physac](https://github.com/raysan5/raylib/blob/master/src/physac.h) physics module for basic 2D physics support. Still in development but already functional. Module comes with some usage examples for basic jump and level interaction and also force-based physic movements.
|
- New [physac](https://github.com/raysan5/raylib/blob/master/src/physac.h) physics module for basic 2D physics support. Still in development but already functional. Module comes with some usage examples for basic jump and level interaction and also force-based physic movements.
|
||||||
|
|
||||||
[raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h) module has been reviewed; some bugs have been solved and the module has been converted to a header-only file for easier portability, optionally, functions can also be used as inline.
|
- [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h) module has been reviewed; some bugs have been solved and the module has been converted to a header-only file for easier portability, optionally, functions can also be used as inline.
|
||||||
|
|
||||||
[gestures](https://github.com/raysan5/raylib/blob/master/src/gestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse. This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code.
|
- [gestures](https://github.com/raysan5/raylib/blob/master/src/gestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse. This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code.
|
||||||
|
|
||||||
Raspberry Pi input system has been redesigned to better read raw inputs using generic Linux event handlers (keyboard:`stdin`, mouse:`/dev/input/mouse0`, gamepad:`/dev/input/js0`). Gamepad support has also been added (experimental).
|
- Raspberry Pi input system has been redesigned to better read raw inputs using generic Linux event handlers (keyboard:`stdin`, mouse:`/dev/input/mouse0`, gamepad:`/dev/input/js0`). Gamepad support has also been added (experimental).
|
||||||
|
|
||||||
Other important improvements are the functional raycast system for 3D picking, including some ray collision-detection functions,
|
Other important improvements are the functional raycast system for 3D picking, including some ray collision-detection functions,
|
||||||
and the addition of two simple functions for persistent data storage. Now raylib user can save and load game data in a file (only some platforms supported). A simple [easings](https://github.com/raysan5/raylib/blob/master/src/easings.h) module has also been added for values animation.
|
and the addition of two simple functions for persistent data storage. Now raylib user can save and load game data in a file (only some platforms supported). A simple [easings](https://github.com/raysan5/raylib/blob/master/src/easings.h) module has also been added for values animation.
|
||||||
@@ -94,17 +94,17 @@ notes on raylib 1.5
|
|||||||
|
|
||||||
On July 2016, after 5 months of raylib 1.4 release, arrives raylib 1.5. This new version is the biggest boost of the library until now, lots of parts of the library have been redesigned, lots of bugs have been solved and some **AMAZING** new features have been added.
|
On July 2016, after 5 months of raylib 1.4 release, arrives raylib 1.5. This new version is the biggest boost of the library until now, lots of parts of the library have been redesigned, lots of bugs have been solved and some **AMAZING** new features have been added.
|
||||||
|
|
||||||
VR support: raylib supports **Oculus Rift CV1**, one of the most anticipated VR devices in the market. Additionally, raylib supports simulated VR stereo rendering, independent of the VR device; it means, raylib can generate stereo renders with custom head-mounted-display device parameteres, that way, any VR device in the market can be **simulated in any platform** just configuring device parameters (and consequently, lens distortion). To enable VR is [extremely easy](https://github.com/raysan5/raylib/blob/master/examples/core_oculus_rift.c).
|
- VR support: raylib supports **Oculus Rift CV1**, one of the most anticipated VR devices in the market. Additionally, raylib supports simulated VR stereo rendering, independent of the VR device; it means, raylib can generate stereo renders with custom head-mounted-display device parameteres, that way, any VR device in the market can be **simulated in any platform** just configuring device parameters (and consequently, lens distortion). To enable VR is [extremely easy](https://github.com/raysan5/raylib/blob/master/examples/core_oculus_rift.c).
|
||||||
|
|
||||||
New materials system: now raylib supports standard material properties for 3D models, including diffuse-ambient-specular colors and diffuse-normal-specular textures. Just assign values to standard material and everything is processed internally.
|
- New materials system: now raylib supports standard material properties for 3D models, including diffuse-ambient-specular colors and diffuse-normal-specular textures. Just assign values to standard material and everything is processed internally.
|
||||||
|
|
||||||
New lighting system: added support for up to 8 configurable lights and 3 light types: **point**, **directional** and **spot** lights. Just create a light, configure its parameters and raylib manages render internally for every 3d object using standard material.
|
- New lighting system: added support for up to 8 configurable lights and 3 light types: **point**, **directional** and **spot** lights. Just create a light, configure its parameters and raylib manages render internally for every 3d object using standard material.
|
||||||
|
|
||||||
Complete gamepad support on Raspberry Pi: Gamepad system has been completely redesigned. Now multiple gamepads can be easily configured and used; gamepad data is read and processed in raw mode in a second thread.
|
- Complete gamepad support on Raspberry Pi: Gamepad system has been completely redesigned. Now multiple gamepads can be easily configured and used; gamepad data is read and processed in raw mode in a second thread.
|
||||||
|
|
||||||
Redesigned physics module: [physac](https://github.com/raysan5/raylib/blob/master/src/physac.h) module has been converted to header only and usage [has been simplified](https://github.com/raysan5/raylib/blob/master/examples/physics_basic_rigidbody.c). Performance has also been singnificantly improved, now physic objects are managed internally in a second thread.
|
- Redesigned physics module: [physac](https://github.com/raysan5/raylib/blob/master/src/physac.h) module has been converted to header only and usage [has been simplified](https://github.com/raysan5/raylib/blob/master/examples/physics_basic_rigidbody.c). Performance has also been singnificantly improved, now physic objects are managed internally in a second thread.
|
||||||
|
|
||||||
Audio chiptunese support and mixing channels: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels are now also supported. All this features thanks to the amazing work of @kd7tck.
|
- Audio chiptunese support and mixing channels: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels are now also supported. All this features thanks to the amazing work of @kd7tck.
|
||||||
|
|
||||||
Other additions include a [2D camera system](https://github.com/raysan5/raylib/blob/master/examples/core_2d_camera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/master/examples/shaders_postprocessing.c)) or support for legacy OpenGL 2.1 on desktop platforms.
|
Other additions include a [2D camera system](https://github.com/raysan5/raylib/blob/master/examples/core_2d_camera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/master/examples/shaders_postprocessing.c)) or support for legacy OpenGL 2.1 on desktop platforms.
|
||||||
|
|
||||||
@@ -119,17 +119,17 @@ notes on raylib 1.6
|
|||||||
|
|
||||||
On November 2016, only 4 months after raylib 1.5, arrives raylib 1.6. This new version represents another big review of the library and includes some interesting additions. This version conmmemorates raylib 3rd anniversary (raylib 1.0 was published on November 2013) and it is a stepping stone for raylib future. raylib roadmap has been reviewed and redefined to focus on its primary objective: create a simple and easy-to-use library to learn videogames programming. Some of the new features:
|
On November 2016, only 4 months after raylib 1.5, arrives raylib 1.6. This new version represents another big review of the library and includes some interesting additions. This version conmmemorates raylib 3rd anniversary (raylib 1.0 was published on November 2013) and it is a stepping stone for raylib future. raylib roadmap has been reviewed and redefined to focus on its primary objective: create a simple and easy-to-use library to learn videogames programming. Some of the new features:
|
||||||
|
|
||||||
Complete [raylib Lua binding](https://github.com/raysan5/raylib-lua). All raylib functions plus the +60 code examples have been ported to Lua, now Lua users can enjoy coding videogames in Lua while using all the internal power of raylib. This addition also open the doors to Lua scripting support for a future raylib-based engine, being able to move game logic (Init, Update, Draw, De-Init) to Lua scripts while keep using raylib functionality.
|
- Complete [raylib Lua binding](https://github.com/raysan5/raylib-lua). All raylib functions plus the +60 code examples have been ported to Lua, now Lua users can enjoy coding videogames in Lua while using all the internal power of raylib. This addition also open the doors to Lua scripting support for a future raylib-based engine, being able to move game logic (Init, Update, Draw, De-Init) to Lua scripts while keep using raylib functionality.
|
||||||
|
|
||||||
Completely redesigned [audio module](https://github.com/raysan5/raylib/blob/master/src/raudio.c). Based on the new direction taken in raylib 1.5, it has been further improved and more functionality added (+20 new functions) to allow raw audio processing and streaming. [FLAC file format support](https://github.com/raysan5/raylib/blob/master/src/external/dr_flac.h) has also been added. In the same line, [OpenAL Soft](https://github.com/kcat/openal-soft) backend is now provided as a static library in Windows to allow static linking and get ride of OpenAL32.dll. Now raylib Windows games are completey self-contained, no external libraries required any more!
|
- Completely redesigned [audio module](https://github.com/raysan5/raylib/blob/master/src/raudio.c). Based on the new direction taken in raylib 1.5, it has been further improved and more functionality added (+20 new functions) to allow raw audio processing and streaming. [FLAC file format support](https://github.com/raysan5/raylib/blob/master/src/external/dr_flac.h) has also been added. In the same line, [OpenAL Soft](https://github.com/kcat/openal-soft) backend is now provided as a static library in Windows to allow static linking and get ride of OpenAL32.dll. Now raylib Windows games are completey self-contained, no external libraries required any more!
|
||||||
|
|
||||||
[Physac](https://github.com/victorfisac/Physac) module has been moved to its own repository and it has been improved A LOT, actually, library has been completely rewritten from scratch by [@victorfisac](https://github.com/victorfisac), multiple samples have been added together with countless new features to match current standard 2D physic libraries. Results are amazing!
|
- [Physac](https://github.com/victorfisac/Physac) module has been moved to its own repository and it has been improved A LOT, actually, library has been completely rewritten from scratch by [@victorfisac](https://github.com/victorfisac), multiple samples have been added together with countless new features to match current standard 2D physic libraries. Results are amazing!
|
||||||
|
|
||||||
Camera and gestures modules have been reviewed, highly simplified and ported to single-file header-only libraries for easier portability and usage flexibility. Consequently, camera system usage has been simplified in all examples.
|
- Camera and gestures modules have been reviewed, highly simplified and ported to single-file header-only libraries for easier portability and usage flexibility. Consequently, camera system usage has been simplified in all examples.
|
||||||
|
|
||||||
Improved Gamepad support on Windows and Raspberry Pi with the addition of new functions for custom gamepad configurations but supporting by default PS3 and Xbox-based gamepads.
|
- Improved Gamepad support on Windows and Raspberry Pi with the addition of new functions for custom gamepad configurations but supporting by default PS3 and Xbox-based gamepads.
|
||||||
|
|
||||||
Improved textures and text functionality, adding new functions for texture filtering control and better TTF/AngelCode fonts loading and generation support.
|
- Improved textures and text functionality, adding new functions for texture filtering control and better TTF/AngelCode fonts loading and generation support.
|
||||||
|
|
||||||
Build system improvement. Added support for raylib dynamic library generation (raylib.dll) for users that prefer dynamic library linking. Also thinking on advance users, it has been added pre-configured [Visual Studio C++ 2015 solution](https://github.com/raysan5/raylib/tree/master/project/vs2015) with raylib project and C/C++ examples for users that prefer that professional IDE and compiler.
|
Build system improvement. Added support for raylib dynamic library generation (raylib.dll) for users that prefer dynamic library linking. Also thinking on advance users, it has been added pre-configured [Visual Studio C++ 2015 solution](https://github.com/raysan5/raylib/tree/master/project/vs2015) with raylib project and C/C++ examples for users that prefer that professional IDE and compiler.
|
||||||
|
|
||||||
@@ -140,15 +140,15 @@ notes on raylib 1.7
|
|||||||
|
|
||||||
On May 2017, around 6 month after raylib 1.6, comes another raylib instalment, raylib 1.7. This time library has been improved a lot in terms of consistency and cleanness. As stated in [this patreon article](https://www.patreon.com/posts/raylib-future-7501034), this new raylib version has focused efforts in becoming more simple and easy-to-use to learn videogames programming. Some highlights of this new version are:
|
On May 2017, around 6 month after raylib 1.6, comes another raylib instalment, raylib 1.7. This time library has been improved a lot in terms of consistency and cleanness. As stated in [this patreon article](https://www.patreon.com/posts/raylib-future-7501034), this new raylib version has focused efforts in becoming more simple and easy-to-use to learn videogames programming. Some highlights of this new version are:
|
||||||
|
|
||||||
More than 30 new functions added to the library, functions to control Window, utils to work with filenames and extensions, functions to draw lines with custom thick, mesh loading, functions for 3d ray collisions detailed detection, funtions for VR simulation and much more... Just check [CHANGELOG](CHANGELOG) for a detailed list of additions!
|
- More than 30 new functions added to the library, functions to control Window, utils to work with filenames and extensions, functions to draw lines with custom thick, mesh loading, functions for 3d ray collisions detailed detection, funtions for VR simulation and much more... Just check [CHANGELOG](CHANGELOG) for a detailed list of additions!
|
||||||
|
|
||||||
Support of [configuration flags](https://github.com/raysan5/raylib/issues/200) on every raylib module. Advance users can customize raylib just choosing desired features, defining some configuration flags on modules compilation. That way users can control library size and available functionality.
|
- Support of [configuration flags](https://github.com/raysan5/raylib/issues/200) on every raylib module. Advance users can customize raylib just choosing desired features, defining some configuration flags on modules compilation. That way users can control library size and available functionality.
|
||||||
|
|
||||||
Improved [build system](https://github.com/raysan5/raylib/blob/master/src/Makefile) for all supported platforms (Windows, Linux, OSX, RPI, Android, HTML5) with a unique Makefile to compile sources. Added support for Android compilation with a custom standalone toolchain and also multiple build compliation flags.
|
- Improved [build system](https://github.com/raysan5/raylib/blob/master/src/Makefile) for all supported platforms (Windows, Linux, OSX, RPI, Android, HTML5) with a unique Makefile to compile sources. Added support for Android compilation with a custom standalone toolchain and also multiple build compliation flags.
|
||||||
|
|
||||||
New [examples](http://www.raylib.com/examples.html) and [sample games](http://www.raylib.com/games.html) added. All samples material has been reviewed, removing useless examples and adding more comprehensive ones; all material has been ported to latest raylib version and tested in multiple platforms. Examples folder structure has been improved and also build systems.
|
- New [examples](http://www.raylib.com/examples.html) and [sample games](http://www.raylib.com/games.html) added. All samples material has been reviewed, removing useless examples and adding more comprehensive ones; all material has been ported to latest raylib version and tested in multiple platforms. Examples folder structure has been improved and also build systems.
|
||||||
|
|
||||||
Improved library consistency and organization in general. Functions and parameters have been renamed, some parts of the library have been cleaned and simplyfied, some functions has been moved to examples (lighting, Oculus Rift CV1 support) towards a more generic library implementation. Lots of hours have been invested in this process...
|
- Improved library consistency and organization in general. Functions and parameters have been renamed, some parts of the library have been cleaned and simplyfied, some functions has been moved to examples (lighting, Oculus Rift CV1 support) towards a more generic library implementation. Lots of hours have been invested in this process...
|
||||||
|
|
||||||
Some other features: Gamepad support on HTML5, RPI touch screen support, 32bit audio support, frames timing improvements, public log system, rres file format support, automatic GIF recording...
|
Some other features: Gamepad support on HTML5, RPI touch screen support, 32bit audio support, frames timing improvements, public log system, rres file format support, automatic GIF recording...
|
||||||
|
|
||||||
@@ -159,17 +159,17 @@ notes on raylib 1.8
|
|||||||
|
|
||||||
October 2017, around 5 months after latest raylib version, another release is published: raylib 1.8. Again, several modules of the library have been reviewed and some new functionality added. Main changes of this new release are:
|
October 2017, around 5 months after latest raylib version, another release is published: raylib 1.8. Again, several modules of the library have been reviewed and some new functionality added. Main changes of this new release are:
|
||||||
|
|
||||||
[Procedural image generation](https://github.com/raysan5/raylib/blob/master/examples/textures/textures_image_generation.c) function, a set of new functions have been added to generate gradients, checked, noise and cellular images from scratch. Image generation could be useful for certain textures or learning pourpouses.
|
- [Procedural image generation](https://github.com/raysan5/raylib/blob/master/examples/textures/textures_image_generation.c) function, a set of new functions have been added to generate gradients, checked, noise and cellular images from scratch. Image generation could be useful for certain textures or learning pourpouses.
|
||||||
|
|
||||||
[Parametric mesh generation](https://github.com/raysan5/raylib/blob/master/examples/models/models_mesh_generation.c) functions, create 3d meshes from scratch just defining a set of parameters, meshes like cube, sphere, cylinder, torus, knot and more can be very useful for prototyping or for lighting and texture testing.
|
- [Parametric mesh generation](https://github.com/raysan5/raylib/blob/master/examples/models/models_mesh_generation.c) functions, create 3d meshes from scratch just defining a set of parameters, meshes like cube, sphere, cylinder, torus, knot and more can be very useful for prototyping or for lighting and texture testing.
|
||||||
|
|
||||||
PBR Materials support, a completely redesigned shaders and material system allows advance materials definition and usage, with fully customizable shaders. Some new functions have been added to generate the environment textures required for PBR shading and a a new complete [PBR material example](https://github.com/raysan5/raylib/blob/master/examples/models/models_material_pbr.c) is also provided for reference.
|
- PBR Materials support, a completely redesigned shaders and material system allows advance materials definition and usage, with fully customizable shaders. Some new functions have been added to generate the environment textures required for PBR shading and a a new complete [PBR material example](https://github.com/raysan5/raylib/blob/master/examples/models/models_material_pbr.c) is also provided for reference.
|
||||||
|
|
||||||
Custom Android APK build pipeline with [simple Makefile](https://github.com/raysan5/raylib/blob/master/templates/simple_game/Makefile). Actually, full code building mechanism based on plain Makefile has been completely reviewed and Android building has been added for sources and also for examples and templates building into final APK package. This way, raylib Android building has been greatly simplified and integrated seamlessly into standard build scripts.
|
- Custom Android APK build pipeline with [simple Makefile](https://github.com/raysan5/raylib/blob/master/templates/simple_game/Makefile). Actually, full code building mechanism based on plain Makefile has been completely reviewed and Android building has been added for sources and also for examples and templates building into final APK package. This way, raylib Android building has been greatly simplified and integrated seamlessly into standard build scripts.
|
||||||
|
|
||||||
[rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) module has been completely reviewed and most of the functions renamed for consistency. This way, standalone usage of rlgl is promoted, with a [complete example provided](https://github.com/raysan5/raylib/blob/master/examples/others/rlgl_standalone.c). rlgl offers a pseudo-OpenGL 1.1 immediate-mode programming-style layer, with backends to multiple OpenGL versions.
|
- [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) module has been completely reviewed and most of the functions renamed for consistency. This way, standalone usage of rlgl is promoted, with a [complete example provided](https://github.com/raysan5/raylib/blob/master/examples/others/rlgl_standalone.c). rlgl offers a pseudo-OpenGL 1.1 immediate-mode programming-style layer, with backends to multiple OpenGL versions.
|
||||||
|
|
||||||
[raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h) library has been also reviewed to align with other advance math libraries like [GLM](https://github.com/g-truc/glm). Matrix math has been improved and simplified, some new Quaternion functions have been added and Vector3 functions have been renamed all around the library for consistency with new Vector2 functionality.
|
- [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h) library has been also reviewed to align with other advance math libraries like [GLM](https://github.com/g-truc/glm). Matrix math has been improved and simplified, some new Quaternion functions have been added and Vector3 functions have been renamed all around the library for consistency with new Vector2 functionality.
|
||||||
|
|
||||||
Additionally, as always, examples and templates have been reviewed to work with new version (some new examples have been added), all external libraries have been updated to latest stable version and latest Notepad++ and MinGW have been configured to work with new raylib. For a full list of changes, just check [CHANGELOG](CHANGELOG).
|
Additionally, as always, examples and templates have been reviewed to work with new version (some new examples have been added), all external libraries have been updated to latest stable version and latest Notepad++ and MinGW have been configured to work with new raylib. For a full list of changes, just check [CHANGELOG](CHANGELOG).
|
||||||
|
|
||||||
@@ -182,17 +182,17 @@ It's been 9 month since last raylib version was published, a lots of things have
|
|||||||
|
|
||||||
In **raylib 2.0** the full API has been carefully reviewed for better consistency, some new functionality has been added and the overall raylib experience has been greatly improved... The key features of new version are:
|
In **raylib 2.0** the full API has been carefully reviewed for better consistency, some new functionality has been added and the overall raylib experience has been greatly improved... The key features of new version are:
|
||||||
|
|
||||||
**Complete removal of external dependencies.** Finally, raylib does not require external libraries to be installed and linked along with raylib, all required libraries are contained and compiled within raylib. Obviously some external libraries are required but only the strictly platform-dependant ones, the ones that come installed with the OS. So, raylib becomes a self-contained platform-independent games development library.
|
- **Complete removal of external dependencies.** Finally, raylib does not require external libraries to be installed and linked along with raylib, all required libraries are contained and compiled within raylib. Obviously some external libraries are required but only the strictly platform-dependant ones, the ones that come installed with the OS. So, raylib becomes a self-contained platform-independent games development library.
|
||||||
|
|
||||||
**Full redesign of audio module to use the amazing miniaudio library**, along with external dependencies removal, OpenAL library has been replaced by [miniaudio](https://github.com/dr-soft/miniaudio), this brand new library offers automatic dynamic linking with default OS audio systems. Undoubtly, the perfect low-level companion for raylib audio module!
|
- **Full redesign of audio module to use the amazing miniaudio library**, along with external dependencies removal, OpenAL library has been replaced by [miniaudio](https://github.com/dr-soft/miniaudio), this brand new library offers automatic dynamic linking with default OS audio systems. Undoubtly, the perfect low-level companion for raylib audio module!
|
||||||
|
|
||||||
**Support for continuous integration building*** through AppVeyor and Travis CI. Consequently, raylib GitHub develop branch has been removed, simplyfing the code-base to a single master branch, always stable. Every time a new commit is deployed, library is compiled for **up-to 12 different configurations**, including multiple platforms, 32bit/64bit and multiple compiler options! All those binaries are automatically attached to any new release!
|
- **Support for continuous integration building*** through AppVeyor and Travis CI. Consequently, raylib GitHub develop branch has been removed, simplyfing the code-base to a single master branch, always stable. Every time a new commit is deployed, library is compiled for **up-to 12 different configurations**, including multiple platforms, 32bit/64bit and multiple compiler options! All those binaries are automatically attached to any new release!
|
||||||
|
|
||||||
**More platforms supported and tested**, including BSD family (FreeBSD, openBSD, NetBSD, DragonFly) and Linux-based family platforms (openSUSE, Debian, Ubuntu, Arch, NixOS...). raylib has already been added to some package managers! Oh, and last but not less important, **Android 64bit** is already supported by raylib!
|
- **More platforms supported and tested**, including BSD family (FreeBSD, openBSD, NetBSD, DragonFly) and Linux-based family platforms (openSUSE, Debian, Ubuntu, Arch, NixOS...). raylib has already been added to some package managers! Oh, and last but not less important, **Android 64bit** is already supported by raylib!
|
||||||
|
|
||||||
**Support for TCC compiler!** Thanks to the lack of external dependencies, raylib can now be easily compiled with a **minimal toolchain**, like the one provide by Tiny C Compiler. It opens the door to an amazing future, allowing, for example, static linkage of libtcc for **runtime compilation of raylib-based code**... and the library itself if required! Moreover, TCC is blazing fast, it can compile all raylib in a couple of seconds!
|
- **Support for TCC compiler!** Thanks to the lack of external dependencies, raylib can now be easily compiled with a **minimal toolchain**, like the one provide by Tiny C Compiler. It opens the door to an amazing future, allowing, for example, static linkage of libtcc for **runtime compilation of raylib-based code**... and the library itself if required! Moreover, TCC is blazing fast, it can compile all raylib in a couple of seconds!
|
||||||
|
|
||||||
Refactored all raylib configuration #defines into a **centralized `config.h` header**, with more than **40 possible configuration options** to compile a totally customizable raylib version including only desired options like supported file-formats or specific functionality support. It allows generating a trully ligth-weight version of the library if desired!
|
- Refactored all raylib configuration #defines into a **centralized `config.h` header**, with more than **40 possible configuration options** to compile a totally customizable raylib version including only desired options like supported file-formats or specific functionality support. It allows generating a trully ligth-weight version of the library if desired!
|
||||||
|
|
||||||
A part of that, lots of new features, like a brand **new font rendering and packaging system** for TTF fonts with **SDF support** (thanks to the amazing STB headers), new functions for **CPU image data manipulation**, new orthographic 3d camera mode, a complete review of `raymath.h` single-file header-only library for better consistency and performance, new examples and way, [way more](https://github.com/raysan5/raylib/blob/master/CHANGELOG).
|
A part of that, lots of new features, like a brand **new font rendering and packaging system** for TTF fonts with **SDF support** (thanks to the amazing STB headers), new functions for **CPU image data manipulation**, new orthographic 3d camera mode, a complete review of `raymath.h` single-file header-only library for better consistency and performance, new examples and way, [way more](https://github.com/raysan5/raylib/blob/master/CHANGELOG).
|
||||||
|
|
||||||
@@ -203,25 +203,54 @@ notes on raylib 2.5
|
|||||||
|
|
||||||
After almost one years since latest raylib installment, here it is **raylib 2.5**. A lot of work has been put on this new version and consequently I decided to bump versioning several digits. The complete list of changes and additions is humungous, details can be found in the [CHANGELOG](CHANGELOG), and here it is a short recap with the highlight improvements.
|
After almost one years since latest raylib installment, here it is **raylib 2.5**. A lot of work has been put on this new version and consequently I decided to bump versioning several digits. The complete list of changes and additions is humungous, details can be found in the [CHANGELOG](CHANGELOG), and here it is a short recap with the highlight improvements.
|
||||||
|
|
||||||
New **window management and filesystem functions** to query monitor information, deal with clipboard, check directory files info and even launch a URL with default system web browser. Experimental **High-DPI monitor support** has also been added through a compile flag.
|
- New **window management and file system functions** to query monitor information, deal with clipboard, check directory files info and even launch a URL with default system web browser. Experimental **High-DPI monitor support** has also been added through a compile flag.
|
||||||
|
|
||||||
**Redesigned Gamepad mechanism**, now generic for all platforms and gamepads, no more specific gamepad configurations.
|
- **Redesigned Gamepad mechanism**, now generic for all platforms and gamepads, no more specific gamepad configurations.
|
||||||
**Redesigned UWP input system**, now raylib supports UWP seamlessly, previous implementation required a custom input system implemented in user code.
|
**Redesigned UWP input system**, now raylib supports UWP seamlessly, previous implementation required a custom input system implemented in user code.
|
||||||
|
|
||||||
`rlgl` module has been redesigned to **support a unique buffer for shapes drawing batching**, including LINES, TRIANGLES, QUADS in the same indexed buffer, also added support for multi-buffering if required. Additionally, `rlPushMatrix()`/`rlPopMatrix()` functionality has been reviewed to behave exactly like OpenGL 1.1, `models_rlgl_solar_system` example has been added to illustrate this behaviour.
|
- `rlgl` module has been redesigned to **support a unique buffer for shapes drawing batching**, including LINES, TRIANGLES, QUADS in the same indexed buffer, also added support for multi-buffering if required. Additionally, `rlPushMatrix()`/`rlPopMatrix()` functionality has been reviewed to behave exactly like OpenGL 1.1, `models_rlgl_solar_system` example has been added to illustrate this behaviour.
|
||||||
|
|
||||||
**VR simulator** has been reviewed to **allow custom configuration of Head-Mounted-Device parameters and distortion shader**, `core_vr_simulator` has been properly adapted to showcase this new functionality, now the VR simulator is a generic configurable stereo rendering system that allows any VR device simulation with just a few lines of code or even dynamic tweaking of HMD parameters.
|
- **VR simulator** has been reviewed to **allow custom configuration of Head-Mounted-Device parameters and distortion shader**, `core_vr_simulator` has been properly adapted to showcase this new functionality, now the VR simulator is a generic configurable stereo rendering system that allows any VR device simulation with just a few lines of code or even dynamic tweaking of HMD parameters.
|
||||||
|
|
||||||
Support for **Unicode text drawing**; now raylib processes UTF8 strings on drawing, supporting Unicode codepoints, allowing rendering mostly any existent language (as long as the font with the glyphs is provided). An amazing example showing this feature has also been added: `text_unicode`.
|
- Support for **Unicode text drawing**; now raylib processes UTF8 strings on drawing, supporting Unicode codepoints, allowing rendering mostly any existent language (as long as the font with the glyphs is provided). An amazing example showing this feature has also been added: `text_unicode`.
|
||||||
|
|
||||||
Brand **new text management API**, with the addition of multiple functions to deal with string data, including functionality like replace, insert, join, split, append, to uppercase, to lower... Note that most of those functions are intended for text management on rendering, using pre-loaded internal buffers, avoiding new memory allocation that user should free manually.
|
- Brand **new text management API**, with the addition of multiple functions to deal with string data, including functionality like replace, insert, join, split, append, to uppercase, to lower... Note that most of those functions are intended for text management on rendering, using pre-loaded internal buffers, avoiding new memory allocation that user should free manually.
|
||||||
|
|
||||||
Multiple **new shapes and textures drawing functions** to support rings (`DrawRing()`, `DrawRingLines()`), circle sectors (`DrawCircleSector()`, `DrawCircleSectorLines()`), rounded rectangles (`DrawRectangleRounded()`, `DrawRectangleRoundedLines()`) and also n-patch textures (`DrawTextureNPatch()`), detailed examples have been added to illustrate all this new functionality.
|
- Multiple **new shapes and textures drawing functions** to support rings (`DrawRing()`, `DrawRingLines()`), circle sectors (`DrawCircleSector()`, `DrawCircleSectorLines()`), rounded rectangles (`DrawRectangleRounded()`, `DrawRectangleRoundedLines()`) and also n-patch textures (`DrawTextureNPatch()`), detailed examples have been added to illustrate all this new functionality.
|
||||||
|
|
||||||
Experimental **cubemap support**, to automatically load multiple cubemap layouts (`LoadTextureCubemap()`). It required some internal `rlgl` redesign to allow cubemap textures.
|
- Experimental **cubemap support**, to automatically load multiple cubemap layouts (`LoadTextureCubemap()`). It required some internal `rlgl` redesign to allow cubemap textures.
|
||||||
|
|
||||||
**Skeletal animation support for 3d models**, this addition implied a redesign of `Model` data structure to accomodate multiple mesh/multiple materials support and bones information. Multiple models functions have been reviewed and added on this process, also **glTF models loading support** has been added.
|
- **Skeletal animation support for 3d models**, this addition implied a redesign of `Model` data structure to accomodate multiple mesh/multiple materials support and bones information. Multiple models functions have been reviewed and added on this process, also **glTF models loading support** has been added.
|
||||||
|
|
||||||
This is a just a brief list with some of the changes of the new **raylib 2.5** but there is way more, about **70 new functions** have been added and several subsystems have been redesigned. More than **30 new examples** have been created to show the new functionalities and better illustrate already available ones.
|
This is a just a brief list with some of the changes of the new **raylib 2.5** but there is way more, about **70 new functions** have been added and several subsystems have been redesigned. More than **30 new examples** have been created to show the new functionalities and better illustrate already available ones.
|
||||||
|
|
||||||
It has been a long year of hard work to make raylib a solid technology to develop new products over it.
|
It has been a long year of hard work to make raylib a solid technology to develop new products over it.
|
||||||
|
|
||||||
|
notes on raylib 3.0
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
After **10 months of intense development**, new raylib version is ready. Despite primary intended as a minor release, the [CHANGELIST](CHANGELOG) has grown so big and the library has changed so much internally that it finally became a major release. Library **internal ABI** has reveived a big redesign and review, targeting portability, integration with other platforms and making it a perfect option for other progamming [language bindings](BINDINGS.md).
|
||||||
|
|
||||||
|
- All **global variables** from the multiple raylib modules have been moved to a **global context state**, it has several benefits, first, better code readability with more comprehensive variables naming and categorization (organized by types, i.e. `CORE.Window.display.width`, `CORE.Input.Keyboard.currentKeyState` or `RLGL.State.modelview`). Second, it allows better memory management to load global context state dynamically when required (not at the moment), making it easy to implement a **hot-reloading mechanism** if desired.
|
||||||
|
|
||||||
|
- All **memory allocations** on raylib and its dependencies now use `RL_MALLOC`, `RL_FREE` and similar macros. Now users can easely hook their own memory allocations mechanism if desired, having more control over memory allocated internally by the library. Additionally, it makes it easier to port the library to embedded devices where memory control is critical. For more info check raylib issue #1074.
|
||||||
|
|
||||||
|
- All **I/O file accesses** from raylib are being moved to **memory data access**, now all I/O file access is centralized into just four functions: `LoadFileData()`, `SaveFileData()`, `LoadFileText()`, `SaveFileText()`. Users can just update those functions to any I/O file system. This change makes it easier to integrate raylib with **Virtual File Systems** or custom I/O file implementations.
|
||||||
|
|
||||||
|
- All **raylib data structures** have been reviewed and optimized for pass-by-value usage. One of raylib distinctive design decisions is that most of its functions receive and return data by value. This design makes raylib really simple for newcomers, avoiding pointers and allowing complete access to all structures data in a simple way. The downside is that data is copied on stack every function call and that copy could be costly so, all raylib data structures have been optimized to **stay under 64 bytes** for fast copy and retrieve.
|
||||||
|
|
||||||
|
- All **raylib tracelog messages** have been reviewd and categorized for a more comprehensive output information when developing raylib applications, now all display, input, timer, platform, auxiliar libraries, file-accesses, data loading/unloading issues are properly reported with more detailed and visual messages.
|
||||||
|
|
||||||
|
- `raudio` module has been internally reviewed to accomodate the new `Music` structure (converted from previous pointer format) and the module has been adapted to the **highly improved** [`miniaudio v0.10`](https://github.com/dr-soft/miniaudio).
|
||||||
|
|
||||||
|
- `text` module reviewed to **improve fonts generation** and text management functions, `Font` structure has been redesigned to better accomodate characters data, decoupling individual characters as `Image` glyphs from the font atlas parameters. Several improvements have been made to better support Unicode strings with UTF-8 encoding.
|
||||||
|
|
||||||
|
- **Multiple new examples added** (most of them contributed by raylib users) and all examples reviewed for correct execution on most of the supported platforms, specially Web and Raspberry Pi. A detailed categorized table has been created on github for easy examples navigation and code access.
|
||||||
|
|
||||||
|
- New **GitHub Actions CI** system has been implemented for Windows, Linux and macOS code and examples compilation on every new commit or PR to make sure library keeps stable and usable with no breaking bugs.
|
||||||
|
|
||||||
|
Note that only key changes are listed here but there is way more! About **30 new functions**, multiple functions reviewed, bindings to [+40 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md) and great samples/demos/tutorials [created by the community](https://discord.gg/VkzNHUE), including raylib integration with [Spine](https://github.com/WEREMSOFT/spine-raylib-runtimes), [Unity](https://unitycoder.com/blog/2019/12/09/using-raylib-dll-in-unity/), [Tiled](https://github.com/OnACoffeeBreak/raylib_tiled_import_with_tmx), [Nuklear](http://bedroomcoders.co.uk/implementing-a-3d-gui-with-raylib/), [enet](https://github.com/nxrighthere/NetDynamics) and [more](https://github.com/raysan5/raylib/issues/1079)!
|
||||||
|
|
||||||
|
It has been **10 months of improvements** to create the best raylib ever.
|
||||||
|
|
||||||
|
Welcome to **raylib 3.0**.
|
||||||
|
78
README.md
@@ -8,11 +8,20 @@ raylib is highly inspired by Borland BGI graphics lib and by XNA framework and i
|
|||||||
|
|
||||||
Ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html)
|
Ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html)
|
||||||
|
|
||||||
[](https://travis-ci.org/raysan5/raylib)
|
<br>
|
||||||
[](https://ci.appveyor.com/project/raysan5/raylib)
|
|
||||||
[](https://discord.gg/VkzNHUE)
|
[](https://github.com/raysan5/raylib/graphs/contributors)
|
||||||
|
[](https://github.com/raysan5/raylib/releases)
|
||||||
|
[](https://github.com/raysan5/raylib/commits/master)
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
[](https://twitter.com/raysan5)
|
|
||||||
|
[](https://discord.gg/VkzNHUE)
|
||||||
|
[](https://github.com/raysan5/raylib/stargazers)
|
||||||
|
[](https://twitter.com/raysan5)
|
||||||
|
[](https://www.reddit.com/r/raylib/)
|
||||||
|
|
||||||
|
[](https://travis-ci.org/raysan5/raylib)
|
||||||
|
[)](https://ci.appveyor.com/project/raysan5/raylib)
|
||||||
|
|
||||||
[](https://github.com/raysan5/raylib/actions)
|
[](https://github.com/raysan5/raylib/actions)
|
||||||
[](https://github.com/raysan5/raylib/actions)
|
[](https://github.com/raysan5/raylib/actions)
|
||||||
@@ -21,46 +30,77 @@ Ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html)
|
|||||||
features
|
features
|
||||||
--------
|
--------
|
||||||
- **NO external dependencies**, all required libraries are bundled into raylib
|
- **NO external dependencies**, all required libraries are bundled into raylib
|
||||||
- Multiple platforms supported: **Windows, Linux, MacOS, Android... and many more!**
|
- Multiple platforms supported: **Windows, Linux, MacOS, Android, HTML5... and more!**
|
||||||
- Written in plain C code (C99) in PascalCase/camelCase notation
|
- Written in plain C code (C99) in PascalCase/camelCase notation
|
||||||
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3 or ES 2.0**)
|
- 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)
|
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
|
||||||
- Multiple **Fonts** formats supported (XNA fonts, AngelCode fonts, TTF)
|
- Multiple **Fonts** formats supported (TTF, XNA fonts, AngelCode fonts)
|
||||||
- Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC)
|
- Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC)
|
||||||
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
|
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
|
||||||
- Flexible Materials system, supporting classic maps and **PBR maps**
|
- Flexible Materials system, supporting classic maps and **PBR maps**
|
||||||
- **Animated 3D models** supported (skeletal bones animation)
|
- **Animated 3D models** supported (skeletal bones animation)
|
||||||
- Shaders support, including model and postprocessing shaders.
|
- 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)
|
- **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)
|
- Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD)
|
||||||
- **VR stereo rendering** support with configurable HMD device parameters
|
- **VR stereo rendering** support with configurable HMD device parameters
|
||||||
- Huge examples collection with [+95 code examples](https://www.raylib.com/examples.html)!
|
- Huge examples collection with [+115 code examples](https://github.com/raysan5/raylib/tree/master/examples)!
|
||||||
- Bindings to [+25 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
|
- Bindings to [+40 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
|
||||||
|
- Free and open source.
|
||||||
|
|
||||||
raylib uses on its [core](https://github.com/raysan5/raylib/blob/master/src/core.c) module the outstanding [GLFW3](http://www.glfw.org/) library, embedded in the form of [rglfw](https://github.com/raysan5/raylib/blob/master/src/rglfw.c) module, to avoid external dependencies.
|
raylib uses on its [core](https://github.com/raysan5/raylib/blob/master/src/core.c) module the outstanding [GLFW3](http://www.glfw.org/) library, embedded in the form of [rglfw](https://github.com/raysan5/raylib/blob/master/src/rglfw.c) module, to avoid external dependencies.
|
||||||
|
|
||||||
raylib uses on its [raudio](https://github.com/raysan5/raylib/blob/master/src/raudio.c) module, the amazing [miniaudio](https://github.com/dr-soft/miniaudio) library to support multiple platforms and multiple audio backends.
|
raylib uses on its [raudio](https://github.com/raysan5/raylib/blob/master/src/raudio.c) module, the amazing [miniaudio](https://github.com/dr-soft/miniaudio) library to support multiple platforms and multiple audio backends.
|
||||||
|
|
||||||
raylib uses internally multiple single-file header-only libraries to support different fileformats loading and saving, all those libraries are embedded with raylib and available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib Wiki](https://github.com/raysan5/raylib/wiki/raylib-dependencies) for a detailed list.
|
raylib uses internally several single-file header-only libraries to support different fileformats loading and saving, all those libraries are embedded with raylib and available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib Wiki](https://github.com/raysan5/raylib/wiki/raylib-dependencies) for a detailed list.
|
||||||
|
|
||||||
*On Android platform, `native_app_glue module` module (provided by Android NDK) and native Android libraries are used to manage window/context, inputs and activity life cycle.*
|
*On Android platform, `native_app_glue` module (provided by Android NDK) and native Android libraries are used to manage window/context, inputs and activity life cycle.*
|
||||||
|
|
||||||
*On Raspberry Pi platform (native mode), `Videocore API` and `EGL` libraries are used for window/context management. Inputs are processed using `evdev` Linux libraries*
|
*On Raspberry Pi platform (native mode), `Videocore API` and `EGL` libraries are used for window/context management. Inputs are processed using `evdev` Linux libraries*
|
||||||
|
|
||||||
|
*On Web platform, raylib uses `emscripten` provided libraries for several input events management, specially noticeable the touch events support.*
|
||||||
|
|
||||||
build and installation
|
build and installation
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
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 on multiple OS distributions. Check [raylib Wiki](https://github.com/raysan5/raylib/wiki) for more info.
|
raylib binary releases for Windows, Linux and macOS are available at the [Github Releases page](https://github.com/raysan5/raylib/releases).
|
||||||
|
|
||||||
If you wish to build raylib yourself, [the raylib Wiki](https://github.com/raysan5/raylib/wiki) also contains detailed instructions on how to approach that.
|
raylib is also available via multiple [package managers](https://github.com/raysan5/raylib/issues/613) on multiple OS distributions.
|
||||||
|
|
||||||
raylib has been developed using two tools:
|
#### Installing and building raylib via vcpkg
|
||||||
|
|
||||||
* Notepad++ (text editor) - [http://notepad-plus-plus.org](http://notepad-plus-plus.org/)
|
You can download and install raylib using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
|
||||||
* MinGW (GCC compiler) - [http://www.mingw.org](http://www.mingw.org/)
|
|
||||||
|
|
||||||
Those are the tools recommended to enjoy raylib development.
|
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.*
|
||||||
|
|
||||||
|
#### 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 for UWP (Universal Window Platform)](https://github.com/raysan5/raylib/wiki/Working-for-UWP)
|
||||||
|
- [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.*
|
||||||
|
|
||||||
|
#### Using 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.*
|
||||||
|
|
||||||
contact
|
contact
|
||||||
-------
|
-------
|
||||||
@@ -73,7 +113,7 @@ contact
|
|||||||
* Patreon: [https://www.patreon.com/raylib](https://www.patreon.com/raylib)
|
* Patreon: [https://www.patreon.com/raylib](https://www.patreon.com/raylib)
|
||||||
* YouTube: [https://www.youtube.com/channel/raylib](https://www.youtube.com/channel/UC8WIBkhYb5sBNqXO1mZ7WSQ)
|
* YouTube: [https://www.youtube.com/channel/raylib](https://www.youtube.com/channel/UC8WIBkhYb5sBNqXO1mZ7WSQ)
|
||||||
|
|
||||||
If you are using raylib and you enjoy it, please, join our [Discord server](https://discord.gg/VkzNHUE).
|
If you are using raylib and enjoying it, please, join our [Discord server](https://discord.gg/VkzNHUE) and let us know! :)
|
||||||
|
|
||||||
license
|
license
|
||||||
-------
|
-------
|
||||||
|
20
ROADMAP.md
@@ -3,14 +3,20 @@ roadmap
|
|||||||
|
|
||||||
Here it is a wish-list with features and ideas to improve the library. Note that features listed here are quite high-level and could be long term additions for the library. Current version of raylib is complete and functional but there is a lot of room for improvement.
|
Here it is a wish-list with features and ideas to improve the library. Note that features listed here are quite high-level and could be long term additions for the library. Current version of raylib is complete and functional but there is a lot of room for improvement.
|
||||||
|
|
||||||
[raylib source code](https://github.com/raysan5/raylib/tree/master/src) has some *TODO* marks around code with pending things to review and improve.
|
[raylib source code](https://github.com/raysan5/raylib/tree/master/src) has some *TODO* marks around code with pending things to review and improve. Check also [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details!
|
||||||
Also, check [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details!
|
|
||||||
|
|
||||||
**raylib 2.x**
|
**raylib 3.x**
|
||||||
- [ ] rnet: raylib network module
|
- [ ] Network module (UDP): `rnet` ([info](https://github.com/raysan5/raylib/issues/753))
|
||||||
- [ ] rres: raylib resource packer
|
- [ ] Custom raylib resource packer: `rres` ([info](https://github.com/raysan5/rres))
|
||||||
- [ ] rlvk: raylib Vulkan API support (GRAPHICS_API_VULKAN)
|
- [ ] Basic CPU/GPU stats system (memory, draws, time...)
|
||||||
- [ ] Basic CPU/GPU stats sytem (memory, draws, time...)
|
- [ ] Continuous Deployment using GitHub Actions
|
||||||
|
|
||||||
|
**raylib 3.0**
|
||||||
|
- [x] Custom memory allocators support
|
||||||
|
- [x] Global variables moved to global context
|
||||||
|
- [x] Optimize data structures for pass-by-value
|
||||||
|
- [x] Trace log messages redesign ([info](https://github.com/raysan5/raylib/issues/1065))
|
||||||
|
- [x] Continuous Integration using GitHub Actions
|
||||||
|
|
||||||
**raylib 2.5**
|
**raylib 2.5**
|
||||||
- [x] Support Animated models
|
- [x] Support Animated models
|
||||||
|
@@ -39,7 +39,7 @@ before_build:
|
|||||||
- cd build
|
- cd build
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- cmake -G %GENERATOR% -DSTATIC=ON -DSHARED=ON -DBUILD_EXAMPLES=%examples% -DBUILD_GAMES=%examples% -DINCLUDE_EVERYTHING=ON ..
|
- cmake -G %GENERATOR% -DCMAKE_BUILD_TYPE=Release -DSTATIC=ON -DSHARED=ON -DBUILD_EXAMPLES=%examples% -DBUILD_GAMES=%examples% -DINCLUDE_EVERYTHING=ON ..
|
||||||
- cmake --build . --target install
|
- cmake --build . --target install
|
||||||
|
|
||||||
after_build:
|
after_build:
|
||||||
|
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
# Define required raylib variables
|
# Define required raylib variables
|
||||||
PROJECT_NAME ?= raylib_examples
|
PROJECT_NAME ?= raylib_examples
|
||||||
RAYLIB_VERSION ?= 2.5.0
|
RAYLIB_VERSION ?= 3.0.0
|
||||||
RAYLIB_API_VERSION ?= 2
|
RAYLIB_API_VERSION ?= 3
|
||||||
RAYLIB_PATH ?= ..
|
RAYLIB_PATH ?= ..
|
||||||
|
|
||||||
# Define default options
|
# Define default options
|
||||||
@@ -116,9 +116,9 @@ endif
|
|||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# Emscripten required variables
|
# Emscripten required variables
|
||||||
EMSDK_PATH ?= C:/emsdk
|
EMSDK_PATH ?= C:/emsdk
|
||||||
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/fastcomp/emscripten
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
|
||||||
CLANG_PATH = $(EMSDK_PATH)/fastcomp/bin
|
CLANG_PATH = $(EMSDK_PATH)/upstream/bin
|
||||||
PYTHON_PATH = $(EMSDK_PATH)/python/2.7.13.1_64bit/python-2.7.13.amd64
|
PYTHON_PATH = $(EMSDK_PATH)/python/3.7.4_64bit
|
||||||
NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin
|
NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin
|
||||||
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
|
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
|
||||||
endif
|
endif
|
||||||
@@ -196,7 +196,7 @@ ifeq ($(BUILD_MODE),DEBUG)
|
|||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
CFLAGS += -Os
|
CFLAGS += -O3
|
||||||
else
|
else
|
||||||
CFLAGS += -s -O1
|
CFLAGS += -s -O1
|
||||||
endif
|
endif
|
||||||
@@ -205,11 +205,6 @@ endif
|
|||||||
# Additional flags for compiler (if desired)
|
# Additional flags for compiler (if desired)
|
||||||
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
|
||||||
# resource file contains windows executable icon and properties
|
|
||||||
# -Wl,--subsystem,windows hides the console window
|
|
||||||
CFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data -Wl,--subsystem,windows
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
||||||
CFLAGS += -D_DEFAULT_SOURCE
|
CFLAGS += -D_DEFAULT_SOURCE
|
||||||
@@ -238,7 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
|||||||
# --profiling # include information for code profiling
|
# --profiling # include information for code profiling
|
||||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||||
# --preload-file resources # specify a resources folder for data compilation
|
# --preload-file resources # specify a resources folder for data compilation
|
||||||
CFLAGS += -s USE_GLFW=3 -s FORCE_FILESYSTEM=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 --preload-file $(dir $<)resources@resources
|
CFLAGS += -s USE_GLFW=3 -s FORCE_FILESYSTEM=1 -s ASYNCIFY --preload-file $(dir $<)resources@resources
|
||||||
|
|
||||||
# NOTE: Simple raylib examples are compiled to be interpreter by emterpreter, that way,
|
# NOTE: Simple raylib examples are compiled to be interpreter by emterpreter, that way,
|
||||||
# we can compile same code for ALL platforms with no change required, but, working on bigger
|
# we can compile same code for ALL platforms with no change required, but, working on bigger
|
||||||
@@ -277,6 +272,14 @@ endif
|
|||||||
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# resource file contains windows executable icon and properties
|
||||||
|
LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
|
||||||
|
# -Wl,--subsystem,windows hides the console window
|
||||||
|
ifeq ($(BUILD_MODE), RELEASE)
|
||||||
|
LDFLAGS += -Wl,--subsystem,windows
|
||||||
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Consider -L$(RAYLIB_INSTALL_PATH)
|
# Consider -L$(RAYLIB_INSTALL_PATH)
|
||||||
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
||||||
@@ -453,7 +456,8 @@ SHADERS = \
|
|||||||
shaders/shaders_eratosthenes \
|
shaders/shaders_eratosthenes \
|
||||||
shaders/shaders_basic_lighting \
|
shaders/shaders_basic_lighting \
|
||||||
shaders/shaders_fog \
|
shaders/shaders_fog \
|
||||||
shaders/shaders_simple_mask
|
shaders/shaders_simple_mask \
|
||||||
|
shaders/shaders_spotlight
|
||||||
|
|
||||||
AUDIO = \
|
AUDIO = \
|
||||||
audio/audio_module_playing \
|
audio/audio_module_playing \
|
||||||
@@ -500,7 +504,8 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
del *.o *.exe /s
|
del *.o *.exe /s
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable|x-pie-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
find . -type f -executable -delete
|
||||||
|
rm -fv *.o
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
find . -type f -perm +ugo+x -delete
|
find . -type f -perm +ugo+x -delete
|
||||||
|
@@ -26,8 +26,10 @@ PLATFORM ?= PLATFORM_ANDROID
|
|||||||
RAYLIB_PATH ?= ..\..
|
RAYLIB_PATH ?= ..\..
|
||||||
|
|
||||||
# Define Android architecture (armeabi-v7a, arm64-v8a, x86, x86-64) and API version
|
# Define Android architecture (armeabi-v7a, arm64-v8a, x86, x86-64) and API version
|
||||||
|
# Starting in 2019 using ARM64 is mandatory for published apps,
|
||||||
|
# and minimum required target API is Android 9 (API level 28)
|
||||||
ANDROID_ARCH ?= ARM
|
ANDROID_ARCH ?= ARM
|
||||||
ANDROID_API_VERSION = 21
|
ANDROID_API_VERSION = 28
|
||||||
ifeq ($(ANDROID_ARCH),ARM)
|
ifeq ($(ANDROID_ARCH),ARM)
|
||||||
ANDROID_ARCH_NAME = armeabi-v7a
|
ANDROID_ARCH_NAME = armeabi-v7a
|
||||||
endif
|
endif
|
||||||
@@ -36,11 +38,11 @@ ifeq ($(ANDROID_ARCH),ARM64)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Required path variables
|
# Required path variables
|
||||||
# NOTE: JAVA_HOME must be set to JDK
|
# NOTE: JAVA_HOME must be set to JDK (using OpenJDK 13)
|
||||||
JAVA_HOME ?= C:/JavaJDK
|
JAVA_HOME ?= C:/open-jdk
|
||||||
ANDROID_HOME = C:/android-sdk
|
ANDROID_HOME = C:/android-sdk
|
||||||
ANDROID_TOOLCHAIN = C:/android_toolchain_$(ANDROID_ARCH)_API$(ANDROID_API_VERSION)
|
ANDROID_TOOLCHAIN = C:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64
|
||||||
ANDROID_BUILD_TOOLS = $(ANDROID_HOME)/build-tools/28.0.1
|
ANDROID_BUILD_TOOLS = $(ANDROID_HOME)/build-tools/29.0.3
|
||||||
ANDROID_PLATFORM_TOOLS = $(ANDROID_HOME)/platform-tools
|
ANDROID_PLATFORM_TOOLS = $(ANDROID_HOME)/platform-tools
|
||||||
|
|
||||||
# Android project configuration variables
|
# Android project configuration variables
|
||||||
@@ -81,13 +83,12 @@ ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Compiler and archiver
|
# Compiler and archiver
|
||||||
# NOTE: GCC is being deprecated in Android NDK r16
|
|
||||||
ifeq ($(ANDROID_ARCH),ARM)
|
ifeq ($(ANDROID_ARCH),ARM)
|
||||||
CC = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-clang
|
CC = $(ANDROID_TOOLCHAIN)/bin/armv7a-linux-androideabi$(ANDROID_API_VERSION)-clang
|
||||||
AR = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-ar
|
AR = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-ar
|
||||||
endif
|
endif
|
||||||
ifeq ($(ANDROID_ARCH),ARM64)
|
ifeq ($(ANDROID_ARCH),ARM64)
|
||||||
CC = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-clang
|
CC = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android$(ANDROID_API_VERSION)-clang
|
||||||
AR = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-ar
|
AR = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-ar
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -274,7 +275,7 @@ zipalign_project_apk_package:
|
|||||||
# Install $(PROJECT_NAME).apk to default emulator/device
|
# Install $(PROJECT_NAME).apk to default emulator/device
|
||||||
# NOTE: Use -e (emulator) or -d (device) parameters if required
|
# NOTE: Use -e (emulator) or -d (device) parameters if required
|
||||||
install:
|
install:
|
||||||
$(ANDROID_PLATFORM_TOOLS)/adb install --abi $(ANDROID_ARCH_NAME) -rds $(PROJECT_NAME).apk
|
$(ANDROID_PLATFORM_TOOLS)/adb install $(PROJECT_NAME).apk
|
||||||
|
|
||||||
# Check supported ABI for the device (armeabi-v7a, arm64-v8a, x86, x86_64)
|
# Check supported ABI for the device (armeabi-v7a, arm64-v8a, x86, x86_64)
|
||||||
check_device_abi:
|
check_device_abi:
|
||||||
|
@@ -4,18 +4,19 @@
|
|||||||
*
|
*
|
||||||
* Welcome to raylib!
|
* Welcome to raylib!
|
||||||
*
|
*
|
||||||
* To test examples, just press F6 and execute raylib_compile_execute script
|
* To test examples in Notepad++, provided with default raylib installer package,
|
||||||
|
* just press F6 and run [raylib_compile_execute] script, it will compile and execute.
|
||||||
* Note that compiled executable is placed in the same folder as .c file
|
* Note that compiled executable is placed in the same folder as .c file
|
||||||
*
|
*
|
||||||
* You can find all basic examples on C:\raylib\raylib\examples folder or
|
* You can find all basic examples on [C:\raylib\raylib\examples] directory and
|
||||||
* raylib official webpage: www.raylib.com
|
* raylib official webpage: [www.raylib.com]
|
||||||
*
|
*
|
||||||
* Enjoy using raylib. :)
|
* Enjoy using raylib. :)
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
@@ -12,7 +12,10 @@
|
|||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
// NOTE: Storage positions must start with 0, directly related to file memory layout
|
// NOTE: Storage positions must start with 0, directly related to file memory layout
|
||||||
typedef enum { STORAGE_SCORE = 0, STORAGE_HISCORE } StorageData;
|
typedef enum {
|
||||||
|
STORAGE_POSITION_SCORE = 0,
|
||||||
|
STORAGE_POSITION_HISCORE = 1
|
||||||
|
} StorageData;
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
@@ -43,14 +46,14 @@ int main(void)
|
|||||||
|
|
||||||
if (IsKeyPressed(KEY_ENTER))
|
if (IsKeyPressed(KEY_ENTER))
|
||||||
{
|
{
|
||||||
StorageSaveValue(STORAGE_SCORE, score);
|
SaveStorageValue(STORAGE_POSITION_SCORE, score);
|
||||||
StorageSaveValue(STORAGE_HISCORE, hiscore);
|
SaveStorageValue(STORAGE_POSITION_HISCORE, hiscore);
|
||||||
}
|
}
|
||||||
else if (IsKeyPressed(KEY_SPACE))
|
else if (IsKeyPressed(KEY_SPACE))
|
||||||
{
|
{
|
||||||
// NOTE: If requested position could not be found, value 0 is returned
|
// NOTE: If requested position could not be found, value 0 is returned
|
||||||
score = StorageLoadValue(STORAGE_SCORE);
|
score = LoadStorageValue(STORAGE_POSITION_SCORE);
|
||||||
hiscore = StorageLoadValue(STORAGE_HISCORE);
|
hiscore = LoadStorageValue(STORAGE_POSITION_HISCORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
framesCounter++;
|
framesCounter++;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [core] example - window scale letterbox
|
* raylib [core] example - window scale letterbox (and virtual mouse)
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 2.5 (www.raylib.com)
|
* This example has been created using raylib 2.5 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
@@ -16,6 +16,18 @@
|
|||||||
#define max(a, b) ((a)>(b)? (a) : (b))
|
#define max(a, b) ((a)>(b)? (a) : (b))
|
||||||
#define min(a, b) ((a)<(b)? (a) : (b))
|
#define min(a, b) ((a)<(b)? (a) : (b))
|
||||||
|
|
||||||
|
// Clamp Vector2 value with min and max and return a new vector2
|
||||||
|
// NOTE: Required for virtual mouse, to clamp inside virtual game size
|
||||||
|
Vector2 ClampValue(Vector2 value, Vector2 min, Vector2 max)
|
||||||
|
{
|
||||||
|
Vector2 result = value;
|
||||||
|
result.x = (result.x > max.x)? max.x : result.x;
|
||||||
|
result.x = (result.x < min.x)? min.x : result.x;
|
||||||
|
result.y = (result.y > max.y)? max.y : result.y;
|
||||||
|
result.y = (result.y < min.y)? min.y : result.y;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
const int windowWidth = 800;
|
const int windowWidth = 800;
|
||||||
@@ -52,6 +64,13 @@ int main(void)
|
|||||||
// Recalculate random colors for the bars
|
// Recalculate random colors for the bars
|
||||||
for (int i = 0; i < 10; i++) colors[i] = (Color){ GetRandomValue(100, 250), GetRandomValue(50, 150), GetRandomValue(10, 100), 255 };
|
for (int i = 0; i < 10; i++) colors[i] = (Color){ GetRandomValue(100, 250), GetRandomValue(50, 150), GetRandomValue(10, 100), 255 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update virtual mouse (clamped mouse value behind game screen)
|
||||||
|
Vector2 mouse = GetMousePosition();
|
||||||
|
Vector2 virtualMouse = { 0 };
|
||||||
|
virtualMouse.x = (mouse.x - (GetScreenWidth() - (gameScreenWidth*scale))*0.5f)/scale;
|
||||||
|
virtualMouse.y = (mouse.y - (GetScreenHeight() - (gameScreenHeight*scale))*0.5f)/scale;
|
||||||
|
virtualMouse = ClampValue(virtualMouse, (Vector2){ 0, 0 }, (Vector2){ gameScreenWidth, gameScreenHeight });
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
@@ -68,6 +87,9 @@ int main(void)
|
|||||||
|
|
||||||
DrawText("If executed inside a window,\nyou can resize the window,\nand see the screen scaling!", 10, 25, 20, WHITE);
|
DrawText("If executed inside a window,\nyou can resize the window,\nand see the screen scaling!", 10, 25, 20, WHITE);
|
||||||
|
|
||||||
|
DrawText(TextFormat("Default Mouse: [%i , %i]", (int)mouse.x, (int)mouse.y), 350, 25, 20, GREEN);
|
||||||
|
DrawText(TextFormat("Virtual Mouse: [%i , %i]", (int)virtualMouse.x, (int)virtualMouse.y), 350, 55, 20, YELLOW);
|
||||||
|
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
|
|
||||||
// Draw RenderTexture2D to window, properly scaled
|
// Draw RenderTexture2D to window, properly scaled
|
||||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 23 KiB |
@@ -37,7 +37,6 @@ int main(void)
|
|||||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||||
camera.type = CAMERA_PERSPECTIVE; // Camera mode type
|
camera.type = CAMERA_PERSPECTIVE; // Camera mode type
|
||||||
|
|
||||||
|
|
||||||
Model model = LoadModel("resources/guy/guy.iqm"); // Load the animated model mesh and basic data
|
Model model = LoadModel("resources/guy/guy.iqm"); // Load the animated model mesh and basic data
|
||||||
Texture2D texture = LoadTexture("resources/guy/guytex.png"); // Load model texture and set material
|
Texture2D texture = LoadTexture("resources/guy/guytex.png"); // Load model texture and set material
|
||||||
SetMaterialTexture(&model.materials[0], MAP_DIFFUSE, texture); // Set model material map texture
|
SetMaterialTexture(&model.materials[0], MAP_DIFFUSE, texture); // Set model material map texture
|
||||||
|
@@ -2,6 +2,9 @@
|
|||||||
*
|
*
|
||||||
* raylib [models] example - PBR material
|
* raylib [models] example - PBR material
|
||||||
*
|
*
|
||||||
|
* NOTE: This example requires raylib OpenGL 3.3 for shaders support and only #version 330
|
||||||
|
* is currently supported. OpenGL ES 2.0 platforms are not supported at the moment.
|
||||||
|
*
|
||||||
* This example has been created using raylib 1.8 (www.raylib.com)
|
* This example has been created using raylib 1.8 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
|
@@ -1,133 +0,0 @@
|
|||||||
/*******************************************************************************************
|
|
||||||
*
|
|
||||||
* BRDF LUT Generation - Bidirectional reflectance distribution function fragment shader
|
|
||||||
*
|
|
||||||
* REF: https://github.com/HectorMF/BRDFGenerator
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 Victor Fisac
|
|
||||||
*
|
|
||||||
**********************************************************************************************/
|
|
||||||
|
|
||||||
#version 330
|
|
||||||
|
|
||||||
|
|
||||||
// Input vertex attributes (from vertex shader)
|
|
||||||
in vec2 fragTexCoord;
|
|
||||||
|
|
||||||
// Constant values
|
|
||||||
const float PI = 3.14159265359;
|
|
||||||
const uint MAX_SAMPLES = 1024u;
|
|
||||||
|
|
||||||
// Output fragment color
|
|
||||||
out vec4 finalColor;
|
|
||||||
|
|
||||||
vec2 Hammersley(uint i, uint N);
|
|
||||||
float RadicalInverseVdC(uint bits);
|
|
||||||
float GeometrySchlickGGX(float NdotV, float roughness);
|
|
||||||
float GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness);
|
|
||||||
vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness);
|
|
||||||
vec2 IntegrateBRDF(float NdotV, float roughness);
|
|
||||||
|
|
||||||
float RadicalInverseVdC(uint bits)
|
|
||||||
{
|
|
||||||
bits = (bits << 16u) | (bits >> 16u);
|
|
||||||
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
|
|
||||||
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
|
|
||||||
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
|
|
||||||
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
|
|
||||||
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute Hammersley coordinates
|
|
||||||
vec2 Hammersley(uint i, uint N)
|
|
||||||
{
|
|
||||||
return vec2(float(i)/float(N), RadicalInverseVdC(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Integrate number of importance samples for (roughness and NoV)
|
|
||||||
vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness)
|
|
||||||
{
|
|
||||||
float a = roughness*roughness;
|
|
||||||
float phi = 2.0 * PI * Xi.x;
|
|
||||||
float cosTheta = sqrt((1.0 - Xi.y)/(1.0 + (a*a - 1.0)*Xi.y));
|
|
||||||
float sinTheta = sqrt(1.0 - cosTheta*cosTheta);
|
|
||||||
|
|
||||||
// Transform from spherical coordinates to cartesian coordinates (halfway vector)
|
|
||||||
vec3 H = vec3(cos(phi)*sinTheta, sin(phi)*sinTheta, cosTheta);
|
|
||||||
|
|
||||||
// Transform from tangent space H vector to world space sample vector
|
|
||||||
vec3 up = ((abs(N.z) < 0.999) ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0));
|
|
||||||
vec3 tangent = normalize(cross(up, N));
|
|
||||||
vec3 bitangent = cross(N, tangent);
|
|
||||||
vec3 sampleVec = tangent*H.x + bitangent*H.y + N*H.z;
|
|
||||||
|
|
||||||
return normalize(sampleVec);
|
|
||||||
}
|
|
||||||
|
|
||||||
float GeometrySchlickGGX(float NdotV, float roughness)
|
|
||||||
{
|
|
||||||
// For IBL k is calculated different
|
|
||||||
float k = (roughness*roughness)/2.0;
|
|
||||||
|
|
||||||
float nom = NdotV;
|
|
||||||
float denom = NdotV*(1.0 - k) + k;
|
|
||||||
|
|
||||||
return nom/denom;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute the geometry term for the BRDF given roughness squared, NoV, NoL
|
|
||||||
float GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness)
|
|
||||||
{
|
|
||||||
float NdotV = max(dot(N, V), 0.0);
|
|
||||||
float NdotL = max(dot(N, L), 0.0);
|
|
||||||
float ggx2 = GeometrySchlickGGX(NdotV, roughness);
|
|
||||||
float ggx1 = GeometrySchlickGGX(NdotL, roughness);
|
|
||||||
|
|
||||||
return ggx1*ggx2;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 IntegrateBRDF(float NdotV, float roughness)
|
|
||||||
{
|
|
||||||
float A = 0.0;
|
|
||||||
float B = 0.0;
|
|
||||||
vec3 V = vec3(sqrt(1.0 - NdotV*NdotV), 0.0, NdotV);
|
|
||||||
vec3 N = vec3(0.0, 0.0, 1.0);
|
|
||||||
|
|
||||||
for (uint i = 0u; i < MAX_SAMPLES; i++)
|
|
||||||
{
|
|
||||||
// Generate a sample vector that's biased towards the preferred alignment direction (importance sampling)
|
|
||||||
|
|
||||||
vec2 Xi = Hammersley(i, MAX_SAMPLES); // Compute a Hammersely coordinate
|
|
||||||
vec3 H = ImportanceSampleGGX(Xi, N, roughness); // Integrate number of importance samples for (roughness and NoV)
|
|
||||||
vec3 L = normalize(2.0*dot(V, H)*H - V); // Compute reflection vector L
|
|
||||||
|
|
||||||
float NdotL = max(L.z, 0.0); // Compute normal dot light
|
|
||||||
float NdotH = max(H.z, 0.0); // Compute normal dot half
|
|
||||||
float VdotH = max(dot(V, H), 0.0); // Compute view dot half
|
|
||||||
|
|
||||||
if (NdotL > 0.0)
|
|
||||||
{
|
|
||||||
float G = GeometrySmith(N, V, L, roughness); // Compute the geometry term for the BRDF given roughness squared, NoV, NoL
|
|
||||||
float GVis = (G*VdotH)/(NdotH*NdotV); // Compute the visibility term given G, VoH, NoH, NoV, NoL
|
|
||||||
float Fc = pow(1.0 - VdotH, 5.0); // Compute the fresnel term given VoH
|
|
||||||
|
|
||||||
A += (1.0 - Fc)*GVis; // Sum the result given fresnel, geometry, visibility
|
|
||||||
B += Fc*GVis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate brdf average sample
|
|
||||||
A /= float(MAX_SAMPLES);
|
|
||||||
B /= float(MAX_SAMPLES);
|
|
||||||
|
|
||||||
return vec2(A, B);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
// Calculate brdf based on texture coordinates
|
|
||||||
vec2 brdf = IntegrateBRDF(fragTexCoord.x, fragTexCoord.y);
|
|
||||||
|
|
||||||
// Calculate final fragment color
|
|
||||||
finalColor = vec4(brdf.r, brdf.g, 0.0, 1.0);
|
|
||||||
}
|
|
@@ -1,25 +0,0 @@
|
|||||||
/*******************************************************************************************
|
|
||||||
*
|
|
||||||
* rPBR [shader] - Bidirectional reflectance distribution function vertex shader
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 Victor Fisac
|
|
||||||
*
|
|
||||||
**********************************************************************************************/
|
|
||||||
|
|
||||||
#version 330
|
|
||||||
|
|
||||||
// Input vertex attributes
|
|
||||||
in vec3 vertexPosition;
|
|
||||||
in vec2 vertexTexCoord;
|
|
||||||
|
|
||||||
// Output vertex attributes (to fragment shader)
|
|
||||||
out vec2 fragTexCoord;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
// Calculate fragment position based on model transformations
|
|
||||||
fragTexCoord = vertexTexCoord;
|
|
||||||
|
|
||||||
// Calculate final vertex position
|
|
||||||
gl_Position = vec4(vertexPosition, 1.0);
|
|
||||||
}
|
|
@@ -1,58 +0,0 @@
|
|||||||
/*******************************************************************************************
|
|
||||||
*
|
|
||||||
* rPBR [shader] - Irradiance cubemap fragment shader
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 Victor Fisac
|
|
||||||
*
|
|
||||||
**********************************************************************************************/
|
|
||||||
|
|
||||||
#version 330
|
|
||||||
|
|
||||||
// Input vertex attributes (from vertex shader)
|
|
||||||
in vec3 fragPosition;
|
|
||||||
|
|
||||||
// Input uniform values
|
|
||||||
uniform samplerCube environmentMap;
|
|
||||||
|
|
||||||
// Constant values
|
|
||||||
const float PI = 3.14159265359f;
|
|
||||||
|
|
||||||
// Output fragment color
|
|
||||||
out vec4 finalColor;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
// The sample direction equals the hemisphere's orientation
|
|
||||||
vec3 normal = normalize(fragPosition);
|
|
||||||
|
|
||||||
vec3 irradiance = vec3(0.0);
|
|
||||||
|
|
||||||
vec3 up = vec3(0.0, 1.0, 0.0);
|
|
||||||
vec3 right = cross(up, normal);
|
|
||||||
up = cross(normal, right);
|
|
||||||
|
|
||||||
float sampleDelta = 0.025f;
|
|
||||||
float nrSamples = 0.0f;
|
|
||||||
|
|
||||||
for (float phi = 0.0; phi < 2.0*PI; phi += sampleDelta)
|
|
||||||
{
|
|
||||||
for (float theta = 0.0; theta < 0.5*PI; theta += sampleDelta)
|
|
||||||
{
|
|
||||||
// Spherical to cartesian (in tangent space)
|
|
||||||
vec3 tangentSample = vec3(sin(theta)*cos(phi), sin(theta)*sin(phi), cos(theta));
|
|
||||||
|
|
||||||
// tangent space to world
|
|
||||||
vec3 sampleVec = tangentSample.x*right + tangentSample.y*up + tangentSample.z*normal;
|
|
||||||
|
|
||||||
// Fetch color from environment cubemap
|
|
||||||
irradiance += texture(environmentMap, sampleVec).rgb*cos(theta)*sin(theta);
|
|
||||||
nrSamples++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate irradiance average value from samples
|
|
||||||
irradiance = PI*irradiance*(1.0/float(nrSamples));
|
|
||||||
|
|
||||||
// Calculate final fragment color
|
|
||||||
finalColor = vec4(irradiance, 1.0);
|
|
||||||
}
|
|
@@ -1,298 +0,0 @@
|
|||||||
/*******************************************************************************************
|
|
||||||
*
|
|
||||||
* rPBR [shader] - Physically based rendering fragment shader
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 Victor Fisac
|
|
||||||
*
|
|
||||||
**********************************************************************************************/
|
|
||||||
|
|
||||||
#version 330
|
|
||||||
|
|
||||||
#define MAX_REFLECTION_LOD 4.0
|
|
||||||
#define MAX_DEPTH_LAYER 20
|
|
||||||
#define MIN_DEPTH_LAYER 10
|
|
||||||
|
|
||||||
#define MAX_LIGHTS 4
|
|
||||||
#define LIGHT_DIRECTIONAL 0
|
|
||||||
#define LIGHT_POINT 1
|
|
||||||
|
|
||||||
struct MaterialProperty {
|
|
||||||
vec3 color;
|
|
||||||
int useSampler;
|
|
||||||
sampler2D sampler;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Light {
|
|
||||||
int enabled;
|
|
||||||
int type;
|
|
||||||
vec3 position;
|
|
||||||
vec3 target;
|
|
||||||
vec4 color;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Input vertex attributes (from vertex shader)
|
|
||||||
in vec3 fragPosition;
|
|
||||||
in vec2 fragTexCoord;
|
|
||||||
in vec3 fragNormal;
|
|
||||||
in vec3 fragTangent;
|
|
||||||
in vec3 fragBinormal;
|
|
||||||
|
|
||||||
// Input material values
|
|
||||||
uniform MaterialProperty albedo;
|
|
||||||
uniform MaterialProperty normals;
|
|
||||||
uniform MaterialProperty metalness;
|
|
||||||
uniform MaterialProperty roughness;
|
|
||||||
uniform MaterialProperty occlusion;
|
|
||||||
uniform MaterialProperty emission;
|
|
||||||
uniform MaterialProperty height;
|
|
||||||
|
|
||||||
// Input uniform values
|
|
||||||
uniform samplerCube irradianceMap;
|
|
||||||
uniform samplerCube prefilterMap;
|
|
||||||
uniform sampler2D brdfLUT;
|
|
||||||
|
|
||||||
// Input lighting values
|
|
||||||
uniform Light lights[MAX_LIGHTS];
|
|
||||||
|
|
||||||
// Other uniform values
|
|
||||||
uniform int renderMode;
|
|
||||||
uniform vec3 viewPos;
|
|
||||||
vec2 texCoord;
|
|
||||||
|
|
||||||
// Constant values
|
|
||||||
const float PI = 3.14159265359;
|
|
||||||
|
|
||||||
// Output fragment color
|
|
||||||
out vec4 finalColor;
|
|
||||||
|
|
||||||
vec3 ComputeMaterialProperty(MaterialProperty property);
|
|
||||||
float DistributionGGX(vec3 N, vec3 H, float roughness);
|
|
||||||
float GeometrySchlickGGX(float NdotV, float roughness);
|
|
||||||
float GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness);
|
|
||||||
vec3 fresnelSchlick(float cosTheta, vec3 F0);
|
|
||||||
vec3 fresnelSchlickRoughness(float cosTheta, vec3 F0, float roughness);
|
|
||||||
vec2 ParallaxMapping(vec2 texCoords, vec3 viewDir);
|
|
||||||
|
|
||||||
vec3 ComputeMaterialProperty(MaterialProperty property)
|
|
||||||
{
|
|
||||||
vec3 result = vec3(0.0, 0.0, 0.0);
|
|
||||||
|
|
||||||
if (property.useSampler == 1) result = texture(property.sampler, texCoord).rgb;
|
|
||||||
else result = property.color;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
float DistributionGGX(vec3 N, vec3 H, float roughness)
|
|
||||||
{
|
|
||||||
float a = roughness*roughness;
|
|
||||||
float a2 = a*a;
|
|
||||||
float NdotH = max(dot(N, H), 0.0);
|
|
||||||
float NdotH2 = NdotH*NdotH;
|
|
||||||
|
|
||||||
float nom = a2;
|
|
||||||
float denom = (NdotH2*(a2 - 1.0) + 1.0);
|
|
||||||
denom = PI*denom*denom;
|
|
||||||
|
|
||||||
return nom/denom;
|
|
||||||
}
|
|
||||||
|
|
||||||
float GeometrySchlickGGX(float NdotV, float roughness)
|
|
||||||
{
|
|
||||||
float r = (roughness + 1.0);
|
|
||||||
float k = r*r/8.0;
|
|
||||||
|
|
||||||
float nom = NdotV;
|
|
||||||
float denom = NdotV*(1.0 - k) + k;
|
|
||||||
|
|
||||||
return nom/denom;
|
|
||||||
}
|
|
||||||
float GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness)
|
|
||||||
{
|
|
||||||
float NdotV = max(dot(N, V), 0.0);
|
|
||||||
float NdotL = max(dot(N, L), 0.0);
|
|
||||||
float ggx2 = GeometrySchlickGGX(NdotV, roughness);
|
|
||||||
float ggx1 = GeometrySchlickGGX(NdotL, roughness);
|
|
||||||
|
|
||||||
return ggx1*ggx2;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 fresnelSchlick(float cosTheta, vec3 F0)
|
|
||||||
{
|
|
||||||
return F0 + (1.0 - F0)*pow(1.0 - cosTheta, 5.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 fresnelSchlickRoughness(float cosTheta, vec3 F0, float roughness)
|
|
||||||
{
|
|
||||||
return F0 + (max(vec3(1.0 - roughness), F0) - F0)*pow(1.0 - cosTheta, 5.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 ParallaxMapping(vec2 texCoords, vec3 viewDir)
|
|
||||||
{
|
|
||||||
// Calculate the number of depth layers and calculate the size of each layer
|
|
||||||
float numLayers = mix(MAX_DEPTH_LAYER, MIN_DEPTH_LAYER, abs(dot(vec3(0.0, 0.0, 1.0), viewDir)));
|
|
||||||
float layerDepth = 1.0/numLayers;
|
|
||||||
|
|
||||||
// Calculate depth of current layer
|
|
||||||
float currentLayerDepth = 0.0;
|
|
||||||
|
|
||||||
// Calculate the amount to shift the texture coordinates per layer (from vector P)
|
|
||||||
// Note: height amount is stored in height material attribute color R channel (sampler use is independent)
|
|
||||||
vec2 P = viewDir.xy*height.color.r;
|
|
||||||
vec2 deltaTexCoords = P/numLayers;
|
|
||||||
|
|
||||||
// Store initial texture coordinates and depth values
|
|
||||||
vec2 currentTexCoords = texCoords;
|
|
||||||
float currentDepthMapValue = texture(height.sampler, currentTexCoords).r;
|
|
||||||
|
|
||||||
while (currentLayerDepth < currentDepthMapValue)
|
|
||||||
{
|
|
||||||
// Shift texture coordinates along direction of P
|
|
||||||
currentTexCoords -= deltaTexCoords;
|
|
||||||
|
|
||||||
// Get depth map value at current texture coordinates
|
|
||||||
currentDepthMapValue = texture(height.sampler, currentTexCoords).r;
|
|
||||||
|
|
||||||
// Get depth of next layer
|
|
||||||
currentLayerDepth += layerDepth;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get texture coordinates before collision (reverse operations)
|
|
||||||
vec2 prevTexCoords = currentTexCoords + deltaTexCoords;
|
|
||||||
|
|
||||||
// Get depth after and before collision for linear interpolation
|
|
||||||
float afterDepth = currentDepthMapValue - currentLayerDepth;
|
|
||||||
float beforeDepth = texture(height.sampler, prevTexCoords).r - currentLayerDepth + layerDepth;
|
|
||||||
|
|
||||||
// Interpolation of texture coordinates
|
|
||||||
float weight = afterDepth/(afterDepth - beforeDepth);
|
|
||||||
vec2 finalTexCoords = prevTexCoords*weight + currentTexCoords*(1.0 - weight);
|
|
||||||
|
|
||||||
return finalTexCoords;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
// Calculate TBN and RM matrices
|
|
||||||
mat3 TBN = transpose(mat3(fragTangent, fragBinormal, fragNormal));
|
|
||||||
|
|
||||||
// Calculate lighting required attributes
|
|
||||||
vec3 normal = normalize(fragNormal);
|
|
||||||
vec3 view = normalize(viewPos - fragPosition);
|
|
||||||
vec3 refl = reflect(-view, normal);
|
|
||||||
|
|
||||||
// Check if parallax mapping is enabled and calculate texture coordinates to use based on height map
|
|
||||||
// NOTE: remember that 'texCoord' variable must be assigned before calling any ComputeMaterialProperty() function
|
|
||||||
if (height.useSampler == 1) texCoord = ParallaxMapping(fragTexCoord, view);
|
|
||||||
else texCoord = fragTexCoord; // Use default texture coordinates
|
|
||||||
|
|
||||||
// Fetch material values from texture sampler or color attributes
|
|
||||||
vec3 color = ComputeMaterialProperty(albedo);
|
|
||||||
vec3 metal = ComputeMaterialProperty(metalness);
|
|
||||||
vec3 rough = ComputeMaterialProperty(roughness);
|
|
||||||
vec3 emiss = ComputeMaterialProperty(emission);
|
|
||||||
vec3 ao = ComputeMaterialProperty(occlusion);
|
|
||||||
|
|
||||||
// Check if normal mapping is enabled
|
|
||||||
if (normals.useSampler == 1)
|
|
||||||
{
|
|
||||||
// Fetch normal map color and transform lighting values to tangent space
|
|
||||||
normal = ComputeMaterialProperty(normals);
|
|
||||||
normal = normalize(normal*2.0 - 1.0);
|
|
||||||
normal = normalize(normal*TBN);
|
|
||||||
|
|
||||||
// Convert tangent space normal to world space due to cubemap reflection calculations
|
|
||||||
refl = normalize(reflect(-view, normal));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate reflectance at normal incidence
|
|
||||||
vec3 F0 = vec3(0.04);
|
|
||||||
F0 = mix(F0, color, metal.r);
|
|
||||||
|
|
||||||
// Calculate lighting for all lights
|
|
||||||
vec3 Lo = vec3(0.0);
|
|
||||||
vec3 lightDot = vec3(0.0);
|
|
||||||
|
|
||||||
for (int i = 0; i < MAX_LIGHTS; i++)
|
|
||||||
{
|
|
||||||
if (lights[i].enabled == 1)
|
|
||||||
{
|
|
||||||
// Calculate per-light radiance
|
|
||||||
vec3 light = vec3(0.0);
|
|
||||||
vec3 radiance = lights[i].color.rgb;
|
|
||||||
if (lights[i].type == LIGHT_DIRECTIONAL) light = -normalize(lights[i].target - lights[i].position);
|
|
||||||
else if (lights[i].type == LIGHT_POINT)
|
|
||||||
{
|
|
||||||
light = normalize(lights[i].position - fragPosition);
|
|
||||||
float distance = length(lights[i].position - fragPosition);
|
|
||||||
float attenuation = 1.0/(distance*distance);
|
|
||||||
radiance *= attenuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cook-torrance BRDF
|
|
||||||
vec3 high = normalize(view + light);
|
|
||||||
float NDF = DistributionGGX(normal, high, rough.r);
|
|
||||||
float G = GeometrySmith(normal, view, light, rough.r);
|
|
||||||
vec3 F = fresnelSchlick(max(dot(high, view), 0.0), F0);
|
|
||||||
vec3 nominator = NDF*G*F;
|
|
||||||
float denominator = 4*max(dot(normal, view), 0.0)*max(dot(normal, light), 0.0) + 0.001;
|
|
||||||
vec3 brdf = nominator/denominator;
|
|
||||||
|
|
||||||
// Store to kS the fresnel value and calculate energy conservation
|
|
||||||
vec3 kS = F;
|
|
||||||
vec3 kD = vec3(1.0) - kS;
|
|
||||||
|
|
||||||
// Multiply kD by the inverse metalness such that only non-metals have diffuse lighting
|
|
||||||
kD *= 1.0 - metal.r;
|
|
||||||
|
|
||||||
// Scale light by dot product between normal and light direction
|
|
||||||
float NdotL = max(dot(normal, light), 0.0);
|
|
||||||
|
|
||||||
// Add to outgoing radiance Lo
|
|
||||||
// Note: BRDF is already multiplied by the Fresnel so it doesn't need to be multiplied again
|
|
||||||
Lo += (kD*color/PI + brdf)*radiance*NdotL*lights[i].color.a;
|
|
||||||
lightDot += radiance*NdotL + brdf*lights[i].color.a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate ambient lighting using IBL
|
|
||||||
vec3 F = fresnelSchlickRoughness(max(dot(normal, view), 0.0), F0, rough.r);
|
|
||||||
vec3 kS = F;
|
|
||||||
vec3 kD = 1.0 - kS;
|
|
||||||
kD *= 1.0 - metal.r;
|
|
||||||
|
|
||||||
// Calculate indirect diffuse
|
|
||||||
vec3 irradiance = texture(irradianceMap, fragNormal).rgb;
|
|
||||||
vec3 diffuse = color*irradiance;
|
|
||||||
|
|
||||||
// Sample both the prefilter map and the BRDF lut and combine them together as per the Split-Sum approximation
|
|
||||||
vec3 prefilterColor = textureLod(prefilterMap, refl, rough.r*MAX_REFLECTION_LOD).rgb;
|
|
||||||
vec2 brdf = texture(brdfLUT, vec2(max(dot(normal, view), 0.0), rough.r)).rg;
|
|
||||||
vec3 reflection = prefilterColor*(F*brdf.x + brdf.y);
|
|
||||||
|
|
||||||
// Calculate final lighting
|
|
||||||
vec3 ambient = (kD*diffuse + reflection)*ao;
|
|
||||||
|
|
||||||
// Calculate fragment color based on render mode
|
|
||||||
vec3 fragmentColor = ambient + Lo + emiss; // Physically Based Rendering
|
|
||||||
|
|
||||||
if (renderMode == 1) fragmentColor = color; // Albedo
|
|
||||||
else if (renderMode == 2) fragmentColor = normal; // Normals
|
|
||||||
else if (renderMode == 3) fragmentColor = metal; // Metalness
|
|
||||||
else if (renderMode == 4) fragmentColor = rough; // Roughness
|
|
||||||
else if (renderMode == 5) fragmentColor = ao; // Ambient Occlusion
|
|
||||||
else if (renderMode == 6) fragmentColor = emiss; // Emission
|
|
||||||
else if (renderMode == 7) fragmentColor = lightDot; // Lighting
|
|
||||||
else if (renderMode == 8) fragmentColor = kS; // Fresnel
|
|
||||||
else if (renderMode == 9) fragmentColor = irradiance; // Irradiance
|
|
||||||
else if (renderMode == 10) fragmentColor = reflection; // Reflection
|
|
||||||
|
|
||||||
// Apply HDR tonemapping
|
|
||||||
fragmentColor = fragmentColor/(fragmentColor + vec3(1.0));
|
|
||||||
|
|
||||||
// Apply gamma correction
|
|
||||||
fragmentColor = pow(fragmentColor, vec3(1.0/2.2));
|
|
||||||
|
|
||||||
// Calculate final fragment color
|
|
||||||
finalColor = vec4(fragmentColor, 1.0);
|
|
||||||
}
|
|
@@ -1,49 +0,0 @@
|
|||||||
/*******************************************************************************************
|
|
||||||
*
|
|
||||||
* rPBR [shader] - Physically based rendering vertex shader
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 Victor Fisac
|
|
||||||
*
|
|
||||||
**********************************************************************************************/
|
|
||||||
|
|
||||||
#version 330
|
|
||||||
|
|
||||||
// Input vertex attributes
|
|
||||||
in vec3 vertexPosition;
|
|
||||||
in vec2 vertexTexCoord;
|
|
||||||
in vec3 vertexNormal;
|
|
||||||
in vec4 vertexTangent;
|
|
||||||
|
|
||||||
// Input uniform values
|
|
||||||
uniform mat4 mvp;
|
|
||||||
uniform mat4 matModel;
|
|
||||||
|
|
||||||
// Output vertex attributes (to fragment shader)
|
|
||||||
out vec3 fragPosition;
|
|
||||||
out vec2 fragTexCoord;
|
|
||||||
out vec3 fragNormal;
|
|
||||||
out vec3 fragTangent;
|
|
||||||
out vec3 fragBinormal;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
// Calculate binormal from vertex normal and tangent
|
|
||||||
vec3 vertexBinormal = cross(vertexNormal, vec3(vertexTangent));
|
|
||||||
|
|
||||||
// Calculate fragment normal based on normal transformations
|
|
||||||
mat3 normalMatrix = transpose(inverse(mat3(matModel)));
|
|
||||||
|
|
||||||
// Calculate fragment position based on model transformations
|
|
||||||
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0f));
|
|
||||||
|
|
||||||
// Send vertex attributes to fragment shader
|
|
||||||
fragTexCoord = vertexTexCoord;
|
|
||||||
fragNormal = normalize(normalMatrix*vertexNormal);
|
|
||||||
fragTangent = normalize(normalMatrix*vec3(vertexTangent));
|
|
||||||
fragTangent = normalize(fragTangent - dot(fragTangent, fragNormal)*fragNormal);
|
|
||||||
fragBinormal = normalize(normalMatrix*vertexBinormal);
|
|
||||||
fragBinormal = cross(fragNormal, fragTangent);
|
|
||||||
|
|
||||||
// Calculate final vertex position
|
|
||||||
gl_Position = mvp*vec4(vertexPosition, 1.0);
|
|
||||||
}
|
|
@@ -1,120 +0,0 @@
|
|||||||
/*******************************************************************************************
|
|
||||||
*
|
|
||||||
* rPBR [shader] - Prefiltered environment for reflections fragment shader
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 Victor Fisac
|
|
||||||
*
|
|
||||||
**********************************************************************************************/
|
|
||||||
|
|
||||||
#version 330
|
|
||||||
#define MAX_SAMPLES 1024u
|
|
||||||
#define CUBEMAP_RESOLUTION 1024.0
|
|
||||||
|
|
||||||
// Input vertex attributes (from vertex shader)
|
|
||||||
in vec3 fragPosition;
|
|
||||||
|
|
||||||
// Input uniform values
|
|
||||||
uniform samplerCube environmentMap;
|
|
||||||
uniform float roughness;
|
|
||||||
|
|
||||||
// Constant values
|
|
||||||
const float PI = 3.14159265359f;
|
|
||||||
|
|
||||||
// Output fragment color
|
|
||||||
out vec4 finalColor;
|
|
||||||
|
|
||||||
float DistributionGGX(vec3 N, vec3 H, float roughness);
|
|
||||||
float RadicalInverse_VdC(uint bits);
|
|
||||||
vec2 Hammersley(uint i, uint N);
|
|
||||||
vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness);
|
|
||||||
|
|
||||||
float DistributionGGX(vec3 N, vec3 H, float roughness)
|
|
||||||
{
|
|
||||||
float a = roughness*roughness;
|
|
||||||
float a2 = a*a;
|
|
||||||
float NdotH = max(dot(N, H), 0.0);
|
|
||||||
float NdotH2 = NdotH*NdotH;
|
|
||||||
|
|
||||||
float nom = a2;
|
|
||||||
float denom = (NdotH2*(a2 - 1.0) + 1.0);
|
|
||||||
denom = PI*denom*denom;
|
|
||||||
|
|
||||||
return nom/denom;
|
|
||||||
}
|
|
||||||
|
|
||||||
float RadicalInverse_VdC(uint bits)
|
|
||||||
{
|
|
||||||
bits = (bits << 16u) | (bits >> 16u);
|
|
||||||
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
|
|
||||||
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
|
|
||||||
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
|
|
||||||
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
|
|
||||||
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 Hammersley(uint i, uint N)
|
|
||||||
{
|
|
||||||
return vec2(float(i)/float(N), RadicalInverse_VdC(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness)
|
|
||||||
{
|
|
||||||
float a = roughness*roughness;
|
|
||||||
float phi = 2.0 * PI * Xi.x;
|
|
||||||
float cosTheta = sqrt((1.0 - Xi.y)/(1.0 + (a*a - 1.0)*Xi.y));
|
|
||||||
float sinTheta = sqrt(1.0 - cosTheta*cosTheta);
|
|
||||||
|
|
||||||
// Transform from spherical coordinates to cartesian coordinates (halfway vector)
|
|
||||||
vec3 H = vec3(cos(phi)*sinTheta, sin(phi)*sinTheta, cosTheta);
|
|
||||||
|
|
||||||
// Transform from tangent space H vector to world space sample vector
|
|
||||||
vec3 up = ((abs(N.z) < 0.999) ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0));
|
|
||||||
vec3 tangent = normalize(cross(up, N));
|
|
||||||
vec3 bitangent = cross(N, tangent);
|
|
||||||
vec3 sampleVec = tangent*H.x + bitangent*H.y + N*H.z;
|
|
||||||
|
|
||||||
return normalize(sampleVec);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
// Make the simplyfying assumption that V equals R equals the normal
|
|
||||||
vec3 N = normalize(fragPosition);
|
|
||||||
vec3 R = N;
|
|
||||||
vec3 V = R;
|
|
||||||
|
|
||||||
vec3 prefilteredColor = vec3(0.0);
|
|
||||||
float totalWeight = 0.0;
|
|
||||||
|
|
||||||
for (uint i = 0u; i < MAX_SAMPLES; i++)
|
|
||||||
{
|
|
||||||
// Generate a sample vector that's biased towards the preferred alignment direction (importance sampling)
|
|
||||||
vec2 Xi = Hammersley(i, MAX_SAMPLES);
|
|
||||||
vec3 H = ImportanceSampleGGX(Xi, N, roughness);
|
|
||||||
vec3 L = normalize(2.0*dot(V, H)*H - V);
|
|
||||||
|
|
||||||
float NdotL = max(dot(N, L), 0.0);
|
|
||||||
if(NdotL > 0.0)
|
|
||||||
{
|
|
||||||
// Sample from the environment's mip level based on roughness/pdf
|
|
||||||
float D = DistributionGGX(N, H, roughness);
|
|
||||||
float NdotH = max(dot(N, H), 0.0);
|
|
||||||
float HdotV = max(dot(H, V), 0.0);
|
|
||||||
float pdf = D*NdotH/(4.0*HdotV) + 0.0001;
|
|
||||||
|
|
||||||
float resolution = CUBEMAP_RESOLUTION;
|
|
||||||
float saTexel = 4.0*PI/(6.0*resolution*resolution);
|
|
||||||
float saSample = 1.0/(float(MAX_SAMPLES)*pdf + 0.0001);
|
|
||||||
float mipLevel = ((roughness == 0.0) ? 0.0 : 0.5*log2(saSample/saTexel));
|
|
||||||
|
|
||||||
prefilteredColor += textureLod(environmentMap, L, mipLevel).rgb*NdotL;
|
|
||||||
totalWeight += NdotL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate prefilter average color
|
|
||||||
prefilteredColor = prefilteredColor/totalWeight;
|
|
||||||
|
|
||||||
// Calculate final fragment color
|
|
||||||
finalColor = vec4(prefilteredColor, 1.0);
|
|
||||||
}
|
|
@@ -15,7 +15,7 @@ in vec3 fragPosition;
|
|||||||
uniform samplerCube environmentMap;
|
uniform samplerCube environmentMap;
|
||||||
|
|
||||||
// Constant values
|
// Constant values
|
||||||
const float PI = 3.14159265359f;
|
const float PI = 3.14159265359;
|
||||||
|
|
||||||
// Output fragment color
|
// Output fragment color
|
||||||
out vec4 finalColor;
|
out vec4 finalColor;
|
||||||
@@ -31,8 +31,8 @@ void main()
|
|||||||
vec3 right = cross(up, normal);
|
vec3 right = cross(up, normal);
|
||||||
up = cross(normal, right);
|
up = cross(normal, right);
|
||||||
|
|
||||||
float sampleDelta = 0.025f;
|
float sampleDelta = 0.025;
|
||||||
float nrSamples = 0.0f;
|
float nrSamples = 0.0;
|
||||||
|
|
||||||
for (float phi = 0.0; phi < 2.0*PI; phi += sampleDelta)
|
for (float phi = 0.0; phi < 2.0*PI; phi += sampleDelta)
|
||||||
{
|
{
|
||||||
|
@@ -34,7 +34,7 @@ void main()
|
|||||||
mat3 normalMatrix = transpose(inverse(mat3(matModel)));
|
mat3 normalMatrix = transpose(inverse(mat3(matModel)));
|
||||||
|
|
||||||
// Calculate fragment position based on model transformations
|
// Calculate fragment position based on model transformations
|
||||||
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0f));
|
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
|
||||||
|
|
||||||
// Send vertex attributes to fragment shader
|
// Send vertex attributes to fragment shader
|
||||||
fragTexCoord = vertexTexCoord;
|
fragTexCoord = vertexTexCoord;
|
||||||
|
@@ -18,7 +18,7 @@ uniform samplerCube environmentMap;
|
|||||||
uniform float roughness;
|
uniform float roughness;
|
||||||
|
|
||||||
// Constant values
|
// Constant values
|
||||||
const float PI = 3.14159265359f;
|
const float PI = 3.14159265359;
|
||||||
|
|
||||||
// Output fragment color
|
// Output fragment color
|
||||||
out vec4 finalColor;
|
out vec4 finalColor;
|
||||||
@@ -35,7 +35,7 @@ float DistributionGGX(vec3 N, vec3 H, float roughness)
|
|||||||
float NdotH = max(dot(N, H), 0.0);
|
float NdotH = max(dot(N, H), 0.0);
|
||||||
float NdotH2 = NdotH*NdotH;
|
float NdotH2 = NdotH*NdotH;
|
||||||
|
|
||||||
float nom = a2;
|
float nom = a2;
|
||||||
float denom = (NdotH2*(a2 - 1.0) + 1.0);
|
float denom = (NdotH2*(a2 - 1.0) + 1.0);
|
||||||
denom = PI*denom*denom;
|
denom = PI*denom*denom;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ float RadicalInverse_VdC(uint bits)
|
|||||||
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
|
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
|
||||||
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
|
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
|
||||||
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
|
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
|
||||||
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
|
return float(bits)*2.3283064365386963e-10; // / 0x100000000
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 Hammersley(uint i, uint N)
|
vec2 Hammersley(uint i, uint N)
|
||||||
@@ -60,7 +60,7 @@ vec2 Hammersley(uint i, uint N)
|
|||||||
vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness)
|
vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness)
|
||||||
{
|
{
|
||||||
float a = roughness*roughness;
|
float a = roughness*roughness;
|
||||||
float phi = 2.0 * PI * Xi.x;
|
float phi = 2.0*PI*Xi.x;
|
||||||
float cosTheta = sqrt((1.0 - Xi.y)/(1.0 + (a*a - 1.0)*Xi.y));
|
float cosTheta = sqrt((1.0 - Xi.y)/(1.0 + (a*a - 1.0)*Xi.y));
|
||||||
float sinTheta = sqrt(1.0 - cosTheta*cosTheta);
|
float sinTheta = sqrt(1.0 - cosTheta*cosTheta);
|
||||||
|
|
||||||
|
@@ -1,79 +1,72 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [network] example - Client/Server ping-pong
|
* raylib [network] example - Client/Server ping-pong
|
||||||
*
|
*
|
||||||
* Welcome to raylib!
|
* This example has been created using raylib 3.0 (www.raylib.com)
|
||||||
*
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
* To test examples, just press F6 and execute raylib_compile_execute script
|
*
|
||||||
* Note that compiled executable is placed in the same folder as .c file
|
* Copyright (c) 2019-2020 Jak Barnes (@syphonx) and Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* You can find all basic examples on C:\raylib\raylib\examples folder or
|
********************************************************************************************/
|
||||||
* raylib official webpage: www.raylib.com
|
|
||||||
*
|
|
||||||
* Enjoy using raylib. :)
|
|
||||||
*
|
|
||||||
* This example has been created using raylib 2.0 (www.raylib.com)
|
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h
|
|
||||||
*for details)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
|
|
||||||
*
|
|
||||||
********************************************************************************************/
|
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define RNET_IMPLEMENTATION
|
||||||
#include "rnet.h"
|
#include "rnet.h"
|
||||||
|
|
||||||
#include <assert.h>
|
float elapsed = 0.0f;
|
||||||
#include <stdio.h>
|
float delay = 1.0f;
|
||||||
#include <string.h>
|
bool ping = false;
|
||||||
|
bool pong = false;
|
||||||
float elapsed = 0.0f;
|
bool connected = false;
|
||||||
float delay = 1.0f;
|
bool clientConnected = false;
|
||||||
bool ping = false;
|
const char *pingmsg = "Ping!";
|
||||||
bool pong = false;
|
const char *pongmsg = "Pong!";
|
||||||
bool connected = false;
|
int msglen = 0;
|
||||||
bool client_connected = false;
|
SocketConfig serverConfig = { .host = "127.0.0.1", .port = "4950", .type = SOCKET_TCP, .server = true, .nonblocking = true };
|
||||||
const char * pingmsg = "Ping!";
|
SocketConfig clientConfig = { .host = "127.0.0.1", .port = "4950", .type = SOCKET_TCP, .nonblocking = true };
|
||||||
const char * pongmsg = "Pong!";
|
SocketConfig connectionConfig = { .nonblocking = true };
|
||||||
int msglen = 0;
|
SocketResult *serverResult = NULL;
|
||||||
SocketConfig server_cfg = {.host = "127.0.0.1", .port = "4950", .type = SOCKET_TCP, .server = true, .nonblocking = true};
|
SocketResult *clientResult = NULL;
|
||||||
SocketConfig client_cfg = {.host = "127.0.0.1", .port = "4950", .type = SOCKET_TCP, .nonblocking = true};
|
SocketSet *socketSet = NULL;
|
||||||
SocketConfig connection_cfg = {.nonblocking = true};
|
Socket *connection = NULL;
|
||||||
SocketResult *server_res = NULL;
|
char receiveBuffer[512] = { 0 };
|
||||||
SocketResult *client_res = NULL;
|
|
||||||
SocketSet * socket_set = NULL;
|
|
||||||
Socket * connection = NULL;
|
|
||||||
char recvBuffer[512];
|
|
||||||
|
|
||||||
// Attempt to connect to the network (Either TCP, or UDP)
|
// Attempt to connect to the network (Either TCP, or UDP)
|
||||||
void NetworkConnect()
|
static void NetworkConnect(void)
|
||||||
{
|
{
|
||||||
// If the server is configured as UDP, ignore connection requests
|
// If the server is configured as UDP, ignore connection requests
|
||||||
if (server_cfg.type == SOCKET_UDP && client_cfg.type == SOCKET_UDP) {
|
if ((serverConfig.type == SOCKET_UDP) && (clientConfig.type == SOCKET_UDP))
|
||||||
ping = true;
|
{
|
||||||
|
ping = true;
|
||||||
connected = true;
|
connected = true;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// If the client is connected, run the server code to check for a connection
|
// If the client is connected, run the server code to check for a connection
|
||||||
if (client_connected) {
|
if (clientConnected)
|
||||||
int active = CheckSockets(socket_set, 0);
|
{
|
||||||
if (active != 0) {
|
int active = CheckSockets(socketSet, 0);
|
||||||
TraceLog(LOG_DEBUG,
|
if (active != 0) TraceLog(LOG_INFO, "There are currently %d socket(s) with data to be processed.", active);
|
||||||
"There are currently %d socket(s) with data to be processed.", active);
|
|
||||||
}
|
if (active > 0)
|
||||||
if (active > 0) {
|
{
|
||||||
if ((connection = SocketAccept(server_res->socket, &connection_cfg)) != NULL) {
|
if ((connection = SocketAccept(serverResult->socket, &connectionConfig)) != NULL)
|
||||||
AddSocket(socket_set, connection);
|
{
|
||||||
ping = true;
|
AddSocket(socketSet, connection);
|
||||||
connected = true;
|
connected = true;
|
||||||
|
ping = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Check if we're connected every _delay_ seconds
|
// Check if we're connected every _delay_ seconds
|
||||||
elapsed += GetFrameTime();
|
elapsed += GetFrameTime();
|
||||||
if (elapsed > delay) {
|
if (elapsed > delay)
|
||||||
if (IsSocketConnected(client_res->socket)) {
|
{
|
||||||
client_connected = true;
|
if (IsSocketConnected(clientResult->socket)) clientConnected = true;
|
||||||
}
|
|
||||||
elapsed = 0.0f;
|
elapsed = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,144 +75,138 @@ void NetworkConnect()
|
|||||||
|
|
||||||
// Once connected to the network, check the sockets for pending information
|
// Once connected to the network, check the sockets for pending information
|
||||||
// and when information is ready, send either a Ping or a Pong.
|
// and when information is ready, send either a Ping or a Pong.
|
||||||
void NetworkUpdate()
|
static void UpdateNetwork(void)
|
||||||
{
|
{
|
||||||
// CheckSockets
|
// CheckSockets, if any of the sockets in the socketSet are pending (received data, or requests)
|
||||||
//
|
// then mark the socket as being ready. You can check this with IsSocketReady(clientResult->socket)
|
||||||
// If any of the sockets in the socket_set are pending (received data, or requests)
|
int active = CheckSockets(socketSet, 0);
|
||||||
// then mark the socket as being ready. You can check this with IsSocketReady(client_res->socket)
|
if (active != 0) TraceLog(LOG_DEBUG, "There are currently %d socket(s) with data to be processed.", active);
|
||||||
int active = CheckSockets(socket_set, 0);
|
|
||||||
if (active != 0) {
|
|
||||||
TraceLog(LOG_DEBUG,
|
|
||||||
"There are currently %d socket(s) with data to be processed.", active);
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsSocketReady
|
// IsSocketReady, if the socket is ready, attempt to receive data from the socket
|
||||||
//
|
|
||||||
// If the socket is ready, attempt to receive data from the socket
|
|
||||||
int bytesRecv = 0;
|
int bytesRecv = 0;
|
||||||
if (server_cfg.type == SOCKET_UDP && client_cfg.type == SOCKET_UDP) {
|
if ((serverConfig.type == SOCKET_UDP) && (clientConfig.type == SOCKET_UDP))
|
||||||
if (IsSocketReady(client_res->socket)) {
|
{
|
||||||
bytesRecv = SocketReceive(client_res->socket, recvBuffer, msglen);
|
if (IsSocketReady(clientResult->socket)) bytesRecv = SocketReceive(clientResult->socket, receiveBuffer, msglen);
|
||||||
}
|
if (IsSocketReady(serverResult->socket)) bytesRecv = SocketReceive(serverResult->socket, receiveBuffer, msglen);
|
||||||
if (IsSocketReady(server_res->socket)) {
|
|
||||||
bytesRecv = SocketReceive(server_res->socket, recvBuffer, msglen);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (IsSocketReady(connection)) {
|
|
||||||
bytesRecv = SocketReceive(connection, recvBuffer, msglen);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (IsSocketReady(connection)) bytesRecv = SocketReceive(connection, receiveBuffer, msglen);
|
||||||
|
|
||||||
// If we received data, was that data a "Ping!" or a "Pong!"
|
// If we received data, was that data a "Ping!" or a "Pong!"
|
||||||
if (bytesRecv > 0) {
|
if (bytesRecv > 0)
|
||||||
if (strcmp(recvBuffer, pingmsg) == 0) { pong = true; }
|
{
|
||||||
if (strcmp(recvBuffer, pongmsg) == 0) { ping = true; }
|
if (strcmp(receiveBuffer, pingmsg) == 0) { pong = true; }
|
||||||
|
if (strcmp(receiveBuffer, pongmsg) == 0) { ping = true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// After each delay has expired, send a response "Ping!" for a "Pong!" and vice versa
|
// After each delay has expired, send a response "Ping!" for a "Pong!" and vice versa
|
||||||
elapsed += GetFrameTime();
|
elapsed += GetFrameTime();
|
||||||
if (elapsed > delay) {
|
if (elapsed > delay)
|
||||||
if (ping) {
|
{
|
||||||
|
if (ping)
|
||||||
|
{
|
||||||
ping = false;
|
ping = false;
|
||||||
if (server_cfg.type == SOCKET_UDP && client_cfg.type == SOCKET_UDP) {
|
if (serverConfig.type == SOCKET_UDP && clientConfig.type == SOCKET_UDP) SocketSend(clientResult->socket, pingmsg, msglen);
|
||||||
SocketSend(client_res->socket, pingmsg, msglen);
|
else SocketSend(clientResult->socket, pingmsg, msglen);
|
||||||
} else {
|
|
||||||
SocketSend(client_res->socket, pingmsg, msglen);
|
|
||||||
}
|
|
||||||
} else if (pong) {
|
|
||||||
pong = false;
|
|
||||||
if (server_cfg.type == SOCKET_UDP && client_cfg.type == SOCKET_UDP) {
|
|
||||||
SocketSend(client_res->socket, pongmsg, msglen);
|
|
||||||
} else {
|
|
||||||
SocketSend(client_res->socket, pongmsg, msglen);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (pong)
|
||||||
|
{
|
||||||
|
pong = false;
|
||||||
|
if (serverConfig.type == SOCKET_UDP && clientConfig.type == SOCKET_UDP) SocketSend(clientResult->socket, pongmsg, msglen);
|
||||||
|
else SocketSend(clientResult->socket, pongmsg, msglen);
|
||||||
|
}
|
||||||
|
|
||||||
elapsed = 0.0f;
|
elapsed = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
// Setup
|
// Initialization
|
||||||
int screenWidth = 800;
|
//--------------------------------------------------------------------------------------
|
||||||
int screenHeight = 450;
|
const int screenWidth = 800;
|
||||||
InitWindow(
|
const int screenHeight = 450;
|
||||||
screenWidth, screenHeight, "raylib [network] example - ping pong");
|
|
||||||
SetTargetFPS(60);
|
|
||||||
SetTraceLogLevel(LOG_DEBUG);
|
|
||||||
|
|
||||||
// Networking
|
InitWindow(screenWidth, screenHeight, "raylib [network] example - ping pong");
|
||||||
InitNetwork();
|
|
||||||
|
|
||||||
// Create the server
|
InitNetworkDevice(); // Init network communications
|
||||||
//
|
|
||||||
// Performs
|
// Create the server: getaddrinfo + socket + setsockopt + bind + listen
|
||||||
// getaddrinfo
|
serverResult = LoadSocketResult();
|
||||||
// socket
|
if (!SocketCreate(&serverConfig, serverResult))
|
||||||
// setsockopt
|
{
|
||||||
// bind
|
TraceLog(LOG_WARNING, "Failed to open server: status %d, errno %d", serverResult->status, serverResult->socket->status);
|
||||||
// listen
|
}
|
||||||
server_res = AllocSocketResult();
|
else
|
||||||
if (!SocketCreate(&server_cfg, server_res)) {
|
{
|
||||||
TraceLog(LOG_WARNING, "Failed to open server: status %d, errno %d",
|
if (!SocketBind(&serverConfig, serverResult))
|
||||||
server_res->status, server_res->socket->status);
|
{
|
||||||
} else {
|
TraceLog(LOG_WARNING, "Failed to bind server: status %d, errno %d", serverResult->status, serverResult->socket->status);
|
||||||
if (!SocketBind(&server_cfg, server_res)) {
|
}
|
||||||
TraceLog(LOG_WARNING, "Failed to bind server: status %d, errno %d",
|
else
|
||||||
server_res->status, server_res->socket->status);
|
{
|
||||||
} else {
|
if (!(serverConfig.type == SOCKET_UDP))
|
||||||
if (!(server_cfg.type == SOCKET_UDP)) {
|
{
|
||||||
if (!SocketListen(&server_cfg, server_res)) {
|
if (!SocketListen(&serverConfig, serverResult))
|
||||||
TraceLog(LOG_WARNING,
|
{
|
||||||
"Failed to start listen server: status %d, errno %d",
|
TraceLog(LOG_WARNING, "Failed to start listen server: status %d, errno %d", serverResult->status, serverResult->socket->status);
|
||||||
server_res->status, server_res->socket->status);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the client
|
// Create the client: getaddrinfo + socket + setsockopt + connect (TCP only)
|
||||||
//
|
clientResult = LoadSocketResult();
|
||||||
// Performs
|
if (!SocketCreate(&clientConfig, clientResult))
|
||||||
// getaddrinfo
|
{
|
||||||
// socket
|
TraceLog(LOG_WARNING, "Failed to open client: status %d, errno %d", clientResult->status, clientResult->socket->status);
|
||||||
// setsockopt
|
}
|
||||||
// connect (TCP only)
|
else
|
||||||
client_res = AllocSocketResult();
|
{
|
||||||
if (!SocketCreate(&client_cfg, client_res)) {
|
if (!(clientConfig.type == SOCKET_UDP))
|
||||||
TraceLog(LOG_WARNING, "Failed to open client: status %d, errno %d",
|
{
|
||||||
client_res->status, client_res->socket->status);
|
if (!SocketConnect(&clientConfig, clientResult))
|
||||||
} else {
|
{
|
||||||
if (!(client_cfg.type == SOCKET_UDP)) {
|
TraceLog(LOG_WARNING, "Failed to connect to server: status %d, errno %d", clientResult->status, clientResult->socket->status);
|
||||||
if (!SocketConnect(&client_cfg, client_res)) {
|
|
||||||
TraceLog(LOG_WARNING,
|
|
||||||
"Failed to connect to server: status %d, errno %d",
|
|
||||||
client_res->status, client_res->socket->status);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create & Add sockets to the socket set
|
// Create and add sockets to the socket set
|
||||||
socket_set = AllocSocketSet(3);
|
socketSet = LoadSocketSet(3);
|
||||||
msglen = strlen(pingmsg) + 1;
|
|
||||||
memset(recvBuffer, '\0', sizeof(recvBuffer));
|
AddSocket(socketSet, serverResult->socket);
|
||||||
AddSocket(socket_set, server_res->socket);
|
AddSocket(socketSet, clientResult->socket);
|
||||||
AddSocket(socket_set, client_res->socket);
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) {
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (connected) UpdateNetwork();
|
||||||
|
//else NetworkConnect();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
if (connected) {
|
ClearBackground(RAYWHITE);
|
||||||
NetworkUpdate();
|
|
||||||
} else {
|
// TODO: Draw relevant connection info
|
||||||
NetworkConnect();
|
|
||||||
}
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// De-Initialization
|
||||||
CloseWindow();
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseNetworkDevice(); // Close network communication
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@@ -1,80 +1,78 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [network] example - Resolve Host
|
* raylib [network] example - Resolve Host
|
||||||
*
|
*
|
||||||
* Welcome to raylib!
|
* This example has been created using raylib 3.0 (www.raylib.com)
|
||||||
*
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
* To test examples, just press F6 and execute raylib_compile_execute script
|
*
|
||||||
* Note that compiled executable is placed in the same folder as .c file
|
* Copyright (c) 2019-2020 Jak Barnes (@syphonx) and Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* You can find all basic examples on C:\raylib\raylib\examples folder or
|
********************************************************************************************/
|
||||||
* raylib official webpage: www.raylib.com
|
|
||||||
*
|
|
||||||
* Enjoy using raylib. :)
|
|
||||||
*
|
|
||||||
* This example has been created using raylib 2.0 (www.raylib.com)
|
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h
|
|
||||||
*for details)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
|
|
||||||
*
|
|
||||||
********************************************************************************************/
|
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define RNET_IMPLEMENTATION
|
||||||
#include "rnet.h"
|
#include "rnet.h"
|
||||||
|
|
||||||
char buffer[ADDRESS_IPV6_ADDRSTRLEN];
|
int main(void)
|
||||||
uint16_t port = 0;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
{
|
||||||
// Setup
|
// Initialization
|
||||||
int screenWidth = 800;
|
//--------------------------------------------------------------------------------------
|
||||||
int screenHeight = 450;
|
const int screenWidth = 800;
|
||||||
InitWindow(
|
const int screenHeight = 450;
|
||||||
screenWidth, screenHeight, "raylib [network] example - ping pong");
|
|
||||||
SetTargetFPS(60);
|
|
||||||
|
|
||||||
SetTraceLogLevel(LOG_DEBUG);
|
InitWindow(screenWidth, screenHeight, "raylib [network] example - resolve host");
|
||||||
|
|
||||||
// Networking
|
InitNetworkDevice(); // Init network communications
|
||||||
InitNetwork();
|
|
||||||
|
|
||||||
AddressInformation* addr = AllocAddressList(1);
|
char buffer[ADDRESS_IPV6_ADDRSTRLEN];
|
||||||
int count = ResolveHost(
|
unsigned short port = 0;
|
||||||
NULL,
|
|
||||||
"5210",
|
AddressInformation *address = LoadAddressList(1);
|
||||||
ADDRESS_TYPE_IPV4,
|
|
||||||
0 // Uncomment any of these flags
|
// Address info flags
|
||||||
// ADDRESS_INFO_NUMERICHOST // or try them in conjunction to
|
// ADDRESS_INFO_NUMERICHOST // or try them in conjunction to
|
||||||
// ADDRESS_INFO_NUMERICSERV // specify custom behaviour from
|
// ADDRESS_INFO_NUMERICSERV // specify custom behaviour from
|
||||||
// ADDRESS_INFO_DNS_ONLY // the function getaddrinfo()
|
// ADDRESS_INFO_DNS_ONLY // the function getaddrinfo()
|
||||||
// ADDRESS_INFO_ALL //
|
// ADDRESS_INFO_ALL //
|
||||||
// ADDRESS_INFO_FQDN // e.g. ADDRESS_INFO_CANONNAME | ADDRESS_INFO_NUMERICSERV
|
// ADDRESS_INFO_FQDN // e.g. ADDRESS_INFO_CANONNAME | ADDRESS_INFO_NUMERICSERV
|
||||||
,
|
int count = ResolveHost(NULL, "5210", ADDRESS_TYPE_IPV4, 0, address);
|
||||||
addr
|
|
||||||
);
|
|
||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
GetAddressHostAndPort(addr[0], buffer, &port);
|
GetAddressHostAndPort(address[0], buffer, &port);
|
||||||
TraceLog(LOG_INFO, "Resolved to ip %s::%d\n", buffer, port);
|
TraceLog(LOG_INFO, "Resolved to ip %s::%d", buffer, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose())
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// TODO: Update your variables here
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
// Clear
|
ClearBackground(RAYWHITE);
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
|
// TODO: Draw relevant connection info
|
||||||
|
|
||||||
// End draw
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// De-Initialization
|
||||||
CloseWindow();
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseNetworkDevice(); // Close network communication
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@@ -1,151 +1,142 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [network] example - TCP Client
|
* raylib [network] example - TCP Client
|
||||||
*
|
*
|
||||||
* Welcome to raylib!
|
* This example has been created using raylib 3.0 (www.raylib.com)
|
||||||
*
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
* To test examples, just press F6 and execute raylib_compile_execute script
|
*
|
||||||
* Note that compiled executable is placed in the same folder as .c file
|
* Copyright (c) 2019-2020 Jak Barnes (@syphonx) and Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* You can find all basic examples on C:\raylib\raylib\examples folder or
|
********************************************************************************************/
|
||||||
* raylib official webpage: www.raylib.com
|
|
||||||
*
|
|
||||||
* Enjoy using raylib. :)
|
|
||||||
*
|
|
||||||
* This example has been created using raylib 2.0 (www.raylib.com)
|
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h
|
|
||||||
*for details)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
|
|
||||||
*
|
|
||||||
********************************************************************************************/
|
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define RNET_IMPLEMENTATION
|
||||||
#include "rnet.h"
|
#include "rnet.h"
|
||||||
|
|
||||||
#include <assert.h>
|
int main(void)
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
float elapsed = 0.0f;
|
|
||||||
float delay = 1.0f;
|
|
||||||
bool ping = false;
|
|
||||||
bool pong = false;
|
|
||||||
bool connected = false;
|
|
||||||
const char * pingmsg = "Ping!";
|
|
||||||
const char * pongmsg = "Pong!";
|
|
||||||
int msglen = 0;
|
|
||||||
SocketConfig client_cfg = {.host = "127.0.0.1", .port = "4950", .type = SOCKET_TCP, .nonblocking = true};
|
|
||||||
SocketResult *client_res = NULL;
|
|
||||||
SocketSet * socket_set = NULL;
|
|
||||||
char recvBuffer[512];
|
|
||||||
|
|
||||||
// Attempt to connect to the network (Either TCP, or UDP)
|
|
||||||
void NetworkConnect()
|
|
||||||
{
|
{
|
||||||
// Check if we're connected every _delay_ seconds
|
// Initialization
|
||||||
elapsed += GetFrameTime();
|
//--------------------------------------------------------------------------------------
|
||||||
if (elapsed > delay) {
|
const int screenWidth = 800;
|
||||||
if (IsSocketConnected(client_res->socket)) { connected = true; }
|
const int screenHeight = 450;
|
||||||
elapsed = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Once connected to the network, check the sockets for pending information
|
InitWindow(screenWidth, screenHeight, "raylib [network] example - tcp client");
|
||||||
// and when information is ready, send either a Ping or a Pong.
|
|
||||||
void NetworkUpdate()
|
|
||||||
{
|
|
||||||
// CheckSockets
|
|
||||||
//
|
|
||||||
// If any of the sockets in the socket_set are pending (received data, or requests)
|
|
||||||
// then mark the socket as being ready. You can check this with IsSocketReady(client_res->socket)
|
|
||||||
int active = CheckSockets(socket_set, 0);
|
|
||||||
if (active != 0) {
|
|
||||||
TraceLog(LOG_DEBUG,
|
|
||||||
"There are currently %d socket(s) with data to be processed.", active);
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsSocketReady
|
InitNetworkDevice(); // Init network communications
|
||||||
//
|
|
||||||
// If the socket is ready, attempt to receive data from the socket
|
|
||||||
int bytesRecv = 0;
|
|
||||||
if (IsSocketReady(client_res->socket)) {
|
|
||||||
bytesRecv = SocketReceive(client_res->socket, recvBuffer, msglen);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we received data, was that data a "Ping!" or a "Pong!"
|
const char *pingmsg = "Ping!";
|
||||||
if (bytesRecv > 0) {
|
const char *pongmsg = "Pong!";
|
||||||
if (strcmp(recvBuffer, pingmsg) == 0) { pong = true; }
|
|
||||||
if (strcmp(recvBuffer, pongmsg) == 0) { ping = true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// After each delay has expired, send a response "Ping!" for a "Pong!" and vice versa
|
bool ping = false;
|
||||||
elapsed += GetFrameTime();
|
bool pong = false;
|
||||||
if (elapsed > delay) {
|
float elapsed = 0.0f;
|
||||||
if (ping) {
|
float delay = 1.0f;
|
||||||
ping = false;
|
bool connected = false;
|
||||||
SocketSend(client_res->socket, pingmsg, msglen);
|
|
||||||
} else if (pong) {
|
|
||||||
pong = false;
|
|
||||||
SocketSend(client_res->socket, pongmsg, msglen);
|
|
||||||
}
|
|
||||||
elapsed = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main()
|
SocketConfig clientConfig = {
|
||||||
{
|
.host = "127.0.0.1",
|
||||||
// Setup
|
.port = "4950",
|
||||||
int screenWidth = 800;
|
.type = SOCKET_TCP,
|
||||||
int screenHeight = 450;
|
.nonblocking = true
|
||||||
InitWindow(
|
};
|
||||||
screenWidth, screenHeight, "raylib [network] example - tcp client");
|
|
||||||
SetTargetFPS(60);
|
|
||||||
SetTraceLogLevel(LOG_DEBUG);
|
|
||||||
|
|
||||||
// Networking
|
SocketSet *socketSet = NULL;
|
||||||
InitNetwork();
|
SocketResult *clientResult = NULL;
|
||||||
|
char receiveBuffer[512] = { 0 };
|
||||||
|
|
||||||
// Create the client
|
// Create the client: getaddrinfo + socket + setsockopt + connect (TCP only)
|
||||||
//
|
clientResult = LoadSocketResult();
|
||||||
// Performs
|
if (!SocketCreate(&clientConfig, clientResult)) TraceLog(LOG_WARNING, "Failed to open client: status %d, errno %d", clientResult->status, clientResult->socket->status);
|
||||||
// getaddrinfo
|
else
|
||||||
// socket
|
{
|
||||||
// setsockopt
|
if (!(clientConfig.type == SOCKET_UDP))
|
||||||
// connect (TCP only)
|
{
|
||||||
client_res = AllocSocketResult();
|
if (!SocketConnect(&clientConfig, clientResult)) TraceLog(LOG_WARNING, "Failed to connect to server: status %d, errno %d", clientResult->status, clientResult->socket->status);
|
||||||
if (!SocketCreate(&client_cfg, client_res)) {
|
|
||||||
TraceLog(LOG_WARNING, "Failed to open client: status %d, errno %d",
|
|
||||||
client_res->status, client_res->socket->status);
|
|
||||||
} else {
|
|
||||||
if (!(client_cfg.type == SOCKET_UDP)) {
|
|
||||||
if (!SocketConnect(&client_cfg, client_res)) {
|
|
||||||
TraceLog(LOG_WARNING,
|
|
||||||
"Failed to connect to server: status %d, errno %d",
|
|
||||||
client_res->status, client_res->socket->status);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create & Add sockets to the socket set
|
// Create and add sockets to the socket set
|
||||||
socket_set = AllocSocketSet(1);
|
socketSet = LoadSocketSet(1);
|
||||||
msglen = strlen(pingmsg) + 1;
|
AddSocket(socketSet, clientResult->socket);
|
||||||
memset(recvBuffer, '\0', sizeof(recvBuffer));
|
|
||||||
AddSocket(socket_set, client_res->socket);
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) {
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
BeginDrawing();
|
{
|
||||||
ClearBackground(RAYWHITE);
|
// Update
|
||||||
if (connected) {
|
//----------------------------------------------------------------------------------
|
||||||
NetworkUpdate();
|
if (connected)
|
||||||
} else {
|
{
|
||||||
NetworkConnect();
|
// Once connected to the network, check the sockets for pending information
|
||||||
|
// and when information is ready, send either a Ping or a Pong.
|
||||||
|
|
||||||
|
// CheckSockets, if any of the sockets in the socketSet are pending (received data, or requests)
|
||||||
|
// then mark the socket as being ready. You can check this with IsSocketReady(clientResult->socket)
|
||||||
|
int active = CheckSockets(socketSet, 0);
|
||||||
|
if (active != 0) TraceLog(LOG_DEBUG, "There are currently %d socket(s) with data to be processed.", active);
|
||||||
|
|
||||||
|
// IsSocketReady, if the socket is ready, attempt to receive data from the socket
|
||||||
|
int bytesRecv = 0;
|
||||||
|
if (IsSocketReady(clientResult->socket)) bytesRecv = SocketReceive(clientResult->socket, receiveBuffer, strlen(pingmsg) + 1);
|
||||||
|
|
||||||
|
// If we received data, was that data a "Ping!" or a "Pong!"
|
||||||
|
if (bytesRecv > 0)
|
||||||
|
{
|
||||||
|
if (strcmp(receiveBuffer, pingmsg) == 0) { pong = true; }
|
||||||
|
if (strcmp(receiveBuffer, pongmsg) == 0) { ping = true; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// After each delay has expired, send a response "Ping!" for a "Pong!" and vice versa
|
||||||
|
elapsed += GetFrameTime();
|
||||||
|
if (elapsed > delay)
|
||||||
|
{
|
||||||
|
if (ping)
|
||||||
|
{
|
||||||
|
ping = false;
|
||||||
|
SocketSend(clientResult->socket, pingmsg, strlen(pingmsg) + 1);
|
||||||
|
}
|
||||||
|
else if (pong)
|
||||||
|
{
|
||||||
|
pong = false;
|
||||||
|
SocketSend(clientResult->socket, pongmsg, strlen(pingmsg) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
elapsed = 0.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Check if we're connected every delay seconds
|
||||||
|
elapsed += GetFrameTime();
|
||||||
|
if (elapsed > delay)
|
||||||
|
{
|
||||||
|
if (IsSocketConnected(clientResult->socket)) { connected = true; }
|
||||||
|
elapsed = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// TODO: Draw relevant connection info
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// De-Initialization
|
||||||
CloseWindow();
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseNetworkDevice(); // Close network communication
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@@ -1,165 +1,162 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [network] example - TCP Server
|
* raylib [network] example - TCP Server
|
||||||
*
|
*
|
||||||
* Welcome to raylib!
|
* This example has been created using raylib 3.0 (www.raylib.com)
|
||||||
*
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
* To test examples, just press F6 and execute raylib_compile_execute script
|
*
|
||||||
* Note that compiled executable is placed in the same folder as .c file
|
* Copyright (c) 2019-2020 Jak Barnes (@syphonx) and Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* You can find all basic examples on C:\raylib\raylib\examples folder or
|
********************************************************************************************/
|
||||||
* raylib official webpage: www.raylib.com
|
|
||||||
*
|
|
||||||
* Enjoy using raylib. :)
|
|
||||||
*
|
|
||||||
* This example has been created using raylib 2.0 (www.raylib.com)
|
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h
|
|
||||||
*for details)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
|
|
||||||
*
|
|
||||||
********************************************************************************************/
|
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define RNET_IMPLEMENTATION
|
||||||
#include "rnet.h"
|
#include "rnet.h"
|
||||||
|
|
||||||
#include <assert.h>
|
int main(void)
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
float elapsed = 0.0f;
|
|
||||||
float delay = 1.0f;
|
|
||||||
bool ping = false;
|
|
||||||
bool pong = false;
|
|
||||||
bool connected = false;
|
|
||||||
const char * pingmsg = "Ping!";
|
|
||||||
const char * pongmsg = "Pong!";
|
|
||||||
int msglen = 0;
|
|
||||||
SocketConfig server_cfg = {.host = "127.0.0.1", .port = "4950", .type = SOCKET_TCP, .server = true, .nonblocking = true};
|
|
||||||
SocketConfig connection_cfg = {.nonblocking = true};
|
|
||||||
SocketResult *server_res = NULL;
|
|
||||||
SocketSet * socket_set = NULL;
|
|
||||||
Socket * connection = NULL;
|
|
||||||
char recvBuffer[512];
|
|
||||||
|
|
||||||
// Attempt to connect to the network (Either TCP, or UDP)
|
|
||||||
void NetworkConnect()
|
|
||||||
{
|
{
|
||||||
int active = CheckSockets(socket_set, 0);
|
// Initialization
|
||||||
if (active != 0) {
|
//--------------------------------------------------------------------------------------
|
||||||
TraceLog(LOG_DEBUG,
|
const int screenWidth = 800;
|
||||||
"There are currently %d socket(s) with data to be processed.", active);
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [network] example - tcp server");
|
||||||
|
|
||||||
|
InitNetworkDevice(); // Init network communications
|
||||||
|
|
||||||
|
const char *pingmsg = "Ping!";
|
||||||
|
const char *pongmsg = "Pong!";
|
||||||
|
|
||||||
|
bool ping = false;
|
||||||
|
bool pong = false;
|
||||||
|
float elapsed = 0.0f;
|
||||||
|
float delay = 1.0f;
|
||||||
|
bool connected = false;
|
||||||
|
|
||||||
|
SocketConfig serverConfig = {
|
||||||
|
.host = "127.0.0.1",
|
||||||
|
.port = "4950",
|
||||||
|
.type = SOCKET_TCP,
|
||||||
|
.server = true,
|
||||||
|
.nonblocking = true
|
||||||
|
};
|
||||||
|
|
||||||
|
SocketConfig connectionConfig = { .nonblocking = true };
|
||||||
|
|
||||||
|
Socket *connection = NULL;
|
||||||
|
SocketSet *socketSet = NULL;
|
||||||
|
SocketResult *serverResult = NULL;
|
||||||
|
char receiveBuffer[512] = { 0 };
|
||||||
|
|
||||||
|
// Create the server: getaddrinfo + socket + setsockopt + bind + listen
|
||||||
|
serverResult = LoadSocketResult();
|
||||||
|
if (!SocketCreate(&serverConfig, serverResult))
|
||||||
|
{
|
||||||
|
TraceLog(LOG_WARNING, "Failed to open server: status %d, errno %d", serverResult->status, serverResult->socket->status);
|
||||||
}
|
}
|
||||||
if (active > 0) {
|
else
|
||||||
if ((connection = SocketAccept(server_res->socket, &connection_cfg)) != NULL) {
|
{
|
||||||
AddSocket(socket_set, connection);
|
if (!SocketBind(&serverConfig, serverResult))
|
||||||
ping = true;
|
{
|
||||||
connected = true;
|
TraceLog(LOG_WARNING, "Failed to bind server: status %d, errno %d", serverResult->status, serverResult->socket->status);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
|
if (!(serverConfig.type == SOCKET_UDP))
|
||||||
// Once connected to the network, check the sockets for pending information
|
{
|
||||||
// and when information is ready, send either a Ping or a Pong.
|
if (!SocketListen(&serverConfig, serverResult)) TraceLog(LOG_WARNING, "Failed to start listen server: status %d, errno %d", serverResult->status, serverResult->socket->status);
|
||||||
void NetworkUpdate()
|
|
||||||
{
|
|
||||||
// CheckSockets
|
|
||||||
//
|
|
||||||
// If any of the sockets in the socket_set are pending (received data, or requests)
|
|
||||||
// then mark the socket as being ready. You can check this with IsSocketReady(client_res->socket)
|
|
||||||
int active = CheckSockets(socket_set, 0);
|
|
||||||
if (active != 0) {
|
|
||||||
TraceLog(LOG_DEBUG,
|
|
||||||
"There are currently %d socket(s) with data to be processed.", active);
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsSocketReady
|
|
||||||
//
|
|
||||||
// If the socket is ready, attempt to receive data from the socket
|
|
||||||
int bytesRecv = 0;
|
|
||||||
if (IsSocketReady(connection)) {
|
|
||||||
bytesRecv = SocketReceive(connection, recvBuffer, msglen);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we received data, was that data a "Ping!" or a "Pong!"
|
|
||||||
if (bytesRecv > 0) {
|
|
||||||
if (strcmp(recvBuffer, pingmsg) == 0) { pong = true; }
|
|
||||||
if (strcmp(recvBuffer, pongmsg) == 0) { ping = true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// After each delay has expired, send a response "Ping!" for a "Pong!" and vice versa
|
|
||||||
elapsed += GetFrameTime();
|
|
||||||
if (elapsed > delay) {
|
|
||||||
if (ping) {
|
|
||||||
ping = false;
|
|
||||||
SocketSend(connection, pingmsg, msglen);
|
|
||||||
} else if (pong) {
|
|
||||||
pong = false;
|
|
||||||
SocketSend(connection, pongmsg, msglen);
|
|
||||||
}
|
|
||||||
elapsed = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
// Setup
|
|
||||||
int screenWidth = 800;
|
|
||||||
int screenHeight = 450;
|
|
||||||
InitWindow(
|
|
||||||
screenWidth, screenHeight, "raylib [network] example - tcp server");
|
|
||||||
SetTargetFPS(60);
|
|
||||||
SetTraceLogLevel(LOG_DEBUG);
|
|
||||||
|
|
||||||
// Networking
|
|
||||||
InitNetwork();
|
|
||||||
|
|
||||||
// Create the server
|
|
||||||
//
|
|
||||||
// Performs
|
|
||||||
// getaddrinfo
|
|
||||||
// socket
|
|
||||||
// setsockopt
|
|
||||||
// bind
|
|
||||||
// listen
|
|
||||||
server_res = AllocSocketResult();
|
|
||||||
if (!SocketCreate(&server_cfg, server_res)) {
|
|
||||||
TraceLog(LOG_WARNING, "Failed to open server: status %d, errno %d",
|
|
||||||
server_res->status, server_res->socket->status);
|
|
||||||
} else {
|
|
||||||
if (!SocketBind(&server_cfg, server_res)) {
|
|
||||||
TraceLog(LOG_WARNING, "Failed to bind server: status %d, errno %d",
|
|
||||||
server_res->status, server_res->socket->status);
|
|
||||||
} else {
|
|
||||||
if (!(server_cfg.type == SOCKET_UDP)) {
|
|
||||||
if (!SocketListen(&server_cfg, server_res)) {
|
|
||||||
TraceLog(LOG_WARNING,
|
|
||||||
"Failed to start listen server: status %d, errno %d",
|
|
||||||
server_res->status, server_res->socket->status);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create & Add sockets to the socket set
|
// Create and add sockets to the socket set
|
||||||
socket_set = AllocSocketSet(2);
|
socketSet = LoadSocketSet(2);
|
||||||
msglen = strlen(pingmsg) + 1;
|
AddSocket(socketSet, serverResult->socket);
|
||||||
memset(recvBuffer, '\0', sizeof(recvBuffer));
|
|
||||||
AddSocket(socket_set, server_res->socket);
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) {
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
BeginDrawing();
|
{
|
||||||
ClearBackground(RAYWHITE);
|
// Update
|
||||||
if (connected) {
|
//----------------------------------------------------------------------------------
|
||||||
NetworkUpdate();
|
if (connected)
|
||||||
} else {
|
{
|
||||||
NetworkConnect();
|
// Once connected to the network, check the sockets for pending information
|
||||||
|
// and when information is ready, send either a Ping or a Pong.
|
||||||
|
|
||||||
|
// CheckSockets, if any of the sockets in the socketSet are pending (received data, or requests)
|
||||||
|
// then mark the socket as being ready. You can check this with IsSocketReady(client_res->socket)
|
||||||
|
int active = CheckSockets(socketSet, 0);
|
||||||
|
if (active != 0) TraceLog(LOG_DEBUG, "There are currently %d socket(s) with data to be processed.", active);
|
||||||
|
|
||||||
|
// IsSocketReady, if the socket is ready, attempt to receive data from the socket
|
||||||
|
int bytesRecv = 0;
|
||||||
|
if (IsSocketReady(connection)) bytesRecv = SocketReceive(connection, receiveBuffer, strlen(pingmsg) + 1);
|
||||||
|
|
||||||
|
// If we received data, was that data a "Ping!" or a "Pong!"
|
||||||
|
if (bytesRecv > 0)
|
||||||
|
{
|
||||||
|
if (strcmp(receiveBuffer, pingmsg) == 0) { pong = true; }
|
||||||
|
if (strcmp(receiveBuffer, pongmsg) == 0) { ping = true; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// After each delay has expired, send a response "Ping!" for a "Pong!" and vice versa
|
||||||
|
elapsed += GetFrameTime();
|
||||||
|
if (elapsed > delay)
|
||||||
|
{
|
||||||
|
if (ping)
|
||||||
|
{
|
||||||
|
ping = false;
|
||||||
|
SocketSend(connection, pingmsg, strlen(pingmsg) + 1);
|
||||||
|
}
|
||||||
|
else if (pong)
|
||||||
|
{
|
||||||
|
pong = false;
|
||||||
|
SocketSend(connection, pongmsg, strlen(pingmsg) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
elapsed = 0.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Attempt to connect to the network (Either TCP, or UDP)
|
||||||
|
int active = CheckSockets(socketSet, 0);
|
||||||
|
if (active != 0) TraceLog(LOG_DEBUG, "There are currently %d socket(s) with data to be processed.", active);
|
||||||
|
|
||||||
|
if (active > 0)
|
||||||
|
{
|
||||||
|
if ((connection = SocketAccept(serverResult->socket, &connectionConfig)) != NULL)
|
||||||
|
{
|
||||||
|
AddSocket(socketSet, connection);
|
||||||
|
connected = true;
|
||||||
|
ping = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// TODO: Draw relevant connection info
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// De-Initialization
|
||||||
CloseWindow();
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseNetworkDevice(); // Close network communication
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@@ -1,48 +1,39 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [network] example - Network Test
|
* raylib [network] example - Network Test
|
||||||
*
|
*
|
||||||
* Welcome to raylib!
|
* This example has been created using raylib 3.0 (www.raylib.com)
|
||||||
*
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
* To test examples, just press F6 and execute raylib_compile_execute script
|
*
|
||||||
* Note that compiled executable is placed in the same folder as .c file
|
* Copyright (c) 2019-2020 Jak Barnes (@syphonx) and Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* You can find all basic examples on C:\raylib\raylib\examples folder or
|
********************************************************************************************/
|
||||||
* raylib official webpage: www.raylib.com
|
|
||||||
*
|
|
||||||
* Enjoy using raylib. :)
|
|
||||||
*
|
|
||||||
* This example has been created using raylib 2.0 (www.raylib.com)
|
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h
|
|
||||||
*for details)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
|
|
||||||
*
|
|
||||||
********************************************************************************************/
|
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define RNET_IMPLEMENTATION
|
||||||
#include "rnet.h"
|
#include "rnet.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
void test_network_initialise()
|
void test_network_initialise()
|
||||||
{
|
{
|
||||||
assert(InitNetwork() == true);
|
assert(InitNetworkDevice() == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_socket_result()
|
void test_socket_result()
|
||||||
{
|
{
|
||||||
SocketResult *result = AllocSocketResult();
|
SocketResult *result = LoadSocketResult();
|
||||||
assert(result != NULL);
|
assert(result != NULL);
|
||||||
FreeSocketResult(&result);
|
UnloadSocketResult(&result);
|
||||||
assert(result == NULL);
|
assert(result == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_socket()
|
void test_socket()
|
||||||
{
|
{
|
||||||
Socket *socket = AllocSocket();
|
Socket *socket = LoadSocket();
|
||||||
assert(socket != NULL);
|
assert(socket != NULL);
|
||||||
FreeSocket(&socket);
|
UnloadSocket(&socket);
|
||||||
assert(socket == NULL);
|
assert(socket == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,8 +41,8 @@ void test_resolve_ip()
|
|||||||
{
|
{
|
||||||
const char *host = "8.8.8.8";
|
const char *host = "8.8.8.8";
|
||||||
const char *port = "8080";
|
const char *port = "8080";
|
||||||
char ip[ADDRESS_IPV6_ADDRSTRLEN];
|
char ip[ADDRESS_IPV6_ADDRSTRLEN];
|
||||||
char service[ADDRESS_MAXSERV];
|
char service[ADDRESS_MAXSERV];
|
||||||
|
|
||||||
memset(ip, '\0', ADDRESS_IPV6_ADDRSTRLEN);
|
memset(ip, '\0', ADDRESS_IPV6_ADDRSTRLEN);
|
||||||
ResolveIP(host, port, NAME_INFO_NUMERICHOST, ip, service);
|
ResolveIP(host, port, NAME_INFO_NUMERICHOST, ip, service);
|
||||||
@@ -91,9 +82,9 @@ void test_resolve_ip()
|
|||||||
|
|
||||||
void test_resolve_host()
|
void test_resolve_host()
|
||||||
{
|
{
|
||||||
const char * address = "localhost";
|
const char *address = "localhost";
|
||||||
const char * port = "80";
|
const char *port = "80";
|
||||||
AddressInformation *addr = AllocAddressList(3);
|
AddressInformation *addr = LoadAddressList(3);
|
||||||
int count = ResolveHost(address, port, ADDRESS_TYPE_ANY, 0, addr);
|
int count = ResolveHost(address, port, ADDRESS_TYPE_ANY, 0, addr);
|
||||||
|
|
||||||
assert(GetAddressFamily(addr[0]) == ADDRESS_TYPE_IPV6);
|
assert(GetAddressFamily(addr[0]) == ADDRESS_TYPE_IPV6);
|
||||||
@@ -113,36 +104,61 @@ void test_address_list()
|
|||||||
|
|
||||||
void test_socket_create()
|
void test_socket_create()
|
||||||
{
|
{
|
||||||
SocketConfig server_cfg = {.host = "127.0.0.1", .port = "8080", .server = true, .nonblocking = true};
|
SocketConfig server_cfg = { .host = "127.0.0.1", .port = "8080", .server = true, .nonblocking = true };
|
||||||
Socket * socket = AllocSocket();
|
Socket *socket = LoadSocket();
|
||||||
SocketResult *server_res = AllocSocketResult();
|
SocketResult *server_res = LoadSocketResult();
|
||||||
SocketSet * socket_set = AllocSocketSet(1);
|
SocketSet *socket_set = LoadSocketSet(1);
|
||||||
|
|
||||||
assert(SocketCreate(&server_cfg, server_res));
|
assert(SocketCreate(&server_cfg, server_res));
|
||||||
assert(AddSocket(socket_set, server_res->socket));
|
assert(AddSocket(socket_set, server_res->socket));
|
||||||
assert(SocketListen(&server_cfg, server_res));
|
assert(SocketListen(&server_cfg, server_res));
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
int screenWidth = 800;
|
// Initialization
|
||||||
int screenHeight = 450;
|
//--------------------------------------------------------------------------------------
|
||||||
InitWindow(
|
const int screenWidth = 800;
|
||||||
screenWidth, screenHeight, "raylib [network] example - network test");
|
const int screenHeight = 450;
|
||||||
SetTargetFPS(60);
|
|
||||||
|
|
||||||
// Run the tests
|
InitWindow(screenWidth, screenHeight, "raylib [network] example - network test");
|
||||||
test_network_initialise();
|
|
||||||
|
InitNetworkDevice(); // Init network communications
|
||||||
|
|
||||||
|
// Run some tests
|
||||||
test_resolve_host();
|
test_resolve_host();
|
||||||
// test_socket_create();
|
//test_socket_create();
|
||||||
|
//test_resolve_ip();
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) {
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// TODO: Update your variables here
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// TODO: Draw relevant connection info
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
CloseWindow();
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseNetworkDevice(); // Close network communication
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@@ -1,128 +1,124 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [network] example - UDP Client
|
* raylib [network] example - UDP Client
|
||||||
*
|
*
|
||||||
* Welcome to raylib!
|
* This example has been created using raylib 3.0 (www.raylib.com)
|
||||||
*
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
* To test examples, just press F6 and execute raylib_compile_execute script
|
*
|
||||||
* Note that compiled executable is placed in the same folder as .c file
|
* Copyright (c) 2019-2020 Jak Barnes (@syphonx) and Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* You can find all basic examples on C:\raylib\raylib\examples folder or
|
********************************************************************************************/
|
||||||
* raylib official webpage: www.raylib.com
|
|
||||||
*
|
|
||||||
* Enjoy using raylib. :)
|
|
||||||
*
|
|
||||||
* This example has been created using raylib 2.0 (www.raylib.com)
|
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h
|
|
||||||
*for details)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
|
|
||||||
*
|
|
||||||
********************************************************************************************/
|
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define RNET_IMPLEMENTATION
|
||||||
#include "rnet.h"
|
#include "rnet.h"
|
||||||
|
|
||||||
#include <assert.h>
|
int main(void)
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
float elapsed = 0.0f;
|
|
||||||
float delay = 1.0f;
|
|
||||||
bool ping = false;
|
|
||||||
bool pong = false;
|
|
||||||
const char * pingmsg = "Ping!";
|
|
||||||
const char * pongmsg = "Pong!";
|
|
||||||
int msglen = 0;
|
|
||||||
SocketConfig client_cfg = {.host = "127.0.0.1", .port = "4950", .type = SOCKET_UDP, .nonblocking = true};
|
|
||||||
SocketResult *client_res = NULL;
|
|
||||||
SocketSet * socket_set = NULL;
|
|
||||||
char recvBuffer[512];
|
|
||||||
|
|
||||||
// Once connected to the network, check the sockets for pending information
|
|
||||||
// and when information is ready, send either a Ping or a Pong.
|
|
||||||
void NetworkUpdate()
|
|
||||||
{
|
{
|
||||||
// CheckSockets
|
// Initialization
|
||||||
//
|
//--------------------------------------------------------------------------------------
|
||||||
// If any of the sockets in the socket_set are pending (received data, or requests)
|
const int screenWidth = 800;
|
||||||
// then mark the socket as being ready. You can check this with IsSocketReady(client_res->socket)
|
const int screenHeight = 450;
|
||||||
int active = CheckSockets(socket_set, 0);
|
|
||||||
if (active != 0) {
|
InitWindow(screenWidth, screenHeight, "raylib [network] example - udp client");
|
||||||
TraceLog(LOG_DEBUG,
|
|
||||||
"There are currently %d socket(s) with data to be processed.", active);
|
InitNetworkDevice(); // Init network communications
|
||||||
|
|
||||||
|
const char *pingmsg = "Ping!";
|
||||||
|
const char *pongmsg = "Pong!";
|
||||||
|
|
||||||
|
bool ping = true;
|
||||||
|
bool pong = false;
|
||||||
|
float elapsed = 0.0f;
|
||||||
|
float delay = 1.0f;
|
||||||
|
|
||||||
|
SocketConfig clientConfig = {
|
||||||
|
.host = "127.0.0.1",
|
||||||
|
.port = "4950",
|
||||||
|
.type = SOCKET_UDP,
|
||||||
|
.nonblocking = true
|
||||||
|
};
|
||||||
|
|
||||||
|
SocketResult *clientResult = NULL;
|
||||||
|
SocketSet *socketSet = NULL;
|
||||||
|
char receiveBuffer[512] = { 0 };
|
||||||
|
|
||||||
|
// Create the client: getaddrinfo + socket + setsockopt + connect (TCP only)
|
||||||
|
clientResult = LoadSocketResult();
|
||||||
|
if (!SocketCreate(&clientConfig, clientResult))
|
||||||
|
{
|
||||||
|
TraceLog(LOG_WARNING, "Failed to open client: status %d, errno %d", clientResult->status, clientResult->socket->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsSocketReady
|
// Create and add sockets to the socket set
|
||||||
//
|
socketSet = LoadSocketSet(1);
|
||||||
// If the socket is ready, attempt to receive data from the socket
|
AddSocket(socketSet, clientResult->socket);
|
||||||
int bytesRecv = 0;
|
|
||||||
if (IsSocketReady(client_res->socket)) {
|
|
||||||
bytesRecv = SocketReceive(client_res->socket, recvBuffer, msglen);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we received data, was that data a "Ping!" or a "Pong!"
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
if (bytesRecv > 0) {
|
//--------------------------------------------------------------------------------------
|
||||||
if (strcmp(recvBuffer, pingmsg) == 0) { pong = true; }
|
|
||||||
if (strcmp(recvBuffer, pongmsg) == 0) { ping = true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// After each delay has expired, send a response "Ping!" for a "Pong!" and vice versa
|
|
||||||
elapsed += GetFrameTime();
|
|
||||||
if (elapsed > delay) {
|
|
||||||
if (ping) {
|
|
||||||
ping = false;
|
|
||||||
SocketSend(client_res->socket, pingmsg, msglen);
|
|
||||||
} else if (pong) {
|
|
||||||
pong = false;
|
|
||||||
SocketSend(client_res->socket, pongmsg, msglen);
|
|
||||||
}
|
|
||||||
elapsed = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
// Setup
|
|
||||||
int screenWidth = 800;
|
|
||||||
int screenHeight = 450;
|
|
||||||
InitWindow(
|
|
||||||
screenWidth, screenHeight, "raylib [network] example - udp client");
|
|
||||||
SetTargetFPS(60);
|
|
||||||
SetTraceLogLevel(LOG_DEBUG);
|
|
||||||
|
|
||||||
// Networking
|
|
||||||
InitNetwork();
|
|
||||||
|
|
||||||
// Create the client
|
|
||||||
//
|
|
||||||
// Performs
|
|
||||||
// getaddrinfo
|
|
||||||
// socket
|
|
||||||
// setsockopt
|
|
||||||
// connect (TCP only)
|
|
||||||
client_res = AllocSocketResult();
|
|
||||||
if (!SocketCreate(&client_cfg, client_res)) {
|
|
||||||
TraceLog(LOG_WARNING, "Failed to open client: status %d, errno %d",
|
|
||||||
client_res->status, client_res->socket->status);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create & Add sockets to the socket set
|
|
||||||
socket_set = AllocSocketSet(1);
|
|
||||||
msglen = strlen(pingmsg) + 1;
|
|
||||||
ping = true;
|
|
||||||
memset(recvBuffer, '\0', sizeof(recvBuffer));
|
|
||||||
AddSocket(socket_set, client_res->socket);
|
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) {
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Once connected to the network, check the sockets for pending information
|
||||||
|
// and when information is ready, send either a Ping or a Pong.
|
||||||
|
|
||||||
|
// CheckSockets, if any of the sockets in the socketSet are pending (received data, or requests)
|
||||||
|
// then mark the socket as being ready. You can check this with IsSocketReady(clientResult->socket)
|
||||||
|
int active = CheckSockets(socketSet, 0);
|
||||||
|
if (active != 0) TraceLog(LOG_INFO, "There are currently %d socket(s) with data to be processed.", active);
|
||||||
|
|
||||||
|
// IsSocketReady, if the socket is ready, attempt to receive data from the socket
|
||||||
|
int bytesRecv = 0;
|
||||||
|
if (IsSocketReady(clientResult->socket)) bytesRecv = SocketReceive(clientResult->socket, receiveBuffer, strlen(pingmsg) + 1);
|
||||||
|
|
||||||
|
// If we received data, was that data a "Ping!" or a "Pong!"
|
||||||
|
if (bytesRecv > 0)
|
||||||
|
{
|
||||||
|
if (strcmp(receiveBuffer, pingmsg) == 0) { pong = true; }
|
||||||
|
if (strcmp(receiveBuffer, pongmsg) == 0) { ping = true; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// After each delay has expired, send a response "Ping!" for a "Pong!" and vice-versa
|
||||||
|
elapsed += GetFrameTime();
|
||||||
|
if (elapsed > delay)
|
||||||
|
{
|
||||||
|
if (ping)
|
||||||
|
{
|
||||||
|
ping = false;
|
||||||
|
SocketSend(clientResult->socket, pingmsg, strlen(pingmsg) + 1);
|
||||||
|
}
|
||||||
|
else if (pong)
|
||||||
|
{
|
||||||
|
pong = false;
|
||||||
|
SocketSend(clientResult->socket, pongmsg, strlen(pongmsg) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
elapsed = 0.0f;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
NetworkUpdate();
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// TODO: Draw relevant connection info
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// De-Initialization
|
||||||
CloseWindow();
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseNetworkDevice(); // Close network communication
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@@ -1,134 +1,128 @@
|
|||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [network] example - UDP Server
|
* raylib [network] example - UDP Server
|
||||||
*
|
*
|
||||||
* Welcome to raylib!
|
* This example has been created using raylib 3.0 (www.raylib.com)
|
||||||
*
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
* To test examples, just press F6 and execute raylib_compile_execute script
|
*
|
||||||
* Note that compiled executable is placed in the same folder as .c file
|
* Copyright (c) 2019-2020 Jak Barnes (@syphonx) and Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* You can find all basic examples on C:\raylib\raylib\examples folder or
|
********************************************************************************************/
|
||||||
* raylib official webpage: www.raylib.com
|
|
||||||
*
|
|
||||||
* Enjoy using raylib. :)
|
|
||||||
*
|
|
||||||
* This example has been created using raylib 2.0 (www.raylib.com)
|
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h
|
|
||||||
*for details)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
|
|
||||||
*
|
|
||||||
********************************************************************************************/
|
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define RNET_IMPLEMENTATION
|
||||||
#include "rnet.h"
|
#include "rnet.h"
|
||||||
|
|
||||||
#include <assert.h>
|
int main(void)
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
float elapsed = 0.0f;
|
|
||||||
float delay = 1.0f;
|
|
||||||
bool ping = false;
|
|
||||||
bool pong = false;
|
|
||||||
const char * pingmsg = "Ping!";
|
|
||||||
const char * pongmsg = "Pong!";
|
|
||||||
int msglen = 0;
|
|
||||||
SocketConfig server_cfg = {.host = "127.0.0.1", .port = "4950", .server = true, .type = SOCKET_UDP, .nonblocking = true};
|
|
||||||
SocketResult *server_res = NULL;
|
|
||||||
SocketSet * socket_set = NULL;
|
|
||||||
char recvBuffer[512];
|
|
||||||
|
|
||||||
// Once connected to the network, check the sockets for pending information
|
|
||||||
// and when information is ready, send either a Ping or a Pong.
|
|
||||||
void NetworkUpdate()
|
|
||||||
{
|
{
|
||||||
// CheckSockets
|
// Initialization
|
||||||
//
|
//--------------------------------------------------------------------------------------
|
||||||
// If any of the sockets in the socket_set are pending (received data, or requests)
|
const int screenWidth = 800;
|
||||||
// then mark the socket as being ready. You can check this with IsSocketReady(client_res->socket)
|
const int screenHeight = 450;
|
||||||
int active = CheckSockets(socket_set, 0);
|
|
||||||
if (active != 0) {
|
|
||||||
TraceLog(LOG_DEBUG,
|
|
||||||
"There are currently %d socket(s) with data to be processed.", active);
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsSocketReady
|
InitWindow(screenWidth, screenHeight, "raylib [network] example - udp server");
|
||||||
//
|
|
||||||
// If the socket is ready, attempt to receive data from the socket
|
|
||||||
// int bytesRecv = 0;
|
|
||||||
// if (IsSocketReady(server_res->socket)) {
|
|
||||||
// bytesRecv = SocketReceive(server_res->socket, recvBuffer, msglen);
|
|
||||||
// }
|
|
||||||
int bytesRecv = SocketReceive(server_res->socket, recvBuffer, msglen);
|
|
||||||
|
|
||||||
// If we received data, was that data a "Ping!" or a "Pong!"
|
InitNetworkDevice(); // Init network communications
|
||||||
if (bytesRecv > 0) {
|
|
||||||
if (strcmp(recvBuffer, pingmsg) == 0) { pong = true; }
|
|
||||||
if (strcmp(recvBuffer, pongmsg) == 0) { ping = true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// After each delay has expired, send a response "Ping!" for a "Pong!" and vice versa
|
const char *pingmsg = "Ping!";
|
||||||
elapsed += GetFrameTime();
|
const char *pongmsg = "Pong!";
|
||||||
if (elapsed > delay) {
|
|
||||||
if (ping) {
|
|
||||||
ping = false;
|
|
||||||
SocketSend(server_res->socket, pingmsg, msglen);
|
|
||||||
} else if (pong) {
|
|
||||||
pong = false;
|
|
||||||
SocketSend(server_res->socket, pongmsg, msglen);
|
|
||||||
}
|
|
||||||
elapsed = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main()
|
bool ping = false;
|
||||||
{
|
bool pong = false;
|
||||||
// Setup
|
float elapsed = 0.0f;
|
||||||
int screenWidth = 800;
|
float delay = 1.0f;
|
||||||
int screenHeight = 450;
|
|
||||||
InitWindow(
|
|
||||||
screenWidth, screenHeight, "raylib [network] example - udp server");
|
|
||||||
SetTargetFPS(60);
|
|
||||||
SetTraceLogLevel(LOG_DEBUG);
|
|
||||||
|
|
||||||
// Networking
|
SocketConfig serverConfig = {
|
||||||
InitNetwork();
|
.host = "127.0.0.1",
|
||||||
|
.port = "4950",
|
||||||
|
.server = true,
|
||||||
|
.type = SOCKET_UDP,
|
||||||
|
.nonblocking = true
|
||||||
|
};
|
||||||
|
|
||||||
// Create the server
|
SocketResult *serverResult = NULL;
|
||||||
//
|
SocketSet *socketSet = NULL;
|
||||||
// Performs
|
char receiveBuffer[512] = { 0 };
|
||||||
// getaddrinfo
|
|
||||||
// socket
|
|
||||||
// setsockopt
|
|
||||||
// bind
|
|
||||||
// listen
|
|
||||||
server_res = AllocSocketResult();
|
|
||||||
if (!SocketCreate(&server_cfg, server_res)) {
|
|
||||||
TraceLog(LOG_WARNING, "Failed to open server: status %d, errno %d",
|
|
||||||
server_res->status, server_res->socket->status);
|
|
||||||
} else {
|
|
||||||
if (!SocketBind(&server_cfg, server_res)) {
|
|
||||||
TraceLog(LOG_WARNING, "Failed to bind server: status %d, errno %d",
|
|
||||||
server_res->status, server_res->socket->status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create & Add sockets to the socket set
|
// Create the server: getaddrinfo + socket + setsockopt + bind + listen
|
||||||
socket_set = AllocSocketSet(1);
|
serverResult = LoadSocketResult();
|
||||||
msglen = strlen(pingmsg) + 1;
|
|
||||||
memset(recvBuffer, '\0', sizeof(recvBuffer));
|
if (!SocketCreate(&serverConfig, serverResult)) TraceLog(LOG_WARNING, "Failed to open server: status %d, errno %d", serverResult->status, serverResult->socket->status);
|
||||||
AddSocket(socket_set, server_res->socket);
|
else if (!SocketBind(&serverConfig, serverResult)) TraceLog(LOG_WARNING, "Failed to bind server: status %d, errno %d", serverResult->status, serverResult->socket->status);
|
||||||
|
|
||||||
|
// Create and add sockets to the socket set
|
||||||
|
socketSet = LoadSocketSet(1);
|
||||||
|
AddSocket(socketSet, serverResult->socket);
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) {
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Once connected to the network, check the sockets for pending information
|
||||||
|
// and when information is ready, send either a Ping or a Pong.
|
||||||
|
|
||||||
|
// CheckSockets, if any of the sockets in the set are pending (received data, or requests)
|
||||||
|
// then mark the socket as being ready. You can check this with IsSocketReady(client_res->socket)
|
||||||
|
int active = CheckSockets(socketSet, 0);
|
||||||
|
if (active != 0) TraceLog(LOG_INFO, "There are currently %d socket(s) with data to be processed.", active);
|
||||||
|
|
||||||
|
// IsSocketReady, if the socket is ready, attempt to receive data from the socket
|
||||||
|
// int bytesRecv = 0;
|
||||||
|
// if (IsSocketReady(serverResult->socket)) {
|
||||||
|
// bytesRecv = SocketReceive(serverResult->socket, receiveBuffer, msglen);
|
||||||
|
// }
|
||||||
|
int bytesRecv = SocketReceive(serverResult->socket, receiveBuffer, strlen(pingmsg) + 1);
|
||||||
|
|
||||||
|
// If we received data, is that data a "Ping!" or a "Pong!"?
|
||||||
|
if (bytesRecv > 0)
|
||||||
|
{
|
||||||
|
if (strcmp(receiveBuffer, pingmsg) == 0) { pong = true; }
|
||||||
|
if (strcmp(receiveBuffer, pongmsg) == 0) { ping = true; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// After each delay has expired, send a response "Ping!" for a "Pong!" and vice-versa
|
||||||
|
elapsed += GetFrameTime();
|
||||||
|
|
||||||
|
if (elapsed > delay)
|
||||||
|
{
|
||||||
|
if (ping)
|
||||||
|
{
|
||||||
|
ping = false;
|
||||||
|
SocketSend(serverResult->socket, pingmsg, strlen(pingmsg) + 1);
|
||||||
|
}
|
||||||
|
else if (pong)
|
||||||
|
{
|
||||||
|
pong = false;
|
||||||
|
SocketSend(serverResult->socket, pongmsg, strlen(pongmsg) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
elapsed = 0.0f;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
NetworkUpdate();
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// TODO: Draw relevant connection info
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// De-Initialization
|
||||||
CloseWindow();
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseNetworkDevice(); // Close network communication
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@@ -45,14 +45,17 @@
|
|||||||
|
|
||||||
#define RLGL_IMPLEMENTATION
|
#define RLGL_IMPLEMENTATION
|
||||||
#define RLGL_STANDALONE
|
#define RLGL_STANDALONE
|
||||||
|
#define RLGL_SUPPORT_TRACELOG
|
||||||
#include "rlgl.h" // OpenGL 1.1 immediate-mode style coding
|
#include "rlgl.h" // OpenGL 1.1 immediate-mode style coding
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#if defined(__EMSCRIPTEN__)
|
||||||
#define GLFW_INCLUDE_ES2
|
#define GLFW_INCLUDE_ES2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <GLFW/glfw3.h> // Windows/Context and inputs management
|
#include <GLFW/glfw3.h> // Windows/Context and inputs management
|
||||||
|
|
||||||
|
#include <stdio.h> // Required for: printf()
|
||||||
|
|
||||||
#define RED (Color){ 230, 41, 55, 255 } // Red
|
#define RED (Color){ 230, 41, 55, 255 } // Red
|
||||||
#define RAYWHITE (Color){ 245, 245, 245, 255 } // My own White (raylib logo)
|
#define RAYWHITE (Color){ 245, 245, 245, 255 } // My own White (raylib logo)
|
||||||
#define DARKGRAY (Color){ 80, 80, 80, 255 } // Dark Gray
|
#define DARKGRAY (Color){ 80, 80, 80, 255 } // Dark Gray
|
||||||
@@ -60,8 +63,8 @@
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module specific Functions Declaration
|
// Module specific Functions Declaration
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
static void ErrorCallback(int error, const char* description);
|
static void ErrorCallback(int error, const char *description);
|
||||||
static void KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods);
|
||||||
|
|
||||||
// Drawing functions (uses rlgl functionality)
|
// Drawing functions (uses rlgl functionality)
|
||||||
static void DrawGrid(int slices, float spacing);
|
static void DrawGrid(int slices, float spacing);
|
||||||
@@ -85,10 +88,10 @@ int main(void)
|
|||||||
|
|
||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
{
|
{
|
||||||
TraceLog(LOG_WARNING, "GLFW3: Can not initialize GLFW");
|
printf("GLFW3: Can not initialize GLFW\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else TraceLog(LOG_INFO, "GLFW3: GLFW initialized successfully");
|
else printf("GLFW3: GLFW initialized successfully\n");
|
||||||
|
|
||||||
glfwWindowHint(GLFW_SAMPLES, 4);
|
glfwWindowHint(GLFW_SAMPLES, 4);
|
||||||
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
||||||
@@ -104,7 +107,7 @@ int main(void)
|
|||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
else TraceLog(LOG_INFO, "GLFW3: Window created successfully");
|
else printf("GLFW3: Window created successfully\n");
|
||||||
|
|
||||||
glfwSetWindowPos(window, 200, 200);
|
glfwSetWindowPos(window, 200, 200);
|
||||||
|
|
||||||
@@ -214,13 +217,13 @@ int main(void)
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// GLFW3: Error callback
|
// GLFW3: Error callback
|
||||||
static void ErrorCallback(int error, const char* description)
|
static void ErrorCallback(int error, const char *description)
|
||||||
{
|
{
|
||||||
TraceLog(LOG_ERROR, description);
|
fprintf(stderr, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GLFW3: Keyboard callback
|
// GLFW3: Keyboard callback
|
||||||
static void KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
|
||||||
{
|
{
|
||||||
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
|
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
|
||||||
{
|
{
|
||||||
|
BIN
examples/shaders/resources/raysan.png
Normal file
After Width: | Height: | Size: 15 KiB |
@@ -11,7 +11,6 @@ uniform sampler2D texture0;
|
|||||||
uniform vec4 colDiffuse;
|
uniform vec4 colDiffuse;
|
||||||
|
|
||||||
// NOTE: Add here your custom variables
|
// NOTE: Add here your custom variables
|
||||||
uniform vec2 resolution = vec2(800, 450);
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
59
examples/shaders/resources/shaders/glsl100/base_lighting.vs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
#version 100
|
||||||
|
|
||||||
|
// Input vertex attributes
|
||||||
|
attribute vec3 vertexPosition;
|
||||||
|
attribute vec2 vertexTexCoord;
|
||||||
|
attribute vec3 vertexNormal;
|
||||||
|
attribute vec4 vertexColor;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform mat4 mvp;
|
||||||
|
uniform mat4 matModel;
|
||||||
|
|
||||||
|
// Output vertex attributes (to fragment shader)
|
||||||
|
varying vec3 fragPosition;
|
||||||
|
varying vec2 fragTexCoord;
|
||||||
|
varying vec4 fragColor;
|
||||||
|
varying vec3 fragNormal;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
// https://github.com/glslify/glsl-inverse
|
||||||
|
mat3 inverse(mat3 m)
|
||||||
|
{
|
||||||
|
float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];
|
||||||
|
float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];
|
||||||
|
float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];
|
||||||
|
|
||||||
|
float b01 = a22*a11 - a12*a21;
|
||||||
|
float b11 = -a22*a10 + a12*a20;
|
||||||
|
float b21 = a21*a10 - a11*a20;
|
||||||
|
|
||||||
|
float det = a00*b01 + a01*b11 + a02*b21;
|
||||||
|
|
||||||
|
return mat3(b01, (-a22*a01 + a02*a21), (a12*a01 - a02*a11),
|
||||||
|
b11, (a22*a00 - a02*a20), (-a12*a00 + a02*a10),
|
||||||
|
b21, (-a21*a00 + a01*a20), (a11*a00 - a01*a10))/det;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://github.com/glslify/glsl-transpose
|
||||||
|
mat3 transpose(mat3 m)
|
||||||
|
{
|
||||||
|
return mat3(m[0][0], m[1][0], m[2][0],
|
||||||
|
m[0][1], m[1][1], m[2][1],
|
||||||
|
m[0][2], m[1][2], m[2][2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// Send vertex attributes to fragment shader
|
||||||
|
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
|
||||||
|
fragTexCoord = vertexTexCoord;
|
||||||
|
fragColor = vertexColor;
|
||||||
|
|
||||||
|
mat3 normalMatrix = transpose(inverse(mat3(matModel)));
|
||||||
|
fragNormal = normalize(normalMatrix*vertexNormal);
|
||||||
|
|
||||||
|
// Calculate final vertex position
|
||||||
|
gl_Position = mvp*vec4(vertexPosition, 1.0);
|
||||||
|
}
|
94
examples/shaders/resources/shaders/glsl100/fog.fs
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
#version 100
|
||||||
|
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
varying vec3 fragPosition;
|
||||||
|
varying vec2 fragTexCoord;
|
||||||
|
varying vec4 fragColor;
|
||||||
|
varying vec3 fragNormal;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec4 colDiffuse;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
#define MAX_LIGHTS 4
|
||||||
|
#define LIGHT_DIRECTIONAL 0
|
||||||
|
#define LIGHT_POINT 1
|
||||||
|
|
||||||
|
struct MaterialProperty {
|
||||||
|
vec3 color;
|
||||||
|
int useSampler;
|
||||||
|
sampler2D sampler;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Light {
|
||||||
|
int enabled;
|
||||||
|
int type;
|
||||||
|
vec3 position;
|
||||||
|
vec3 target;
|
||||||
|
vec4 color;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Input lighting values
|
||||||
|
uniform Light lights[MAX_LIGHTS];
|
||||||
|
uniform vec4 ambient;
|
||||||
|
uniform vec3 viewPos;
|
||||||
|
uniform float fogDensity;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// Texel color fetching from texture sampler
|
||||||
|
vec4 texelColor = texture2D(texture0, fragTexCoord);
|
||||||
|
vec3 lightDot = vec3(0.0);
|
||||||
|
vec3 normal = normalize(fragNormal);
|
||||||
|
vec3 viewD = normalize(viewPos - fragPosition);
|
||||||
|
vec3 specular = vec3(0.0);
|
||||||
|
|
||||||
|
// NOTE: Implement here your fragment shader code
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_LIGHTS; i++)
|
||||||
|
{
|
||||||
|
if (lights[i].enabled == 1)
|
||||||
|
{
|
||||||
|
vec3 light = vec3(0.0);
|
||||||
|
|
||||||
|
if (lights[i].type == LIGHT_DIRECTIONAL) light = -normalize(lights[i].target - lights[i].position);
|
||||||
|
if (lights[i].type == LIGHT_POINT) light = normalize(lights[i].position - fragPosition);
|
||||||
|
|
||||||
|
float NdotL = max(dot(normal, light), 0.0);
|
||||||
|
lightDot += lights[i].color.rgb*NdotL;
|
||||||
|
|
||||||
|
float specCo = 0.0;
|
||||||
|
if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewD, reflect(-(light), normal))), 16.0); // Shine: 16.0
|
||||||
|
specular += specCo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 finalColor = (texelColor*((colDiffuse + vec4(specular,1))*vec4(lightDot, 1.0)));
|
||||||
|
finalColor += texelColor*(ambient/10.0);
|
||||||
|
|
||||||
|
// Gamma correction
|
||||||
|
finalColor = pow(finalColor, vec4(1.0/2.2));
|
||||||
|
|
||||||
|
// Fog calculation
|
||||||
|
float dist = length(viewPos - fragPosition);
|
||||||
|
|
||||||
|
// these could be parameters...
|
||||||
|
const vec4 fogColor = vec4(0.5, 0.5, 0.5, 1.0);
|
||||||
|
//const float fogDensity = 0.16;
|
||||||
|
|
||||||
|
// Exponential fog
|
||||||
|
float fogFactor = 1.0/exp((dist*fogDensity)*(dist*fogDensity));
|
||||||
|
|
||||||
|
// Linear fog (less nice)
|
||||||
|
//const float fogStart = 2.0;
|
||||||
|
//const float fogEnd = 10.0;
|
||||||
|
//float fogFactor = (fogEnd - dist)/(fogEnd - fogStart);
|
||||||
|
|
||||||
|
fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||||
|
|
||||||
|
gl_FragColor = mix(fogColor, finalColor, fogFactor);
|
||||||
|
}
|
81
examples/shaders/resources/shaders/glsl100/lighting.fs
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
#version 100
|
||||||
|
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
varying vec3 fragPosition;
|
||||||
|
varying vec2 fragTexCoord;
|
||||||
|
varying vec4 fragColor;
|
||||||
|
varying vec3 fragNormal;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec4 colDiffuse;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
#define MAX_LIGHTS 4
|
||||||
|
#define LIGHT_DIRECTIONAL 0
|
||||||
|
#define LIGHT_POINT 1
|
||||||
|
|
||||||
|
struct MaterialProperty {
|
||||||
|
vec3 color;
|
||||||
|
int useSampler;
|
||||||
|
sampler2D sampler;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Light {
|
||||||
|
int enabled;
|
||||||
|
int type;
|
||||||
|
vec3 position;
|
||||||
|
vec3 target;
|
||||||
|
vec4 color;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Input lighting values
|
||||||
|
uniform Light lights[MAX_LIGHTS];
|
||||||
|
uniform vec4 ambient;
|
||||||
|
uniform vec3 viewPos;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// Texel color fetching from texture sampler
|
||||||
|
vec4 texelColor = texture2D(texture0, fragTexCoord);
|
||||||
|
vec3 lightDot = vec3(0.0);
|
||||||
|
vec3 normal = normalize(fragNormal);
|
||||||
|
vec3 viewD = normalize(viewPos - fragPosition);
|
||||||
|
vec3 specular = vec3(0.0);
|
||||||
|
|
||||||
|
// NOTE: Implement here your fragment shader code
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_LIGHTS; i++)
|
||||||
|
{
|
||||||
|
if (lights[i].enabled == 1)
|
||||||
|
{
|
||||||
|
vec3 light = vec3(0.0);
|
||||||
|
|
||||||
|
if (lights[i].type == LIGHT_DIRECTIONAL)
|
||||||
|
{
|
||||||
|
light = -normalize(lights[i].target - lights[i].position);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lights[i].type == LIGHT_POINT)
|
||||||
|
{
|
||||||
|
light = normalize(lights[i].position - fragPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
float NdotL = max(dot(normal, light), 0.0);
|
||||||
|
lightDot += lights[i].color.rgb*NdotL;
|
||||||
|
|
||||||
|
float specCo = 0.0;
|
||||||
|
if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewD, reflect(-(light), normal))), 16.0); // 16 refers to shine
|
||||||
|
specular += specCo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 finalColor = (texelColor*((colDiffuse + vec4(specular, 1.0))*vec4(lightDot, 1.0)));
|
||||||
|
finalColor += texelColor*(ambient/10.0);
|
||||||
|
|
||||||
|
// Gamma correction
|
||||||
|
gl_FragColor = pow(finalColor, vec4(1.0/2.2));
|
||||||
|
}
|
24
examples/shaders/resources/shaders/glsl100/mask.fs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#version 100
|
||||||
|
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
varying vec2 fragTexCoord;
|
||||||
|
varying vec4 fragColor;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform sampler2D mask;
|
||||||
|
uniform vec4 colDiffuse;
|
||||||
|
uniform int frame;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 maskColour = texture2D(mask, fragTexCoord + vec2(sin(-float(frame)/150.0)/10.0, cos(-float(frame)/170.0)/10.0));
|
||||||
|
if (maskColour.r < 0.25) discard;
|
||||||
|
vec4 texelColor = texture2D(texture0, fragTexCoord + vec2(sin(float(frame)/90.0)/8.0, cos(float(frame)/60.0)/8.0));
|
||||||
|
|
||||||
|
gl_FragColor = texelColor*maskColour;
|
||||||
|
}
|
77
examples/shaders/resources/shaders/glsl100/spotlight.fs
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
#version 100
|
||||||
|
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
#define MAX_SPOTS 3
|
||||||
|
|
||||||
|
struct Spot {
|
||||||
|
vec2 pos; // window coords of spot
|
||||||
|
float inner; // inner fully transparent centre radius
|
||||||
|
float radius; // alpha fades out to this radius
|
||||||
|
};
|
||||||
|
|
||||||
|
uniform Spot spots[MAX_SPOTS]; // Spotlight positions array
|
||||||
|
uniform float screenWidth; // Width of the screen
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
float alpha = 1.0;
|
||||||
|
|
||||||
|
// Get the position of the current fragment (screen coordinates!)
|
||||||
|
vec2 pos = vec2(gl_FragCoord.x, gl_FragCoord.y);
|
||||||
|
|
||||||
|
// Find out which spotlight is nearest
|
||||||
|
float d = 65000.0; // some high value
|
||||||
|
int fi = -1; // found index
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_SPOTS; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < MAX_SPOTS; j++)
|
||||||
|
{
|
||||||
|
float dj = distance(pos, spots[j].pos) - spots[j].radius + spots[i].radius;
|
||||||
|
|
||||||
|
if (d > dj)
|
||||||
|
{
|
||||||
|
d = dj;
|
||||||
|
fi = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// d now equals distance to nearest spot...
|
||||||
|
// allowing for the different radii of all spotlights
|
||||||
|
if (fi == 0)
|
||||||
|
{
|
||||||
|
if (d > spots[0].radius) alpha = 1.0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (d < spots[0].inner) alpha = 0.0;
|
||||||
|
else alpha = (d - spots[0].inner)/(spots[0].radius - spots[0].inner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (fi == 1)
|
||||||
|
{
|
||||||
|
if (d > spots[1].radius) alpha = 1.0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (d < spots[1].inner) alpha = 0.0;
|
||||||
|
else alpha = (d - spots[1].inner)/(spots[1].radius - spots[1].inner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (fi == 2)
|
||||||
|
{
|
||||||
|
if (d > spots[2].radius) alpha = 1.0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (d < spots[2].inner) alpha = 0.0;
|
||||||
|
else alpha = (d - spots[2].inner)/(spots[2].radius - spots[2].inner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Right hand side of screen is dimly lit,
|
||||||
|
// could make the threshold value user definable
|
||||||
|
if ((pos.x > screenWidth/2.0) && (alpha > 0.9)) alpha = 0.9;
|
||||||
|
|
||||||
|
// could make the black out colour user definable...
|
||||||
|
gl_FragColor = vec4(0, 0, 0, alpha);
|
||||||
|
}
|
59
examples/shaders/resources/shaders/glsl120/base_lighting.vs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
#version 120
|
||||||
|
|
||||||
|
// Input vertex attributes
|
||||||
|
attribute vec3 vertexPosition;
|
||||||
|
attribute vec2 vertexTexCoord;
|
||||||
|
attribute vec3 vertexNormal;
|
||||||
|
attribute vec4 vertexColor;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform mat4 mvp;
|
||||||
|
uniform mat4 matModel;
|
||||||
|
|
||||||
|
// Output vertex attributes (to fragment shader)
|
||||||
|
varying vec3 fragPosition;
|
||||||
|
varying vec2 fragTexCoord;
|
||||||
|
varying vec4 fragColor;
|
||||||
|
varying vec3 fragNormal;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
// https://github.com/glslify/glsl-inverse
|
||||||
|
mat3 inverse(mat3 m)
|
||||||
|
{
|
||||||
|
float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];
|
||||||
|
float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];
|
||||||
|
float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];
|
||||||
|
|
||||||
|
float b01 = a22*a11 - a12*a21;
|
||||||
|
float b11 = -a22*a10 + a12*a20;
|
||||||
|
float b21 = a21*a10 - a11*a20;
|
||||||
|
|
||||||
|
float det = a00*b01 + a01*b11 + a02*b21;
|
||||||
|
|
||||||
|
return mat3(b01, (-a22*a01 + a02*a21), (a12*a01 - a02*a11),
|
||||||
|
b11, (a22*a00 - a02*a20), (-a12*a00 + a02*a10),
|
||||||
|
b21, (-a21*a00 + a01*a20), (a11*a00 - a01*a10))/det;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://github.com/glslify/glsl-transpose
|
||||||
|
mat3 transpose(mat3 m)
|
||||||
|
{
|
||||||
|
return mat3(m[0][0], m[1][0], m[2][0],
|
||||||
|
m[0][1], m[1][1], m[2][1],
|
||||||
|
m[0][2], m[1][2], m[2][2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// Send vertex attributes to fragment shader
|
||||||
|
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
|
||||||
|
fragTexCoord = vertexTexCoord;
|
||||||
|
fragColor = vertexColor;
|
||||||
|
|
||||||
|
mat3 normalMatrix = transpose(inverse(mat3(matModel)));
|
||||||
|
fragNormal = normalize(normalMatrix*vertexNormal);
|
||||||
|
|
||||||
|
// Calculate final vertex position
|
||||||
|
gl_Position = mvp*vec4(vertexPosition, 1.0);
|
||||||
|
}
|
92
examples/shaders/resources/shaders/glsl120/fog.fs
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
#version 120
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
varying vec3 fragPosition;
|
||||||
|
varying vec2 fragTexCoord;
|
||||||
|
varying vec4 fragColor;
|
||||||
|
varying vec3 fragNormal;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec4 colDiffuse;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
#define MAX_LIGHTS 4
|
||||||
|
#define LIGHT_DIRECTIONAL 0
|
||||||
|
#define LIGHT_POINT 1
|
||||||
|
|
||||||
|
struct MaterialProperty {
|
||||||
|
vec3 color;
|
||||||
|
int useSampler;
|
||||||
|
sampler2D sampler;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Light {
|
||||||
|
int enabled;
|
||||||
|
int type;
|
||||||
|
vec3 position;
|
||||||
|
vec3 target;
|
||||||
|
vec4 color;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Input lighting values
|
||||||
|
uniform Light lights[MAX_LIGHTS];
|
||||||
|
uniform vec4 ambient;
|
||||||
|
uniform vec3 viewPos;
|
||||||
|
uniform float fogDensity;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// Texel color fetching from texture sampler
|
||||||
|
vec4 texelColor = texture2D(texture0, fragTexCoord);
|
||||||
|
vec3 lightDot = vec3(0.0);
|
||||||
|
vec3 normal = normalize(fragNormal);
|
||||||
|
vec3 viewD = normalize(viewPos - fragPosition);
|
||||||
|
vec3 specular = vec3(0.0);
|
||||||
|
|
||||||
|
// NOTE: Implement here your fragment shader code
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_LIGHTS; i++)
|
||||||
|
{
|
||||||
|
if (lights[i].enabled == 1)
|
||||||
|
{
|
||||||
|
vec3 light = vec3(0.0);
|
||||||
|
|
||||||
|
if (lights[i].type == LIGHT_DIRECTIONAL) light = -normalize(lights[i].target - lights[i].position);
|
||||||
|
if (lights[i].type == LIGHT_POINT) light = normalize(lights[i].position - fragPosition);
|
||||||
|
|
||||||
|
float NdotL = max(dot(normal, light), 0.0);
|
||||||
|
lightDot += lights[i].color.rgb*NdotL;
|
||||||
|
|
||||||
|
float specCo = 0.0;
|
||||||
|
if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewD, reflect(-(light), normal))), 16.0); // Shine: 16.0
|
||||||
|
specular += specCo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 finalColor = (texelColor*((colDiffuse + vec4(specular,1))*vec4(lightDot, 1.0)));
|
||||||
|
finalColor += texelColor*(ambient/10.0);
|
||||||
|
|
||||||
|
// Gamma correction
|
||||||
|
finalColor = pow(finalColor, vec4(1.0/2.2));
|
||||||
|
|
||||||
|
// Fog calculation
|
||||||
|
float dist = length(viewPos - fragPosition);
|
||||||
|
|
||||||
|
// these could be parameters...
|
||||||
|
const vec4 fogColor = vec4(0.5, 0.5, 0.5, 1.0);
|
||||||
|
//const float fogDensity = 0.16;
|
||||||
|
|
||||||
|
// Exponential fog
|
||||||
|
float fogFactor = 1.0/exp((dist*fogDensity)*(dist*fogDensity));
|
||||||
|
|
||||||
|
// Linear fog (less nice)
|
||||||
|
//const float fogStart = 2.0;
|
||||||
|
//const float fogEnd = 10.0;
|
||||||
|
//float fogFactor = (fogEnd - dist)/(fogEnd - fogStart);
|
||||||
|
|
||||||
|
fogFactor = clamp(fogFactor, 0.0, 1.0);
|
||||||
|
|
||||||
|
gl_FragColor = mix(fogColor, finalColor, fogFactor);
|
||||||
|
}
|
@@ -21,7 +21,7 @@ out vec3 fragNormal;
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// Send vertex attributes to fragment shader
|
// Send vertex attributes to fragment shader
|
||||||
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0f));
|
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
|
||||||
fragTexCoord = vertexTexCoord;
|
fragTexCoord = vertexTexCoord;
|
||||||
fragColor = vertexColor;
|
fragColor = vertexColor;
|
||||||
|
|
@@ -55,25 +55,21 @@ void main()
|
|||||||
if (lights[i].enabled == 1)
|
if (lights[i].enabled == 1)
|
||||||
{
|
{
|
||||||
vec3 light = vec3(0.0);
|
vec3 light = vec3(0.0);
|
||||||
if (lights[i].type == LIGHT_DIRECTIONAL) {
|
|
||||||
light = -normalize(lights[i].target - lights[i].position);
|
if (lights[i].type == LIGHT_DIRECTIONAL) light = -normalize(lights[i].target - lights[i].position);
|
||||||
}
|
if (lights[i].type == LIGHT_POINT) light = normalize(lights[i].position - fragPosition);
|
||||||
if (lights[i].type == LIGHT_POINT) {
|
|
||||||
light = normalize(lights[i].position - fragPosition);
|
|
||||||
}
|
|
||||||
float NdotL = max(dot(normal, light), 0.0);
|
float NdotL = max(dot(normal, light), 0.0);
|
||||||
lightDot += lights[i].color.rgb * NdotL;
|
lightDot += lights[i].color.rgb*NdotL;
|
||||||
|
|
||||||
float specCo = 0.0;
|
float specCo = 0.0;
|
||||||
if(NdotL > 0.0)
|
if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewD, reflect(-(light), normal))), 16.0); // Shine: 16.0
|
||||||
specCo = pow(max(0.0, dot(viewD, reflect(-(light), normal))), 16);//16 =shine
|
|
||||||
specular += specCo;
|
specular += specCo;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
finalColor = (texelColor * ((colDiffuse+vec4(specular,1)) * vec4(lightDot, 1.0)));
|
finalColor = (texelColor*((colDiffuse + vec4(specular,1))*vec4(lightDot, 1.0)));
|
||||||
finalColor += texelColor * (ambient/10.0);
|
finalColor += texelColor*(ambient/10.0);
|
||||||
|
|
||||||
// Gamma correction
|
// Gamma correction
|
||||||
finalColor = pow(finalColor, vec4(1.0/2.2));
|
finalColor = pow(finalColor, vec4(1.0/2.2));
|
||||||
|
@@ -1,32 +0,0 @@
|
|||||||
#version 330
|
|
||||||
|
|
||||||
// Input vertex attributes
|
|
||||||
in vec3 vertexPosition;
|
|
||||||
in vec2 vertexTexCoord;
|
|
||||||
in vec3 vertexNormal;
|
|
||||||
in vec4 vertexColor;
|
|
||||||
|
|
||||||
// Input uniform values
|
|
||||||
uniform mat4 mvp;
|
|
||||||
uniform mat4 matModel;
|
|
||||||
|
|
||||||
// Output vertex attributes (to fragment shader)
|
|
||||||
out vec2 fragTexCoord;
|
|
||||||
out vec4 fragColor;
|
|
||||||
out vec3 fragPosition;
|
|
||||||
out vec3 fragNormal;
|
|
||||||
|
|
||||||
// NOTE: Add here your custom variables
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
// Send vertex attributes to fragment shader
|
|
||||||
fragTexCoord = vertexTexCoord;
|
|
||||||
fragColor = vertexColor;
|
|
||||||
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0f));
|
|
||||||
mat3 normalMatrix = transpose(inverse(mat3(matModel)));
|
|
||||||
fragNormal = normalize(normalMatrix*vertexNormal);
|
|
||||||
|
|
||||||
// Calculate final vertex position
|
|
||||||
gl_Position = mvp*vec4(vertexPosition, 1.0);
|
|
||||||
}
|
|
@@ -69,7 +69,7 @@ void main()
|
|||||||
lightDot += lights[i].color.rgb*NdotL;
|
lightDot += lights[i].color.rgb*NdotL;
|
||||||
|
|
||||||
float specCo = 0.0;
|
float specCo = 0.0;
|
||||||
if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewD, reflect(-(light), normal))), 16); // 16 refers to shine
|
if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewD, reflect(-(light), normal))), 16.0); // 16 refers to shine
|
||||||
specular += specCo;
|
specular += specCo;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
// Input vertex attributes (from vertex shader)
|
// Input vertex attributes (from vertex shader)
|
||||||
in vec2 fragTexCoord;
|
in vec2 fragTexCoord;
|
||||||
|
in vec4 fragColor;
|
||||||
|
|
||||||
// Input uniform values
|
// Input uniform values
|
||||||
uniform sampler2D texture0;
|
uniform sampler2D texture0;
|
||||||
@@ -13,9 +14,9 @@ out vec4 finalColor;
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 maskColour = texture(mask, fragTexCoord+vec2(sin(-frame/150.0)/10.0,cos(-frame/170.0)/10.0));
|
vec4 maskColour = texture(mask, fragTexCoord + vec2(sin(-frame/150.0)/10.0, cos(-frame/170.0)/10.0));
|
||||||
if (maskColour.r < 0.25) discard;
|
if (maskColour.r < 0.25) discard;
|
||||||
vec4 texelColor = texture(texture0, fragTexCoord+vec2(sin(frame/90.0)/8.0,cos(frame/60.0)/8.0));
|
vec4 texelColor = texture(texture0, fragTexCoord + vec2(sin(frame/90.0)/8.0, cos(frame/60.0)/8.0));
|
||||||
|
|
||||||
finalColor = texelColor * maskColour;
|
finalColor = texelColor*maskColour;
|
||||||
}
|
}
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
#version 330
|
|
||||||
|
|
||||||
// Input vertex attributes
|
|
||||||
in vec3 vertexPosition;
|
|
||||||
in vec2 vertexTexCoord;
|
|
||||||
|
|
||||||
// Input uniform values
|
|
||||||
uniform mat4 mvp;
|
|
||||||
uniform mat4 matModel;
|
|
||||||
|
|
||||||
// Output vertex attributes (to fragment shader)
|
|
||||||
out vec2 fragTexCoord;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
// Send vertex attributes to fragment shader
|
|
||||||
fragTexCoord = vertexTexCoord;
|
|
||||||
|
|
||||||
// Calculate final vertex position
|
|
||||||
gl_Position = mvp*vec4(vertexPosition, 1.0);
|
|
||||||
}
|
|
65
examples/shaders/resources/shaders/glsl330/spotlight.fs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
#version 330
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
in vec4 fragColor;
|
||||||
|
|
||||||
|
// Output fragment color
|
||||||
|
out vec4 finalColor;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
#define MAX_SPOTS 3
|
||||||
|
|
||||||
|
struct Spot {
|
||||||
|
vec2 pos; // window coords of spot
|
||||||
|
float inner; // inner fully transparent centre radius
|
||||||
|
float radius; // alpha fades out to this radius
|
||||||
|
};
|
||||||
|
|
||||||
|
uniform Spot spots[MAX_SPOTS]; // Spotlight positions array
|
||||||
|
uniform float screenWidth; // Width of the screen
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
float alpha = 1.0;
|
||||||
|
|
||||||
|
// Get the position of the current fragment (screen coordinates!)
|
||||||
|
vec2 pos = vec2(gl_FragCoord.x, gl_FragCoord.y);
|
||||||
|
|
||||||
|
// Find out which spotlight is nearest
|
||||||
|
float d = 65000; // some high value
|
||||||
|
int fi = -1; // found index
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_SPOTS; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < MAX_SPOTS; j++)
|
||||||
|
{
|
||||||
|
float dj = distance(pos, spots[j].pos) - spots[j].radius + spots[i].radius;
|
||||||
|
|
||||||
|
if (d > dj)
|
||||||
|
{
|
||||||
|
d = dj;
|
||||||
|
fi = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// d now equals distance to nearest spot...
|
||||||
|
// allowing for the different radii of all spotlights
|
||||||
|
if (fi != -1)
|
||||||
|
{
|
||||||
|
if (d > spots[fi].radius) alpha = 1.0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (d < spots[fi].inner) alpha = 0.0;
|
||||||
|
else alpha = (d - spots[fi].inner) / (spots[fi].radius - spots[fi].inner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Right hand side of screen is dimly lit,
|
||||||
|
// could make the threshold value user definable
|
||||||
|
if ((pos.x > screenWidth/2.0) && (alpha > 0.9)) alpha = 0.9;
|
||||||
|
|
||||||
|
finalColor = vec4(0, 0, 0, alpha);
|
||||||
|
}
|
@@ -68,17 +68,11 @@ typedef enum {
|
|||||||
extern "C" { // Prevents name mangling of functions
|
extern "C" { // Prevents name mangling of functions
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
// Global Variables Definition
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
int lightsCount = 0; // Current amount of created lights
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module Functions Declaration
|
// Module Functions Declaration
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
Light CreateLight(int type, Vector3 position, Vector3 target, Color color, Shader shader); // Create a light and get shader locations
|
Light CreateLight(int type, Vector3 position, Vector3 target, Color color, Shader shader); // Create a light and get shader locations
|
||||||
void UpdateLightValues(Shader shader, Light light); // Send light properties to shader
|
void UpdateLightValues(Shader shader, Light light); // Send light properties to shader
|
||||||
//void InitLightLocations(Shader shader, Light *light); // Init light shader locations
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
@@ -110,7 +104,7 @@ void UpdateLightValues(Shader shader, Light light); // Send light proper
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Global Variables Definition
|
// Global Variables Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// ...
|
static int lightsCount = 0; // Current amount of created lights
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module specific Functions Declaration
|
// Module specific Functions Declaration
|
||||||
@@ -142,6 +136,8 @@ Light CreateLight(int type, Vector3 position, Vector3 target, Color color, Shade
|
|||||||
char posName[32] = "lights[x].position\0";
|
char posName[32] = "lights[x].position\0";
|
||||||
char targetName[32] = "lights[x].target\0";
|
char targetName[32] = "lights[x].target\0";
|
||||||
char colorName[32] = "lights[x].color\0";
|
char colorName[32] = "lights[x].color\0";
|
||||||
|
|
||||||
|
// Set location name [x] depending on lights count
|
||||||
enabledName[7] = '0' + lightsCount;
|
enabledName[7] = '0' + lightsCount;
|
||||||
typeName[7] = '0' + lightsCount;
|
typeName[7] = '0' + lightsCount;
|
||||||
posName[7] = '0' + lightsCount;
|
posName[7] = '0' + lightsCount;
|
||||||
|
@@ -69,8 +69,8 @@ int main(void)
|
|||||||
modelB.materials[0].maps[MAP_DIFFUSE].texture = texture;
|
modelB.materials[0].maps[MAP_DIFFUSE].texture = texture;
|
||||||
modelC.materials[0].maps[MAP_DIFFUSE].texture = texture;
|
modelC.materials[0].maps[MAP_DIFFUSE].texture = texture;
|
||||||
|
|
||||||
Shader shader = LoadShader("resources/shaders/glsl330/basic_lighting.vs",
|
Shader shader = LoadShader(FormatText("resources/shaders/glsl%i/base_lighting.vs", GLSL_VERSION),
|
||||||
"resources/shaders/glsl330/basic_lighting.fs");
|
FormatText("resources/shaders/glsl%i/lighting.fs", GLSL_VERSION));
|
||||||
|
|
||||||
// Get some shader loactions
|
// Get some shader loactions
|
||||||
shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel");
|
shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel");
|
||||||
@@ -112,7 +112,7 @@ int main(void)
|
|||||||
UpdateCamera(&camera); // Update camera
|
UpdateCamera(&camera); // Update camera
|
||||||
|
|
||||||
// Make the lights do differing orbits
|
// Make the lights do differing orbits
|
||||||
angle -= 0.02;
|
angle -= 0.02f;
|
||||||
lights[0].position.x = cosf(angle)*4.0f;
|
lights[0].position.x = cosf(angle)*4.0f;
|
||||||
lights[0].position.z = sinf(angle)*4.0f;
|
lights[0].position.z = sinf(angle)*4.0f;
|
||||||
lights[1].position.x = cosf(-angle*0.6f)*4.0f;
|
lights[1].position.x = cosf(-angle*0.6f)*4.0f;
|
||||||
@@ -128,8 +128,8 @@ int main(void)
|
|||||||
UpdateLightValues(shader, lights[3]);
|
UpdateLightValues(shader, lights[3]);
|
||||||
|
|
||||||
// Rotate the torus
|
// Rotate the torus
|
||||||
modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateX(-0.025));
|
modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateX(-0.025f));
|
||||||
modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateZ(0.012));
|
modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateZ(0.012f));
|
||||||
|
|
||||||
// Update the light shader with the camera view position
|
// Update the light shader with the camera view position
|
||||||
float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z };
|
float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z };
|
||||||
@@ -161,7 +161,7 @@ int main(void)
|
|||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
DrawText("Keys RGB & W toggle lights", 10, 30, 20, DARKGRAY);
|
DrawText("Use keys RGBW to toggle lights", 10, 30, 20, DARKGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@@ -32,6 +32,12 @@
|
|||||||
#define RLIGHTS_IMPLEMENTATION
|
#define RLIGHTS_IMPLEMENTATION
|
||||||
#include "rlights.h"
|
#include "rlights.h"
|
||||||
|
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
#define GLSL_VERSION 330
|
||||||
|
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
|
#define GLSL_VERSION 100
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
// Initialization
|
// Initialization
|
||||||
@@ -61,7 +67,8 @@ int main(void)
|
|||||||
modelC.materials[0].maps[MAP_DIFFUSE].texture = texture;
|
modelC.materials[0].maps[MAP_DIFFUSE].texture = texture;
|
||||||
|
|
||||||
// Load shader and set up some uniforms
|
// Load shader and set up some uniforms
|
||||||
Shader shader = LoadShader("resources/shaders/glsl330/fog.vs", "resources/shaders/glsl330/fog.fs");
|
Shader shader = LoadShader(FormatText("resources/shaders/glsl%i/base_lighting.vs", GLSL_VERSION),
|
||||||
|
FormatText("resources/shaders/glsl%i/fog.fs", GLSL_VERSION));
|
||||||
shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel");
|
shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel");
|
||||||
shader.locs[LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos");
|
shader.locs[LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos");
|
||||||
|
|
||||||
|
@@ -2,12 +2,8 @@
|
|||||||
*
|
*
|
||||||
* raylib [shaders] example - Raymarching shapes generation
|
* raylib [shaders] example - Raymarching shapes generation
|
||||||
*
|
*
|
||||||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
* NOTE: This example requires raylib OpenGL 3.3 for shaders support and only #version 330
|
||||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
* is currently supported. OpenGL ES 2.0 platforms are not supported at the moment.
|
||||||
*
|
|
||||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
|
|
||||||
* on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
|
|
||||||
* raylib comes with shaders ready for both versions, check raylib/shaders install folder
|
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 2.0 (www.raylib.com)
|
* This example has been created using raylib 2.0 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
@@ -20,7 +16,7 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#define GLSL_VERSION 330
|
#define GLSL_VERSION 330
|
||||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB -> Not supported at this moment
|
||||||
#define GLSL_VERSION 100
|
#define GLSL_VERSION 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -21,6 +21,12 @@
|
|||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
#include "raymath.h"
|
#include "raymath.h"
|
||||||
|
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
#define GLSL_VERSION 330
|
||||||
|
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
|
#define GLSL_VERSION 100
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
// Initialization
|
// Initialization
|
||||||
@@ -50,7 +56,7 @@ int main(void)
|
|||||||
Model model3 = LoadModelFromMesh(sphere);
|
Model model3 = LoadModelFromMesh(sphere);
|
||||||
|
|
||||||
// Load the shader
|
// Load the shader
|
||||||
Shader shader = LoadShader("resources/shaders/glsl330/mask.vs", "resources/shaders/glsl330/mask.fs");
|
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/mask.fs", GLSL_VERSION));
|
||||||
|
|
||||||
// Load and apply the diffuse texture (colour map)
|
// Load and apply the diffuse texture (colour map)
|
||||||
Texture texDiffuse = LoadTexture("resources/plasma.png");
|
Texture texDiffuse = LoadTexture("resources/plasma.png");
|
||||||
@@ -66,7 +72,7 @@ int main(void)
|
|||||||
shader.locs[LOC_MAP_EMISSION] = GetShaderLocation(shader, "mask");
|
shader.locs[LOC_MAP_EMISSION] = GetShaderLocation(shader, "mask");
|
||||||
|
|
||||||
// Frame is incremented each frame to animate the shader
|
// Frame is incremented each frame to animate the shader
|
||||||
int shaderFrame = GetShaderLocation(shader, "framesCounter");
|
int shaderFrame = GetShaderLocation(shader, "frame");
|
||||||
|
|
||||||
// Apply the shader to the two models
|
// Apply the shader to the two models
|
||||||
model1.materials[0].shader = shader;
|
model1.materials[0].shader = shader;
|
||||||
|
262
examples/shaders/shaders_spotlight.c
Normal file
@@ -0,0 +1,262 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [shaders] example - Simple shader mask
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 2.5 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Example contributed by Chris Camacho (@codifies - http://bedroomcoders.co.uk/)
|
||||||
|
* and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 Chris Camacho (@codifies) and Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************
|
||||||
|
*
|
||||||
|
* The shader makes alpha holes in the forground to give the apearance of a top
|
||||||
|
* down look at a spotlight casting a pool of light...
|
||||||
|
*
|
||||||
|
* The right hand side of the screen there is just enough light to see whats
|
||||||
|
* going on without the spot light, great for a stealth type game where you
|
||||||
|
* have to avoid the spotlights.
|
||||||
|
*
|
||||||
|
* The left hand side of the screen is in pitch dark except for where the spotlights are.
|
||||||
|
*
|
||||||
|
* Although this example doesn't scale like the letterbox example, you could integrate
|
||||||
|
* the two techniques, but by scaling the actual colour of the render texture rather
|
||||||
|
* than using alpha as a mask.
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
#include "raymath.h"
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
#define GLSL_VERSION 330
|
||||||
|
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
|
#define GLSL_VERSION 100
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define MAXSPOT 3 // NB must be the same as define in shader
|
||||||
|
#define numStars 400
|
||||||
|
|
||||||
|
|
||||||
|
// Spot data
|
||||||
|
typedef struct {
|
||||||
|
Vector2 pos;
|
||||||
|
Vector2 vel;
|
||||||
|
float inner;
|
||||||
|
float radius;
|
||||||
|
|
||||||
|
// Shader locations
|
||||||
|
unsigned int posLoc;
|
||||||
|
unsigned int innerLoc;
|
||||||
|
unsigned int radiusLoc;
|
||||||
|
} Spot;
|
||||||
|
|
||||||
|
// Stars in the star field have a position and velocity
|
||||||
|
typedef struct Star {
|
||||||
|
Vector2 pos;
|
||||||
|
Vector2 vel;
|
||||||
|
} Star;
|
||||||
|
|
||||||
|
void UpdateStar(Star *s);
|
||||||
|
void ResetStar(Star *s);
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib - shader spotlight");
|
||||||
|
HideCursor();
|
||||||
|
|
||||||
|
Texture texRay = LoadTexture("resources/raysan.png");
|
||||||
|
|
||||||
|
Star stars[numStars] = { 0 };
|
||||||
|
|
||||||
|
for (int n = 0; n < numStars; n++) ResetStar(&stars[n]);
|
||||||
|
|
||||||
|
// Progress all the stars on, so they don't all start in the centre
|
||||||
|
for (int m = 0; m < screenWidth/2.0; m++)
|
||||||
|
{
|
||||||
|
for (int n = 0; n < numStars; n++) UpdateStar(&stars[n]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int frameCounter = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Use default vert shader
|
||||||
|
Shader spotShader = LoadShader(0, FormatText("resources/shaders/glsl%i/spotlight.fs", GLSL_VERSION));
|
||||||
|
|
||||||
|
// Get the locations of spots in the shader
|
||||||
|
Spot spots[MAXSPOT];
|
||||||
|
/*
|
||||||
|
unsigned int posLoc;
|
||||||
|
unsigned int innerLoc;
|
||||||
|
unsigned int radiusLoc;
|
||||||
|
*/
|
||||||
|
for (int i = 0; i < MAXSPOT; i++)
|
||||||
|
{
|
||||||
|
char posName[32] = "spots[x].pos\0";
|
||||||
|
char innerName[32] = "spots[x].inner\0";
|
||||||
|
char radiusName[32] = "spots[x].radius\0";
|
||||||
|
|
||||||
|
posName[6] = '0' + i;
|
||||||
|
innerName[6] = '0' + i;
|
||||||
|
radiusName[6] = '0' + i;
|
||||||
|
|
||||||
|
spots[i].posLoc = GetShaderLocation(spotShader, posName);
|
||||||
|
spots[i].innerLoc = GetShaderLocation(spotShader, innerName);
|
||||||
|
spots[i].radiusLoc = GetShaderLocation(spotShader, radiusName);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// tell the shader how wide the screen is so we can have
|
||||||
|
// a pitch black half and a dimly lit half.
|
||||||
|
{
|
||||||
|
unsigned int wLoc = GetShaderLocation(spotShader, "screenWidth");
|
||||||
|
float sw = (float)GetScreenWidth();
|
||||||
|
SetShaderValue(spotShader, wLoc, &sw, UNIFORM_FLOAT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// randomise the locations and velocities of the spotlights
|
||||||
|
// and initialise the shader locations
|
||||||
|
for (int i = 0; i < MAXSPOT; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
spots[i].pos.x = GetRandomValue(64, screenWidth - 64);
|
||||||
|
spots[i].pos.y = GetRandomValue(64, screenHeight - 64);
|
||||||
|
spots[i].vel = (Vector2){ 0, 0 };
|
||||||
|
|
||||||
|
while ((fabs(spots[i].vel.x) + fabs(spots[i].vel.y)) < 2)
|
||||||
|
{
|
||||||
|
spots[i].vel.x = GetRandomValue(-40, 40)/10.0;
|
||||||
|
spots[i].vel.y = GetRandomValue(-40, 40)/10.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
spots[i].inner = 28 * (i + 1);
|
||||||
|
spots[i].radius = 48 * (i + 1);
|
||||||
|
|
||||||
|
SetShaderValue(spotShader, spots[i].posLoc, &spots[i].pos.x, UNIFORM_VEC2);
|
||||||
|
SetShaderValue(spotShader, spots[i].innerLoc, &spots[i].inner, UNIFORM_FLOAT);
|
||||||
|
SetShaderValue(spotShader, spots[i].radiusLoc, &spots[i].radius, UNIFORM_FLOAT);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
frameCounter++;
|
||||||
|
|
||||||
|
// Move the stars, resetting them if the go offscreen
|
||||||
|
for (int n = 0; n < numStars; n++) UpdateStar(&stars[n]);
|
||||||
|
|
||||||
|
// Update the spots, send them to the shader
|
||||||
|
for (int i = 0; i < MAXSPOT; i++)
|
||||||
|
{
|
||||||
|
if ( i == 0 ) {
|
||||||
|
Vector2 mp = GetMousePosition();
|
||||||
|
spots[i].pos.x = mp.x;
|
||||||
|
spots[i].pos.y = screenHeight - mp.y;
|
||||||
|
} else {
|
||||||
|
spots[i].pos.x += spots[i].vel.x;
|
||||||
|
spots[i].pos.y += spots[i].vel.y;
|
||||||
|
|
||||||
|
if (spots[i].pos.x < 64) spots[i].vel.x = -spots[i].vel.x;
|
||||||
|
if (spots[i].pos.x > screenWidth - 64) spots[i].vel.x = -spots[i].vel.x;
|
||||||
|
if (spots[i].pos.y < 64) spots[i].vel.y = -spots[i].vel.y;
|
||||||
|
if (spots[i].pos.y > screenHeight - 64) spots[i].vel.y = -spots[i].vel.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetShaderValue(spotShader, spots[i].posLoc, &spots[i].pos.x, UNIFORM_VEC2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(DARKBLUE);
|
||||||
|
|
||||||
|
// Draw stars and bobs
|
||||||
|
for (int n = 0; n < numStars; n++)
|
||||||
|
{
|
||||||
|
// Single pixel is just too small these days!
|
||||||
|
DrawRectangle(stars[n].pos.x, stars[n].pos.y, 2, 2, WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
DrawTexture(texRay,
|
||||||
|
(screenWidth/2.0) + cos((frameCounter + i*8)/51.45f)*(screenWidth/2.2) - 32,
|
||||||
|
(screenHeight/2.0) + sin((frameCounter + i*8)/17.87f)*(screenHeight/4.2),
|
||||||
|
WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw spot lights
|
||||||
|
BeginShaderMode(spotShader);
|
||||||
|
// instead of a blank rectangle you could render here
|
||||||
|
// a render texture of the full screen used to do screen
|
||||||
|
// scaling (slight adjustment to shader would be required
|
||||||
|
// to actually pay attention to the colour!)
|
||||||
|
DrawRectangle(0,0,screenWidth,screenHeight,WHITE);
|
||||||
|
EndShaderMode();
|
||||||
|
|
||||||
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
DrawText("Move the mouse!", 10, 30, 20, GREEN);
|
||||||
|
DrawText("Pitch Black", screenWidth * .2, screenHeight / 2, 20, GREEN);
|
||||||
|
DrawText("Dark", screenWidth * .66, screenHeight / 2, 20, GREEN);
|
||||||
|
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadTexture(texRay);
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ResetStar(Star *s)
|
||||||
|
{
|
||||||
|
s->pos = (Vector2){ GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
s->vel.x = (float)GetRandomValue(-1000, 1000)/100.0f;
|
||||||
|
s->vel.y = (float)GetRandomValue(-1000, 1000)/100.0f;
|
||||||
|
|
||||||
|
} while (!(fabs(s->vel.x) + fabs(s->vel.y) > 1));
|
||||||
|
|
||||||
|
s->pos = Vector2Add(s->pos, Vector2MultiplyV(s->vel, (Vector2){ 8, 8 }));
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateStar(Star *s)
|
||||||
|
{
|
||||||
|
s->pos = Vector2Add(s->pos, s->vel);
|
||||||
|
|
||||||
|
if (s->pos.x < 0 || s->pos.x > GetScreenWidth() ||
|
||||||
|
s->pos.y < 0 || s->pos.y > GetScreenHeight())
|
||||||
|
{
|
||||||
|
ResetStar(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
BIN
examples/shaders/shaders_spotlight.png
Normal file
After Width: | Height: | Size: 118 KiB |
@@ -35,6 +35,11 @@ int main(void)
|
|||||||
ImageDraw(&parrots, cat, (Rectangle){ 0, 0, cat.width, cat.height }, (Rectangle){ 30, 40, cat.width*1.5f, cat.height*1.5f }, WHITE);
|
ImageDraw(&parrots, cat, (Rectangle){ 0, 0, cat.width, cat.height }, (Rectangle){ 30, 40, cat.width*1.5f, cat.height*1.5f }, WHITE);
|
||||||
ImageCrop(&parrots, (Rectangle){ 0, 50, parrots.width, parrots.height - 100 }); // Crop resulting image
|
ImageCrop(&parrots, (Rectangle){ 0, 50, parrots.width, parrots.height - 100 }); // Crop resulting image
|
||||||
|
|
||||||
|
// Draw on the image with a few image draw methods
|
||||||
|
ImageDrawPixel(&parrots, 10, 10, RAYWHITE);
|
||||||
|
ImageDrawCircle(&parrots, 10, 10, 5, RAYWHITE);
|
||||||
|
ImageDrawRectangle(&parrots, 5, 20, 10, 10, RAYWHITE);
|
||||||
|
|
||||||
UnloadImage(cat); // Unload image from RAM
|
UnloadImage(cat); // Unload image from RAM
|
||||||
|
|
||||||
// Load custom font for frawing on image
|
// Load custom font for frawing on image
|
||||||
|
Before Width: | Height: | Size: 410 KiB After Width: | Height: | Size: 234 KiB |
@@ -106,7 +106,7 @@ int main(void)
|
|||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
|
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON) || (GetGestureDetected() == GESTURE_DRAG))
|
||||||
{
|
{
|
||||||
// Paint circle into render texture
|
// Paint circle into render texture
|
||||||
// NOTE: To avoid discontinuous circles, we could store
|
// NOTE: To avoid discontinuous circles, we could store
|
||||||
@@ -166,7 +166,7 @@ int main(void)
|
|||||||
// Draw drawing circle for reference
|
// Draw drawing circle for reference
|
||||||
if (mousePos.y > 50)
|
if (mousePos.y > 50)
|
||||||
{
|
{
|
||||||
if (IsMouseButtonDown(MOUSE_RIGHT_BUTTON)) DrawCircleLines(mousePos.x, mousePos.y, brushSize, colors[colorSelected]);
|
if (IsMouseButtonDown(MOUSE_RIGHT_BUTTON)) DrawCircleLines(mousePos.x, mousePos.y, brushSize, GRAY);
|
||||||
else DrawCircle(GetMouseX(), GetMouseY(), brushSize, colors[colorSelected]);
|
else DrawCircle(GetMouseX(), GetMouseY(), brushSize, colors[colorSelected]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013-2019 Ramon Santamaria (@raysan5)
|
# Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
|
||||||
#
|
#
|
||||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
# 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.
|
# will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
# Define required raylib variables
|
# Define required raylib variables
|
||||||
PROJECT_NAME ?= raylib_examples
|
PROJECT_NAME ?= raylib_examples
|
||||||
RAYLIB_VERSION ?= 2.5.0
|
RAYLIB_VERSION ?= 3.0.0
|
||||||
RAYLIB_API_VERSION ?= 2
|
RAYLIB_API_VERSION ?= 3
|
||||||
RAYLIB_PATH ?= ..
|
RAYLIB_PATH ?= ..
|
||||||
|
|
||||||
# Define default options
|
# Define default options
|
||||||
@@ -115,13 +115,12 @@ endif
|
|||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# Emscripten required variables
|
# Emscripten required variables
|
||||||
EMSDK_PATH ?= D:/emsdk
|
EMSDK_PATH ?= C:/emsdk
|
||||||
EMSCRIPTEN_VERSION ?= 1.38.31
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/fastcomp/emscripten
|
||||||
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
|
CLANG_PATH = $(EMSDK_PATH)/fastcomp/bin
|
||||||
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
|
PYTHON_PATH = $(EMSDK_PATH)/python/2.7.13.1_64bit/python-2.7.13.amd64
|
||||||
NODE_VERSION = 8.9.1_64bit
|
NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin
|
||||||
export PATH = $(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
|
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
|
||||||
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Define raylib release directory for compiled library.
|
# Define raylib release directory for compiled library.
|
||||||
@@ -188,10 +187,19 @@ endif
|
|||||||
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
||||||
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||||
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||||
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
||||||
|
|
||||||
ifeq ($(BUILD_MODE),DEBUG)
|
ifeq ($(BUILD_MODE),DEBUG)
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -s ASSERTIONS=1 --profiling
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -Os
|
||||||
|
else
|
||||||
|
CFLAGS += -s -O1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Additional flags for compiler (if desired)
|
# Additional flags for compiler (if desired)
|
||||||
@@ -200,7 +208,10 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
# resource file contains windows executable icon and properties
|
# resource file contains windows executable icon and properties
|
||||||
# -Wl,--subsystem,windows hides the console window
|
# -Wl,--subsystem,windows hides the console window
|
||||||
CFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data -Wl,--subsystem,windows
|
CFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
|
||||||
|
ifeq ($(BUILD_MODE), RELEASE)
|
||||||
|
CFLAGS += -Wl,--subsystem,windows
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
||||||
@@ -230,10 +241,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
|||||||
# --profiling # include information for code profiling
|
# --profiling # include information for code profiling
|
||||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||||
# --preload-file resources # specify a resources folder for data compilation
|
# --preload-file resources # specify a resources folder for data compilation
|
||||||
CFLAGS += -Os -s USE_GLFW=3
|
CFLAGS += -s USE_GLFW=3
|
||||||
ifeq ($(BUILD_MODE), DEBUG)
|
|
||||||
CFLAGS += -s ASSERTIONS=1 --profiling
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define a custom shell .html and output extension
|
# Define a custom shell .html and output extension
|
||||||
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||||
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
# Libraries for OSX 10.9 desktop compiling
|
# Libraries for OSX 10.9 desktop compiling
|
||||||
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
||||||
LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
|
LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
||||||
@@ -372,7 +380,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
del *.o *.exe /s
|
del *.o *.exe /s
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable|x-pie-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
find . -type f -perm +ugo+x -delete
|
find . -type f -perm +ugo+x -delete
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013-2019 Ramon Santamaria (@raysan5)
|
# Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
|
||||||
#
|
#
|
||||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
# 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.
|
# will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
# Define required raylib variables
|
# Define required raylib variables
|
||||||
PROJECT_NAME ?= roomba
|
PROJECT_NAME ?= roomba
|
||||||
RAYLIB_VERSION ?= 2.5.0
|
RAYLIB_VERSION ?= 3.0.0
|
||||||
RAYLIB_API_VERSION ?= 2
|
RAYLIB_API_VERSION ?= 3
|
||||||
RAYLIB_PATH ?= C:\GitHub\raylib
|
RAYLIB_PATH ?= C:\GitHub\raylib
|
||||||
|
|
||||||
# Define default options
|
# Define default options
|
||||||
@@ -115,13 +115,12 @@ endif
|
|||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# Emscripten required variables
|
# Emscripten required variables
|
||||||
EMSDK_PATH ?= C:/emsdk
|
EMSDK_PATH ?= C:/emsdk
|
||||||
EMSCRIPTEN_VERSION ?= 1.38.31
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/fastcomp/emscripten
|
||||||
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
|
CLANG_PATH = $(EMSDK_PATH)/fastcomp/bin
|
||||||
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
|
PYTHON_PATH = $(EMSDK_PATH)/python/2.7.13.1_64bit/python-2.7.13.amd64
|
||||||
NODE_VERSION = 8.9.1_64bit
|
NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin
|
||||||
export PATH = $(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
|
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
|
||||||
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Define raylib release directory for compiled library.
|
# Define raylib release directory for compiled library.
|
||||||
@@ -188,20 +187,24 @@ endif
|
|||||||
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
||||||
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||||
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||||
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
||||||
|
|
||||||
ifeq ($(BUILD_MODE),DEBUG)
|
ifeq ($(BUILD_MODE),DEBUG)
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -s ASSERTIONS=1 --profiling
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -Os
|
||||||
|
else
|
||||||
|
CFLAGS += -s -O1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Additional flags for compiler (if desired)
|
# Additional flags for compiler (if desired)
|
||||||
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
|
||||||
# resource file contains windows executable icon and properties
|
|
||||||
# -Wl,--subsystem,windows hides the console window
|
|
||||||
CFLAGS += $(RAYLIB_PATH)/raylib.rc.data -Wl,--subsystem,windows
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
||||||
CFLAGS += -D_DEFAULT_SOURCE
|
CFLAGS += -D_DEFAULT_SOURCE
|
||||||
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
|||||||
# --profiling # include information for code profiling
|
# --profiling # include information for code profiling
|
||||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||||
# --preload-file resources # specify a resources folder for data compilation
|
# --preload-file resources # specify a resources folder for data compilation
|
||||||
CFLAGS += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=16777216 --preload-file resources
|
CFLAGS += -s USE_GLFW=3 -s TOTAL_MEMORY=16777216 --preload-file resources
|
||||||
ifeq ($(BUILD_MODE), DEBUG)
|
|
||||||
CFLAGS += -s ASSERTIONS=1 --profiling
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define a custom shell .html and output extension
|
# Define a custom shell .html and output extension
|
||||||
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||||
@@ -267,6 +267,14 @@ endif
|
|||||||
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# resource file contains windows executable icon and properties
|
||||||
|
LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
|
||||||
|
# -Wl,--subsystem,windows hides the console window
|
||||||
|
ifeq ($(BUILD_MODE), RELEASE)
|
||||||
|
LDFLAGS += -Wl,--subsystem,windows
|
||||||
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Consider -L$(RAYLIB_INSTALL_PATH)
|
# Consider -L$(RAYLIB_INSTALL_PATH)
|
||||||
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
||||||
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
# NOTE: WinMM library required to set high-res timer resolution
|
# NOTE: WinMM library required to set high-res timer resolution
|
||||||
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
||||||
# Required for physac examples
|
# Required for physac examples
|
||||||
#LDLIBS += -static -lpthread
|
LDLIBS += -static -lpthread
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
# Libraries for Debian GNU/Linux desktop compiling
|
# Libraries for Debian GNU/Linux desktop compiling
|
||||||
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
# Libraries for OSX 10.9 desktop compiling
|
# Libraries for OSX 10.9 desktop compiling
|
||||||
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
||||||
LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
|
LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
||||||
@@ -380,7 +388,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
del *.o *.exe /s
|
del *.o *.exe /s
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable|x-pie-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
find . -type f -perm +ugo+x -delete
|
find . -type f -perm +ugo+x -delete
|
||||||
|
@@ -19,6 +19,11 @@
|
|||||||
#include <emscripten/emscripten.h>
|
#include <emscripten/emscripten.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GameScreen currentScreen = 0;
|
||||||
|
Font font = { 0 };
|
||||||
|
Font font2 = { 0 };
|
||||||
|
Music music = { 0 };
|
||||||
|
Sound fxCoin = { 0 };
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Global Variables Definition (local to this module)
|
// Global Variables Definition (local to this module)
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@@ -36,11 +36,11 @@ typedef enum GameScreen { LOGO = 0, TITLE, OPTIONS, GAMEPLAY, ENDING } GameScree
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Global Variables Definition
|
// Global Variables Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
GameScreen currentScreen;
|
extern GameScreen currentScreen;
|
||||||
Font font;
|
extern Font font;
|
||||||
Font font2;
|
extern Font font2;
|
||||||
Music music;
|
extern Music music;
|
||||||
Sound fxCoin;
|
extern Sound fxCoin;
|
||||||
|
|
||||||
int score;
|
int score;
|
||||||
int result; // 0-Loose, 1-Win
|
int result; // 0-Loose, 1-Win
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013-2019 Ramon Santamaria (@raysan5)
|
# Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
|
||||||
#
|
#
|
||||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
# 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.
|
# will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
# Define required raylib variables
|
# Define required raylib variables
|
||||||
PROJECT_NAME ?= drturtle
|
PROJECT_NAME ?= drturtle
|
||||||
RAYLIB_VERSION ?= 2.5.0
|
RAYLIB_VERSION ?= 3.0.0
|
||||||
RAYLIB_API_VERSION ?= 2
|
RAYLIB_API_VERSION ?= 3
|
||||||
RAYLIB_PATH ?= C:\GitHub\raylib
|
RAYLIB_PATH ?= C:\GitHub\raylib
|
||||||
|
|
||||||
# Define default options
|
# Define default options
|
||||||
@@ -115,13 +115,12 @@ endif
|
|||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# Emscripten required variables
|
# Emscripten required variables
|
||||||
EMSDK_PATH ?= C:/emsdk
|
EMSDK_PATH ?= C:/emsdk
|
||||||
EMSCRIPTEN_VERSION ?= 1.38.32
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/fastcomp/emscripten
|
||||||
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
|
CLANG_PATH = $(EMSDK_PATH)/fastcomp/bin
|
||||||
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
|
PYTHON_PATH = $(EMSDK_PATH)/python/2.7.13.1_64bit/python-2.7.13.amd64
|
||||||
NODE_VERSION = 8.9.1_64bit
|
NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin
|
||||||
export PATH = $(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
|
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
|
||||||
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Define raylib release directory for compiled library.
|
# Define raylib release directory for compiled library.
|
||||||
@@ -188,20 +187,24 @@ endif
|
|||||||
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
||||||
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||||
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||||
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
||||||
|
|
||||||
ifeq ($(BUILD_MODE),DEBUG)
|
ifeq ($(BUILD_MODE),DEBUG)
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -s ASSERTIONS=1 --profiling
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -Os
|
||||||
|
else
|
||||||
|
CFLAGS += -s -O1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Additional flags for compiler (if desired)
|
# Additional flags for compiler (if desired)
|
||||||
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
|
||||||
# resource file contains windows executable icon and properties
|
|
||||||
# -Wl,--subsystem,windows hides the console window
|
|
||||||
CFLAGS += $(RAYLIB_PATH)/raylib.rc.data -Wl,--subsystem,windows
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
||||||
CFLAGS += -D_DEFAULT_SOURCE
|
CFLAGS += -D_DEFAULT_SOURCE
|
||||||
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
|||||||
# --profiling # include information for code profiling
|
# --profiling # include information for code profiling
|
||||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||||
# --preload-file resources # specify a resources folder for data compilation
|
# --preload-file resources # specify a resources folder for data compilation
|
||||||
CFLAGS += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
|
CFLAGS += -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
|
||||||
ifeq ($(BUILD_MODE), DEBUG)
|
|
||||||
CFLAGS += -s ASSERTIONS=1 --profiling
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define a custom shell .html and output extension
|
# Define a custom shell .html and output extension
|
||||||
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||||
@@ -267,6 +267,14 @@ endif
|
|||||||
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# resource file contains windows executable icon and properties
|
||||||
|
LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
|
||||||
|
# -Wl,--subsystem,windows hides the console window
|
||||||
|
ifeq ($(BUILD_MODE), RELEASE)
|
||||||
|
LDFLAGS += -Wl,--subsystem,windows
|
||||||
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Consider -L$(RAYLIB_INSTALL_PATH)
|
# Consider -L$(RAYLIB_INSTALL_PATH)
|
||||||
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
||||||
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
# NOTE: WinMM library required to set high-res timer resolution
|
# NOTE: WinMM library required to set high-res timer resolution
|
||||||
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
||||||
# Required for physac examples
|
# Required for physac examples
|
||||||
#LDLIBS += -static -lpthread
|
LDLIBS += -static -lpthread
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
# Libraries for Debian GNU/Linux desktop compiling
|
# Libraries for Debian GNU/Linux desktop compiling
|
||||||
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
# Libraries for OSX 10.9 desktop compiling
|
# Libraries for OSX 10.9 desktop compiling
|
||||||
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
||||||
LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
|
LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
||||||
@@ -359,7 +367,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
del *.o *.exe /s
|
del *.o *.exe /s
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable|x-pie-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
find . -type f -perm +ugo+x -delete
|
find . -type f -perm +ugo+x -delete
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013-2019 Ramon Santamaria (@raysan5)
|
# Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
|
||||||
#
|
#
|
||||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
# 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.
|
# will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
# Define required raylib variables
|
# Define required raylib variables
|
||||||
PROJECT_NAME ?= just_do
|
PROJECT_NAME ?= just_do
|
||||||
RAYLIB_VERSION ?= 2.5.0
|
RAYLIB_VERSION ?= 3.0.0
|
||||||
RAYLIB_API_VERSION ?= 2
|
RAYLIB_API_VERSION ?= 3
|
||||||
RAYLIB_PATH ?= C:\GitHub\raylib
|
RAYLIB_PATH ?= C:\GitHub\raylib
|
||||||
|
|
||||||
# Define default options
|
# Define default options
|
||||||
@@ -115,13 +115,12 @@ endif
|
|||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# Emscripten required variables
|
# Emscripten required variables
|
||||||
EMSDK_PATH ?= C:/emsdk
|
EMSDK_PATH ?= C:/emsdk
|
||||||
EMSCRIPTEN_VERSION ?= 1.38.31
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/fastcomp/emscripten
|
||||||
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
|
CLANG_PATH = $(EMSDK_PATH)/fastcomp/bin
|
||||||
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
|
PYTHON_PATH = $(EMSDK_PATH)/python/2.7.13.1_64bit/python-2.7.13.amd64
|
||||||
NODE_VERSION = 8.9.1_64bit
|
NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin
|
||||||
export PATH = $(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
|
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
|
||||||
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Define raylib release directory for compiled library.
|
# Define raylib release directory for compiled library.
|
||||||
@@ -188,20 +187,24 @@ endif
|
|||||||
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
||||||
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||||
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||||
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
||||||
|
|
||||||
ifeq ($(BUILD_MODE),DEBUG)
|
ifeq ($(BUILD_MODE),DEBUG)
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -s ASSERTIONS=1 --profiling
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -Os
|
||||||
|
else
|
||||||
|
CFLAGS += -s -O1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Additional flags for compiler (if desired)
|
# Additional flags for compiler (if desired)
|
||||||
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
|
||||||
# resource file contains windows executable icon and properties
|
|
||||||
# -Wl,--subsystem,windows hides the console window
|
|
||||||
CFLAGS += $(RAYLIB_PATH)/raylib.rc.data -Wl,--subsystem,windows
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
||||||
CFLAGS += -D_DEFAULT_SOURCE
|
CFLAGS += -D_DEFAULT_SOURCE
|
||||||
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
|||||||
# --profiling # include information for code profiling
|
# --profiling # include information for code profiling
|
||||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||||
# --preload-file resources # specify a resources folder for data compilation
|
# --preload-file resources # specify a resources folder for data compilation
|
||||||
CFLAGS += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=16777216 --preload-file resources
|
CFLAGS += -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
|
||||||
ifeq ($(BUILD_MODE), DEBUG)
|
|
||||||
CFLAGS += -s ASSERTIONS=1 --profiling
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define a custom shell .html and output extension
|
# Define a custom shell .html and output extension
|
||||||
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||||
@@ -267,6 +267,14 @@ endif
|
|||||||
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# resource file contains windows executable icon and properties
|
||||||
|
LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
|
||||||
|
# -Wl,--subsystem,windows hides the console window
|
||||||
|
ifeq ($(BUILD_MODE), RELEASE)
|
||||||
|
LDFLAGS += -Wl,--subsystem,windows
|
||||||
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Consider -L$(RAYLIB_INSTALL_PATH)
|
# Consider -L$(RAYLIB_INSTALL_PATH)
|
||||||
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
||||||
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
# NOTE: WinMM library required to set high-res timer resolution
|
# NOTE: WinMM library required to set high-res timer resolution
|
||||||
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
||||||
# Required for physac examples
|
# Required for physac examples
|
||||||
#LDLIBS += -static -lpthread
|
LDLIBS += -static -lpthread
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
# Libraries for Debian GNU/Linux desktop compiling
|
# Libraries for Debian GNU/Linux desktop compiling
|
||||||
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
# Libraries for OSX 10.9 desktop compiling
|
# Libraries for OSX 10.9 desktop compiling
|
||||||
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
||||||
LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
|
LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
||||||
@@ -387,7 +395,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
del *.o *.exe /s
|
del *.o *.exe /s
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable|x-pie-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
find . -type f -perm +ugo+x -delete
|
find . -type f -perm +ugo+x -delete
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013-2019 Ramon Santamaria (@raysan5)
|
# Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
|
||||||
#
|
#
|
||||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
# 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.
|
# will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
# Define required raylib variables
|
# Define required raylib variables
|
||||||
PROJECT_NAME ?= koala_seasons
|
PROJECT_NAME ?= koala_seasons
|
||||||
RAYLIB_VERSION ?= 2.5.0
|
RAYLIB_VERSION ?= 3.0.0
|
||||||
RAYLIB_API_VERSION ?= 2
|
RAYLIB_API_VERSION ?= 3
|
||||||
RAYLIB_PATH ?= C:\GitHub\raylib
|
RAYLIB_PATH ?= C:\GitHub\raylib
|
||||||
|
|
||||||
# Define default options
|
# Define default options
|
||||||
@@ -115,13 +115,12 @@ endif
|
|||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# Emscripten required variables
|
# Emscripten required variables
|
||||||
EMSDK_PATH ?= C:/emsdk
|
EMSDK_PATH ?= C:/emsdk
|
||||||
EMSCRIPTEN_VERSION ?= 1.38.32
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/fastcomp/emscripten
|
||||||
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
|
CLANG_PATH = $(EMSDK_PATH)/fastcomp/bin
|
||||||
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
|
PYTHON_PATH = $(EMSDK_PATH)/python/2.7.13.1_64bit/python-2.7.13.amd64
|
||||||
NODE_VERSION = 8.9.1_64bit
|
NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin
|
||||||
export PATH = $(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
|
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
|
||||||
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Define raylib release directory for compiled library.
|
# Define raylib release directory for compiled library.
|
||||||
@@ -188,20 +187,24 @@ endif
|
|||||||
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
||||||
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||||
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||||
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
||||||
|
|
||||||
ifeq ($(BUILD_MODE),DEBUG)
|
ifeq ($(BUILD_MODE),DEBUG)
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -s ASSERTIONS=1 --profiling
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -Os
|
||||||
|
else
|
||||||
|
CFLAGS += -s -O1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Additional flags for compiler (if desired)
|
# Additional flags for compiler (if desired)
|
||||||
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
|
||||||
# resource file contains windows executable icon and properties
|
|
||||||
# -Wl,--subsystem,windows hides the console window
|
|
||||||
CFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data -Wl,--subsystem,windows
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
||||||
CFLAGS += -D_DEFAULT_SOURCE
|
CFLAGS += -D_DEFAULT_SOURCE
|
||||||
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
|||||||
# --profiling # include information for code profiling
|
# --profiling # include information for code profiling
|
||||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||||
# --preload-file resources # specify a resources folder for data compilation
|
# --preload-file resources # specify a resources folder for data compilation
|
||||||
CFLAGS += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
|
CFLAGS += -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
|
||||||
ifeq ($(BUILD_MODE), DEBUG)
|
|
||||||
CFLAGS += -s ASSERTIONS=1 --profiling
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define a custom shell .html and output extension
|
# Define a custom shell .html and output extension
|
||||||
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||||
@@ -267,6 +267,14 @@ endif
|
|||||||
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# resource file contains windows executable icon and properties
|
||||||
|
LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
|
||||||
|
# -Wl,--subsystem,windows hides the console window
|
||||||
|
ifeq ($(BUILD_MODE), RELEASE)
|
||||||
|
LDFLAGS += -Wl,--subsystem,windows
|
||||||
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Consider -L$(RAYLIB_INSTALL_PATH)
|
# Consider -L$(RAYLIB_INSTALL_PATH)
|
||||||
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
||||||
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
# NOTE: WinMM library required to set high-res timer resolution
|
# NOTE: WinMM library required to set high-res timer resolution
|
||||||
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
||||||
# Required for physac examples
|
# Required for physac examples
|
||||||
#LDLIBS += -static -lpthread
|
LDLIBS += -static -lpthread
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
# Libraries for Debian GNU/Linux desktop compiling
|
# Libraries for Debian GNU/Linux desktop compiling
|
||||||
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
# Libraries for OSX 10.9 desktop compiling
|
# Libraries for OSX 10.9 desktop compiling
|
||||||
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
||||||
LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
|
LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
||||||
@@ -380,7 +388,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
del *.o *.exe /s
|
del *.o *.exe /s
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable|x-pie-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
find . -type f -perm +ugo+x -delete
|
find . -type f -perm +ugo+x -delete
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013-2019 Ramon Santamaria (@raysan5)
|
# Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
|
||||||
#
|
#
|
||||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
# 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.
|
# will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
# Define required raylib variables
|
# Define required raylib variables
|
||||||
PROJECT_NAME ?= light_my_ritual
|
PROJECT_NAME ?= light_my_ritual
|
||||||
RAYLIB_VERSION ?= 2.5.0
|
RAYLIB_VERSION ?= 3.0.0
|
||||||
RAYLIB_API_VERSION ?= 2
|
RAYLIB_API_VERSION ?= 3
|
||||||
RAYLIB_PATH ?= C:\GitHub\raylib
|
RAYLIB_PATH ?= C:\GitHub\raylib
|
||||||
|
|
||||||
# Define default options
|
# Define default options
|
||||||
@@ -115,13 +115,12 @@ endif
|
|||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# Emscripten required variables
|
# Emscripten required variables
|
||||||
EMSDK_PATH ?= C:/emsdk
|
EMSDK_PATH ?= C:/emsdk
|
||||||
EMSCRIPTEN_VERSION ?= 1.38.32
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/fastcomp/emscripten
|
||||||
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
|
CLANG_PATH = $(EMSDK_PATH)/fastcomp/bin
|
||||||
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
|
PYTHON_PATH = $(EMSDK_PATH)/python/2.7.13.1_64bit/python-2.7.13.amd64
|
||||||
NODE_VERSION = 8.9.1_64bit
|
NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin
|
||||||
export PATH = $(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
|
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
|
||||||
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Define raylib release directory for compiled library.
|
# Define raylib release directory for compiled library.
|
||||||
@@ -188,20 +187,24 @@ endif
|
|||||||
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
||||||
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||||
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||||
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
||||||
|
|
||||||
ifeq ($(BUILD_MODE),DEBUG)
|
ifeq ($(BUILD_MODE),DEBUG)
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -s ASSERTIONS=1 --profiling
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -Os
|
||||||
|
else
|
||||||
|
CFLAGS += -s -O1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Additional flags for compiler (if desired)
|
# Additional flags for compiler (if desired)
|
||||||
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
|
||||||
# resource file contains windows executable icon and properties
|
|
||||||
# -Wl,--subsystem,windows hides the console window
|
|
||||||
CFLAGS += $(RAYLIB_PATH)/raylib.rc.data -Wl,--subsystem,windows
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
||||||
CFLAGS += -D_DEFAULT_SOURCE
|
CFLAGS += -D_DEFAULT_SOURCE
|
||||||
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
|||||||
# --profiling # include information for code profiling
|
# --profiling # include information for code profiling
|
||||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||||
# --preload-file resources # specify a resources folder for data compilation
|
# --preload-file resources # specify a resources folder for data compilation
|
||||||
CFLAGS += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
|
CFLAGS += -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
|
||||||
ifeq ($(BUILD_MODE), DEBUG)
|
|
||||||
CFLAGS += -s ASSERTIONS=1 --profiling
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define a custom shell .html and output extension
|
# Define a custom shell .html and output extension
|
||||||
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||||
@@ -267,6 +267,14 @@ endif
|
|||||||
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# resource file contains windows executable icon and properties
|
||||||
|
LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
|
||||||
|
# -Wl,--subsystem,windows hides the console window
|
||||||
|
ifeq ($(BUILD_MODE), RELEASE)
|
||||||
|
LDFLAGS += -Wl,--subsystem,windows
|
||||||
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Consider -L$(RAYLIB_INSTALL_PATH)
|
# Consider -L$(RAYLIB_INSTALL_PATH)
|
||||||
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
||||||
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
# NOTE: WinMM library required to set high-res timer resolution
|
# NOTE: WinMM library required to set high-res timer resolution
|
||||||
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
||||||
# Required for physac examples
|
# Required for physac examples
|
||||||
#LDLIBS += -static -lpthread
|
LDLIBS += -static -lpthread
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
# Libraries for Debian GNU/Linux desktop compiling
|
# Libraries for Debian GNU/Linux desktop compiling
|
||||||
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
# Libraries for OSX 10.9 desktop compiling
|
# Libraries for OSX 10.9 desktop compiling
|
||||||
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
||||||
LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
|
LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
||||||
@@ -379,7 +387,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
del *.o *.exe /s
|
del *.o *.exe /s
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable|x-pie-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
find . -type f -perm +ugo+x -delete
|
find . -type f -perm +ugo+x -delete
|
||||||
|
20
games/repair/LICENSE.txt
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
This game sources are licensed under an unmodified zlib/libpng license,
|
||||||
|
which is an OSI-certified, BSD-like license:
|
||||||
|
|
||||||
|
Copyright (c) 2020 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.
|
406
games/repair/Makefile
Normal file
@@ -0,0 +1,406 @@
|
|||||||
|
#**************************************************************************************************
|
||||||
|
#
|
||||||
|
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013-2020 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.
|
||||||
|
#
|
||||||
|
#**************************************************************************************************
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
# Define required raylib variables
|
||||||
|
PROJECT_NAME ?= repair
|
||||||
|
RAYLIB_VERSION ?= 3.0.0
|
||||||
|
RAYLIB_API_VERSION ?= 3
|
||||||
|
RAYLIB_PATH ?= C:\GitHub\raylib
|
||||||
|
|
||||||
|
# Define default options
|
||||||
|
|
||||||
|
# One of PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
|
PLATFORM ?= PLATFORM_DESKTOP
|
||||||
|
|
||||||
|
# Locations of your newly installed library and associated headers. See ../src/Makefile
|
||||||
|
# On Linux, if you have installed raylib but cannot compile the examples, check that
|
||||||
|
# the *_INSTALL_PATH values here are the same as those in src/Makefile or point to known locations.
|
||||||
|
# To enable system-wide compile-time and runtime linking to libraylib.so, run ../src/$ sudo make install RAYLIB_LIBTYPE_SHARED.
|
||||||
|
# To enable compile-time linking to a special version of libraylib.so, change these variables here.
|
||||||
|
# To enable runtime linking to a special version of libraylib.so, see EXAMPLE_RUNTIME_PATH below.
|
||||||
|
# If there is a libraylib in both EXAMPLE_RUNTIME_PATH and RAYLIB_INSTALL_PATH, at runtime,
|
||||||
|
# the library at EXAMPLE_RUNTIME_PATH, if present, will take precedence over the one at RAYLIB_INSTALL_PATH.
|
||||||
|
# RAYLIB_INSTALL_PATH should be the desired full path to libraylib. No relative paths.
|
||||||
|
DESTDIR ?= /usr/local
|
||||||
|
RAYLIB_INSTALL_PATH ?= $(DESTDIR)/lib
|
||||||
|
# RAYLIB_H_INSTALL_PATH locates the installed raylib header and associated source files.
|
||||||
|
RAYLIB_H_INSTALL_PATH ?= $(DESTDIR)/include
|
||||||
|
|
||||||
|
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
|
||||||
|
RAYLIB_LIBTYPE ?= STATIC
|
||||||
|
|
||||||
|
# Build mode for project: DEBUG or RELEASE
|
||||||
|
BUILD_MODE ?= RELEASE
|
||||||
|
|
||||||
|
# Use external GLFW library instead of rglfw module
|
||||||
|
# TODO: Review usage on Linux. Target version of choice. Switch on -lglfw or -lglfw3
|
||||||
|
USE_EXTERNAL_GLFW ?= FALSE
|
||||||
|
|
||||||
|
# Use Wayland display server protocol on Linux desktop
|
||||||
|
# by default it uses X11 windowing system
|
||||||
|
USE_WAYLAND_DISPLAY ?= FALSE
|
||||||
|
|
||||||
|
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
||||||
|
# ifeq ($(UNAME),Msys) -> Windows
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
PLATFORM_OS=WINDOWS
|
||||||
|
else
|
||||||
|
UNAMEOS=$(shell uname)
|
||||||
|
ifeq ($(UNAMEOS),Linux)
|
||||||
|
PLATFORM_OS=LINUX
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAMEOS),FreeBSD)
|
||||||
|
PLATFORM_OS=BSD
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAMEOS),OpenBSD)
|
||||||
|
PLATFORM_OS=BSD
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAMEOS),NetBSD)
|
||||||
|
PLATFORM_OS=BSD
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAMEOS),DragonFly)
|
||||||
|
PLATFORM_OS=BSD
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAMEOS),Darwin)
|
||||||
|
PLATFORM_OS=OSX
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
UNAMEOS=$(shell uname)
|
||||||
|
ifeq ($(UNAMEOS),Linux)
|
||||||
|
PLATFORM_OS=LINUX
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# RAYLIB_PATH adjustment for different platforms.
|
||||||
|
# If using GNU make, we can get the full path to the top of the tree. Windows? BSD?
|
||||||
|
# Required for ldconfig or other tools that do not perform path expansion.
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
RAYLIB_PREFIX ?= ..
|
||||||
|
RAYLIB_PATH = $(realpath $(RAYLIB_PREFIX))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
# Default path for raylib on Raspberry Pi, if installed in different path, update it!
|
||||||
|
# This is not currently used by src/Makefile. Not sure of its origin or usage. Refer to wiki.
|
||||||
|
# TODO: update install: target in src/Makefile for RPI, consider relation to LINUX.
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
RAYLIB_PATH ?= /home/pi/raylib
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
# Emscripten required variables
|
||||||
|
EMSDK_PATH ?= C:/emsdk
|
||||||
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/fastcomp/emscripten
|
||||||
|
CLANG_PATH = $(EMSDK_PATH)/fastcomp/bin
|
||||||
|
PYTHON_PATH = $(EMSDK_PATH)/python/2.7.13.1_64bit/python-2.7.13.amd64
|
||||||
|
NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin
|
||||||
|
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define raylib release directory for compiled library.
|
||||||
|
# RAYLIB_RELEASE_PATH points to provided binaries or your freshly built version
|
||||||
|
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
|
||||||
|
|
||||||
|
# EXAMPLE_RUNTIME_PATH embeds a custom runtime location of libraylib.so or other desired libraries
|
||||||
|
# into each example binary compiled with RAYLIB_LIBTYPE=SHARED. It defaults to RAYLIB_RELEASE_PATH
|
||||||
|
# so that these examples link at runtime with your version of libraylib.so in ../release/libs/linux
|
||||||
|
# without formal installation from ../src/Makefile. It aids portability and is useful if you have
|
||||||
|
# multiple versions of raylib, have raylib installed to a non-standard location, or want to
|
||||||
|
# bundle libraylib.so with your game. Change it to your liking.
|
||||||
|
# NOTE: If, at runtime, there is a libraylib.so at both EXAMPLE_RUNTIME_PATH and RAYLIB_INSTALL_PATH,
|
||||||
|
# The library at EXAMPLE_RUNTIME_PATH, if present, will take precedence over RAYLIB_INSTALL_PATH,
|
||||||
|
# Implemented for LINUX below with CFLAGS += -Wl,-rpath,$(EXAMPLE_RUNTIME_PATH)
|
||||||
|
# To see the result, run readelf -d core/core_basic_window; looking at the RPATH or RUNPATH attribute.
|
||||||
|
# To see which libraries a built example is linking to, ldd core/core_basic_window;
|
||||||
|
# Look for libraylib.so.1 => $(RAYLIB_INSTALL_PATH)/libraylib.so.1 or similar listing.
|
||||||
|
EXAMPLE_RUNTIME_PATH ?= $(RAYLIB_RELEASE_PATH)
|
||||||
|
|
||||||
|
# Define default C compiler: gcc
|
||||||
|
# NOTE: define g++ compiler if using C++
|
||||||
|
CC = gcc
|
||||||
|
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
# OSX default compiler
|
||||||
|
CC = clang
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
|
# FreeBSD, OpenBSD, NetBSD, DragonFly default compiler
|
||||||
|
CC = clang
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
||||||
|
# Define RPI cross-compiler
|
||||||
|
#CC = armv6j-hardfloat-linux-gnueabi-gcc
|
||||||
|
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
# HTML5 emscripten compiler
|
||||||
|
# WARNING: To compile to HTML5, code must be redesigned
|
||||||
|
# to use emscripten.h and emscripten_set_main_loop()
|
||||||
|
CC = emcc
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define default make program: Mingw32-make
|
||||||
|
MAKE = mingw32-make
|
||||||
|
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
MAKE = make
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define compiler flags:
|
||||||
|
# -O1 defines optimization level
|
||||||
|
# -g include debug information on compilation
|
||||||
|
# -s strip unnecessary data from build
|
||||||
|
# -Wall turns on most, but not all, compiler warnings
|
||||||
|
# -std=c99 defines C language mode (standard C from 1999 revision)
|
||||||
|
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
||||||
|
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||||
|
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||||
|
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
||||||
|
|
||||||
|
ifeq ($(BUILD_MODE),DEBUG)
|
||||||
|
CFLAGS += -g
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -s ASSERTIONS=1 --profiling
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -Os
|
||||||
|
else
|
||||||
|
CFLAGS += -s -O1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Additional flags for compiler (if desired)
|
||||||
|
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
||||||
|
CFLAGS += -D_DEFAULT_SOURCE
|
||||||
|
endif
|
||||||
|
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||||
|
# Explicitly enable runtime link to libraylib.so
|
||||||
|
CFLAGS += -Wl,-rpath,$(EXAMPLE_RUNTIME_PATH)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
CFLAGS += -std=gnu99
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
# -Os # size optimization
|
||||||
|
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
||||||
|
# -s USE_GLFW=3 # Use glfw3 library (context/input management)
|
||||||
|
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL!
|
||||||
|
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
|
||||||
|
# -s USE_PTHREADS=1 # multithreading support
|
||||||
|
# -s WASM=0 # disable Web Assembly, emitted by default
|
||||||
|
# -s EMTERPRETIFY=1 # enable emscripten code interpreter (very slow)
|
||||||
|
# -s EMTERPRETIFY_ASYNC=1 # support synchronous loops by emterpreter
|
||||||
|
# -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data
|
||||||
|
# -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
|
||||||
|
# --profiling # include information for code profiling
|
||||||
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||||
|
# --preload-file resources # specify a resources folder for data compilation
|
||||||
|
CFLAGS += -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
|
||||||
|
|
||||||
|
# Define a custom shell .html and output extension
|
||||||
|
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||||
|
EXT = .html
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define include paths for required headers
|
||||||
|
# NOTE: Several external required libraries (stb and others)
|
||||||
|
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
|
||||||
|
|
||||||
|
# Define additional directories containing required header files
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
# RPI required libraries
|
||||||
|
INCLUDE_PATHS += -I/opt/vc/include
|
||||||
|
INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux
|
||||||
|
INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
|
# Consider -L$(RAYLIB_H_INSTALL_PATH)
|
||||||
|
INCLUDE_PATHS += -I/usr/local/include
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
# Reset everything.
|
||||||
|
# Precedence: immediately local, installed version, raysan5 provided libs -I$(RAYLIB_H_INSTALL_PATH) -I$(RAYLIB_PATH)/release/include
|
||||||
|
INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -isystem. -isystem$(RAYLIB_PATH)/src -isystem$(RAYLIB_PATH)/release/include -isystem$(RAYLIB_PATH)/src/external
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define library paths containing required libs.
|
||||||
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
||||||
|
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# resource file contains windows executable icon and properties
|
||||||
|
LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
|
||||||
|
# -Wl,--subsystem,windows hides the console window
|
||||||
|
ifeq ($(BUILD_MODE), RELEASE)
|
||||||
|
LDFLAGS += -Wl,--subsystem,windows
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
|
# Consider -L$(RAYLIB_INSTALL_PATH)
|
||||||
|
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
# Reset everything.
|
||||||
|
# Precedence: immediately local, installed version, raysan5 provided libs
|
||||||
|
LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
LDFLAGS += -L/opt/vc/lib
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define any libraries required on linking
|
||||||
|
# if you want to link libraries (libname.so or libname.a), use the -lname
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# Libraries for Windows desktop compilation
|
||||||
|
# NOTE: WinMM library required to set high-res timer resolution
|
||||||
|
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
||||||
|
# Required for physac examples
|
||||||
|
LDLIBS += -static -lpthread
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
# Libraries for Debian GNU/Linux desktop compiling
|
||||||
|
# NOTE: Required packages: libegl1-mesa-dev
|
||||||
|
LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt
|
||||||
|
|
||||||
|
# On X11 requires also below libraries
|
||||||
|
LDLIBS += -lX11
|
||||||
|
# NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
|
||||||
|
#LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
|
||||||
|
|
||||||
|
# On Wayland windowing system, additional libraries requires
|
||||||
|
ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
|
||||||
|
LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
|
||||||
|
endif
|
||||||
|
# Explicit link to libc
|
||||||
|
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||||
|
LDLIBS += -lc
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
# Libraries for OSX 10.9 desktop compiling
|
||||||
|
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
||||||
|
LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
|
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
||||||
|
# NOTE: Required packages: mesa-libs
|
||||||
|
LDLIBS = -lraylib -lGL -lpthread -lm
|
||||||
|
|
||||||
|
# On XWindow requires also below libraries
|
||||||
|
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
|
||||||
|
endif
|
||||||
|
ifeq ($(USE_EXTERNAL_GLFW),TRUE)
|
||||||
|
# NOTE: It could require additional packages installed: libglfw3-dev
|
||||||
|
LDLIBS += -lglfw
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
# Libraries for Raspberry Pi compiling
|
||||||
|
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||||
|
LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
# Libraries for web (HTML5) compiling
|
||||||
|
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.bc
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define all source files required
|
||||||
|
PROJECT_SOURCE_FILES ?= \
|
||||||
|
repair.c \
|
||||||
|
screens/screen_logo.c \
|
||||||
|
screens/screen_title.c \
|
||||||
|
screens/screen_gameplay.c \
|
||||||
|
screens/screen_ending.c
|
||||||
|
|
||||||
|
# Define all object files from source files
|
||||||
|
OBJS = $(patsubst %.c, %.o, $(PROJECT_SOURCE_FILES))
|
||||||
|
|
||||||
|
# For Android platform we call a custom Makefile.Android
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_ANDROID)
|
||||||
|
MAKEFILE_PARAMS = -f Makefile.Android
|
||||||
|
export PROJECT_NAME
|
||||||
|
export PROJECT_SOURCE_FILES
|
||||||
|
else
|
||||||
|
MAKEFILE_PARAMS = $(PROJECT_NAME)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Default target entry
|
||||||
|
# NOTE: We call this Makefile target or Makefile.Android target
|
||||||
|
all:
|
||||||
|
$(MAKE) $(MAKEFILE_PARAMS)
|
||||||
|
|
||||||
|
# Project target defined by PROJECT_NAME
|
||||||
|
$(PROJECT_NAME): $(OBJS)
|
||||||
|
$(CC) -o $(PROJECT_NAME)$(EXT) $(OBJS) $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
# Compile source files
|
||||||
|
# NOTE: This pattern will compile every module defined on $(OBJS)
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) -c $< -o $@ $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
# Clean everything
|
||||||
|
clean:
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
del *.o *.exe /s
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable|x-pie-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
find . -type f -perm +ugo+x -delete
|
||||||
|
rm -f *.o
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
find . -type f -executable -delete
|
||||||
|
rm -fv *.o
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
del *.o *.html *.js
|
||||||
|
endif
|
||||||
|
@echo Cleaning done
|
||||||
|
|
413
games/repair/repair.c
Normal file
@@ -0,0 +1,413 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* RE_PAIR [GLOBAL GAME JAM 2020]
|
||||||
|
*
|
||||||
|
* Let's find your perfect match!
|
||||||
|
* Ready for dating? Do you need some face tweaks? Choose wisely!
|
||||||
|
*
|
||||||
|
* This game has been created using raylib 3.0 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
#include "screens/screens.h" // NOTE: Defines global variable: currentScreen
|
||||||
|
|
||||||
|
#if defined(PLATFORM_WEB)
|
||||||
|
#include <emscripten/emscripten.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
GameScreen currentScreen = 0;
|
||||||
|
Font font = { 0 };
|
||||||
|
Music music = { 0 };
|
||||||
|
Sound fxCoin = { 0 };
|
||||||
|
Texture2D background = { 0 };
|
||||||
|
Texture2D texNPatch = { 0 };
|
||||||
|
NPatchInfo npInfo = { 0 };
|
||||||
|
|
||||||
|
Texture2D texHead, texHair, texNose, texMouth, texEyes, texComp;
|
||||||
|
|
||||||
|
Character playerBase = { 0 };
|
||||||
|
Character datingBase = { 0 };
|
||||||
|
|
||||||
|
Character player = { 0 };
|
||||||
|
Character dating = { 0 };
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Global Variables Definition (local to this module)
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 1280;
|
||||||
|
const int screenHeight = 720;
|
||||||
|
|
||||||
|
// Required variables to manage screen transitions (fade-in, fade-out)
|
||||||
|
static float transAlpha = 0.0f;
|
||||||
|
static bool onTransition = false;
|
||||||
|
static bool transFadeOut = false;
|
||||||
|
static int transFromScreen = -1;
|
||||||
|
static int transToScreen = -1;
|
||||||
|
|
||||||
|
// NOTE: Some global variables that require to be visible for all screens,
|
||||||
|
// are defined in screens.h (i.e. currentScreen)
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Local Functions Declaration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
static void ChangeToScreen(int screen); // No transition effect
|
||||||
|
|
||||||
|
static void TransitionToScreen(int screen);
|
||||||
|
static void UpdateTransition(void);
|
||||||
|
static void DrawTransition(void);
|
||||||
|
|
||||||
|
static void UpdateDrawFrame(void); // Update and Draw one frame
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Main entry point
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization (Note windowTitle is unused on Android)
|
||||||
|
//---------------------------------------------------------
|
||||||
|
InitWindow(screenWidth, screenHeight, "RE-PAIR [GGJ2020]");
|
||||||
|
|
||||||
|
// Global data loading (assets that must be available in all screens, i.e. fonts)
|
||||||
|
InitAudioDevice();
|
||||||
|
|
||||||
|
font = LoadFont("resources/font.png");
|
||||||
|
SetTextureFilter(font.texture, FILTER_BILINEAR);
|
||||||
|
|
||||||
|
music = LoadMusicStream("resources/elevator_romance.ogg");
|
||||||
|
fxCoin = LoadSound("resources/coin.wav");
|
||||||
|
|
||||||
|
background = LoadTexture("resources/background.png");
|
||||||
|
|
||||||
|
texNPatch = LoadTexture("resources/npatch.png");
|
||||||
|
npInfo.sourceRec = (Rectangle){ 0, 0, 80, texNPatch.height },
|
||||||
|
npInfo.left = 24;
|
||||||
|
npInfo.top = 24;
|
||||||
|
npInfo.right = 24;
|
||||||
|
npInfo.bottom = 24;
|
||||||
|
|
||||||
|
// Load required textures
|
||||||
|
texHead = LoadTexture("resources/head_models.png");
|
||||||
|
texHair = LoadTexture("resources/hair_models.png");
|
||||||
|
texNose = LoadTexture("resources/nose_models.png");
|
||||||
|
texMouth = LoadTexture("resources/mouth_models.png");
|
||||||
|
texEyes = LoadTexture("resources/eyes_models.png");
|
||||||
|
//texComp = LoadTexture("resources/comp_models.png");
|
||||||
|
|
||||||
|
SetMusicVolume(music, 0.5f);
|
||||||
|
//PlayMusicStream(music);
|
||||||
|
|
||||||
|
// Setup and Init first screen
|
||||||
|
currentScreen = LOGO;
|
||||||
|
InitLogoScreen();
|
||||||
|
|
||||||
|
#if defined(PLATFORM_WEB)
|
||||||
|
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
|
||||||
|
#else
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
UpdateDrawFrame();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Unload current screen data before closing
|
||||||
|
switch (currentScreen)
|
||||||
|
{
|
||||||
|
case LOGO: UnloadLogoScreen(); break;
|
||||||
|
case TITLE: UnloadTitleScreen(); break;
|
||||||
|
case GAMEPLAY: UnloadGameplayScreen(); break;
|
||||||
|
case ENDING: UnloadEndingScreen(); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unload all global loaded data (i.e. fonts) here!
|
||||||
|
UnloadFont(font);
|
||||||
|
UnloadMusicStream(music);
|
||||||
|
UnloadSound(fxCoin);
|
||||||
|
UnloadTexture(background);
|
||||||
|
UnloadTexture(texNPatch);
|
||||||
|
|
||||||
|
UnloadTexture(texHead);
|
||||||
|
UnloadTexture(texHair);
|
||||||
|
UnloadTexture(texNose);
|
||||||
|
UnloadTexture(texMouth);
|
||||||
|
UnloadTexture(texEyes);
|
||||||
|
//UnloadTexture(texComp);
|
||||||
|
|
||||||
|
CloseAudioDevice(); // Close audio context
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Public Functions Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Character GenerateCharacter(void)
|
||||||
|
{
|
||||||
|
Character character = { 0 };
|
||||||
|
|
||||||
|
// Generate player character!
|
||||||
|
character.head = GetRandomValue(0, texHead.width/BASE_HEAD_WIDTH - 1);
|
||||||
|
character.colHead = headColors[GetRandomValue(0, 5)];
|
||||||
|
character.hair = GetRandomValue(0, texHair.width/BASE_HAIR_WIDTH - 1);
|
||||||
|
character.colHair = hairColors[GetRandomValue(0, 9)];
|
||||||
|
character.eyes = GetRandomValue(0, texEyes.width/BASE_EYES_WIDTH - 1);
|
||||||
|
character.nose = GetRandomValue(0, texNose.width/BASE_NOSE_WIDTH - 1);
|
||||||
|
character.mouth = GetRandomValue(0, texMouth.width/BASE_MOUTH_WIDTH - 1);
|
||||||
|
|
||||||
|
// NOTE: No character customization at this point
|
||||||
|
|
||||||
|
return character;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomizeCharacter(Character *character)
|
||||||
|
{
|
||||||
|
if (GetRandomValue(0, 1)) character->hair = GetRandomValue(0, texHair.width/BASE_HAIR_WIDTH - 1);
|
||||||
|
if (GetRandomValue(0, 1)) character->colHair = hairColors[GetRandomValue(0, 9)];
|
||||||
|
if (GetRandomValue(0, 1)) character->eyes = GetRandomValue(0, texEyes.width/BASE_EYES_WIDTH - 1);
|
||||||
|
if (GetRandomValue(0, 1)) character->nose = GetRandomValue(0, texNose.width/BASE_NOSE_WIDTH - 1);
|
||||||
|
if (GetRandomValue(0, 1)) character->mouth = GetRandomValue(0, texMouth.width/BASE_MOUTH_WIDTH - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawCharacter(Character character, Vector2 position)
|
||||||
|
{
|
||||||
|
DrawTextureRec(texHair, (Rectangle){ BASE_HAIR_WIDTH*character.hair, 240, BASE_HAIR_WIDTH, texHair.height - 240 }, (Vector2){ position.x + (250 - BASE_HAIR_WIDTH)/2, position.y + 240 }, GetColor(character.colHair));
|
||||||
|
DrawTextureRec(texHead, (Rectangle){ BASE_HEAD_WIDTH*character.head, 0, BASE_HEAD_WIDTH, texHead.height }, (Vector2){ position.x + (250 - BASE_HEAD_WIDTH)/2, position.y + 60 }, GetColor(character.colHead));
|
||||||
|
DrawTextureRec(texHair, (Rectangle){ BASE_HAIR_WIDTH*character.hair, 0, BASE_HAIR_WIDTH, 240 }, (Vector2){ position.x + (250 - BASE_HAIR_WIDTH)/2, position.y }, GetColor(character.colHair));
|
||||||
|
DrawTextureRec(texEyes, (Rectangle){ BASE_EYES_WIDTH*character.eyes, 0, BASE_EYES_WIDTH, texEyes.height }, (Vector2){ position.x + (250 - BASE_EYES_WIDTH)/2, position.y + 190 }, WHITE);
|
||||||
|
DrawTextureRec(texNose, (Rectangle){ BASE_NOSE_WIDTH*character.nose, 0, BASE_NOSE_WIDTH, texNose.height }, (Vector2){ position.x + (250 - BASE_NOSE_WIDTH)/2, position.y + 275 }, GetColor(character.colHead));
|
||||||
|
DrawTextureRec(texMouth, (Rectangle){ BASE_MOUTH_WIDTH*character.mouth, 0, BASE_MOUTH_WIDTH, texMouth.height }, (Vector2){ position.x + (250 - BASE_MOUTH_WIDTH)/2, position.y + 370 }, GetColor(character.colHead));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gui Button
|
||||||
|
bool GuiButton(Rectangle bounds, const char *text, int forcedState)
|
||||||
|
{
|
||||||
|
static const int textColor[4] = { 0xeff6ffff, 0x78e782ff, 0xb04d5fff, 0xd6d6d6ff };
|
||||||
|
|
||||||
|
int state = (forcedState >= 0)? forcedState : 0; // NORMAL
|
||||||
|
bool pressed = false;
|
||||||
|
Vector2 textSize = MeasureTextEx(font, text, font.baseSize, 1);
|
||||||
|
|
||||||
|
// Update control
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
if ((state < 3) && (forcedState < 0))
|
||||||
|
{
|
||||||
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
|
// Check button state
|
||||||
|
if (CheckCollisionPointRec(mousePoint, bounds))
|
||||||
|
{
|
||||||
|
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = 2; // PRESSED
|
||||||
|
else state = 1; // FOCUSED
|
||||||
|
|
||||||
|
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON) || IsGestureDetected(GESTURE_TAP))
|
||||||
|
{
|
||||||
|
pressed = true;
|
||||||
|
PlaySound(fxCoin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
npInfo.sourceRec.x = 80*state;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw control
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
//DrawRectangleRec(bounds, GREEN);
|
||||||
|
//DrawRectangleLinesEx(bounds, 4, DARKGREEN);
|
||||||
|
DrawTextureNPatch(texNPatch, npInfo, bounds, (Vector2){ 0.0f, 0.0f }, 0.0f, WHITE);
|
||||||
|
DrawTextEx(font, text, (Vector2){ bounds.x + bounds.width/2 - textSize.x/2, bounds.y + bounds.height/2 - textSize.y/2 + 4 }, font.baseSize, 1, GetColor(textColor[state]));
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
return pressed;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module specific Functions Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Change to next screen, no transition
|
||||||
|
static void ChangeToScreen(int screen)
|
||||||
|
{
|
||||||
|
// Unload current screen
|
||||||
|
switch (currentScreen)
|
||||||
|
{
|
||||||
|
case LOGO: UnloadLogoScreen(); break;
|
||||||
|
case TITLE: UnloadTitleScreen(); break;
|
||||||
|
case GAMEPLAY: UnloadGameplayScreen(); break;
|
||||||
|
case ENDING: UnloadEndingScreen(); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init next screen
|
||||||
|
switch (screen)
|
||||||
|
{
|
||||||
|
case LOGO: InitLogoScreen(); break;
|
||||||
|
case TITLE: InitTitleScreen(); break;
|
||||||
|
case GAMEPLAY: InitGameplayScreen(); break;
|
||||||
|
case ENDING: InitEndingScreen(); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentScreen = screen;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define transition to next screen
|
||||||
|
static void TransitionToScreen(int screen)
|
||||||
|
{
|
||||||
|
onTransition = true;
|
||||||
|
transFadeOut = false;
|
||||||
|
transFromScreen = currentScreen;
|
||||||
|
transToScreen = screen;
|
||||||
|
transAlpha = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update transition effect
|
||||||
|
static void UpdateTransition(void)
|
||||||
|
{
|
||||||
|
if (!transFadeOut)
|
||||||
|
{
|
||||||
|
transAlpha += 0.05f;
|
||||||
|
|
||||||
|
// NOTE: Due to float internal representation, condition jumps on 1.0f instead of 1.05f
|
||||||
|
// For that reason we compare against 1.01f, to avoid last frame loading stop
|
||||||
|
if (transAlpha > 1.01f)
|
||||||
|
{
|
||||||
|
transAlpha = 1.0f;
|
||||||
|
|
||||||
|
// Unload current screen
|
||||||
|
switch (transFromScreen)
|
||||||
|
{
|
||||||
|
case LOGO: UnloadLogoScreen(); break;
|
||||||
|
case TITLE: UnloadTitleScreen(); break;
|
||||||
|
case GAMEPLAY: UnloadGameplayScreen(); break;
|
||||||
|
case ENDING: UnloadEndingScreen(); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load next screen
|
||||||
|
switch (transToScreen)
|
||||||
|
{
|
||||||
|
case LOGO: InitLogoScreen(); break;
|
||||||
|
case TITLE: InitTitleScreen(); break;
|
||||||
|
case GAMEPLAY: InitGameplayScreen(); break;
|
||||||
|
case ENDING: InitEndingScreen(); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentScreen = transToScreen;
|
||||||
|
|
||||||
|
// Activate fade out effect to next loaded screen
|
||||||
|
transFadeOut = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // Transition fade out logic
|
||||||
|
{
|
||||||
|
transAlpha -= 0.02f;
|
||||||
|
|
||||||
|
if (transAlpha < -0.01f)
|
||||||
|
{
|
||||||
|
transAlpha = 0.0f;
|
||||||
|
transFadeOut = false;
|
||||||
|
onTransition = false;
|
||||||
|
transFromScreen = -1;
|
||||||
|
transToScreen = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw transition effect (full-screen rectangle)
|
||||||
|
static void DrawTransition(void)
|
||||||
|
{
|
||||||
|
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(BLACK, transAlpha));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update and draw game frame
|
||||||
|
static void UpdateDrawFrame(void)
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
UpdateMusicStream(music); // NOTE: Music keeps playing between screens
|
||||||
|
|
||||||
|
if (!onTransition)
|
||||||
|
{
|
||||||
|
switch(currentScreen)
|
||||||
|
{
|
||||||
|
case LOGO:
|
||||||
|
{
|
||||||
|
UpdateLogoScreen();
|
||||||
|
|
||||||
|
if (FinishLogoScreen())
|
||||||
|
{
|
||||||
|
TransitionToScreen(TITLE);
|
||||||
|
PlayMusicStream(music);
|
||||||
|
}
|
||||||
|
|
||||||
|
} break;
|
||||||
|
case TITLE:
|
||||||
|
{
|
||||||
|
UpdateTitleScreen();
|
||||||
|
|
||||||
|
if (FinishTitleScreen() == 1) TransitionToScreen(GAMEPLAY);
|
||||||
|
//else if (FinishTitleScreen() == 2) TransitionToScreen(GAMEPLAY);
|
||||||
|
|
||||||
|
} break;
|
||||||
|
case GAMEPLAY:
|
||||||
|
{
|
||||||
|
UpdateGameplayScreen();
|
||||||
|
|
||||||
|
if (FinishGameplayScreen() == 1) TransitionToScreen(ENDING);
|
||||||
|
//else if (FinishGameplayScreen() == 2) TransitionToScreen(TITLE);
|
||||||
|
|
||||||
|
} break;
|
||||||
|
case ENDING:
|
||||||
|
{
|
||||||
|
UpdateEndingScreen();
|
||||||
|
|
||||||
|
if (FinishEndingScreen() == 1) TransitionToScreen(TITLE);
|
||||||
|
|
||||||
|
} break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else UpdateTransition(); // Update transition (fade-in, fade-out)
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
switch(currentScreen)
|
||||||
|
{
|
||||||
|
case LOGO: DrawLogoScreen(); break;
|
||||||
|
case TITLE: DrawTitleScreen(); break;
|
||||||
|
case GAMEPLAY: DrawGameplayScreen(); break;
|
||||||
|
case ENDING: DrawEndingScreen(); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw full screen rectangle in front of everything
|
||||||
|
if (onTransition) DrawTransition();
|
||||||
|
|
||||||
|
//DrawFPS(10, 10);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
BIN
games/repair/resources/background.png
Normal file
After Width: | Height: | Size: 451 KiB |
BIN
games/repair/resources/coin.wav
Normal file
BIN
games/repair/resources/elevator_romance.ogg
Normal file
BIN
games/repair/resources/eyes_models.png
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
games/repair/resources/font.png
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
games/repair/resources/hair_models.png
Normal file
After Width: | Height: | Size: 222 KiB |
BIN
games/repair/resources/head_models.png
Normal file
After Width: | Height: | Size: 88 KiB |
BIN
games/repair/resources/match.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
games/repair/resources/mouth_models.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
games/repair/resources/nose_models.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
games/repair/resources/npatch.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
games/repair/resources/qmark.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
games/repair/resources/raylib_logo.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
games/repair/resources/title.png
Normal file
After Width: | Height: | Size: 15 KiB |
246
games/repair/screens/screen_ending.c
Normal file
@@ -0,0 +1,246 @@
|
|||||||
|
/**********************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib - Advance Game template
|
||||||
|
*
|
||||||
|
* Ending Screen Functions Definitions (Init, Update, Draw, Unload)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2014-2020 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.
|
||||||
|
*
|
||||||
|
**********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
#include "screens.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int hair;
|
||||||
|
int colHair;
|
||||||
|
int eyes;
|
||||||
|
int nose;
|
||||||
|
int mouth;
|
||||||
|
//int glasses;
|
||||||
|
//int piercing;
|
||||||
|
} CharLikes;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Global Variables Definition (local to this module)
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Ending screen global variables
|
||||||
|
static int framesCounter = 0;
|
||||||
|
static int finishScreen = 0;
|
||||||
|
|
||||||
|
static Texture2D texQmark = { 0 };
|
||||||
|
static Texture2D texMatch = { 0 };
|
||||||
|
|
||||||
|
static int state = 0;
|
||||||
|
static int matchValue = 0;
|
||||||
|
|
||||||
|
static CharLikes playerLikes = { 0 };
|
||||||
|
static CharLikes playerBaseLikes = { 0 };
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Ending Screen Functions Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Ending Screen Initialization logic
|
||||||
|
void InitEndingScreen(void)
|
||||||
|
{
|
||||||
|
framesCounter = 0;
|
||||||
|
finishScreen = 0;
|
||||||
|
state = 0;
|
||||||
|
|
||||||
|
CustomizeCharacter(&dating);
|
||||||
|
|
||||||
|
texQmark = LoadTexture("resources/qmark.png");
|
||||||
|
texMatch = LoadTexture("resources/match.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ending Screen Update logic
|
||||||
|
void UpdateEndingScreen(void)
|
||||||
|
{
|
||||||
|
if (state == 0)
|
||||||
|
{
|
||||||
|
framesCounter++;
|
||||||
|
|
||||||
|
if (framesCounter > 200)
|
||||||
|
{
|
||||||
|
state = 1;
|
||||||
|
|
||||||
|
// Check like percentatge for player base (playerBaseLikes)
|
||||||
|
if (playerBase.hair == dating.hair) playerBaseLikes.hair = GetRandomValue(70, 100);
|
||||||
|
else if (playerBase.hair == datingBase.hair) playerBaseLikes.hair = GetRandomValue(0, 30);
|
||||||
|
else playerBaseLikes.hair = GetRandomValue(0, 100);
|
||||||
|
|
||||||
|
if (playerBase.colHair == dating.colHair) playerBaseLikes.colHair = GetRandomValue(70, 100);
|
||||||
|
else if (playerBase.colHair == datingBase.colHair) playerBaseLikes.colHair = GetRandomValue(0, 30);
|
||||||
|
else playerBaseLikes.colHair = GetRandomValue(0, 100);
|
||||||
|
|
||||||
|
if (playerBase.eyes == dating.eyes) playerBaseLikes.eyes = GetRandomValue(70, 100);
|
||||||
|
else if (playerBase.eyes == datingBase.eyes) playerBaseLikes.eyes = GetRandomValue(0, 30);
|
||||||
|
else playerBaseLikes.eyes = GetRandomValue(0, 100);
|
||||||
|
|
||||||
|
if (playerBase.nose == dating.nose) playerBaseLikes.nose = GetRandomValue(70, 100);
|
||||||
|
else if (playerBase.nose == datingBase.nose) playerBaseLikes.nose = GetRandomValue(0, 30);
|
||||||
|
else playerBaseLikes.nose = GetRandomValue(0, 100);
|
||||||
|
|
||||||
|
if (playerBase.mouth == dating.mouth) playerBaseLikes.mouth = GetRandomValue(70, 100);
|
||||||
|
else if (playerBase.mouth == datingBase.mouth) playerBaseLikes.mouth = GetRandomValue(0, 30);
|
||||||
|
else playerBaseLikes.mouth = GetRandomValue(0, 100);
|
||||||
|
|
||||||
|
|
||||||
|
// Check like percentatge for player (playerLikes)
|
||||||
|
if (player.hair == dating.hair) playerLikes.hair = GetRandomValue(70, 100);
|
||||||
|
else if (player.hair == datingBase.hair) playerLikes.hair = GetRandomValue(0, 30);
|
||||||
|
else playerLikes.hair = GetRandomValue(0, 100);
|
||||||
|
|
||||||
|
if (player.colHair == dating.colHair) playerLikes.colHair = GetRandomValue(70, 100);
|
||||||
|
else if (player.colHair == datingBase.colHair) playerLikes.colHair = GetRandomValue(0, 30);
|
||||||
|
else playerLikes.colHair = GetRandomValue(0, 100);
|
||||||
|
|
||||||
|
if (player.eyes == dating.eyes) playerLikes.eyes = GetRandomValue(70, 100);
|
||||||
|
else if (player.eyes == datingBase.eyes) playerLikes.eyes = GetRandomValue(0, 30);
|
||||||
|
else playerLikes.eyes = GetRandomValue(0, 100);
|
||||||
|
|
||||||
|
if (player.nose == dating.nose) playerLikes.nose = GetRandomValue(70, 100);
|
||||||
|
else if (player.nose == datingBase.nose) playerLikes.nose = GetRandomValue(0, 30);
|
||||||
|
else playerLikes.nose = GetRandomValue(0, 100);
|
||||||
|
|
||||||
|
if (player.mouth == dating.mouth) playerLikes.mouth = GetRandomValue(70, 100);
|
||||||
|
else if (player.mouth == datingBase.mouth) playerLikes.mouth = GetRandomValue(0, 30);
|
||||||
|
else playerLikes.mouth = GetRandomValue(0, 100);
|
||||||
|
|
||||||
|
// NOTE: Max possible points to get 5*100 = 500
|
||||||
|
// If getting > 250 player likes! :D
|
||||||
|
matchValue = playerLikes.hair + playerLikes.colHair + playerLikes.eyes + playerLikes.nose + playerLikes.mouth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (state == 1)
|
||||||
|
{
|
||||||
|
// Levels animation?
|
||||||
|
}
|
||||||
|
|
||||||
|
// Press enter or tap to return to TITLE screen
|
||||||
|
if (IsKeyPressed(KEY_ENTER))
|
||||||
|
{
|
||||||
|
finishScreen = 1;
|
||||||
|
PlaySound(fxCoin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ending Screen Draw logic
|
||||||
|
void DrawEndingScreen(void)
|
||||||
|
{
|
||||||
|
// Draw background
|
||||||
|
DrawTexture(background, 0, 0, GetColor(0xf6aa60ff));
|
||||||
|
|
||||||
|
DrawCharacter(player, (Vector2){ 180, 40 });
|
||||||
|
|
||||||
|
DrawCharacter(dating, (Vector2){ 820, 40 });
|
||||||
|
|
||||||
|
if (state == 0)
|
||||||
|
{
|
||||||
|
if ((framesCounter/15)%2 == 1) DrawTexture(texQmark, GetScreenWidth()/2 - texQmark.width/2, 180, WHITE);
|
||||||
|
}
|
||||||
|
else if (state == 1)
|
||||||
|
{
|
||||||
|
DrawTextEx(font, TextFormat("MATCH: %i%%", (int)(((float)matchValue/500.0f)*100.0f)), (Vector2){ 420, 40 }, font.baseSize*2, 1, SKYBLUE);
|
||||||
|
|
||||||
|
DrawTextureRec(texMatch, (Rectangle){ 0, (matchValue > 250)? 0 : texMatch.height/2, texMatch.width, texMatch.height/2 }, (Vector2){ GetScreenWidth()/2 - texMatch.width/2, 240 }, WHITE);
|
||||||
|
|
||||||
|
int barsPositionX = 80;
|
||||||
|
|
||||||
|
//DrawRectangle(0, 530, GetScreenWidth(), GetScreenHeight() - 530, Fade(GRAY, 0.6f));
|
||||||
|
//DrawRectangleLines(0, 530, GetScreenWidth(), GetScreenHeight() - 530, Fade(DARKGRAY, 0.8f));
|
||||||
|
|
||||||
|
// Draw like values: player base
|
||||||
|
DrawTextEx(font, "HAIR:", (Vector2){ barsPositionX, 550 }, font.baseSize/2, 1, WHITE);
|
||||||
|
DrawRectangle(barsPositionX + 80, 550 + 6, 400, font.baseSize/4, GRAY);
|
||||||
|
DrawRectangle(barsPositionX + 80, 550 + 6, playerBaseLikes.hair*4, font.baseSize/4, RED);
|
||||||
|
|
||||||
|
DrawTextEx(font, "TINT:", (Vector2){ barsPositionX, 580 }, font.baseSize/2, 1, WHITE);
|
||||||
|
DrawRectangle(barsPositionX + 80, 580 + 6, 400, font.baseSize/4, GRAY);
|
||||||
|
DrawRectangle(barsPositionX + 80, 580 + 6, playerBaseLikes.colHair*4, font.baseSize/4, RED);
|
||||||
|
|
||||||
|
DrawTextEx(font, "EYES:", (Vector2){ barsPositionX, 610 }, font.baseSize/2, 1, WHITE);
|
||||||
|
DrawRectangle(barsPositionX + 80, 610 + 6, 400, font.baseSize/4, GRAY);
|
||||||
|
DrawRectangle(barsPositionX + 80, 610 + 6, playerBaseLikes.eyes*4, font.baseSize/4, RED);
|
||||||
|
|
||||||
|
DrawTextEx(font, "NOSE:", (Vector2){ barsPositionX, 640 }, font.baseSize/2, 1, WHITE);
|
||||||
|
DrawRectangle(barsPositionX + 80, 640 + 6, 400, font.baseSize/4, GRAY);
|
||||||
|
DrawRectangle(barsPositionX + 80, 640 + 6, playerBaseLikes.nose*4, font.baseSize/4, RED);
|
||||||
|
|
||||||
|
DrawTextEx(font, "LIPS:", (Vector2){ barsPositionX, 670 }, font.baseSize/2, 1, WHITE);
|
||||||
|
DrawRectangle(barsPositionX + 80, 670 + 6, 400, font.baseSize/4, GRAY);
|
||||||
|
DrawRectangle(barsPositionX + 80, 670 + 6, playerBaseLikes.mouth*4, font.baseSize/4, RED);
|
||||||
|
|
||||||
|
// Draw like values: player
|
||||||
|
if (player.hair != playerBase.hair)
|
||||||
|
{
|
||||||
|
DrawTextEx(font, "after re-touch:", (Vector2){ barsPositionX + 80 + 400 + 20, 550 }, font.baseSize/2, 1, WHITE);
|
||||||
|
DrawRectangle(barsPositionX + 80 + 400 + 100 + 90, 550 + 6, 400, font.baseSize/4, GRAY);
|
||||||
|
DrawRectangle(barsPositionX + 80 + 400 + 100 + 90, 550 + 6, playerLikes.hair*4, font.baseSize/4, RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.colHair != playerBase.colHair)
|
||||||
|
{
|
||||||
|
DrawTextEx(font, "after re-touch:", (Vector2){ barsPositionX + 80 + 400 + 20, 580 }, font.baseSize/2, 1, WHITE);
|
||||||
|
DrawRectangle(barsPositionX + 80 + 400 + 100 + 90, 580 + 6, 400, font.baseSize/4, GRAY);
|
||||||
|
DrawRectangle(barsPositionX + 80 + 400 + 100 + 90, 580 + 6, playerLikes.colHair*4, font.baseSize/4, RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.eyes != playerBase.eyes)
|
||||||
|
{
|
||||||
|
DrawTextEx(font, "after re-touch:", (Vector2){ barsPositionX + 80 + 400 + 20, 610 }, font.baseSize/2, 1, WHITE);
|
||||||
|
DrawRectangle(barsPositionX + 80 + 400 + 100 + 90, 610 + 6, 400, font.baseSize/4, GRAY);
|
||||||
|
DrawRectangle(barsPositionX + 80 + 400 + 100 + 90, 610 + 6, playerLikes.eyes*4, font.baseSize/4, RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.nose != playerBase.nose)
|
||||||
|
{
|
||||||
|
DrawTextEx(font, "after re-touch:", (Vector2){ barsPositionX + 80 + 400 + 20, 640 }, font.baseSize/2, 1, WHITE);
|
||||||
|
DrawRectangle(barsPositionX + 80 + 400 + 100 + 90, 640 + 6, 400, font.baseSize/4, GRAY);
|
||||||
|
DrawRectangle(barsPositionX + 80 + 400 + 100 + 90, 640 + 6, playerLikes.nose*4, font.baseSize/4, RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.mouth != playerBase.mouth)
|
||||||
|
{
|
||||||
|
DrawTextEx(font, "after re-touch:", (Vector2){ barsPositionX + 80 + 400 + 20, 670 }, font.baseSize/2, 1, WHITE);
|
||||||
|
DrawRectangle(barsPositionX + 80 + 400 + 100 + 90, 670 + 6, 400, font.baseSize/4, GRAY);
|
||||||
|
DrawRectangle(barsPositionX + 80 + 400 + 100 + 90, 670 + 6, playerLikes.mouth*4, font.baseSize/4, RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw left button: date!
|
||||||
|
if (GuiButton((Rectangle){ GetScreenWidth() - 280, 60, 260, 80 }, "AGAIN!", -1))
|
||||||
|
{
|
||||||
|
finishScreen = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ending Screen Unload logic
|
||||||
|
void UnloadEndingScreen(void)
|
||||||
|
{
|
||||||
|
UnloadTexture(texQmark);
|
||||||
|
UnloadTexture(texMatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ending Screen should finish?
|
||||||
|
int FinishEndingScreen(void)
|
||||||
|
{
|
||||||
|
return finishScreen;
|
||||||
|
}
|
169
games/repair/screens/screen_gameplay.c
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
/**********************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib - Advance Game template
|
||||||
|
*
|
||||||
|
* Gameplay Screen Functions Definitions (Init, Update, Draw, Unload)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2014-2020 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.
|
||||||
|
*
|
||||||
|
**********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
#include "screens.h"
|
||||||
|
|
||||||
|
static bool doHairCut = false;
|
||||||
|
static bool doHairTint = false;
|
||||||
|
static bool doEyeLiner = false;
|
||||||
|
static bool doLipStick = false;
|
||||||
|
static bool doNose = false;
|
||||||
|
static bool doGlasses = false;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Global Variables Definition (local to this module)
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const unsigned int headColors[6] = { 0xffe29bff, 0xfed5a8ff, 0xad8962ff, 0xfff1b8ff, 0xffd6c4ff, 0xd49c8dff };
|
||||||
|
const unsigned int hairColors[10] = { 0xf5bf60ff, 0xaa754aff, 0x974e14ff, 0xf36347ff, 0x87f347ff, 0xfc48d0ff, 0x3b435dff, 0x5f5e60ff, 0xe7e7e7ff, 0xfb386bff };
|
||||||
|
|
||||||
|
// Gameplay screen global variables
|
||||||
|
static int framesCounter = 0;
|
||||||
|
static int finishScreen = 0;
|
||||||
|
|
||||||
|
static RenderTexture target = { 0 };
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Gameplay Screen Functions Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Gameplay Screen Initialization logic
|
||||||
|
void InitGameplayScreen(void)
|
||||||
|
{
|
||||||
|
// Initialize GAMEPLAY screen variables
|
||||||
|
framesCounter = 0;
|
||||||
|
finishScreen = 0;
|
||||||
|
|
||||||
|
target = LoadRenderTexture(720, 720);
|
||||||
|
SetTextureFilter(target.texture, FILTER_BILINEAR);
|
||||||
|
|
||||||
|
// Generate player character!
|
||||||
|
//player = GenerateCharacter();
|
||||||
|
playerBase = player;
|
||||||
|
|
||||||
|
// Generate dating character!
|
||||||
|
dating = GenerateCharacter();
|
||||||
|
datingBase = dating;
|
||||||
|
|
||||||
|
// TODO: Generate dating character likes
|
||||||
|
// For the different types of properties we assign random like values: 0% (total-dislike) -> 100% (total-like)
|
||||||
|
|
||||||
|
// The total match point will be the (like accumulated amount)/(num properties)
|
||||||
|
// Some of the elements add points or remove points
|
||||||
|
|
||||||
|
// At the end we can show the like percentadge of every element
|
||||||
|
|
||||||
|
doHairCut = false;
|
||||||
|
doHairTint = false;
|
||||||
|
doEyeLiner = false;
|
||||||
|
doLipStick = false;
|
||||||
|
doNose = false;
|
||||||
|
doGlasses = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gameplay Screen Update logic
|
||||||
|
void UpdateGameplayScreen(void)
|
||||||
|
{
|
||||||
|
if (IsKeyPressed(KEY_SPACE))
|
||||||
|
{
|
||||||
|
player = GenerateCharacter();
|
||||||
|
playerBase = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_ENTER)) finishScreen = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gameplay Screen Draw logic
|
||||||
|
void DrawGameplayScreen(void)
|
||||||
|
{
|
||||||
|
// Draw background
|
||||||
|
DrawTexture(background, 0, 0, GetColor(0xf6aa60ff));
|
||||||
|
|
||||||
|
// Draw left menu buttons
|
||||||
|
GuiButton((Rectangle){ 20, 40, 300, 60 }, "RE-TOUCH:", 2);
|
||||||
|
|
||||||
|
if (GuiButton((Rectangle){ 20, 40 + 90, 300, 80 }, "HAIR TINT", doHairTint? 3 : -1))
|
||||||
|
{
|
||||||
|
doHairTint = true;
|
||||||
|
player.colHair = hairColors[GetRandomValue(0, 9)];
|
||||||
|
}
|
||||||
|
if (GuiButton((Rectangle){ 20, 40 + 180, 300, 80 }, "HAIR", doHairCut? 3 : -1))
|
||||||
|
{
|
||||||
|
doHairCut = true;
|
||||||
|
player.hair = GetRandomValue(0, texHair.width/BASE_HAIR_WIDTH);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (GuiButton((Rectangle){ 20, 40 + 270, 300, 80 }, "EYES", doEyeLiner? 3 : -1))
|
||||||
|
{
|
||||||
|
doEyeLiner = true;
|
||||||
|
player.eyes = GetRandomValue(0, texEyes.width/BASE_EYES_WIDTH - 1);
|
||||||
|
}
|
||||||
|
if (GuiButton((Rectangle){ 20, 40 + 360, 300, 80 }, "NOSE", doNose? 3 : -1))
|
||||||
|
{
|
||||||
|
doNose = true;
|
||||||
|
player.nose = GetRandomValue(0, texNose.width/BASE_NOSE_WIDTH - 1);
|
||||||
|
}
|
||||||
|
if (GuiButton((Rectangle){ 20, 40 + 450, 300, 80 }, "LIPS", doLipStick? 3 : -1))
|
||||||
|
{
|
||||||
|
doLipStick = true;
|
||||||
|
player.mouth = GetRandomValue(0, texMouth.width/BASE_MOUTH_WIDTH - 1);
|
||||||
|
}
|
||||||
|
if (GuiButton((Rectangle){ 20, 40 + 540, 300, 80 }, "GLASSES", 3))
|
||||||
|
{
|
||||||
|
doGlasses = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw player
|
||||||
|
DrawCharacter(player, (Vector2){ GetScreenWidth()/2 - 125, 80 });
|
||||||
|
|
||||||
|
// Draw dating view
|
||||||
|
GuiButton((Rectangle){ 970, 40, 260, 60 }, "DATING:", 2);
|
||||||
|
GuiButton((Rectangle){ 970, 40 + 70, 260, 260 }, " ", 0);
|
||||||
|
|
||||||
|
BeginTextureMode(target);
|
||||||
|
DrawCharacter(dating, (Vector2){ (720 - 250)/2, (720 - 500)/2 });
|
||||||
|
EndTextureMode();
|
||||||
|
|
||||||
|
DrawTexturePro(target.texture, (Rectangle){ 0.0f, 0.0f, (float)target.texture.width, (float)-target.texture.height }, (Rectangle){ 970, 40 + 70, 260, 260 }, (Vector2){ 0, 0 }, 0.0f, WHITE);
|
||||||
|
|
||||||
|
// Draw left button: date!
|
||||||
|
if (GuiButton((Rectangle){ 970, 580, 260, 90 }, "GO DATE!", -1))
|
||||||
|
{
|
||||||
|
finishScreen = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gameplay Screen Unload logic
|
||||||
|
void UnloadGameplayScreen(void)
|
||||||
|
{
|
||||||
|
// Unload required textures
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gameplay Screen should finish?
|
||||||
|
int FinishGameplayScreen(void)
|
||||||
|
{
|
||||||
|
return finishScreen;
|
||||||
|
}
|
211
games/repair/screens/screen_logo.c
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
/**********************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib - Advance Game template
|
||||||
|
*
|
||||||
|
* Logo Screen Functions Definitions (Init, Update, Draw, Unload)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2014-2020 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.
|
||||||
|
*
|
||||||
|
**********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
#include "screens.h"
|
||||||
|
|
||||||
|
#define LOGO_RECS_SIDE 16
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Global Variables Definition (local to this module)
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Logo screen global variables
|
||||||
|
static int framesCounter = 0;
|
||||||
|
static int finishScreen = 0;
|
||||||
|
|
||||||
|
static int logoPositionX = 0;
|
||||||
|
static int logoPositionY = 0;
|
||||||
|
|
||||||
|
static int lettersCount = 0;
|
||||||
|
|
||||||
|
static int topSideRecWidth = 0;
|
||||||
|
static int leftSideRecHeight = 0;
|
||||||
|
|
||||||
|
static int bottomSideRecWidth = 0;
|
||||||
|
static int rightSideRecHeight = 0;
|
||||||
|
|
||||||
|
static char raylib[8] = { 0 }; // raylib text array, max 8 letters
|
||||||
|
static int state = 0; // Tracking animation states (State Machine)
|
||||||
|
static float alpha = 1.0f; // Useful for fading
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Logo Screen Functions Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Logo Screen Initialization logic
|
||||||
|
void InitLogoScreen(void)
|
||||||
|
{
|
||||||
|
// Initialize LOGO screen variables here!
|
||||||
|
finishScreen = 0;
|
||||||
|
framesCounter = 0;
|
||||||
|
lettersCount = 0;
|
||||||
|
|
||||||
|
logoPositionX = GetScreenWidth()/2 - 128;
|
||||||
|
logoPositionY = GetScreenHeight()/2 - 128;
|
||||||
|
|
||||||
|
topSideRecWidth = LOGO_RECS_SIDE;
|
||||||
|
leftSideRecHeight = LOGO_RECS_SIDE;
|
||||||
|
bottomSideRecWidth = LOGO_RECS_SIDE;
|
||||||
|
rightSideRecHeight = LOGO_RECS_SIDE;
|
||||||
|
|
||||||
|
for (int i = 0; i < 8; i++) raylib[i] = '\0';
|
||||||
|
|
||||||
|
state = 0;
|
||||||
|
alpha = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Logo Screen Update logic
|
||||||
|
void UpdateLogoScreen(void)
|
||||||
|
{
|
||||||
|
// Update LOGO screen variables here!
|
||||||
|
if (state == 0) // State 0: Small box blinking
|
||||||
|
{
|
||||||
|
framesCounter++;
|
||||||
|
|
||||||
|
if (framesCounter == 80)
|
||||||
|
{
|
||||||
|
state = 1;
|
||||||
|
framesCounter = 0; // Reset counter... will be used later...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (state == 1) // State 1: Top and left bars growing
|
||||||
|
{
|
||||||
|
topSideRecWidth += 8;
|
||||||
|
leftSideRecHeight += 8;
|
||||||
|
|
||||||
|
if (topSideRecWidth == 256) state = 2;
|
||||||
|
}
|
||||||
|
else if (state == 2) // State 2: Bottom and right bars growing
|
||||||
|
{
|
||||||
|
bottomSideRecWidth += 8;
|
||||||
|
rightSideRecHeight += 8;
|
||||||
|
|
||||||
|
if (bottomSideRecWidth == 256) state = 3;
|
||||||
|
}
|
||||||
|
else if (state == 3) // State 3: Letters appearing (one by one)
|
||||||
|
{
|
||||||
|
framesCounter++;
|
||||||
|
|
||||||
|
if (framesCounter/10) // Every 12 frames, one more letter!
|
||||||
|
{
|
||||||
|
lettersCount++;
|
||||||
|
framesCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (lettersCount)
|
||||||
|
{
|
||||||
|
case 1: raylib[0] = 'r'; break;
|
||||||
|
case 2: raylib[1] = 'a'; break;
|
||||||
|
case 3: raylib[2] = 'y'; break;
|
||||||
|
case 4: raylib[3] = 'l'; break;
|
||||||
|
case 5: raylib[4] = 'i'; break;
|
||||||
|
case 6: raylib[5] = 'b'; break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// When all letters have appeared...
|
||||||
|
if (lettersCount >= 10)
|
||||||
|
{
|
||||||
|
state = 4;
|
||||||
|
framesCounter = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (state == 4)
|
||||||
|
{
|
||||||
|
framesCounter++;
|
||||||
|
|
||||||
|
if (framesCounter > 100)
|
||||||
|
{
|
||||||
|
alpha -= 0.02f;
|
||||||
|
|
||||||
|
if (alpha <= 0.0f)
|
||||||
|
{
|
||||||
|
alpha = 0.0f;
|
||||||
|
finishScreen = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Logo Screen Draw logic
|
||||||
|
void DrawLogoScreen(void)
|
||||||
|
{
|
||||||
|
if (state == 0)
|
||||||
|
{
|
||||||
|
if ((framesCounter/10)%2) DrawRectangle(logoPositionX, logoPositionY, 16, 16, BLACK);
|
||||||
|
}
|
||||||
|
else if (state == 1)
|
||||||
|
{
|
||||||
|
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK);
|
||||||
|
DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK);
|
||||||
|
}
|
||||||
|
else if (state == 2)
|
||||||
|
{
|
||||||
|
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK);
|
||||||
|
DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK);
|
||||||
|
|
||||||
|
DrawRectangle(logoPositionX + 240, logoPositionY, 16, rightSideRecHeight, BLACK);
|
||||||
|
DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, BLACK);
|
||||||
|
}
|
||||||
|
else if (state == 3)
|
||||||
|
{
|
||||||
|
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, Fade(BLACK, alpha));
|
||||||
|
DrawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, Fade(BLACK, alpha));
|
||||||
|
|
||||||
|
DrawRectangle(logoPositionX + 240, logoPositionY + 16, 16, rightSideRecHeight - 32, Fade(BLACK, alpha));
|
||||||
|
DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, Fade(BLACK, alpha));
|
||||||
|
|
||||||
|
DrawRectangle(GetScreenWidth()/2 - 112, GetScreenHeight()/2 - 112, 224, 224, Fade(RAYWHITE, alpha));
|
||||||
|
|
||||||
|
DrawText(raylib, GetScreenWidth()/2 - 44, GetScreenHeight()/2 + 48, 50, Fade(BLACK, alpha));
|
||||||
|
}
|
||||||
|
else if (state == 4)
|
||||||
|
{
|
||||||
|
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, Fade(BLACK, alpha));
|
||||||
|
DrawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, Fade(BLACK, alpha));
|
||||||
|
|
||||||
|
DrawRectangle(logoPositionX + 240, logoPositionY + 16, 16, rightSideRecHeight - 32, Fade(BLACK, alpha));
|
||||||
|
DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, Fade(BLACK, alpha));
|
||||||
|
|
||||||
|
DrawRectangle(GetScreenWidth()/2 - 112, GetScreenHeight()/2 - 112, 224, 224, Fade(RAYWHITE, alpha));
|
||||||
|
|
||||||
|
DrawText(raylib, GetScreenWidth()/2 - 44, GetScreenHeight()/2 + 48, 50, Fade(BLACK, alpha));
|
||||||
|
|
||||||
|
if (framesCounter > 20) DrawText("powered by", logoPositionX, logoPositionY - 27, 20, Fade(DARKGRAY, alpha));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Logo Screen Unload logic
|
||||||
|
void UnloadLogoScreen(void)
|
||||||
|
{
|
||||||
|
// Unload LOGO screen variables here!
|
||||||
|
}
|
||||||
|
|
||||||
|
// Logo Screen should finish?
|
||||||
|
int FinishLogoScreen(void)
|
||||||
|
{
|
||||||
|
return finishScreen;
|
||||||
|
}
|
130
games/repair/screens/screen_title.c
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
/**********************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib - Advance Game template
|
||||||
|
*
|
||||||
|
* Title Screen Functions Definitions (Init, Update, Draw, Unload)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2014-2020 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.
|
||||||
|
*
|
||||||
|
**********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
#include "screens.h"
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Global Variables Definition (local to this module)
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Title screen global variables
|
||||||
|
static int framesCounter = 0;
|
||||||
|
static int finishScreen = 0;
|
||||||
|
|
||||||
|
static Texture2D texTitle = { 0 };
|
||||||
|
static Texture2D texLogo = { 0 };
|
||||||
|
|
||||||
|
static int titlePositionY = 0;
|
||||||
|
static int titleCounter = 0;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Title Screen Functions Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Title Screen Initialization logic
|
||||||
|
void InitTitleScreen(void)
|
||||||
|
{
|
||||||
|
framesCounter = 0;
|
||||||
|
finishScreen = 0;
|
||||||
|
|
||||||
|
texTitle = LoadTexture("resources/title.png");
|
||||||
|
texLogo = LoadTexture("resources/raylib_logo.png");
|
||||||
|
|
||||||
|
player = GenerateCharacter();
|
||||||
|
|
||||||
|
titlePositionY = -200;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Title Screen Update logic
|
||||||
|
void UpdateTitleScreen(void)
|
||||||
|
{
|
||||||
|
framesCounter++;
|
||||||
|
|
||||||
|
if (framesCounter > 5)
|
||||||
|
{
|
||||||
|
int partToChange = GetRandomValue(0, 4);
|
||||||
|
|
||||||
|
if (partToChange == 0)
|
||||||
|
{
|
||||||
|
player.head = GetRandomValue(0, texHead.width/BASE_HEAD_WIDTH - 1);
|
||||||
|
player.colHead = headColors[GetRandomValue(0, 5)];
|
||||||
|
}
|
||||||
|
else if (partToChange == 1) player.eyes = GetRandomValue(0, texEyes.width/BASE_EYES_WIDTH - 1);
|
||||||
|
else if (partToChange == 2) player.nose = GetRandomValue(0, texNose.width/BASE_NOSE_WIDTH - 1);
|
||||||
|
else if (partToChange == 3) player.mouth = GetRandomValue(0, texMouth.width/BASE_MOUTH_WIDTH - 1);
|
||||||
|
else if (partToChange == 4)
|
||||||
|
{
|
||||||
|
player.hair = GetRandomValue(0, texHair.width/BASE_HAIR_WIDTH - 1);
|
||||||
|
player.colHair = hairColors[GetRandomValue(0, 9)];
|
||||||
|
}
|
||||||
|
|
||||||
|
framesCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
titlePositionY += 3;
|
||||||
|
if (titlePositionY > 40) titlePositionY = 40;
|
||||||
|
|
||||||
|
titleCounter++;
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_ENTER)) finishScreen = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Title Screen Draw logic
|
||||||
|
void DrawTitleScreen(void)
|
||||||
|
{
|
||||||
|
DrawTexture(background, 0, 0, GetColor(0xf6aa60ff));
|
||||||
|
|
||||||
|
// Draw face, parts keep changing ranomly
|
||||||
|
DrawCharacter(player, (Vector2){ GetScreenWidth()/2 - 125, 80 });
|
||||||
|
|
||||||
|
// Draw face rectangles
|
||||||
|
//DrawRectangleRec((Rectangle){ GetScreenWidth()/2 - BASE_EYES_WIDTH/2, 270, BASE_EYES_WIDTH, texEyes.height }, Fade(GREEN, 0.3f));
|
||||||
|
//DrawRectangleRec((Rectangle){ GetScreenWidth()/2 - BASE_NOSE_WIDTH/2, 355, BASE_NOSE_WIDTH, texNose.height }, Fade(SKYBLUE, 0.3f));
|
||||||
|
//DrawRectangleRec((Rectangle){ GetScreenWidth()/2 - BASE_MOUTH_WIDTH/2, 450, BASE_MOUTH_WIDTH, texMouth.height }, Fade(RED, 0.3f));
|
||||||
|
|
||||||
|
DrawTexture(texTitle, GetScreenWidth()/2 - texTitle.width/2, titlePositionY, WHITE);
|
||||||
|
|
||||||
|
if (titleCounter > 180)
|
||||||
|
{
|
||||||
|
if (GuiButton((Rectangle){ GetScreenWidth()/2 - 440/2, 580, 440, 80 }, "START DATE!", -1)) finishScreen = 1; // GAMEPLAY
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawText("powered by", 20, GetScreenHeight() - texLogo.height - 35, 10, BLACK);
|
||||||
|
DrawTexture(texLogo, 20, GetScreenHeight() - texLogo.height - 20, WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Title Screen Unload logic
|
||||||
|
void UnloadTitleScreen(void)
|
||||||
|
{
|
||||||
|
UnloadTexture(texTitle);
|
||||||
|
UnloadTexture(texLogo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Title Screen should finish?
|
||||||
|
int FinishTitleScreen(void)
|
||||||
|
{
|
||||||
|
return finishScreen;
|
||||||
|
}
|
125
games/repair/screens/screens.h
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
/**********************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib - Advance Game template
|
||||||
|
*
|
||||||
|
* Screens Functions Declarations (Init, Update, Draw, Unload)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2014-2020 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.
|
||||||
|
*
|
||||||
|
**********************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef SCREENS_H
|
||||||
|
#define SCREENS_H
|
||||||
|
|
||||||
|
#define BASE_HEAD_WIDTH 400
|
||||||
|
#define BASE_HAIR_WIDTH 500
|
||||||
|
#define BASE_NOSE_WIDTH 80
|
||||||
|
#define BASE_MOUTH_WIDTH 170
|
||||||
|
#define BASE_EYES_WIDTH 240
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Types and Structures Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
typedef enum GameScreen { LOGO = 0, TITLE, OPTIONS, GAMEPLAY, ENDING } GameScreen;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int head;
|
||||||
|
int colHead;
|
||||||
|
int eyes; // Config
|
||||||
|
int nose; // Config
|
||||||
|
int mouth; // Config
|
||||||
|
int hair; // Config
|
||||||
|
int colHair; // Config
|
||||||
|
int glasses; // Config
|
||||||
|
//int piercing;
|
||||||
|
//int freckles;
|
||||||
|
} Character;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Global Variables Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
extern const unsigned int headColors[6];
|
||||||
|
extern const unsigned int hairColors[10];
|
||||||
|
|
||||||
|
extern GameScreen currentScreen;
|
||||||
|
extern Font font;
|
||||||
|
extern Music music;
|
||||||
|
extern Sound fxCoin;
|
||||||
|
extern Texture2D background;
|
||||||
|
extern Texture2D texNPatch;
|
||||||
|
extern NPatchInfo npInfo;
|
||||||
|
extern Texture2D texHead, texHair, texNose, texMouth, texEyes, texComp;
|
||||||
|
extern Texture2D texMakeup;
|
||||||
|
|
||||||
|
extern Character player;
|
||||||
|
extern Character playerBase;
|
||||||
|
extern Character dating;
|
||||||
|
extern Character datingBase;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" { // Prevents name mangling of functions
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Gui Button
|
||||||
|
bool GuiButton(Rectangle rec, const char *text, int forcedState);
|
||||||
|
|
||||||
|
Character GenerateCharacter(void);
|
||||||
|
void CustomizeCharacter(Character *character);
|
||||||
|
void DrawCharacter(Character character, Vector2 position);
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Logo Screen Functions Declaration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
void InitLogoScreen(void);
|
||||||
|
void UpdateLogoScreen(void);
|
||||||
|
void DrawLogoScreen(void);
|
||||||
|
void UnloadLogoScreen(void);
|
||||||
|
int FinishLogoScreen(void);
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Title Screen Functions Declaration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
void InitTitleScreen(void);
|
||||||
|
void UpdateTitleScreen(void);
|
||||||
|
void DrawTitleScreen(void);
|
||||||
|
void UnloadTitleScreen(void);
|
||||||
|
int FinishTitleScreen(void);
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Gameplay Screen Functions Declaration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
void InitGameplayScreen(void);
|
||||||
|
void UpdateGameplayScreen(void);
|
||||||
|
void DrawGameplayScreen(void);
|
||||||
|
void UnloadGameplayScreen(void);
|
||||||
|
int FinishGameplayScreen(void);
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Ending Screen Functions Declaration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
void InitEndingScreen(void);
|
||||||
|
void UpdateEndingScreen(void);
|
||||||
|
void DrawEndingScreen(void);
|
||||||
|
void UnloadEndingScreen(void);
|
||||||
|
int FinishEndingScreen(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // SCREENS_H
|
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013-2019 Ramon Santamaria (@raysan5)
|
# Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
|
||||||
#
|
#
|
||||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
# 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.
|
# will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
# Define required raylib variables
|
# Define required raylib variables
|
||||||
PROJECT_NAME ?= skully_escape
|
PROJECT_NAME ?= skully_escape
|
||||||
RAYLIB_VERSION ?= 2.5.0
|
RAYLIB_VERSION ?= 3.0.0
|
||||||
RAYLIB_API_VERSION ?= 2
|
RAYLIB_API_VERSION ?= 3
|
||||||
RAYLIB_PATH ?= C:\GitHub\raylib
|
RAYLIB_PATH ?= C:\GitHub\raylib
|
||||||
|
|
||||||
# Define default options
|
# Define default options
|
||||||
@@ -115,13 +115,12 @@ endif
|
|||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# Emscripten required variables
|
# Emscripten required variables
|
||||||
EMSDK_PATH ?= C:/emsdk
|
EMSDK_PATH ?= C:/emsdk
|
||||||
EMSCRIPTEN_VERSION ?= 1.38.32
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/fastcomp/emscripten
|
||||||
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
|
CLANG_PATH = $(EMSDK_PATH)/fastcomp/bin
|
||||||
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
|
PYTHON_PATH = $(EMSDK_PATH)/python/2.7.13.1_64bit/python-2.7.13.amd64
|
||||||
NODE_VERSION = 8.9.1_64bit
|
NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin
|
||||||
export PATH = $(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
|
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
|
||||||
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Define raylib release directory for compiled library.
|
# Define raylib release directory for compiled library.
|
||||||
@@ -188,20 +187,24 @@ endif
|
|||||||
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
||||||
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||||
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||||
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
||||||
|
|
||||||
ifeq ($(BUILD_MODE),DEBUG)
|
ifeq ($(BUILD_MODE),DEBUG)
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -s ASSERTIONS=1 --profiling
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -Os
|
||||||
|
else
|
||||||
|
CFLAGS += -s -O1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Additional flags for compiler (if desired)
|
# Additional flags for compiler (if desired)
|
||||||
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
|
||||||
# resource file contains windows executable icon and properties
|
|
||||||
# -Wl,--subsystem,windows hides the console window
|
|
||||||
CFLAGS += $(RAYLIB_PATH)/raylib.rc.data -Wl,--subsystem,windows
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
||||||
CFLAGS += -D_DEFAULT_SOURCE
|
CFLAGS += -D_DEFAULT_SOURCE
|
||||||
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
|||||||
# --profiling # include information for code profiling
|
# --profiling # include information for code profiling
|
||||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||||
# --preload-file resources # specify a resources folder for data compilation
|
# --preload-file resources # specify a resources folder for data compilation
|
||||||
CFLAGS += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
|
CFLAGS += -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
|
||||||
ifeq ($(BUILD_MODE), DEBUG)
|
|
||||||
CFLAGS += -s ASSERTIONS=1 --profiling
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define a custom shell .html and output extension
|
# Define a custom shell .html and output extension
|
||||||
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||||
@@ -267,6 +267,14 @@ endif
|
|||||||
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# resource file contains windows executable icon and properties
|
||||||
|
LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
|
||||||
|
# -Wl,--subsystem,windows hides the console window
|
||||||
|
ifeq ($(BUILD_MODE), RELEASE)
|
||||||
|
LDFLAGS += -Wl,--subsystem,windows
|
||||||
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Consider -L$(RAYLIB_INSTALL_PATH)
|
# Consider -L$(RAYLIB_INSTALL_PATH)
|
||||||
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
||||||
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
# NOTE: WinMM library required to set high-res timer resolution
|
# NOTE: WinMM library required to set high-res timer resolution
|
||||||
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
||||||
# Required for physac examples
|
# Required for physac examples
|
||||||
#LDLIBS += -static -lpthread
|
LDLIBS += -static -lpthread
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
# Libraries for Debian GNU/Linux desktop compiling
|
# Libraries for Debian GNU/Linux desktop compiling
|
||||||
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
# Libraries for OSX 10.9 desktop compiling
|
# Libraries for OSX 10.9 desktop compiling
|
||||||
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
||||||
LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
|
LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
||||||
@@ -389,7 +397,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
del *.o *.exe /s
|
del *.o *.exe /s
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable|x-pie-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
find . -type f -perm +ugo+x -delete
|
find . -type f -perm +ugo+x -delete
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013-2019 Ramon Santamaria (@raysan5)
|
# Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
|
||||||
#
|
#
|
||||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
# 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.
|
# will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
# Define required raylib variables
|
# Define required raylib variables
|
||||||
PROJECT_NAME ?= transmission
|
PROJECT_NAME ?= transmission
|
||||||
RAYLIB_VERSION ?= 2.5.0
|
RAYLIB_VERSION ?= 3.0.0
|
||||||
RAYLIB_API_VERSION ?= 2
|
RAYLIB_API_VERSION ?= 3
|
||||||
RAYLIB_PATH ?= C:\GitHub\raylib
|
RAYLIB_PATH ?= C:\GitHub\raylib
|
||||||
|
|
||||||
# Define default options
|
# Define default options
|
||||||
@@ -115,13 +115,12 @@ endif
|
|||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# Emscripten required variables
|
# Emscripten required variables
|
||||||
EMSDK_PATH ?= C:/emsdk
|
EMSDK_PATH ?= C:/emsdk
|
||||||
EMSCRIPTEN_VERSION ?= 1.38.32
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/fastcomp/emscripten
|
||||||
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
|
CLANG_PATH = $(EMSDK_PATH)/fastcomp/bin
|
||||||
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
|
PYTHON_PATH = $(EMSDK_PATH)/python/2.7.13.1_64bit/python-2.7.13.amd64
|
||||||
NODE_VERSION = 8.9.1_64bit
|
NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin
|
||||||
export PATH = $(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
|
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
|
||||||
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Define raylib release directory for compiled library.
|
# Define raylib release directory for compiled library.
|
||||||
@@ -188,20 +187,24 @@ endif
|
|||||||
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
||||||
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||||
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||||
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
||||||
|
|
||||||
ifeq ($(BUILD_MODE),DEBUG)
|
ifeq ($(BUILD_MODE),DEBUG)
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -s ASSERTIONS=1 --profiling
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -Os
|
||||||
|
else
|
||||||
|
CFLAGS += -s -O1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Additional flags for compiler (if desired)
|
# Additional flags for compiler (if desired)
|
||||||
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
|
||||||
# resource file contains windows executable icon and properties
|
|
||||||
# -Wl,--subsystem,windows hides the console window
|
|
||||||
CFLAGS += $(RAYLIB_PATH)/raylib.rc.data -Wl,--subsystem,windows
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
||||||
CFLAGS += -D_DEFAULT_SOURCE
|
CFLAGS += -D_DEFAULT_SOURCE
|
||||||
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
|||||||
# --profiling # include information for code profiling
|
# --profiling # include information for code profiling
|
||||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||||
# --preload-file resources # specify a resources folder for data compilation
|
# --preload-file resources # specify a resources folder for data compilation
|
||||||
CFLAGS += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
|
CFLAGS += -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
|
||||||
ifeq ($(BUILD_MODE), DEBUG)
|
|
||||||
CFLAGS += -s ASSERTIONS=1 --profiling
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define a custom shell .html and output extension
|
# Define a custom shell .html and output extension
|
||||||
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||||
@@ -267,6 +267,14 @@ endif
|
|||||||
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# resource file contains windows executable icon and properties
|
||||||
|
LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
|
||||||
|
# -Wl,--subsystem,windows hides the console window
|
||||||
|
ifeq ($(BUILD_MODE), RELEASE)
|
||||||
|
LDFLAGS += -Wl,--subsystem,windows
|
||||||
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Consider -L$(RAYLIB_INSTALL_PATH)
|
# Consider -L$(RAYLIB_INSTALL_PATH)
|
||||||
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
||||||
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
# NOTE: WinMM library required to set high-res timer resolution
|
# NOTE: WinMM library required to set high-res timer resolution
|
||||||
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
||||||
# Required for physac examples
|
# Required for physac examples
|
||||||
#LDLIBS += -static -lpthread
|
LDLIBS += -static -lpthread
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
# Libraries for Debian GNU/Linux desktop compiling
|
# Libraries for Debian GNU/Linux desktop compiling
|
||||||
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
# Libraries for OSX 10.9 desktop compiling
|
# Libraries for OSX 10.9 desktop compiling
|
||||||
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
||||||
LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
|
LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
||||||
@@ -381,7 +389,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
del *.o *.exe /s
|
del *.o *.exe /s
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable|x-pie-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
find . -type f -perm +ugo+x -delete
|
find . -type f -perm +ugo+x -delete
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013-2019 Ramon Santamaria (@raysan5)
|
# Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
|
||||||
#
|
#
|
||||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
# 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.
|
# will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
# Define required raylib variables
|
# Define required raylib variables
|
||||||
PROJECT_NAME ?= wave_collector
|
PROJECT_NAME ?= wave_collector
|
||||||
RAYLIB_VERSION ?= 2.5.0
|
RAYLIB_VERSION ?= 3.0.0
|
||||||
RAYLIB_API_VERSION ?= 2
|
RAYLIB_API_VERSION ?= 3
|
||||||
RAYLIB_PATH ?= C:\GitHub\raylib
|
RAYLIB_PATH ?= C:\GitHub\raylib
|
||||||
|
|
||||||
# Define default options
|
# Define default options
|
||||||
@@ -115,13 +115,12 @@ endif
|
|||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# Emscripten required variables
|
# Emscripten required variables
|
||||||
EMSDK_PATH ?= C:/emsdk
|
EMSDK_PATH ?= C:/emsdk
|
||||||
EMSCRIPTEN_VERSION ?= 1.38.32
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/fastcomp/emscripten
|
||||||
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
|
CLANG_PATH = $(EMSDK_PATH)/fastcomp/bin
|
||||||
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
|
PYTHON_PATH = $(EMSDK_PATH)/python/2.7.13.1_64bit/python-2.7.13.amd64
|
||||||
NODE_VERSION = 8.9.1_64bit
|
NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin
|
||||||
export PATH = $(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
|
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
|
||||||
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Define raylib release directory for compiled library.
|
# Define raylib release directory for compiled library.
|
||||||
@@ -188,20 +187,24 @@ endif
|
|||||||
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
||||||
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||||
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||||
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
||||||
|
|
||||||
ifeq ($(BUILD_MODE),DEBUG)
|
ifeq ($(BUILD_MODE),DEBUG)
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -s ASSERTIONS=1 --profiling
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
CFLAGS += -Os
|
||||||
|
else
|
||||||
|
CFLAGS += -s -O1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Additional flags for compiler (if desired)
|
# Additional flags for compiler (if desired)
|
||||||
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
|
||||||
# resource file contains windows executable icon and properties
|
|
||||||
# -Wl,--subsystem,windows hides the console window
|
|
||||||
CFLAGS += $(RAYLIB_PATH)/raylib.rc.data -Wl,--subsystem,windows
|
|
||||||
endif
|
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
||||||
CFLAGS += -D_DEFAULT_SOURCE
|
CFLAGS += -D_DEFAULT_SOURCE
|
||||||
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
|||||||
# --profiling # include information for code profiling
|
# --profiling # include information for code profiling
|
||||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||||
# --preload-file resources # specify a resources folder for data compilation
|
# --preload-file resources # specify a resources folder for data compilation
|
||||||
CFLAGS += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
|
CFLAGS += -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
|
||||||
ifeq ($(BUILD_MODE), DEBUG)
|
|
||||||
CFLAGS += -s ASSERTIONS=1 --profiling
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Define a custom shell .html and output extension
|
# Define a custom shell .html and output extension
|
||||||
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||||
@@ -267,6 +267,14 @@ endif
|
|||||||
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# resource file contains windows executable icon and properties
|
||||||
|
LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
|
||||||
|
# -Wl,--subsystem,windows hides the console window
|
||||||
|
ifeq ($(BUILD_MODE), RELEASE)
|
||||||
|
LDFLAGS += -Wl,--subsystem,windows
|
||||||
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Consider -L$(RAYLIB_INSTALL_PATH)
|
# Consider -L$(RAYLIB_INSTALL_PATH)
|
||||||
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
||||||
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
# NOTE: WinMM library required to set high-res timer resolution
|
# NOTE: WinMM library required to set high-res timer resolution
|
||||||
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
|
||||||
# Required for physac examples
|
# Required for physac examples
|
||||||
#LDLIBS += -static -lpthread
|
LDLIBS += -static -lpthread
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
# Libraries for Debian GNU/Linux desktop compiling
|
# Libraries for Debian GNU/Linux desktop compiling
|
||||||
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
# Libraries for OSX 10.9 desktop compiling
|
# Libraries for OSX 10.9 desktop compiling
|
||||||
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
||||||
LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
|
LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),BSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
||||||
@@ -380,7 +388,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
del *.o *.exe /s
|
del *.o *.exe /s
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable|x-pie-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
find . -type f -perm +ugo+x -delete
|
find . -type f -perm +ugo+x -delete
|
||||||
|
@@ -982,12 +982,93 @@
|
|||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="ImageDrawRectangle" func="yes">
|
<KeyWord name="ImageDrawRectangle" func="yes">
|
||||||
<Overload retVal="void" descr="Draw rectangle within an image">
|
<Overload retVal="void" descr="Draw rectangle within an image">
|
||||||
|
<Param name="Image *dst" />
|
||||||
|
<Param name="int posX" />
|
||||||
|
<Param name="int posY" />
|
||||||
|
<Param name="int width" />
|
||||||
|
<Param name="int height" />
|
||||||
|
<Param name="Color color" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="ImageDrawRectangleV" func="yes">
|
||||||
|
<Overload retVal="void" descr="Draw rectangle within an image (Vector version)">
|
||||||
<Param name="Image *dst" />
|
<Param name="Image *dst" />
|
||||||
<Param name="Vector2 position" />
|
<Param name="Vector2 position" />
|
||||||
|
<Param name="Vector2 size" />
|
||||||
|
<Param name="Color color" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="ImageDrawRectangleRec" func="yes">
|
||||||
|
<Overload retVal="void" descr="Draw rectangle within an image">
|
||||||
|
<Param name="Image *dst" />
|
||||||
<Param name="Rectangle rec" />
|
<Param name="Rectangle rec" />
|
||||||
<Param name="Color color" />
|
<Param name="Color color" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="ImageDrawRectangleLines" func="yes">
|
||||||
|
<Overload retVal="void" descr="Draw rectangle lines within an image">
|
||||||
|
<Param name="Image *dst" />
|
||||||
|
<Param name="Rectangle rec" />
|
||||||
|
<Param name="int thick" />
|
||||||
|
<Param name="Color color" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="ImageClearBackground" func="yes">
|
||||||
|
<Overload retVal="void" descr="Clear image background with given color">
|
||||||
|
<Param name="Image *dst" />
|
||||||
|
<Param name="Color color" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="ImageDrawPixel" func="yes">
|
||||||
|
<Overload retVal="void" descr="Clear image background with given color">
|
||||||
|
<Param name="Image *dst" />
|
||||||
|
<Param name="int posX" />
|
||||||
|
<Param name="int posY" />
|
||||||
|
<Param name="Color color" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="ImageDrawPixelV" func="yes">
|
||||||
|
<Overload retVal="void" descr="Clear image background with given color (Vector version)">
|
||||||
|
<Param name="Image *dst" />
|
||||||
|
<Param name="Vector2 position" />
|
||||||
|
<Param name="Color color" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="ImageDrawCircle" func="yes">
|
||||||
|
<Overload retVal="void" descr="Draw circle within an image">
|
||||||
|
<Param name="Image *dst" />
|
||||||
|
<Param name="int centerX" />
|
||||||
|
<Param name="int centerY" />
|
||||||
|
<Param name="int radius" />
|
||||||
|
<Param name="Color color" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="ImageDrawCircleV" func="yes">
|
||||||
|
<Overload retVal="void" descr="Draw circle within an image (Vector version)">
|
||||||
|
<Param name="Image *dst" />
|
||||||
|
<Param name="Vector2 center" />
|
||||||
|
<Param name="int radius" />
|
||||||
|
<Param name="Color color" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="ImageDrawLine" func="yes">
|
||||||
|
<Overload retVal="void" descr="Draw line within an image">
|
||||||
|
<Param name="Image *dst" />
|
||||||
|
<Param name="int startPosX" />
|
||||||
|
<Param name="int startPosY" />
|
||||||
|
<Param name="int endPosX" />
|
||||||
|
<Param name="int endPosY" />
|
||||||
|
<Param name="Color color" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="ImageDrawLineV" func="yes">
|
||||||
|
<Overload retVal="void" descr="Draw line within an image (Vector2 version)">
|
||||||
|
<Param name="Image *dst" />
|
||||||
|
<Param name="Vector2 start" />
|
||||||
|
<Param name="Vector2 end" />
|
||||||
|
<Param name="Color color" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
<KeyWord name="ImageDrawText" func="yes">
|
<KeyWord name="ImageDrawText" func="yes">
|
||||||
<Overload retVal="void" descr="Draw text (default font) within an image (destination)">
|
<Overload retVal="void" descr="Draw text (default font) within an image (destination)">
|
||||||
<Param name="Image *dst" />
|
<Param name="Image *dst" />
|
||||||
|
@@ -102,6 +102,9 @@
|
|||||||
<Param name="int monitor" />
|
<Param name="int monitor" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="GetWindowPosition" func="yes">
|
||||||
|
<Overload retVal="Vector2" descr="Get window position XY on monitor"></Overload>
|
||||||
|
</KeyWord>
|
||||||
<KeyWord name="GetMonitorName" func="yes">
|
<KeyWord name="GetMonitorName" func="yes">
|
||||||
<Overload retVal="const char" descr="Get the human-readable, UTF-8 encoded name of the primary monitor">
|
<Overload retVal="const char" descr="Get the human-readable, UTF-8 encoded name of the primary monitor">
|
||||||
<Param name="int monitor" />
|
<Param name="int monitor" />
|
||||||
@@ -169,6 +172,17 @@
|
|||||||
<KeyWord name="EndTextureMode" func="yes">
|
<KeyWord name="EndTextureMode" func="yes">
|
||||||
<Overload retVal="void" descr="Ends drawing to render texture"></Overload>
|
<Overload retVal="void" descr="Ends drawing to render texture"></Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="BeginScissorMode" func="yes">
|
||||||
|
<Overload retVal="void" descr="Begin scissor mode (define screen area for following drawing)">
|
||||||
|
<Param name="int x" />
|
||||||
|
<Param name="int y" />
|
||||||
|
<Param name="int width" />
|
||||||
|
<Param name="int height" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="EndScissorMode" func="yes">
|
||||||
|
<Overload retVal="void" descr="End scissor mode"></Overload>
|
||||||
|
</KeyWord>
|
||||||
|
|
||||||
<!-- Screen-space-related functions -->
|
<!-- Screen-space-related functions -->
|
||||||
<KeyWord name="GetMouseRay" func="yes">
|
<KeyWord name="GetMouseRay" func="yes">
|
||||||
@@ -177,15 +191,40 @@
|
|||||||
<Param name="Camera camera" />
|
<Param name="Camera camera" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="GetCameraMatrix" func="yes">
|
||||||
|
<Overload retVal="Matrix" descr="Returns camera transform matrix (view matrix)">
|
||||||
|
<Param name="Camera camera" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="GetCameraMatrix2D" func="yes">
|
||||||
|
<Overload retVal="Matrix" descr="Returns camera 2d transform matrix">
|
||||||
|
<Param name="Camera2D camera" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
<KeyWord name="GetWorldToScreen" func="yes">
|
<KeyWord name="GetWorldToScreen" func="yes">
|
||||||
<Overload retVal="Vector2" descr="Returns the screen space position for a 3d world space position">
|
<Overload retVal="Vector2" descr="Returns the screen space position for a 3d world space position">
|
||||||
<Param name="Vector3 position" />
|
<Param name="Vector3 position" />
|
||||||
<Param name="Camera camera" />
|
<Param name="Camera camera" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="GetCameraMatrix" func="yes">
|
<KeyWord name="GetWorldToScreenEx" func="yes">
|
||||||
<Overload retVal="Matrix" descr="Returns camera transform matrix (view matrix)">
|
<Overload retVal="Vector2" descr="Returns size position for a 3d world space position">
|
||||||
|
<Param name="Vector3 position" />
|
||||||
<Param name="Camera camera" />
|
<Param name="Camera camera" />
|
||||||
|
<Param name="int width" />
|
||||||
|
<Param name="int height" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="GetWorldToScreen2D" func="yes">
|
||||||
|
<Overload retVal="Vector2" descr="Returns the screen space position for a 2d camera world space position">
|
||||||
|
<Param name="Vector2 position" />
|
||||||
|
<Param name="Camera2D camera" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="GetScreenToWorld2D" func="yes">
|
||||||
|
<Overload retVal="Vector2" descr="Returns the world space position for a 2d camera screen space position">
|
||||||
|
<Param name="Vector2 position" />
|
||||||
|
<Param name="Camera2D camera" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
|
||||||
@@ -216,6 +255,11 @@
|
|||||||
<Param name="Color color" />
|
<Param name="Color color" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="ColorFromNormalized" func="yes">
|
||||||
|
<Overload retVal="Color" descr="Returns color from normalized values [0..1]">
|
||||||
|
<Param name="Vector4 normalized" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
<KeyWord name="ColorToHSV" func="yes">
|
<KeyWord name="ColorToHSV" func="yes">
|
||||||
<Overload retVal="Vector3" descr="Returns HSV values for a Color">
|
<Overload retVal="Vector3" descr="Returns HSV values for a Color">
|
||||||
<Param name="Color color" />
|
<Param name="Color color" />
|
||||||
@@ -241,7 +285,7 @@
|
|||||||
<!-- Misc. functions -->
|
<!-- Misc. functions -->
|
||||||
<KeyWord name="SetConfigFlags" func="yes">
|
<KeyWord name="SetConfigFlags" func="yes">
|
||||||
<Overload retVal="void" descr="Setup window configuration flags (view FLAGS)">
|
<Overload retVal="void" descr="Setup window configuration flags (view FLAGS)">
|
||||||
<Param name="unsigned char flags" />
|
<Param name="unsigned int flags" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="SetTraceLogLevel" func="yes">
|
<KeyWord name="SetTraceLogLevel" func="yes">
|
||||||
@@ -290,6 +334,11 @@
|
|||||||
<Param name="const char *ext" />
|
<Param name="const char *ext" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="DirectoryExists" func="yes">
|
||||||
|
<Overload retVal="bool" descr="Check if a directory path exists">
|
||||||
|
<Param name="const char *dirPath" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
<KeyWord name="GetExtension" func="yes">
|
<KeyWord name="GetExtension" func="yes">
|
||||||
<Overload retVal="const char" descr="Get pointer to extension for a filename string">
|
<Overload retVal="const char" descr="Get pointer to extension for a filename string">
|
||||||
<Param name="const char *fileName" />
|
<Param name="const char *fileName" />
|
||||||
@@ -301,13 +350,18 @@
|
|||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="GetFileNameWithoutExt" func="yes">
|
<KeyWord name="GetFileNameWithoutExt" func="yes">
|
||||||
<Overload retVal="const char" descr="Get filename string without extension (memory should be freed)">
|
<Overload retVal="const char" descr="Get filename string without extension (uses static string)">
|
||||||
<Param name="const char *filePath" />
|
<Param name="const char *filePath" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="GetDirectoryPath" func="yes">
|
<KeyWord name="GetDirectoryPath" func="yes">
|
||||||
<Overload retVal="const char" descr="Get full path for a given fileName (uses static string)">
|
<Overload retVal="const char" descr="Get full path for a given fileName with path (uses static string)">
|
||||||
<Param name="const char *fileName" />
|
<Param name="const char *filePath" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="GetPrevDirectoryPath" func="yes">
|
||||||
|
<Overload retVal="const char" descr="Get previous directory path for a given path (uses static string)">
|
||||||
|
<Param name="const char *dirPath" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="GetWorkingDirectory" func="yes">
|
<KeyWord name="GetWorkingDirectory" func="yes">
|
||||||
@@ -344,6 +398,21 @@
|
|||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
|
||||||
|
<KeyWord name="char *CompressData" func="yes">
|
||||||
|
<Overload retVal="unsigned" descr="Compress data (DEFLATE algorythm)">
|
||||||
|
<Param name="unsigned char *data" />
|
||||||
|
<Param name="int dataLength" />
|
||||||
|
<Param name="int *compDataLength" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="char *DecompressData" func="yes">
|
||||||
|
<Overload retVal="unsigned" descr="Decompress data (DEFLATE algorythm)">
|
||||||
|
<Param name="unsigned char *compData" />
|
||||||
|
<Param name="int compDataLength" />
|
||||||
|
<Param name="int *dataLength" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
|
||||||
<!-- Persistent storage management -->
|
<!-- Persistent storage management -->
|
||||||
<KeyWord name="StorageSaveValue" func="yes">
|
<KeyWord name="StorageSaveValue" func="yes">
|
||||||
<Overload retVal="void" descr="Save integer value to storage file (to defined position)">
|
<Overload retVal="void" descr="Save integer value to storage file (to defined position)">
|
||||||
@@ -703,6 +772,24 @@
|
|||||||
<Param name="Color color" />
|
<Param name="Color color" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="DrawEllipse" func="yes">
|
||||||
|
<Overload retVal="void" descr="Draw ellipse">
|
||||||
|
<Param name="int centerX" />
|
||||||
|
<Param name="int centerY" />
|
||||||
|
<Param name="float radiusH" />
|
||||||
|
<Param name="float radiusV" />
|
||||||
|
<Param name="Color color" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="DrawEllipseLines" func="yes">
|
||||||
|
<Overload retVal="void" descr="Draw ellipse outline">
|
||||||
|
<Param name="int centerX" />
|
||||||
|
<Param name="int centerY" />
|
||||||
|
<Param name="float radiusH" />
|
||||||
|
<Param name="float radiusV" />
|
||||||
|
<Param name="Color color" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
<KeyWord name="DrawRing" func="yes">
|
<KeyWord name="DrawRing" func="yes">
|
||||||
<Overload retVal="void" descr="Draw ring">
|
<Overload retVal="void" descr="Draw ring">
|
||||||
<Param name="Vector2 center" />
|
<Param name="Vector2 center" />
|
||||||
@@ -818,7 +905,7 @@
|
|||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="DrawTriangle" func="yes">
|
<KeyWord name="DrawTriangle" func="yes">
|
||||||
<Overload retVal="void" descr="Draw a color-filled triangle">
|
<Overload retVal="void" descr="Draw a color-filled triangle (vertex in counter-clockwise order!)">
|
||||||
<Param name="Vector2 v1" />
|
<Param name="Vector2 v1" />
|
||||||
<Param name="Vector2 v2" />
|
<Param name="Vector2 v2" />
|
||||||
<Param name="Vector2 v3" />
|
<Param name="Vector2 v3" />
|
||||||
@@ -826,7 +913,7 @@
|
|||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="DrawTriangleLines" func="yes">
|
<KeyWord name="DrawTriangleLines" func="yes">
|
||||||
<Overload retVal="void" descr="Draw triangle outline">
|
<Overload retVal="void" descr="Draw triangle outline (vertex in counter-clockwise order!)">
|
||||||
<Param name="Vector2 v1" />
|
<Param name="Vector2 v1" />
|
||||||
<Param name="Vector2 v2" />
|
<Param name="Vector2 v2" />
|
||||||
<Param name="Vector2 v3" />
|
<Param name="Vector2 v3" />
|
||||||
@@ -834,12 +921,19 @@
|
|||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="DrawTriangleFan" func="yes">
|
<KeyWord name="DrawTriangleFan" func="yes">
|
||||||
<Overload retVal="void" descr="Draw a triangle fan defined by points">
|
<Overload retVal="void" descr="Draw a triangle fan defined by points (first vertex is the center)">
|
||||||
<Param name="Vector2 *points" />
|
<Param name="Vector2 *points" />
|
||||||
<Param name="int numPoints" />
|
<Param name="int numPoints" />
|
||||||
<Param name="Color color" />
|
<Param name="Color color" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="DrawTriangleStrip" func="yes">
|
||||||
|
<Overload retVal="void" descr="Draw a triangle strip defined by points">
|
||||||
|
<Param name="Vector2 *points" />
|
||||||
|
<Param name="int pointsCount" />
|
||||||
|
<Param name="Color color" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
<KeyWord name="DrawPoly" func="yes">
|
<KeyWord name="DrawPoly" func="yes">
|
||||||
<Overload retVal="void" descr="Draw a regular polygon (Vector version)">
|
<Overload retVal="void" descr="Draw a regular polygon (Vector version)">
|
||||||
<Param name="Vector2 center" />
|
<Param name="Vector2 center" />
|
||||||
@@ -849,11 +943,13 @@
|
|||||||
<Param name="Color color" />
|
<Param name="Color color" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="DrawPolyLines" func="yes">
|
||||||
<KeyWord name="SetShapesTexture" func="yes">
|
<Overload retVal="void" descr="Draw a polygon outline of n sides">
|
||||||
<Overload retVal="void" descr="Define default texture used to draw shapes">
|
<Param name="Vector2 center" />
|
||||||
<Param name="Texture2D texture" />
|
<Param name="int sides" />
|
||||||
<Param name="Rectangle source" />
|
<Param name="float radius" />
|
||||||
|
<Param name="float rotation" />
|
||||||
|
<Param name="Color color" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
|
||||||
@@ -995,6 +1091,12 @@
|
|||||||
<Param name="Image image" />
|
<Param name="Image image" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="GetImageAlphaBorder" func="yes">
|
||||||
|
<Overload retVal="Rectangle" descr="Get image alpha border rectangle">
|
||||||
|
<Param name="Image image" />
|
||||||
|
<Param name="float threshold" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
<KeyWord name="GetPixelDataSize" func="yes">
|
<KeyWord name="GetPixelDataSize" func="yes">
|
||||||
<Overload retVal="int" descr="Get pixel data size in bytes (image or texture)">
|
<Overload retVal="int" descr="Get pixel data size in bytes (image or texture)">
|
||||||
<Param name="int width" />
|
<Param name="int width" />
|
||||||
@@ -1023,6 +1125,12 @@
|
|||||||
<Param name="Image image" />
|
<Param name="Image image" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="ImageFromImage" func="yes">
|
||||||
|
<Overload retVal="Image" descr="Create an image from another image piece">
|
||||||
|
<Param name="Image image" />
|
||||||
|
<Param name="Rectangle rec" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
<KeyWord name="ImageToPOT" func="yes">
|
<KeyWord name="ImageToPOT" func="yes">
|
||||||
<Overload retVal="void" descr="Convert image to POT (power-of-two)">
|
<Overload retVal="void" descr="Convert image to POT (power-of-two)">
|
||||||
<Param name="Image *image" />
|
<Param name="Image *image" />
|
||||||
@@ -1127,11 +1235,12 @@
|
|||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="ImageDraw" func="yes">
|
<KeyWord name="ImageDraw" func="yes">
|
||||||
<Overload retVal="void" descr="Draw a source image within a destination image">
|
<Overload retVal="void" descr="Draw a source image within a destination image (tint applied to source)">
|
||||||
<Param name="Image *dst" />
|
<Param name="Image *dst" />
|
||||||
<Param name="Image src" />
|
<Param name="Image src" />
|
||||||
<Param name="Rectangle srcRec" />
|
<Param name="Rectangle srcRec" />
|
||||||
<Param name="Rectangle dstRec" />
|
<Param name="Rectangle dstRec" />
|
||||||
|
<Param name="Color tint" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="ImageDrawRectangle" func="yes">
|
<KeyWord name="ImageDrawRectangle" func="yes">
|
||||||
@@ -1413,7 +1522,8 @@
|
|||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="GenImageFontAtlas" func="yes">
|
<KeyWord name="GenImageFontAtlas" func="yes">
|
||||||
<Overload retVal="Image" descr="Generate image font atlas using chars info">
|
<Overload retVal="Image" descr="Generate image font atlas using chars info">
|
||||||
<Param name="CharInfo *chars" />
|
<Param name="const CharInfo *chars" />
|
||||||
|
<Param name="Rectangle **recs" />
|
||||||
<Param name="int charsCount" />
|
<Param name="int charsCount" />
|
||||||
<Param name="int fontSize" />
|
<Param name="int fontSize" />
|
||||||
<Param name="int padding" />
|
<Param name="int padding" />
|
||||||
@@ -1463,17 +1573,14 @@
|
|||||||
<Param name="Color tint" />
|
<Param name="Color tint" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="DrawTextRecEx" func="yes">
|
<!--RLAPI void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint); // Draw text using font inside rectangle limits with support for text selection -->
|
||||||
<Overload retVal="void" descr="Draw text using font inside rectangle limits with support for text selection">
|
<KeyWord name="DrawTextCodepoint" func="yes">
|
||||||
|
<Overload retVal="void" descr="Draw one character (codepoint)">
|
||||||
<Param name="Font font" />
|
<Param name="Font font" />
|
||||||
<Param name="const char *text" />
|
<Param name="int codepoint" />
|
||||||
<Param name="Rectangle rec" />
|
<Param name="Vector2 position" />
|
||||||
<Param name="float fontSize" />
|
<Param name="float scale" />
|
||||||
<Param name="float spacing" />
|
|
||||||
<Param name="bool wordWrap" />
|
|
||||||
<Param name="Color tint" />
|
<Param name="Color tint" />
|
||||||
<Param name="int selectStart" />
|
|
||||||
<Param name="int selecFont" />
|
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
|
||||||
@@ -1495,18 +1602,18 @@
|
|||||||
<KeyWord name="GetGlyphIndex" func="yes">
|
<KeyWord name="GetGlyphIndex" func="yes">
|
||||||
<Overload retVal="int" descr="Get index position for a unicode character on font">
|
<Overload retVal="int" descr="Get index position for a unicode character on font">
|
||||||
<Param name="Font font" />
|
<Param name="Font font" />
|
||||||
<Param name="int character" />
|
<Param name="int codepoint" />
|
||||||
</Overload>
|
|
||||||
</KeyWord>
|
|
||||||
<KeyWord name="GetNextCodepoint" func="yes">
|
|
||||||
<Overload retVal="int" descr="Returns next codepoint in a UTF8 encoded string">
|
|
||||||
<Param name="const char *text" />
|
|
||||||
<Param name="int *count" />
|
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
|
||||||
<!-- Text strings management functions -->
|
<!-- Text strings management functions (no utf8 strings, only byte chars) -->
|
||||||
<!-- NOTE: Some strings allocate memory internally for returned strings, just be careful! -->
|
<!-- NOTE: Some strings allocate memory internally for returned strings, just be careful! -->
|
||||||
|
<KeyWord name="TextCopy" func="yes">
|
||||||
|
<Overload retVal="int" descr="Copy one string to another, returns bytes copied">
|
||||||
|
<Param name="char *dst" />
|
||||||
|
<Param name="const char *src" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
<KeyWord name="TextIsEqual" func="yes">
|
<KeyWord name="TextIsEqual" func="yes">
|
||||||
<Overload retVal="bool" descr="Check if two text string are equal">
|
<Overload retVal="bool" descr="Check if two text string are equal">
|
||||||
<Param name="const char *text1" />
|
<Param name="const char *text1" />
|
||||||
@@ -1518,11 +1625,6 @@
|
|||||||
<Param name="const char *text" />
|
<Param name="const char *text" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="int TextCountCodepoints" func="yes">
|
|
||||||
<Overload retVal="unsigned" descr="Get total number of characters (codepoints) in a UTF8 encoded string">
|
|
||||||
<Param name="const char *text" />
|
|
||||||
</Overload>
|
|
||||||
</KeyWord>
|
|
||||||
<KeyWord name="TextFormat" func="yes">
|
<KeyWord name="TextFormat" func="yes">
|
||||||
<Overload retVal="const char" descr="Text formatting with variables (sprintf style)">
|
<Overload retVal="const char" descr="Text formatting with variables (sprintf style)">
|
||||||
<Param name="const char *text" />
|
<Param name="const char *text" />
|
||||||
@@ -1537,14 +1639,14 @@
|
|||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="TextReplace" func="yes">
|
<KeyWord name="TextReplace" func="yes">
|
||||||
<Overload retVal="const char" descr="Replace text string (memory should be freed!)">
|
<Overload retVal="char" descr="Replace text string (memory must be freed!)">
|
||||||
<Param name="char *text" />
|
<Param name="char *text" />
|
||||||
<Param name="const char *replace" />
|
<Param name="const char *replace" />
|
||||||
<Param name="const char *by" />
|
<Param name="const char *by" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="TextInsert" func="yes">
|
<KeyWord name="TextInsert" func="yes">
|
||||||
<Overload retVal="const char" descr="Insert text in a position (memory should be freed!)">
|
<Overload retVal="char" descr="Insert text in a position (memory must be freed!)">
|
||||||
<Param name="const char *text" />
|
<Param name="const char *text" />
|
||||||
<Param name="const char *insert" />
|
<Param name="const char *insert" />
|
||||||
<Param name="int position" />
|
<Param name="int position" />
|
||||||
@@ -1597,6 +1699,37 @@
|
|||||||
<Param name="const char *text" />
|
<Param name="const char *text" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="TextToUtf8" func="yes">
|
||||||
|
<Overload retVal="char" descr="Encode text codepoint into utf8 text (memory must be freed!)">
|
||||||
|
<Param name="int *codepoints" />
|
||||||
|
<Param name="int length" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
|
||||||
|
<!-- UTF8 text strings management functions -->
|
||||||
|
<KeyWord name="GetCodepoints" func="yes">
|
||||||
|
<Overload retVal="int" descr="Get all codepoints in a string, codepoints count returned by parameters">
|
||||||
|
<Param name="const char *text" />
|
||||||
|
<Param name="int *count" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="GetCodepointsCount" func="yes">
|
||||||
|
<Overload retVal="int" descr="Get total number of characters (codepoints) in a UTF8 encoded string">
|
||||||
|
<Param name="const char *text" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="GetNextCodepoint" func="yes">
|
||||||
|
<Overload retVal="int" descr="Returns next codepoint in a UTF8 encoded string; 0x3f('?') is returned on failure">
|
||||||
|
<Param name="const char *text" />
|
||||||
|
<Param name="int *bytesProcessed" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="CodepointToUtf8" func="yes">
|
||||||
|
<Overload retVal="const char" descr="Encode codepoint into utf8 text (char array length returned as parameter)">
|
||||||
|
<Param name="int codepoint" />
|
||||||
|
<Param name="int *byteLength" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
|
||||||
<!-------------------------------------------------------------------------------------- -->
|
<!-------------------------------------------------------------------------------------- -->
|
||||||
<!-- Basic 3d Shapes Drawing Functions (Module: models) -->
|
<!-- Basic 3d Shapes Drawing Functions (Module: models) -->
|
||||||
@@ -1610,6 +1743,12 @@
|
|||||||
<Param name="Color color" />
|
<Param name="Color color" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="DrawPoint3D" func="yes">
|
||||||
|
<Overload retVal="void" descr="Draw a point in 3D space, actually a small line">
|
||||||
|
<Param name="Vector3 position" />
|
||||||
|
<Param name="Color color" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
<KeyWord name="DrawCircle3D" func="yes">
|
<KeyWord name="DrawCircle3D" func="yes">
|
||||||
<Overload retVal="void" descr="Draw a circle in 3D world space">
|
<Overload retVal="void" descr="Draw a circle in 3D world space">
|
||||||
<Param name="Vector3 center" />
|
<Param name="Vector3 center" />
|
||||||
@@ -1730,7 +1869,6 @@
|
|||||||
<Param name="Vector3 position" />
|
<Param name="Vector3 position" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<!--DrawTorus(), DrawTeapot() could be useful? -->
|
|
||||||
|
|
||||||
<!-------------------------------------------------------------------------------------- -->
|
<!-------------------------------------------------------------------------------------- -->
|
||||||
<!-- Model 3d Loading and Drawing Functions (Module: models) -->
|
<!-- Model 3d Loading and Drawing Functions (Module: models) -->
|
||||||
@@ -1768,7 +1906,7 @@
|
|||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="UnloadMesh" func="yes">
|
<KeyWord name="UnloadMesh" func="yes">
|
||||||
<Overload retVal="void" descr="Unload mesh from memory (RAM and/or VRAM)">
|
<Overload retVal="void" descr="Unload mesh from memory (RAM and/or VRAM)">
|
||||||
<Param name="Mesh *mesh" />
|
<Param name="Mesh mesh" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
|
||||||
@@ -1998,22 +2136,22 @@
|
|||||||
<KeyWord name="CheckCollisionBoxSphere" func="yes">
|
<KeyWord name="CheckCollisionBoxSphere" func="yes">
|
||||||
<Overload retVal="bool" descr="Detect collision between box and sphere">
|
<Overload retVal="bool" descr="Detect collision between box and sphere">
|
||||||
<Param name="BoundingBox box" />
|
<Param name="BoundingBox box" />
|
||||||
<Param name="Vector3 centerSphere" />
|
<Param name="Vector3 center" />
|
||||||
<Param name="float radiusSphere" />
|
<Param name="float radius" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="CheckCollisionRaySphere" func="yes">
|
<KeyWord name="CheckCollisionRaySphere" func="yes">
|
||||||
<Overload retVal="bool" descr="Detect collision between ray and sphere">
|
<Overload retVal="bool" descr="Detect collision between ray and sphere">
|
||||||
<Param name="Ray ray" />
|
<Param name="Ray ray" />
|
||||||
<Param name="Vector3 spherePosition" />
|
<Param name="Vector3 center" />
|
||||||
<Param name="float sphereRadius" />
|
<Param name="float radius" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="CheckCollisionRaySphereEx" func="yes">
|
<KeyWord name="CheckCollisionRaySphereEx" func="yes">
|
||||||
<Overload retVal="bool" descr="Detect collision between ray and sphere, returns collision point">
|
<Overload retVal="bool" descr="Detect collision between ray and sphere, returns collision point">
|
||||||
<Param name="Ray ray" />
|
<Param name="Ray ray" />
|
||||||
<Param name="Vector3 spherePosition" />
|
<Param name="Vector3 center" />
|
||||||
<Param name="float sphereRadius" />
|
<Param name="float radius" />
|
||||||
<Param name="Vector3 *collisionPoint" />
|
<Param name="Vector3 *collisionPoint" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
@@ -2026,7 +2164,7 @@
|
|||||||
<KeyWord name="GetCollisionRayModel" func="yes">
|
<KeyWord name="GetCollisionRayModel" func="yes">
|
||||||
<Overload retVal="RayHitInfo" descr="Get collision info between ray and model">
|
<Overload retVal="RayHitInfo" descr="Get collision info between ray and model">
|
||||||
<Param name="Ray ray" />
|
<Param name="Ray ray" />
|
||||||
<Param name="Model *model" />
|
<Param name="Model model" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="GetCollisionRayTriangle" func="yes">
|
<KeyWord name="GetCollisionRayTriangle" func="yes">
|
||||||
@@ -2063,8 +2201,8 @@
|
|||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="LoadShaderCode" func="yes">
|
<KeyWord name="LoadShaderCode" func="yes">
|
||||||
<Overload retVal="Shader" descr="Load shader from code strings and bind default locations">
|
<Overload retVal="Shader" descr="Load shader from code strings and bind default locations">
|
||||||
<Param name="char *vsCode" />
|
<Param name="const char *vsCode" />
|
||||||
<Param name="char *fsCode" />
|
<Param name="const char *fsCode" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="UnloadShader" func="yes">
|
<KeyWord name="UnloadShader" func="yes">
|
||||||
@@ -2079,6 +2217,18 @@
|
|||||||
<KeyWord name="GetTextureDefault" func="yes">
|
<KeyWord name="GetTextureDefault" func="yes">
|
||||||
<Overload retVal="Texture2D" descr="Get default texture"></Overload>
|
<Overload retVal="Texture2D" descr="Get default texture"></Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="GetShapesTexture" func="yes">
|
||||||
|
<Overload retVal="Texture2D" descr="Get texture to draw shapes"></Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="GetShapesTextureRec" func="yes">
|
||||||
|
<Overload retVal="Rectangle" descr="Get texture rectangle to draw shapes"></Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="SetShapesTexture" func="yes">
|
||||||
|
<Overload retVal="void" descr="Define default texture used to draw shapes">
|
||||||
|
<Param name="Texture2D texture" />
|
||||||
|
<Param name="Rectangle source" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
|
||||||
<!-- Shader configuration functions -->
|
<!-- Shader configuration functions -->
|
||||||
<KeyWord name="GetShaderLocation" func="yes">
|
<KeyWord name="GetShaderLocation" func="yes">
|
||||||
@@ -2129,17 +2279,18 @@
|
|||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="GetMatrixModelview" func="yes">
|
<KeyWord name="GetMatrixModelview" func="yes">
|
||||||
<Overload retVal="Matrix" descr="Get internal modelview matrix">
|
<Overload retVal="Matrix" descr="Get internal modelview matrix"></Overload>
|
||||||
<Param name="Matrix view" />
|
</KeyWord>
|
||||||
</Overload>
|
<KeyWord name="GetMatrixProjection" func="yes">
|
||||||
|
<Overload retVal="Matrix" descr="Get internal projection matrix"></Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
|
||||||
<!-- Texture maps generation (PBR) -->
|
<!-- Texture maps generation (PBR) -->
|
||||||
<!-- NOTE: Required shaders should be provided -->
|
<!-- NOTE: Required shaders should be provided -->
|
||||||
<KeyWord name="GenTextureCubemap" func="yes">
|
<KeyWord name="GenTextureCubemap" func="yes">
|
||||||
<Overload retVal="Texture2D" descr="Generate cubemap texture from HDR texture">
|
<Overload retVal="Texture2D" descr="Generate cubemap texture from 2D texture">
|
||||||
<Param name="Shader shader" />
|
<Param name="Shader shader" />
|
||||||
<Param name="Texture2D skyHDR" />
|
<Param name="Texture2D map" />
|
||||||
<Param name="int size" />
|
<Param name="int size" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
@@ -2181,17 +2332,6 @@
|
|||||||
<KeyWord name="EndBlendMode" func="yes">
|
<KeyWord name="EndBlendMode" func="yes">
|
||||||
<Overload retVal="void" descr="End blending mode (reset to default: alpha blending)"></Overload>
|
<Overload retVal="void" descr="End blending mode (reset to default: alpha blending)"></Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="BeginScissorMode" func="yes">
|
|
||||||
<Overload retVal="void" descr="Begin scissor mode (define screen area for following drawing)">
|
|
||||||
<Param name="int x" />
|
|
||||||
<Param name="int y" />
|
|
||||||
<Param name="int width" />
|
|
||||||
<Param name="int height" />
|
|
||||||
</Overload>
|
|
||||||
</KeyWord>
|
|
||||||
<KeyWord name="EndScissorMode" func="yes">
|
|
||||||
<Overload retVal="void" descr="End scissor mode"></Overload>
|
|
||||||
</KeyWord>
|
|
||||||
|
|
||||||
<!-- VR control functions -->
|
<!-- VR control functions -->
|
||||||
<KeyWord name="InitVrSimulator" func="yes">
|
<KeyWord name="InitVrSimulator" func="yes">
|
||||||
@@ -2206,7 +2346,7 @@
|
|||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="SetVrConfiguration" func="yes">
|
<KeyWord name="SetVrConfiguration" func="yes">
|
||||||
<Overload retVal="void" descr="Set stereo rendering configuration parameters ">
|
<Overload retVal="void" descr="Set stereo rendering configuration parameters">
|
||||||
<Param name="VrDeviceInfo info" />
|
<Param name="VrDeviceInfo info" />
|
||||||
<Param name="Shader distortion" />
|
<Param name="Shader distortion" />
|
||||||
</Overload>
|
</Overload>
|
||||||
@@ -2250,9 +2390,6 @@
|
|||||||
<Param name="const char *fileName" />
|
<Param name="const char *fileName" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="LoadWaveEx" func="yes">
|
|
||||||
<Overload retVal="Wave" descr="Load wave data from raw array data"></Overload>
|
|
||||||
</KeyWord>
|
|
||||||
<KeyWord name="LoadSound" func="yes">
|
<KeyWord name="LoadSound" func="yes">
|
||||||
<Overload retVal="Sound" descr="Load sound from file">
|
<Overload retVal="Sound" descr="Load sound from file">
|
||||||
<Param name="const char *fileName" />
|
<Param name="const char *fileName" />
|
||||||
@@ -2299,6 +2436,11 @@
|
|||||||
<Param name="Sound sound" />
|
<Param name="Sound sound" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="StopSound" func="yes">
|
||||||
|
<Overload retVal="void" descr="Stop playing a sound">
|
||||||
|
<Param name="Sound sound" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
<KeyWord name="PauseSound" func="yes">
|
<KeyWord name="PauseSound" func="yes">
|
||||||
<Overload retVal="void" descr="Pause a sound">
|
<Overload retVal="void" descr="Pause a sound">
|
||||||
<Param name="Sound sound" />
|
<Param name="Sound sound" />
|
||||||
@@ -2309,11 +2451,17 @@
|
|||||||
<Param name="Sound sound" />
|
<Param name="Sound sound" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="StopSound" func="yes">
|
<KeyWord name="PlaySoundMulti" func="yes">
|
||||||
<Overload retVal="void" descr="Stop playing a sound">
|
<Overload retVal="void" descr="Play a sound (using multichannel buffer pool)">
|
||||||
<Param name="Sound sound" />
|
<Param name="Sound sound" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="StopSoundMulti" func="yes">
|
||||||
|
<Overload retVal="void" descr="Stop any sound playing (using multichannel buffer pool)"></Overload>
|
||||||
|
</KeyWord>
|
||||||
|
<KeyWord name="GetSoundsPlaying" func="yes">
|
||||||
|
<Overload retVal="int" descr="Get number of sounds playing in the multichannel"></Overload>
|
||||||
|
</KeyWord>
|
||||||
<KeyWord name="IsSoundPlaying" func="yes">
|
<KeyWord name="IsSoundPlaying" func="yes">
|
||||||
<Overload retVal="bool" descr="Check if a sound is currently playing">
|
<Overload retVal="bool" descr="Check if a sound is currently playing">
|
||||||
<Param name="Sound sound" />
|
<Param name="Sound sound" />
|
||||||
@@ -2447,7 +2595,7 @@
|
|||||||
<Param name="AudioStream stream" />
|
<Param name="AudioStream stream" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
<KeyWord name="IsAudioBufferProcessed" func="yes">
|
<KeyWord name="IsAudioStreamProcessed" func="yes">
|
||||||
<Overload retVal="bool" descr="Check if any audio stream buffers requires refill">
|
<Overload retVal="bool" descr="Check if any audio stream buffers requires refill">
|
||||||
<Param name="AudioStream stream" />
|
<Param name="AudioStream stream" />
|
||||||
</Overload>
|
</Overload>
|
||||||
@@ -2489,3 +2637,8 @@
|
|||||||
<Param name="float pitch" />
|
<Param name="float pitch" />
|
||||||
</Overload>
|
</Overload>
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
<KeyWord name="SetAudioStreamBufferSizeDefault" func="yes">
|
||||||
|
<Overload retVal="void" descr="Default size for new audio streams">
|
||||||
|
<Param name="int size" />
|
||||||
|
</Overload>
|
||||||
|
</KeyWord>
|
||||||
|
@@ -27,6 +27,7 @@ RLAPI int GetMonitorWidth(int monitor); // Get primary
|
|||||||
RLAPI int GetMonitorHeight(int monitor); // Get primary monitor height
|
RLAPI int GetMonitorHeight(int monitor); // Get primary monitor height
|
||||||
RLAPI int GetMonitorPhysicalWidth(int monitor); // Get primary monitor physical width in millimetres
|
RLAPI int GetMonitorPhysicalWidth(int monitor); // Get primary monitor physical width in millimetres
|
||||||
RLAPI int GetMonitorPhysicalHeight(int monitor); // Get primary monitor physical height in millimetres
|
RLAPI int GetMonitorPhysicalHeight(int monitor); // Get primary monitor physical height in millimetres
|
||||||
|
RLAPI Vector2 GetWindowPosition(void); // Get window position XY on monitor
|
||||||
RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the primary monitor
|
RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the primary monitor
|
||||||
RLAPI const char *GetClipboardText(void); // Get clipboard text content
|
RLAPI const char *GetClipboardText(void); // Get clipboard text content
|
||||||
RLAPI void SetClipboardText(const char *text); // Set clipboard text content
|
RLAPI void SetClipboardText(const char *text); // Set clipboard text content
|
||||||
@@ -48,11 +49,17 @@ RLAPI void BeginMode3D(Camera3D camera); // Initializes
|
|||||||
RLAPI void EndMode3D(void); // Ends 3D mode and returns to default 2D orthographic mode
|
RLAPI void EndMode3D(void); // Ends 3D mode and returns to default 2D orthographic mode
|
||||||
RLAPI void BeginTextureMode(RenderTexture2D target); // Initializes render texture for drawing
|
RLAPI void BeginTextureMode(RenderTexture2D target); // Initializes render texture for drawing
|
||||||
RLAPI void EndTextureMode(void); // Ends drawing to render texture
|
RLAPI void EndTextureMode(void); // Ends drawing to render texture
|
||||||
|
RLAPI void BeginScissorMode(int x, int y, int width, int height); // Begin scissor mode (define screen area for following drawing)
|
||||||
|
RLAPI void EndScissorMode(void); // End scissor mode
|
||||||
|
|
||||||
// Screen-space-related functions
|
// Screen-space-related functions
|
||||||
RLAPI Ray GetMouseRay(Vector2 mousePosition, Camera camera); // Returns a ray trace from mouse position
|
RLAPI Ray GetMouseRay(Vector2 mousePosition, Camera camera); // Returns a ray trace from mouse position
|
||||||
RLAPI Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Returns the screen space position for a 3d world space position
|
|
||||||
RLAPI Matrix GetCameraMatrix(Camera camera); // Returns camera transform matrix (view matrix)
|
RLAPI Matrix GetCameraMatrix(Camera camera); // Returns camera transform matrix (view matrix)
|
||||||
|
RLAPI Matrix GetCameraMatrix2D(Camera2D camera); // Returns camera 2d transform matrix
|
||||||
|
RLAPI Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Returns the screen space position for a 3d world space position
|
||||||
|
RLAPI Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int height); // Returns size position for a 3d world space position
|
||||||
|
RLAPI Vector2 GetWorldToScreen2D(Vector2 position, Camera2D camera); // Returns the screen space position for a 2d camera world space position
|
||||||
|
RLAPI Vector2 GetScreenToWorld2D(Vector2 position, Camera2D camera); // Returns the world space position for a 2d camera screen space position
|
||||||
|
|
||||||
// Timing-related functions
|
// Timing-related functions
|
||||||
RLAPI void SetTargetFPS(int fps); // Set target FPS (maximum)
|
RLAPI void SetTargetFPS(int fps); // Set target FPS (maximum)
|
||||||
@@ -63,13 +70,14 @@ RLAPI double GetTime(void); // Returns ela
|
|||||||
// Color-related functions
|
// Color-related functions
|
||||||
RLAPI int ColorToInt(Color color); // Returns hexadecimal value for a Color
|
RLAPI int ColorToInt(Color color); // Returns hexadecimal value for a Color
|
||||||
RLAPI Vector4 ColorNormalize(Color color); // Returns color normalized as float [0..1]
|
RLAPI Vector4 ColorNormalize(Color color); // Returns color normalized as float [0..1]
|
||||||
|
RLAPI Color ColorFromNormalized(Vector4 normalized); // Returns color from normalized values [0..1]
|
||||||
RLAPI Vector3 ColorToHSV(Color color); // Returns HSV values for a Color
|
RLAPI Vector3 ColorToHSV(Color color); // Returns HSV values for a Color
|
||||||
RLAPI Color ColorFromHSV(Vector3 hsv); // Returns a Color from HSV values
|
RLAPI Color ColorFromHSV(Vector3 hsv); // Returns a Color from HSV values
|
||||||
RLAPI Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value
|
RLAPI Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value
|
||||||
RLAPI Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
|
RLAPI Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
|
||||||
|
|
||||||
// Misc. functions
|
// Misc. functions
|
||||||
RLAPI void SetConfigFlags(unsigned char flags); // Setup window configuration flags (view FLAGS)
|
RLAPI void SetConfigFlags(unsigned int flags); // Setup window configuration flags (view FLAGS)
|
||||||
RLAPI void SetTraceLogLevel(int logType); // Set the current threshold (minimum) log level
|
RLAPI void SetTraceLogLevel(int logType); // Set the current threshold (minimum) log level
|
||||||
RLAPI void SetTraceLogExit(int logType); // Set the exit threshold (minimum) log level
|
RLAPI void SetTraceLogExit(int logType); // Set the exit threshold (minimum) log level
|
||||||
RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set a trace log callback to enable custom logging
|
RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set a trace log callback to enable custom logging
|
||||||
@@ -80,10 +88,12 @@ RLAPI int GetRandomValue(int min, int max); // Returns a r
|
|||||||
// Files management functions
|
// Files management functions
|
||||||
RLAPI bool FileExists(const char *fileName); // Check if file exists
|
RLAPI bool FileExists(const char *fileName); // Check if file exists
|
||||||
RLAPI bool IsFileExtension(const char *fileName, const char *ext);// Check file extension
|
RLAPI bool IsFileExtension(const char *fileName, const char *ext);// Check file extension
|
||||||
|
RLAPI bool DirectoryExists(const char *dirPath); // Check if a directory path exists
|
||||||
RLAPI const char *GetExtension(const char *fileName); // Get pointer to extension for a filename string
|
RLAPI const char *GetExtension(const char *fileName); // Get pointer to extension for a filename string
|
||||||
RLAPI const char *GetFileName(const char *filePath); // Get pointer to filename for a path string
|
RLAPI const char *GetFileName(const char *filePath); // Get pointer to filename for a path string
|
||||||
RLAPI const char *GetFileNameWithoutExt(const char *filePath); // Get filename string without extension (memory should be freed)
|
RLAPI const char *GetFileNameWithoutExt(const char *filePath); // Get filename string without extension (uses static string)
|
||||||
RLAPI const char *GetDirectoryPath(const char *fileName); // Get full path for a given fileName (uses static string)
|
RLAPI const char *GetDirectoryPath(const char *filePath); // Get full path for a given fileName with path (uses static string)
|
||||||
|
RLAPI const char *GetPrevDirectoryPath(const char *dirPath); // Get previous directory path for a given path (uses static string)
|
||||||
RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
|
RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
|
||||||
RLAPI char **GetDirectoryFiles(const char *dirPath, int *count); // Get filenames in a directory path (memory should be freed)
|
RLAPI char **GetDirectoryFiles(const char *dirPath, int *count); // Get filenames in a directory path (memory should be freed)
|
||||||
RLAPI void ClearDirectoryFiles(void); // Clear directory files paths buffers (free memory)
|
RLAPI void ClearDirectoryFiles(void); // Clear directory files paths buffers (free memory)
|
||||||
@@ -93,6 +103,9 @@ RLAPI char **GetDroppedFiles(int *count); // Get dropped
|
|||||||
RLAPI void ClearDroppedFiles(void); // Clear dropped files paths buffer (free memory)
|
RLAPI void ClearDroppedFiles(void); // Clear dropped files paths buffer (free memory)
|
||||||
RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time)
|
RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time)
|
||||||
|
|
||||||
|
RLAPI unsigned char *CompressData(unsigned char *data, int dataLength, int *compDataLength); // Compress data (DEFLATE algorythm)
|
||||||
|
RLAPI unsigned char *DecompressData(unsigned char *compData, int compDataLength, int *dataLength); // Decompress data (DEFLATE algorythm)
|
||||||
|
|
||||||
// Persistent storage management
|
// Persistent storage management
|
||||||
RLAPI void StorageSaveValue(int position, int value); // Save integer value to storage file (to defined position)
|
RLAPI void StorageSaveValue(int position, int value); // Save integer value to storage file (to defined position)
|
||||||
RLAPI int StorageLoadValue(int position); // Load integer value from storage file (from defined position)
|
RLAPI int StorageLoadValue(int position); // Load integer value from storage file (from defined position)
|
||||||
@@ -183,6 +196,8 @@ RLAPI void DrawCircleSectorLines(Vector2 center, float radius, int startAngle, i
|
|||||||
RLAPI void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); // Draw a gradient-filled circle
|
RLAPI void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); // Draw a gradient-filled circle
|
||||||
RLAPI void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
|
RLAPI void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
|
||||||
RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
|
RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
|
||||||
|
RLAPI void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse
|
||||||
|
RLAPI void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse outline
|
||||||
RLAPI void DrawRing(Vector2 center, float innerRadius, float outerRadius, int startAngle, int endAngle, int segments, Color color); // Draw ring
|
RLAPI void DrawRing(Vector2 center, float innerRadius, float outerRadius, int startAngle, int endAngle, int segments, Color color); // Draw ring
|
||||||
RLAPI void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, int startAngle, int endAngle, int segments, Color color); // Draw ring outline
|
RLAPI void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, int startAngle, int endAngle, int segments, Color color); // Draw ring outline
|
||||||
RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle
|
RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle
|
||||||
@@ -196,12 +211,12 @@ RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color c
|
|||||||
RLAPI void DrawRectangleLinesEx(Rectangle rec, int lineThick, Color color); // Draw rectangle outline with extended parameters
|
RLAPI void DrawRectangleLinesEx(Rectangle rec, int lineThick, Color color); // Draw rectangle outline with extended parameters
|
||||||
RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges
|
RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges
|
||||||
RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, int lineThick, Color color); // Draw rectangle with rounded edges outline
|
RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, int lineThick, Color color); // Draw rectangle with rounded edges outline
|
||||||
RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle
|
RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
|
||||||
RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline
|
RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline (vertex in counter-clockwise order!)
|
||||||
RLAPI void DrawTriangleFan(Vector2 *points, int numPoints, Color color); // Draw a triangle fan defined by points
|
RLAPI void DrawTriangleFan(Vector2 *points, int numPoints, Color color); // Draw a triangle fan defined by points (first vertex is the center)
|
||||||
|
RLAPI void DrawTriangleStrip(Vector2 *points, int pointsCount, Color color); // Draw a triangle strip defined by points
|
||||||
RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version)
|
RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version)
|
||||||
|
RLAPI void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides
|
||||||
RLAPI void SetShapesTexture(Texture2D texture, Rectangle source); // Define default texture used to draw shapes
|
|
||||||
|
|
||||||
// Basic shapes collision detection functions
|
// Basic shapes collision detection functions
|
||||||
RLAPI bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2); // Check collision between two rectangles
|
RLAPI bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2); // Check collision between two rectangles
|
||||||
@@ -232,6 +247,7 @@ RLAPI void UnloadTexture(Texture2D texture);
|
|||||||
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
|
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
|
||||||
RLAPI Color *GetImageData(Image image); // Get pixel data from image as a Color struct array
|
RLAPI Color *GetImageData(Image image); // Get pixel data from image as a Color struct array
|
||||||
RLAPI Vector4 *GetImageDataNormalized(Image image); // Get pixel data from image as Vector4 array (float normalized)
|
RLAPI Vector4 *GetImageDataNormalized(Image image); // Get pixel data from image as Vector4 array (float normalized)
|
||||||
|
RLAPI Rectangle GetImageAlphaBorder(Image image, float threshold); // Get image alpha border rectangle
|
||||||
RLAPI int GetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes (image or texture)
|
RLAPI int GetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes (image or texture)
|
||||||
RLAPI Image GetTextureData(Texture2D texture); // Get pixel data from GPU texture and return an Image
|
RLAPI Image GetTextureData(Texture2D texture); // Get pixel data from GPU texture and return an Image
|
||||||
RLAPI Image GetScreenData(void); // Get pixel data from screen buffer and return an Image (screenshot)
|
RLAPI Image GetScreenData(void); // Get pixel data from screen buffer and return an Image (screenshot)
|
||||||
@@ -239,6 +255,7 @@ RLAPI void UpdateTexture(Texture2D texture, const void *pixels);
|
|||||||
|
|
||||||
// Image manipulation functions
|
// Image manipulation functions
|
||||||
RLAPI Image ImageCopy(Image image); // Create an image duplicate (useful for transformations)
|
RLAPI Image ImageCopy(Image image); // Create an image duplicate (useful for transformations)
|
||||||
|
RLAPI Image ImageFromImage(Image image, Rectangle rec); // Create an image from another image piece
|
||||||
RLAPI void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two)
|
RLAPI void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two)
|
||||||
RLAPI void ImageFormat(Image *image, int newFormat); // Convert image data to desired format
|
RLAPI void ImageFormat(Image *image, int newFormat); // Convert image data to desired format
|
||||||
RLAPI void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image
|
RLAPI void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image
|
||||||
@@ -254,7 +271,7 @@ RLAPI void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp);
|
|||||||
RLAPI Color *ImageExtractPalette(Image image, int maxPaletteSize, int *extractCount); // Extract color palette from image to maximum size (memory should be freed)
|
RLAPI Color *ImageExtractPalette(Image image, int maxPaletteSize, int *extractCount); // Extract color palette from image to maximum size (memory should be freed)
|
||||||
RLAPI Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font)
|
RLAPI Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font)
|
||||||
RLAPI Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font)
|
RLAPI Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font)
|
||||||
RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec); // Draw a source image within a destination image
|
RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source)
|
||||||
RLAPI void ImageDrawRectangle(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image
|
RLAPI void ImageDrawRectangle(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image
|
||||||
RLAPI void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image
|
RLAPI void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image
|
||||||
RLAPI void ImageDrawText(Image *dst, Vector2 position, const char *text, int fontSize, Color color); // Draw text (default font) within an image (destination)
|
RLAPI void ImageDrawText(Image *dst, Vector2 position, const char *text, int fontSize, Color color); // Draw text (default font) within an image (destination)
|
||||||
@@ -304,7 +321,7 @@ RLAPI Font LoadFont(const char *fileName);
|
|||||||
RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int charsCount); // Load font from file with extended parameters
|
RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int charsCount); // Load font from file with extended parameters
|
||||||
RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
|
RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
|
||||||
RLAPI CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int charsCount, int type); // Load font data for further use
|
RLAPI CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int charsCount, int type); // Load font data for further use
|
||||||
RLAPI Image GenImageFontAtlas(CharInfo *chars, int charsCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info
|
RLAPI Image GenImageFontAtlas(const CharInfo *chars, Rectangle **recs, int charsCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info
|
||||||
RLAPI void UnloadFont(Font font); // Unload Font from GPU memory (VRAM)
|
RLAPI void UnloadFont(Font font); // Unload Font from GPU memory (VRAM)
|
||||||
|
|
||||||
// Text drawing functions
|
// Text drawing functions
|
||||||
@@ -312,24 +329,23 @@ RLAPI void DrawFPS(int posX, int posY);
|
|||||||
RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
|
RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
|
||||||
RLAPI void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters
|
RLAPI void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters
|
||||||
RLAPI void DrawTextRec(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rectangle limits
|
RLAPI void DrawTextRec(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rectangle limits
|
||||||
RLAPI void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectText, Color selectBack); // Draw text using font inside rectangle limits with support for text selection
|
//RLAPI void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint); // Draw text using font inside rectangle limits with support for text selection
|
||||||
|
RLAPI void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float scale, Color tint); // Draw one character (codepoint)
|
||||||
|
|
||||||
// Text misc. functions
|
// Text misc. functions
|
||||||
RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font
|
RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font
|
||||||
RLAPI Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // Measure string size for Font
|
RLAPI Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // Measure string size for Font
|
||||||
RLAPI int GetGlyphIndex(Font font, int character); // Get index position for a unicode character on font
|
RLAPI int GetGlyphIndex(Font font, int codepoint); // Get index position for a unicode character on font
|
||||||
RLAPI int GetNextCodepoint(const char *text, int *count); // Returns next codepoint in a UTF8 encoded string
|
|
||||||
// NOTE: 0x3f(`?`) is returned on failure, `count` will hold the total number of bytes processed
|
|
||||||
|
|
||||||
// Text strings management functions
|
// Text strings management functions (no utf8 strings, only byte chars)
|
||||||
// NOTE: Some strings allocate memory internally for returned strings, just be careful!
|
// NOTE: Some strings allocate memory internally for returned strings, just be careful!
|
||||||
|
RLAPI int TextCopy(char *dst, const char *src); // Copy one string to another, returns bytes copied
|
||||||
RLAPI bool TextIsEqual(const char *text1, const char *text2); // Check if two text string are equal
|
RLAPI bool TextIsEqual(const char *text1, const char *text2); // Check if two text string are equal
|
||||||
RLAPI unsigned int TextLength(const char *text); // Get text length, checks for '\0' ending
|
RLAPI unsigned int TextLength(const char *text); // Get text length, checks for '\0' ending
|
||||||
RLAPI unsigned int TextCountCodepoints(const char *text); // Get total number of characters (codepoints) in a UTF8 encoded string
|
|
||||||
RLAPI const char *TextFormat(const char *text, ...); // Text formatting with variables (sprintf style)
|
RLAPI const char *TextFormat(const char *text, ...); // Text formatting with variables (sprintf style)
|
||||||
RLAPI const char *TextSubtext(const char *text, int position, int length); // Get a piece of a text string
|
RLAPI const char *TextSubtext(const char *text, int position, int length); // Get a piece of a text string
|
||||||
RLAPI const char *TextReplace(char *text, const char *replace, const char *by); // Replace text string (memory should be freed!)
|
RLAPI char *TextReplace(char *text, const char *replace, const char *by); // Replace text string (memory must be freed!)
|
||||||
RLAPI const char *TextInsert(const char *text, const char *insert, int position); // Insert text in a position (memory should be freed!)
|
RLAPI char *TextInsert(const char *text, const char *insert, int position); // Insert text in a position (memory must be freed!)
|
||||||
RLAPI const char *TextJoin(const char **textList, int count, const char *delimiter); // Join text strings with delimiter
|
RLAPI const char *TextJoin(const char **textList, int count, const char *delimiter); // Join text strings with delimiter
|
||||||
RLAPI const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings
|
RLAPI const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings
|
||||||
RLAPI void TextAppend(char *text, const char *append, int *position); // Append text at specific position and move cursor!
|
RLAPI void TextAppend(char *text, const char *append, int *position); // Append text at specific position and move cursor!
|
||||||
@@ -338,6 +354,13 @@ RLAPI const char *TextToUpper(const char *text); // Get upp
|
|||||||
RLAPI const char *TextToLower(const char *text); // Get lower case version of provided string
|
RLAPI const char *TextToLower(const char *text); // Get lower case version of provided string
|
||||||
RLAPI const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
|
RLAPI const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
|
||||||
RLAPI int TextToInteger(const char *text); // Get integer value from text (negative values not supported)
|
RLAPI int TextToInteger(const char *text); // Get integer value from text (negative values not supported)
|
||||||
|
RLAPI char *TextToUtf8(int *codepoints, int length); // Encode text codepoint into utf8 text (memory must be freed!)
|
||||||
|
|
||||||
|
// UTF8 text strings management functions
|
||||||
|
RLAPI int *GetCodepoints(const char *text, int *count); // Get all codepoints in a string, codepoints count returned by parameters
|
||||||
|
RLAPI int GetCodepointsCount(const char *text); // Get total number of characters (codepoints) in a UTF8 encoded string
|
||||||
|
RLAPI int GetNextCodepoint(const char *text, int *bytesProcessed); // Returns next codepoint in a UTF8 encoded string; 0x3f('?') is returned on failure
|
||||||
|
RLAPI const char *CodepointToUtf8(int codepoint, int *byteLength); // Encode codepoint into utf8 text (char array length returned as parameter)
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Basic 3d Shapes Drawing Functions (Module: models)
|
// Basic 3d Shapes Drawing Functions (Module: models)
|
||||||
@@ -345,6 +368,7 @@ RLAPI int TextToInteger(const char *text); // Get int
|
|||||||
|
|
||||||
// Basic geometric 3D shapes drawing functions
|
// Basic geometric 3D shapes drawing functions
|
||||||
RLAPI void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); // Draw a line in 3D world space
|
RLAPI void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); // Draw a line in 3D world space
|
||||||
|
RLAPI void DrawPoint3D(Vector3 position, Color color); // Draw a point in 3D space, actually a small line
|
||||||
RLAPI void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space
|
RLAPI void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space
|
||||||
RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
|
RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
|
||||||
RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
|
RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
|
||||||
@@ -360,7 +384,6 @@ RLAPI void DrawPlane(Vector3 centerPos, Vector2 size, Color color);
|
|||||||
RLAPI void DrawRay(Ray ray, Color color); // Draw a ray line
|
RLAPI void DrawRay(Ray ray, Color color); // Draw a ray line
|
||||||
RLAPI void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
|
RLAPI void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
|
||||||
RLAPI void DrawGizmo(Vector3 position); // Draw simple gizmo
|
RLAPI void DrawGizmo(Vector3 position); // Draw simple gizmo
|
||||||
//DrawTorus(), DrawTeapot() could be useful?
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Model 3d Loading and Drawing Functions (Module: models)
|
// Model 3d Loading and Drawing Functions (Module: models)
|
||||||
@@ -374,7 +397,7 @@ RLAPI void UnloadModel(Model model);
|
|||||||
// Mesh loading/unloading functions
|
// Mesh loading/unloading functions
|
||||||
RLAPI Mesh *LoadMeshes(const char *fileName, int *meshCount); // Load meshes from model file
|
RLAPI Mesh *LoadMeshes(const char *fileName, int *meshCount); // Load meshes from model file
|
||||||
RLAPI void ExportMesh(Mesh mesh, const char *fileName); // Export mesh data to file
|
RLAPI void ExportMesh(Mesh mesh, const char *fileName); // Export mesh data to file
|
||||||
RLAPI void UnloadMesh(Mesh *mesh); // Unload mesh from memory (RAM and/or VRAM)
|
RLAPI void UnloadMesh(Mesh mesh); // Unload mesh from memory (RAM and/or VRAM)
|
||||||
|
|
||||||
// Material loading/unloading functions
|
// Material loading/unloading functions
|
||||||
RLAPI Material *LoadMaterials(const char *fileName, int *materialCount); // Load materials from model file
|
RLAPI Material *LoadMaterials(const char *fileName, int *materialCount); // Load materials from model file
|
||||||
@@ -418,11 +441,11 @@ RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRe
|
|||||||
// Collision detection functions
|
// Collision detection functions
|
||||||
RLAPI bool CheckCollisionSpheres(Vector3 centerA, float radiusA, Vector3 centerB, float radiusB); // Detect collision between two spheres
|
RLAPI bool CheckCollisionSpheres(Vector3 centerA, float radiusA, Vector3 centerB, float radiusB); // Detect collision between two spheres
|
||||||
RLAPI bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); // Detect collision between two bounding boxes
|
RLAPI bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); // Detect collision between two bounding boxes
|
||||||
RLAPI bool CheckCollisionBoxSphere(BoundingBox box, Vector3 centerSphere, float radiusSphere); // Detect collision between box and sphere
|
RLAPI bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius); // Detect collision between box and sphere
|
||||||
RLAPI bool CheckCollisionRaySphere(Ray ray, Vector3 spherePosition, float sphereRadius); // Detect collision between ray and sphere
|
RLAPI bool CheckCollisionRaySphere(Ray ray, Vector3 center, float radius); // Detect collision between ray and sphere
|
||||||
RLAPI bool CheckCollisionRaySphereEx(Ray ray, Vector3 spherePosition, float sphereRadius, Vector3 *collisionPoint); // Detect collision between ray and sphere, returns collision point
|
RLAPI bool CheckCollisionRaySphereEx(Ray ray, Vector3 center, float radius, Vector3 *collisionPoint); // Detect collision between ray and sphere, returns collision point
|
||||||
RLAPI bool CheckCollisionRayBox(Ray ray, BoundingBox box); // Detect collision between ray and box
|
RLAPI bool CheckCollisionRayBox(Ray ray, BoundingBox box); // Detect collision between ray and box
|
||||||
RLAPI RayHitInfo GetCollisionRayModel(Ray ray, Model *model); // Get collision info between ray and model
|
RLAPI RayHitInfo GetCollisionRayModel(Ray ray, Model model); // Get collision info between ray and model
|
||||||
RLAPI RayHitInfo GetCollisionRayTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); // Get collision info between ray and triangle
|
RLAPI RayHitInfo GetCollisionRayTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); // Get collision info between ray and triangle
|
||||||
RLAPI RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight); // Get collision info between ray and ground plane (Y-normal plane)
|
RLAPI RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight); // Get collision info between ray and ground plane (Y-normal plane)
|
||||||
|
|
||||||
@@ -434,11 +457,14 @@ RLAPI RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight);
|
|||||||
// Shader loading/unloading functions
|
// Shader loading/unloading functions
|
||||||
RLAPI char *LoadText(const char *fileName); // Load chars array from text file
|
RLAPI char *LoadText(const char *fileName); // Load chars array from text file
|
||||||
RLAPI Shader LoadShader(const char *vsFileName, const char *fsFileName); // Load shader from files and bind default locations
|
RLAPI Shader LoadShader(const char *vsFileName, const char *fsFileName); // Load shader from files and bind default locations
|
||||||
RLAPI Shader LoadShaderCode(char *vsCode, char *fsCode); // Load shader from code strings and bind default locations
|
RLAPI Shader LoadShaderCode(const char *vsCode, const char *fsCode); // Load shader from code strings and bind default locations
|
||||||
RLAPI void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM)
|
RLAPI void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM)
|
||||||
|
|
||||||
RLAPI Shader GetShaderDefault(void); // Get default shader
|
RLAPI Shader GetShaderDefault(void); // Get default shader
|
||||||
RLAPI Texture2D GetTextureDefault(void); // Get default texture
|
RLAPI Texture2D GetTextureDefault(void); // Get default texture
|
||||||
|
RLAPI Texture2D GetShapesTexture(void); // Get texture to draw shapes
|
||||||
|
RLAPI Rectangle GetShapesTextureRec(void); // Get texture rectangle to draw shapes
|
||||||
|
RLAPI void SetShapesTexture(Texture2D texture, Rectangle source); // Define default texture used to draw shapes
|
||||||
|
|
||||||
// Shader configuration functions
|
// Shader configuration functions
|
||||||
RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
|
RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
|
||||||
@@ -448,11 +474,12 @@ RLAPI void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat);
|
|||||||
RLAPI void SetShaderValueTexture(Shader shader, int uniformLoc, Texture2D texture); // Set shader uniform value for texture
|
RLAPI void SetShaderValueTexture(Shader shader, int uniformLoc, Texture2D texture); // Set shader uniform value for texture
|
||||||
RLAPI void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix)
|
RLAPI void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix)
|
||||||
RLAPI void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix)
|
RLAPI void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix)
|
||||||
RLAPI Matrix GetMatrixModelview(); // Get internal modelview matrix
|
RLAPI Matrix GetMatrixModelview(void); // Get internal modelview matrix
|
||||||
|
RLAPI Matrix GetMatrixProjection(void); // Get internal projection matrix
|
||||||
|
|
||||||
// Texture maps generation (PBR)
|
// Texture maps generation (PBR)
|
||||||
// NOTE: Required shaders should be provided
|
// NOTE: Required shaders should be provided
|
||||||
RLAPI Texture2D GenTextureCubemap(Shader shader, Texture2D skyHDR, int size); // Generate cubemap texture from HDR texture
|
RLAPI Texture2D GenTextureCubemap(Shader shader, Texture2D map, int size); // Generate cubemap texture from 2D texture
|
||||||
RLAPI Texture2D GenTextureIrradiance(Shader shader, Texture2D cubemap, int size); // Generate irradiance texture using cubemap data
|
RLAPI Texture2D GenTextureIrradiance(Shader shader, Texture2D cubemap, int size); // Generate irradiance texture using cubemap data
|
||||||
RLAPI Texture2D GenTexturePrefilter(Shader shader, Texture2D cubemap, int size); // Generate prefilter texture using cubemap data
|
RLAPI Texture2D GenTexturePrefilter(Shader shader, Texture2D cubemap, int size); // Generate prefilter texture using cubemap data
|
||||||
RLAPI Texture2D GenTextureBRDF(Shader shader, int size); // Generate BRDF texture
|
RLAPI Texture2D GenTextureBRDF(Shader shader, int size); // Generate BRDF texture
|
||||||
@@ -462,8 +489,6 @@ RLAPI void BeginShaderMode(Shader shader); // Beg
|
|||||||
RLAPI void EndShaderMode(void); // End custom shader drawing (use default shader)
|
RLAPI void EndShaderMode(void); // End custom shader drawing (use default shader)
|
||||||
RLAPI void BeginBlendMode(int mode); // Begin blending mode (alpha, additive, multiplied)
|
RLAPI void BeginBlendMode(int mode); // Begin blending mode (alpha, additive, multiplied)
|
||||||
RLAPI void EndBlendMode(void); // End blending mode (reset to default: alpha blending)
|
RLAPI void EndBlendMode(void); // End blending mode (reset to default: alpha blending)
|
||||||
RLAPI void BeginScissorMode(int x, int y, int width, int height); // Begin scissor mode (define screen area for following drawing)
|
|
||||||
RLAPI void EndScissorMode(void); // End scissor mode
|
|
||||||
|
|
||||||
// VR control functions
|
// VR control functions
|
||||||
RLAPI void InitVrSimulator(void); // Init VR simulator for selected device parameters
|
RLAPI void InitVrSimulator(void); // Init VR simulator for selected device parameters
|
||||||
@@ -487,7 +512,6 @@ RLAPI void SetMasterVolume(float volume); // Set mas
|
|||||||
|
|
||||||
// Wave/Sound loading/unloading functions
|
// Wave/Sound loading/unloading functions
|
||||||
RLAPI Wave LoadWave(const char *fileName); // Load wave data from file
|
RLAPI Wave LoadWave(const char *fileName); // Load wave data from file
|
||||||
RLAPI Wave LoadWaveEx(void *data, int sampleCount, int sampleRate, int sampleSize, int channels); // Load wave data from raw array data
|
|
||||||
RLAPI Sound LoadSound(const char *fileName); // Load sound from file
|
RLAPI Sound LoadSound(const char *fileName); // Load sound from file
|
||||||
RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound from wave data
|
RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound from wave data
|
||||||
RLAPI void UpdateSound(Sound sound, const void *data, int samplesCount);// Update sound buffer with new data
|
RLAPI void UpdateSound(Sound sound, const void *data, int samplesCount);// Update sound buffer with new data
|
||||||
@@ -498,9 +522,12 @@ RLAPI void ExportWaveAsCode(Wave wave, const char *fileName); // Export
|
|||||||
|
|
||||||
// Wave/Sound management functions
|
// Wave/Sound management functions
|
||||||
RLAPI void PlaySound(Sound sound); // Play a sound
|
RLAPI void PlaySound(Sound sound); // Play a sound
|
||||||
|
RLAPI void StopSound(Sound sound); // Stop playing a sound
|
||||||
RLAPI void PauseSound(Sound sound); // Pause a sound
|
RLAPI void PauseSound(Sound sound); // Pause a sound
|
||||||
RLAPI void ResumeSound(Sound sound); // Resume a paused sound
|
RLAPI void ResumeSound(Sound sound); // Resume a paused sound
|
||||||
RLAPI void StopSound(Sound sound); // Stop playing a sound
|
RLAPI void PlaySoundMulti(Sound sound); // Play a sound (using multichannel buffer pool)
|
||||||
|
RLAPI void StopSoundMulti(void); // Stop any sound playing (using multichannel buffer pool)
|
||||||
|
RLAPI int GetSoundsPlaying(void); // Get number of sounds playing in the multichannel
|
||||||
RLAPI bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
|
RLAPI bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
|
||||||
RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
|
RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
|
||||||
RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
||||||
@@ -528,7 +555,7 @@ RLAPI float GetMusicTimePlayed(Music music); // Get cur
|
|||||||
RLAPI AudioStream InitAudioStream(unsigned int sampleRate, unsigned int sampleSize, unsigned int channels); // Init audio stream (to stream raw audio pcm data)
|
RLAPI AudioStream InitAudioStream(unsigned int sampleRate, unsigned int sampleSize, unsigned int channels); // Init audio stream (to stream raw audio pcm data)
|
||||||
RLAPI void UpdateAudioStream(AudioStream stream, const void *data, int samplesCount); // Update audio stream buffers with data
|
RLAPI void UpdateAudioStream(AudioStream stream, const void *data, int samplesCount); // Update audio stream buffers with data
|
||||||
RLAPI void CloseAudioStream(AudioStream stream); // Close audio stream and free memory
|
RLAPI void CloseAudioStream(AudioStream stream); // Close audio stream and free memory
|
||||||
RLAPI bool IsAudioBufferProcessed(AudioStream stream); // Check if any audio stream buffers requires refill
|
RLAPI bool IsAudioStreamProcessed(AudioStream stream); // Check if any audio stream buffers requires refill
|
||||||
RLAPI void PlayAudioStream(AudioStream stream); // Play audio stream
|
RLAPI void PlayAudioStream(AudioStream stream); // Play audio stream
|
||||||
RLAPI void PauseAudioStream(AudioStream stream); // Pause audio stream
|
RLAPI void PauseAudioStream(AudioStream stream); // Pause audio stream
|
||||||
RLAPI void ResumeAudioStream(AudioStream stream); // Resume audio stream
|
RLAPI void ResumeAudioStream(AudioStream stream); // Resume audio stream
|
||||||
@@ -536,3 +563,4 @@ RLAPI bool IsAudioStreamPlaying(AudioStream stream); // Check i
|
|||||||
RLAPI void StopAudioStream(AudioStream stream); // Stop audio stream
|
RLAPI void StopAudioStream(AudioStream stream); // Stop audio stream
|
||||||
RLAPI void SetAudioStreamVolume(AudioStream stream, float volume); // Set volume for audio stream (1.0 is max level)
|
RLAPI void SetAudioStreamVolume(AudioStream stream, float volume); // Set volume for audio stream (1.0 is max level)
|
||||||
RLAPI void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level)
|
RLAPI void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level)
|
||||||
|
RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams
|
||||||
|
@@ -57,9 +57,9 @@ void App::Update()
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RED);
|
||||||
|
|
||||||
DrawRectangle(posX, posY, 400, 100, RED);
|
DrawRectangle(posX, posY, 400, 100, WHITE);
|
||||||
|
|
||||||
DrawLine(0, 0, GetScreenWidth(), GetScreenHeight(), BLUE);
|
DrawLine(0, 0, GetScreenWidth(), GetScreenHeight(), BLUE);
|
||||||
|
|
||||||
|
@@ -59,7 +59,7 @@ using namespace Windows::Graphics::Display;
|
|||||||
using namespace Microsoft::WRL;
|
using namespace Microsoft::WRL;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
|
|
||||||
extern "C" { EGLNativeWindowType uwpWindow; };
|
extern "C" { EGLNativeWindowType handle; };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO list:
|
TODO list:
|
||||||
@@ -117,7 +117,7 @@ public:
|
|||||||
|
|
||||||
// The CoreWindow has been created, so EGL can be initialized.
|
// The CoreWindow has been created, so EGL can be initialized.
|
||||||
|
|
||||||
uwpWindow = (EGLNativeWindowType)window;
|
handle = (EGLNativeWindowType)window;
|
||||||
|
|
||||||
InitWindow(width, height, NULL);
|
InitWindow(width, height, NULL);
|
||||||
}
|
}
|
||||||
|
@@ -64,7 +64,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Platform)'=='ARM'">
|
<ItemDefinitionGroup Condition="'$(Platform)'=='ARM'">
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>mincore.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>mincore.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(VCInstallDir)\lib\store\arm;$(VCInstallDir)\lib\arm;$(SolutionDir)\raylib\Debug</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(VCInstallDir)\lib\store\arm;$(VCInstallDir)\lib\arm;$(SolutionDir)\raylib\Debug</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
@@ -10,6 +10,9 @@ set SOURCES=core_basic_window.c
|
|||||||
REM Set your raylib\src location here (relative path!)
|
REM Set your raylib\src location here (relative path!)
|
||||||
set RAYLIB_SRC=..\..\src
|
set RAYLIB_SRC=..\..\src
|
||||||
|
|
||||||
|
REM Set the target platform for the compiler (Ex: x86 or x64)
|
||||||
|
set TARGET_PLATFORM=x86
|
||||||
|
|
||||||
REM About this build script: it does many things, but in essence, it's
|
REM About this build script: it does many things, but in essence, it's
|
||||||
REM very simple. It has 3 compiler invocations: building raylib (which
|
REM very simple. It has 3 compiler invocations: building raylib (which
|
||||||
REM is not done always, see logic by searching "Build raylib"), building
|
REM is not done always, see logic by searching "Build raylib"), building
|
||||||
@@ -63,7 +66,7 @@ IF NOT "%1" == "" (
|
|||||||
|
|
||||||
|
|
||||||
:HELP
|
:HELP
|
||||||
echo Usage: windows-build.bat [-hdurcqqv]
|
echo Usage: build-windows.bat [-hdurcqqv]
|
||||||
echo -h Show this information
|
echo -h Show this information
|
||||||
echo -d Faster builds that have debug symbols, and enable warnings
|
echo -d Faster builds that have debug symbols, and enable warnings
|
||||||
echo -u Run upx* on the executable after compilation (before -r)
|
echo -u Run upx* on the executable after compilation (before -r)
|
||||||
@@ -81,10 +84,10 @@ echo easier, and it's a very small bit in the build scripts. The option
|
|||||||
echo requires that you have upx installed and on your path, of course.
|
echo requires that you have upx installed and on your path, of course.
|
||||||
echo.
|
echo.
|
||||||
echo Examples:
|
echo Examples:
|
||||||
echo Build a release build: windows-build.bat
|
echo Build a release build: build-windows.bat
|
||||||
echo Build a release build, full recompile: windows-build.bat -c
|
echo Build a release build, full recompile: build-windows.bat -c
|
||||||
echo Build a debug build and run: windows-build.bat -d -r
|
echo Build a debug build and run: build-windows.bat -d -r
|
||||||
echo Build in debug, run, don't print at all: windows-build.bat -drqq
|
echo Build in debug, run, don't print at all: build-windows.bat -drqq
|
||||||
exit /B
|
exit /B
|
||||||
|
|
||||||
|
|
||||||
@@ -104,9 +107,9 @@ IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxil
|
|||||||
exit /B
|
exit /B
|
||||||
)
|
)
|
||||||
IF DEFINED VERBOSE (
|
IF DEFINED VERBOSE (
|
||||||
call !VC_INIT! x86
|
call !VC_INIT! !TARGET_PLATFORM!
|
||||||
) ELSE (
|
) ELSE (
|
||||||
call !VC_INIT! x86 > NUL 2>&1
|
call !VC_INIT! !TARGET_PLATFORM! > NUL 2>&1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -128,7 +131,7 @@ IF DEFINED BUILD_DEBUG (
|
|||||||
set OUTPUT_FLAG=/Fe: "!GAME_NAME!"
|
set OUTPUT_FLAG=/Fe: "!GAME_NAME!"
|
||||||
set COMPILATION_FLAGS=/Od /Zi
|
set COMPILATION_FLAGS=/Od /Zi
|
||||||
set WARNING_FLAGS=/Wall
|
set WARNING_FLAGS=/Wall
|
||||||
set SUBSYSTEM_FLAGS=
|
set SUBSYSTEM_FLAGS=/DEBUG
|
||||||
set LINK_FLAGS=/link kernel32.lib user32.lib shell32.lib winmm.lib gdi32.lib opengl32.lib
|
set LINK_FLAGS=/link kernel32.lib user32.lib shell32.lib winmm.lib gdi32.lib opengl32.lib
|
||||||
set OUTPUT_DIR=builds-debug\windows-msvc
|
set OUTPUT_DIR=builds-debug\windows-msvc
|
||||||
)
|
)
|
||||||
|
@@ -3,8 +3,8 @@ project(raylib C)
|
|||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
|
||||||
|
|
||||||
set(PROJECT_VERSION 2.6.0)
|
set(PROJECT_VERSION 3.0.0)
|
||||||
set(API_VERSION 261)
|
set(API_VERSION 301)
|
||||||
|
|
||||||
include("CMakeOptions.txt")
|
include("CMakeOptions.txt")
|
||||||
include(BuildType)
|
include(BuildType)
|
||||||
@@ -263,6 +263,11 @@ file(COPY "raymath.h" DESTINATION ".")
|
|||||||
file(COPY "raudio.h" DESTINATION ".")
|
file(COPY "raudio.h" DESTINATION ".")
|
||||||
|
|
||||||
# Print the flags for the user
|
# Print the flags for the user
|
||||||
|
if (DEFINED CMAKE_BUILD_TYPE)
|
||||||
|
message(STATUS "Generated build type: ${CMAKE_BUILD_TYPE}")
|
||||||
|
else()
|
||||||
|
message(STATUS "Generated config types: ${CMAKE_CONFIGURATION_TYPES}")
|
||||||
|
endif()
|
||||||
message(STATUS "Compiling with the flags:")
|
message(STATUS "Compiling with the flags:")
|
||||||
message(STATUS " PLATFORM=" ${PLATFORM_CPP})
|
message(STATUS " PLATFORM=" ${PLATFORM_CPP})
|
||||||
message(STATUS " GRAPHICS=" ${GRAPHICS})
|
message(STATUS " GRAPHICS=" ${GRAPHICS})
|
||||||
|