242 Commits
2.6.0 ... 3.0.0

Author SHA1 Message Date
Ray
7ef114d1da Set build type to Release only #1164 2020-04-01 11:07:01 +02:00
raysan5
adb20569be Review shared library building 2020-04-01 11:06:05 +02:00
Ray
07f3a65a96 Update ROADMAP.md 2020-03-31 23:00:48 +02:00
Ray
6a8b1079c1 Update project version for release 2020-03-30 23:42:17 +02:00
Ray
703850b341 Update README.md 2020-03-30 23:28:38 +02:00
raysan5
8da6307456 Get icons back on shell.html
It seems there is some related issue on emscripten side... but I'll keep the icons here despite not displayed properly for the moment.
2020-03-30 21:34:45 +02:00
raysan5
e469f4ebf7 Update config.h, enable some file-formats by default 2020-03-30 17:42:42 +02:00
raysan5
8941cf3e66 Update textures.c 2020-03-30 17:42:19 +02:00
raysan5
68cad30646 Remove useless files 2020-03-30 17:27:03 +02:00
raysan5
fc7ec5e907 Update raylib.h 2020-03-30 17:11:35 +02:00
Dani Martin
1a948849f3 [cppcheck] Fix minor warnings in models.c and raudio.c (#1162)
Errores fixes:
models.c,2843 Either the condition 'fileData!=NULL' is redundant or there is possible null pointer dereference: fileData.
raudio.c,805, 806, 807, 808, %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'.
2020-03-30 17:08:01 +02:00
Ray
bba10504e2 Update HISTORY.md 2020-03-30 16:30:34 +02:00
Ray
ff11a6fbe8 Update CHANGELOG 2020-03-30 16:25:59 +02:00
Ray
27ebe78313 Update CHANGELOG 2020-03-30 16:23:37 +02:00
raysan5
44961d1975 Update core_basic_window.c 2020-03-30 16:09:09 +02:00
raysan5
e8a8d544c5 Review formating and signegness issues 2020-03-30 14:38:16 +02:00
Dani Martin
62cdb2299b [cppcheck] Improvements in SaveStorageValue() in core.c (#1160)
* [cppcheck] Improvements in SaveStorageValue() in core.c

in file core.c cppcheck shows errors only in function SaveStorageValue():

* Common realloc mistake: 'fileData' nulled but not freed upon failure
* Memory pointed to by 'fileData' is freed twice.

Validation:
* Tested examples/core/core_storage_values.c
* Launched Unit Test for this function
* Rerun CPPCHECK afer fix

* [cppcheck] Change functions header to accept only positive position in files

Changes:
* Functions SaveStorageValue(), LoadStorageValue() (core.c)
* Functions LoadFileData(), SaveFileData() (utils.c)
* Headers in raylib.h

Validation:
* Tested examples/core/core_storage_values.c
* Launched Unit Test for these functions
* Rerun CPPCHECK afer fix
2020-03-30 13:51:36 +02:00
Ray
9b66883e0b Update README.md 2020-03-30 13:29:05 +02:00
Ray
d1b0d6a6dc Update README.md 2020-03-30 13:28:30 +02:00
Ray
c47ba58494 Update README.md 2020-03-30 13:23:20 +02:00
Valentin Lemière
41582f0448 Fix "variable is reassigned before use" linter warning on raymath.h (#1158) 2020-03-29 22:03:10 +02:00
raysan5
3e76d3a3d3 Added example: shaders_spotlight 2020-03-29 14:25:09 +02:00
raysan5
733ed972f7 Reorganize image functions 2020-03-29 13:37:33 +02:00
raysan5
5d7050bdf9 Reorganize image/texture functions for consistency 2020-03-29 13:31:12 +02:00
Rob Loach
a025636fa1 Update ImageDraw*() functions to match arguments of Draw*() (#1156)
* Update ImageDraw*() functions to match arguments of Draw*()

Updated draw functions:
ImageDrawPixel()
ImageDrawPixelV()
ImageDrawCircle()
ImageDrawCircleV()
ImageDrawLine()
ImageDrawLineV()
ImageDrawRectangle()
ImageDrawRectangleV()
ImageDrawRectangleRec()

* [nodepadpp] Update Notepad++ ImageDraw defintions

This updates the Notepad++ definitions with the updated ImageDraw methods.

* [examples] Add ImageDraw calls to textures_image_drawing

* Update ImageDraw*() methods
2020-03-29 12:43:34 +02:00
Ray
3c3dfde3f9 Added binding: raylib-zig 2020-03-28 19:35:20 +01:00
Ray
5829fdb73e Added binding: raylib-ats2 2020-03-28 19:30:00 +01:00
Ray
9b74c40fc2 Update HISTORY.md 2020-03-28 19:17:51 +01:00
raysan5
66e0d774bd Revert "Update compilation warning flags (#1151)"
This reverts commit 2528854664.
2020-03-28 18:39:56 +01:00
raysan5
a5e1aff99b [example] Integrate virtual mouse in main example 2020-03-28 18:36:30 +01:00
raysan5
e333eb415b Update window rc 2020-03-28 18:27:56 +01:00
Ray
02df366a7a Update HISTORY.md 2020-03-27 20:40:00 +01:00
Ray
976a10c891 Update CHANGELOG 2020-03-27 20:31:20 +01:00
raysan5
d28e73849b Review TRACELOG() messages 2020-03-27 18:49:21 +01:00
raysan5
d7b15ac1cf Review TRACELOG() categories 2020-03-27 18:45:37 +01:00
raysan5
c0c775e45d [rlgl] Review TRACELOG() messages, categorized 2020-03-27 18:31:36 +01:00
raysan5
b5842434c2 Corrected missing semicolon 2020-03-27 18:31:16 +01:00
raysan5
c7e9951795 [core] Review TRACELOG() messages, categorized 2020-03-27 18:06:09 +01:00
raysan5
70ed975b99 [models] Review TRACELOG() messages, categorized 2020-03-27 17:43:51 +01:00
raysan5
7e2b1b4ff0 [textures] Review TRACELOG() messages 2020-03-27 17:43:38 +01:00
raysan5
915b5f370b [raudio] Review TRACELOG() messages, categorized 2020-03-27 17:43:24 +01:00
raysan5
0c6c421508 [raudio] Review TRACELOG() messages, categorized 2020-03-27 17:16:30 +01:00
raysan5
bc2c6251f8 [text] Review TRACELOG() messages, categorized 2020-03-27 17:16:07 +01:00
raysan5
b9dd459d5a [textures] Review TRACELOG() messages, categorized 2020-03-27 17:15:44 +01:00
raysan5
28da2522fe [utils] Review TRACELOG() messages, categorized 2020-03-27 17:15:26 +01:00
Dani Martin
2528854664 Update compilation warning flags (#1151)
* Update compilation warning flags

Removed the -Wall flag that allow many warnings and added manually all the warning flags that don't generate warnings in the src/external folder.
Specifically, these are some of the flags reporting errors in src/external:

-Wmissing-prototypes
-Wunused-variable
-Wunused-value
-Wunused-parameter
-Wunused-function

* Uptade compilation flags in examples with missing -std=c99
2020-03-26 18:48:34 +01:00
raysan5
7ae7a87f8a Remove trail spaces 2020-03-25 19:41:51 +01:00
raysan5
3d41c1b6cd Minor tweaks 2020-03-25 19:38:55 +01:00
raysan5
96005f2566 ADDED: IsWindowFullscreen() 2020-03-25 18:52:38 +01:00
raysan5
e37d021cd3 Enable IQM models support on config.h 2020-03-25 18:51:46 +01:00
raysan5
133a882556 Update config.h 2020-03-25 18:39:28 +01:00
raysan5
74339b9fdc [example] Review shaders_spotlight to work on GLSL 100 2020-03-25 18:39:21 +01:00
chriscamacho
2dbcef218c spotlight example, each spot has own radius, mouse countrol (#1148)
NB glsl100 shader needs testing on "bare metal"

Co-authored-by: codifies <nospam@antispam.com>
2020-03-25 10:28:16 +01:00
Random
e07281f8bd Fixed DrawTextRecEx() selection when wordwrap is ON (again) (#1149) 2020-03-25 10:27:43 +01:00
raysan5
5e670be239 REVIEWED: shaders_spotlight example
It seems something is not working properly...
2020-03-24 19:49:09 +01:00
raysan5
05abaee0e0 Update core_window_letterbox_virtual_mouse.c 2020-03-24 19:10:50 +01:00
raysan5
d657537821 Support mtl loading by tinyobj_parse_obj() #1134
I don't like this solution but well... let's use it for the moment...
2020-03-24 18:42:57 +01:00
Ray
5fe0db347c Update HISTORY.md 2020-03-24 15:03:55 +01:00
Ray
649665eac9 Update CHANGELOG 2020-03-24 15:01:09 +01:00
chriscamacho
efe359d613 as per request spotlight example (#1146)
Co-authored-by: codifies <nospam@antispam.com>
2020-03-24 14:27:14 +01:00
Anata
c45fe62abc Add files via upload (#1147)
Virtual mouse with window letterbox, and Clamp
2020-03-24 14:25:44 +01:00
Ádám Dóda
584e2d664c GenMeshHeightmap flat shading normals (#1140) 2020-03-24 13:27:49 +01:00
raysan5
51a8e1d692 Remove define not required 2020-03-24 13:26:34 +01:00
Doyle
da836a732c Android: Better track touch input returned from IsMouse*() (#1144)
* Android: Better track touch input returned from IsMouse*()

Switch to actually tracking touch input to use for "mouse" input rather
than the gestures system. The gesture system as an abstraction ontop of
raw touch input loses some information needed to map to "mouse"
input.

Before,
- IsMouseButtonReleased() triggers immediately after the initial touch
(because GESTURE_TAP activates immediately on touch) instead of waiting for the
touch to be released.
- IsMouseButtonUp() returns false, when it should just be the opposite
of IsMouseButtonDown().
- IsMouseButtonDown() returns true only after GESTURE_HOLD (which
activates after some period of time after GESTURE_TAP), when instead it
should just be true whenever there is touch input i.e. gesture !=
GESTURE_NONE or alternatively when any input is received on the screen.

After this PR, touches map closer to mouse input.
- IsMouseButtonReleased() triggers when touch is released (last frame
was touched, this frame not touched).
- IsMouseButtonUp() returns the opposite of IsMouseButtonDown()
- IsMouseButtonDown() is true when
(AMOTION_EVENT_ACTION_DOWN || AMOTION_EVENT_ACTION_MOVE) and false when
(AMOTION_EVENT_ACTION_UP)

* RPI: Include index check for RPI in GetTouchPosition()
2020-03-24 13:23:34 +01:00
raysan5
6bab884d1d Added note on examples not supporting GLSL100 2020-03-24 12:39:05 +01:00
Ahmad Fatoum
4e6db307e4 appveyor: configure for Release with Debug Info
We build the library as debug with AppVeyor and package it this way,
which is unfortunate, because on Windows it's linked against debug
variants of the C runtime. Fix this by build RelWithDebInfo instead

Fixes #1128.
2020-03-24 06:37:22 +01:00
Ahmad Fatoum
0229f9b1a4 CMakeLists.txt: report generated CMAKE_CONFIGURATION_TYPES
We might want to customize this in feature for multi-config builds (e.g.
a Visual studio build with both Debug and Release configurations).

Output the variable value for user awareness.
2020-03-24 06:37:22 +01:00
chriscamacho
6bbaca118f ended up using the 100 version shaders as off the top of my (#1142)
head can't think of any improvement I could use on the shaders for
version 120
This has been tested on Linux (Desktop) requires testing on a Rpi

Co-authored-by: codifies <nospam@antispam.com>
2020-03-23 23:07:42 +01:00
Ray
ba3b4b2d08 Set a release date for raylib 3.0! 2020-03-23 20:56:31 +01:00
raysan5
fcdb120935 Comment tweaks 2020-03-23 20:24:20 +01:00
raysan5
8f45370073 Comment tweaks 2020-03-23 20:24:09 +01:00
Ray
502bc61931 Update HISTORY.md 2020-03-23 14:30:19 +01:00
Ray
5a39b22521 Update CHANGELOG 2020-03-23 14:22:06 +01:00
Ray
6c44c9d730 Update HISTORY.md 2020-03-21 21:14:26 +01:00
Ray
a523c64718 Update CHANGELOG 2020-03-21 20:33:46 +01:00
raysan5
5aebd2a16c Review formating from PR #1138 2020-03-21 20:30:40 +01:00
Sourav Gupta
574c689ff7 Added draw functions to ImageDraw*() (#1138)
Added draw functions:
ImageClearBackground()
ImageDrawPixel()
ImageDrawLineEx()
ImageDrawCircle()
2020-03-21 20:23:50 +01:00
Ray
b178c992a1 Update README.md 2020-03-21 20:21:08 +01:00
Ray
a4d31e1dad Added raylib 3.0 notes -WIP- 2020-03-21 20:20:37 +01:00
Ray
e151487fde Review history introduction 2020-03-21 19:13:16 +01:00
Ray
061848cd0c Updated badges links 2020-03-21 18:48:04 +01:00
Ray
ab1c12c449 Update Travis/AppVeyor badges 2020-03-21 15:05:02 +01:00
Ray
8db8401bc1 Review Travis/AppVeyor badges 2020-03-21 13:50:24 +01:00
Ray
58a81dd760 Update README.md 2020-03-21 13:48:53 +01:00
Ray
a5838e40d9 Update CONTRIBUTING.md 2020-03-21 13:37:48 +01:00
Ray
78e8fd1c31 Update CHANGELOG 2020-03-21 13:32:53 +01:00
Ray
2d07d29a1c Update README.md 2020-03-21 13:29:03 +01:00
Ray
19bbcbb486 Update badges 2020-03-21 13:26:19 +01:00
Ray
b6ba3dacb9 Playing with badges 2020-03-21 13:23:20 +01:00
Ray
65d9d0aac1 Testing badges 2020-03-21 13:22:06 +01:00
Ray
b9c966f902 Playing with badges... 2020-03-21 13:01:50 +01:00
Ray
d62368f133 Update README.md 2020-03-21 12:43:27 +01:00
Ray
3d66a6c93f Added: new binding to Carp 2020-03-21 11:28:18 +01:00
Doyle
01e035e28b Android: Track touch motion across screen (#1137)
This was working in 2.6 but no longer does in current git tree.
It appears touch position is only tracked on
AMOTION_EVENT_ACTION_[DOWN|UP], which only registers the initial touch
on the screen. Subsequent movement is not tracked into CORE.

Touch position and the Gesture System appears to be updated twice in
AndroidInputCallback in what looks like perhaps a copy paste error (code
is identical) with the exception of tracking AMOTION_EVENT_ACTION_UP in
the 2nd copy of the code (but this is not necessary to track).

If you need to track the first touch or release touch position, you can
do so with checking IsMouseButton[Pressed|Released] on the same frame.

This patch makes it so the touch position is always updated, and merges the
duplicated code into 1 singular code path.
2020-03-19 16:56:48 +01:00
raysan5
4af4483f5f Added security check in case init fails #1135 2020-03-17 20:57:01 +01:00
raysan5
2344941974 Replace external libraries custom allocators by raylib ones #1074
NOTE: Two libraries still use custom allocators: glfw and stb_vorbis
2020-03-17 13:40:07 +01:00
Ray
6f41b9594a Update README.md 2020-03-16 20:46:28 +01:00
Ray
3e049c09d5 ADDED: XD Pascal bindings 2020-03-16 19:11:06 +01:00
Henrique de Lima
92e1205f40 Adding the option to change the target platform(x86/x64), Generating the .pdb file on debug builds, and correcting comments that called the script 'windows-build.bat' instead of 'build-windows.bat' (#1133) 2020-03-16 10:32:39 +01:00
raysan5
71b06caed4 Corrected typo 2020-03-15 17:06:08 +01:00
raysan5
4611406c68 REVIEWED: ImageTextEx() to support line breaks #1131
NOTE: This functionality has an important issue, line space is fixed to 1.5 font.baseSize pixels, depending on the font and how it has been generated that spacing could be too wide or too narrow...
2020-03-15 16:18:48 +01:00
Doyle
427be604b9 Android: Set display.[width, height] before screen size check (#1132)
In `InitGraphicsDevice(...)`, the Android section has a screen security check
like other platforms- but CORE.display.width, CORE.display.height are
not set yet, so the security check sets it to 0. So ensure we query the
device's screen width and height before the screen size security check.

This also gives you the ability to run a proper full-screen application
on Android without any scaling and guess work on the target device by
setting screen width and height to 0 in `InitWindow(...)` and using
`GetScreen[Width|Height]()` to get the actual values.
2020-03-15 15:56:43 +01:00
Ray
d57b5ac89a Added note on transparent framebuffer w/o X11 on RPI 2020-03-12 17:47:35 +01:00
Ray
82937e1564 Update .gitignore 2020-03-12 13:02:18 +01:00
Ray
7fa12844ed [text] TextToUpper(): Added note on diacritics 2020-03-12 13:02:09 +01:00
Ray
af011bc952 ADDED Binding: FreeBasic 2020-03-09 18:52:41 +01:00
Ray
4c728f0b54 Minor tweaks 2020-03-09 18:45:37 +01:00
Ray
5895fb6adc Address issue #1125 2020-03-09 13:01:10 +01:00
Ahmad Fatoum
eb6f8bd0ba Revert "Always use latest raylib version for cmake (#1123)" (#1126)
We didn't use the latest version, but a compatible version, which is established by raylib-config-version.cmake.

It's ok to have a minimal version, so revert b7c0d5b6dd.
2020-03-09 08:29:47 +01:00
G3bE
b7c0d5b6dd Always use latest raylib version for cmake (#1123)
* Always use latest raylib version

* Always use latest raylib version

* Always use latest raylib version
2020-03-08 18:04:29 +01:00
SasLuca
680f9d5772 Changed if to else if. (#1122) 2020-03-08 18:03:23 +01:00
Astie Teddy
20d8889a03 ADDED Bindings: raylua-lua (raylua) (#1124) 2020-03-08 18:02:37 +01:00
Ray
c67bc02dd1 Reviewed missing include 2020-03-07 21:54:54 +01:00
Ray
1b56f7917e Update raylib version 2020-03-05 19:33:54 +01:00
Ray
7639726193 ADDED Bindings: raylib-luamore, raylib-nelua, raylib-mosaic 2020-03-05 18:58:10 +01:00
Ray
fb2ed693e4 Android: Support file saving to internal data storage 2020-03-05 18:12:41 +01:00
Ray
966e8adcf9 Reviewed and Updated Android compilation scripts 2020-03-05 12:25:39 +01:00
Ray
c3386300d3 Remove comment 2020-03-04 18:23:31 +01:00
Ray
cb4c676f5d Added BlitzMax binding 2020-03-04 13:12:16 +01:00
Ray
74c486201d ADDED: LoadFileText() and SaveFileText()
Improved file access checks
2020-03-04 00:21:46 +01:00
Ray
6b8f30964d WARNING: Corrected issue with IsKeyDown() #1119 2020-03-03 16:43:15 +01:00
Ray
dc2e5c1751 Update core.c 2020-03-03 16:10:31 +01:00
Ray
645a5b2507 Avoid icons in shell
Very weird... lately icons are not properly displayed on browser!
2020-03-03 15:53:13 +01:00
Ray
3a073db029 REVIEWED: Mouse/Touch input system
After several reviews, now it seems everything works as expected.
2020-03-03 14:58:54 +01:00
Ray
a6297a2be1 Some code tweaks 2020-03-03 01:21:06 +01:00
Ray
8724cf2ea5 Support any mouse button for gesture detection 2020-03-02 13:29:36 +01:00
Ray
485787059a Review shader exaples to work on web (GLSL 100) 2020-03-02 13:27:54 +01:00
Ray
08615d3247 Review some comment 2020-03-02 12:22:57 +01:00
Ray
a1b2d96d9c Support touch drawing on web 2020-03-02 12:22:38 +01:00
i-right-i
3c2ee1cc75 Update raymath.h (#1118)
* Update raymath.h

Added Vector2Rotate Function.

* Update raymath.h
2020-03-02 10:22:08 +01:00
Ray
117696a893 Update textures_mouse_painting.c 2020-03-02 00:09:05 +01:00
Ray
2f5a7ddcc6 Added comment on IsMouseButtonDown() issue
IsMouseButtonDown() does not process touch state down properly, state is reseted every frame...
2020-03-02 00:07:06 +01:00
Ray
18a9982126 Reviewed IsMouseButtonDown() 2020-03-01 01:29:34 +01:00
Ray
41d3c47ffe Update Makefile 2020-03-01 01:28:49 +01:00
Ray
7428747ef0 REDESIGNED input system for better mouse/touch support 2020-02-29 22:10:23 +01:00
Ray
1ee6290fcf Replaced fabs() by fabsf() when required 2020-02-28 12:54:39 +01:00
brankoku
572969d8b7 LoadText() tweak (#1113)
Guarantee string is zero-terminated
2020-02-28 08:23:05 +01:00
Ray
f2247c6f0a REVIEWED: LoadText() 2020-02-28 00:32:46 +01:00
Ray
05992a6fce Tweaks 2020-02-27 16:37:32 +01:00
Ray
c8464bc731 Corrected return value 2020-02-27 16:22:34 +01:00
Ray
b2098a2d60 REDESIGN: ExportImage()
Use new file I/O ABI
2020-02-27 16:15:58 +01:00
Ray
ac73e3b5e2 REDESIGN: ExportWave()
Use new file I/O ABI
2020-02-27 16:15:20 +01:00
Ray
1be68d8cfe Tweak on variable init 2020-02-27 16:14:50 +01:00
Ray
eb86d69a38 Review default config flags 2020-02-27 16:14:31 +01:00
Ray
acfa967e89 Corrected issue with variable name 2020-02-27 13:56:27 +01:00
Ray
5ff0776235 Remove trail spaces and some tweaks 2020-02-27 13:33:09 +01:00
Ray
2a408d789c REDESIGNED: LoadImage() -WIP-
Using new file I/O ABI
2020-02-27 13:21:51 +01:00
Ray
5100cb3e7f REDESIGNED: LoadImageRaw(), LoadAnimatedGIF()
Using new file I/O ABI
2020-02-27 13:21:21 +01:00
Ray
b029fb6d31 REDESIGNED: LoadFontEx()
Using new file I/O ABI
2020-02-27 13:19:58 +01:00
Ray
245ba2a152 LoadText(): Added comment 2020-02-27 13:19:13 +01:00
Ray
89ecad1e29 Review macros 2020-02-27 13:18:55 +01:00
Ray
23bde477e5 REDESIGN: LoadStorageValue()/SaveStorageValue()
Using new file I/O ABI
2020-02-27 13:18:15 +01:00
Ray
2294947660 Update core_storage_values.c 2020-02-26 23:42:41 +01:00
Ray
5aed36e76d Tweaks on fullsccreen detection... 2020-02-26 23:42:06 +01:00
Ray
e5b5aea998 WARNING: RENAMED: Storage functions
Renamed functions for consistency:

 - StorageLoadValue() > LoadStorageValue()
 - StorageSaveValue() > SaveStorageValue()
2020-02-26 23:40:53 +01:00
Ray
fadd74358b Security check 2020-02-26 23:38:12 +01:00
Ray
7912fac815 Correct typo 2020-02-26 23:19:29 +01:00
Ray
fa4e0c1a26 Reviewed example 2020-02-26 20:47:08 +01:00
Ray
1046449339 ADDED: LoadFileData(), SaveFileData() 2020-02-26 20:29:33 +01:00
Ray
c5d5d19443 Remove trail spaces 2020-02-26 20:23:55 +01:00
Ray
0f783aab34 Remove TraceLog() dependency on standalone mode 2020-02-26 20:23:36 +01:00
Ray
7849db65e0 Remove TraceLog() dependency on standalone mode 2020-02-26 20:23:06 +01:00
Ray
9b5a796213 Use float math functions 2020-02-26 20:20:52 +01:00
Ray
32e374d941 [core] SetWindowSize() try to support PLATFORM_WEB -WIP- 2020-02-24 12:35:53 +01:00
Ray
113a580021 [rlgl] LoadText() variable scope improvement 2020-02-24 12:05:54 +01:00
Ray
a77273d8d8 Make sure current text buffer is empty #1109 2020-02-24 11:15:02 +01:00
Ray
310fd9b147 Update to latest emscripten toolchain
Corrected issue on web compilation
2020-02-22 17:21:10 +01:00
Ray
01d8642520 Merge branch 'master' of https://github.com/raysan5/raylib 2020-02-22 10:38:37 +01:00
Ray
30f3e49f3d Improve inputs on Android 2020-02-22 10:38:32 +01:00
Ray
0b8aded399 Support ToggleFullscreen() on web 2020-02-22 10:37:43 +01:00
Ray
d2aeafcf1e Update Makefile 2020-02-22 10:36:34 +01:00
Ray
81881a120c Comment tweak 2020-02-22 10:36:20 +01:00
Tyler Jessilynn Bezera
e7fdf8a13d Expand GLTF Model support (#1108)
* Update GLTF support to include loading color for albdeo (saved in the color value of the materialmap), support occlussion and emmission maps.. as well as some quality of life updates.

* clean up to use single image
2020-02-22 10:17:30 +01:00
Ray
a750bcceec Support links on WebAssembly 2020-02-21 01:13:41 +01:00
Ray
67d0bf75a7 Update Makefile paths to use emscripten upstream
Note that emscripten upstream branch implements the new asyncify implementation, expected to be faster than emterpreter one.
2020-02-20 23:00:29 +01:00
Ray
a8a21312e1 Removed TABS 2020-02-20 13:46:49 +01:00
Ray
42dad5df95 [rnet] Renamed some functions 2020-02-20 13:46:33 +01:00
Ray
e176a476c0 [rnet] Review network examples formatting 2020-02-20 12:42:37 +01:00
Ray
19390eaf09 [rnet] Examples review -WIP- 2020-02-19 18:16:20 +01:00
Ray
faff512140 [rnet] Convert to header-only
Some functions renamed
2020-02-19 18:15:59 +01:00
Ray
946a6cb280 Review mouse inputs 2020-02-19 12:44:57 +01:00
Ray
7d789763d6 Update API version 2020-02-19 12:35:30 +01:00
Ray
d62a2f793f Improved GetFPS() calculation for average 2020-02-19 12:20:15 +01:00
Ray
9eefcb7939 Update miniaudio.h 2020-02-19 12:19:41 +01:00
o3o
36bf8a60d8 Fix #1103 (#1104)
Fix 1102
2020-02-18 23:19:30 +01:00
Ray
6d1cdf25a7 [rnet] Review module formating
Align formating with other raylib modules coding style.
2020-02-18 18:15:22 +01:00
Ray
51db3b589d Review function name on RAUDIO_STANDALONE 2020-02-18 18:14:22 +01:00
Ray
b18940d3c6 Remove spaces 2020-02-18 18:03:28 +01:00
Ray
3f25c52a29 Some security checks in case music is not properly loaded 2020-02-18 16:30:52 +01:00
Ray
39e73ccc4d [text] TextLength() security check 2020-02-17 00:47:05 +01:00
Ray
df4b55d657 Comment fprintf() calls 2020-02-17 00:46:41 +01:00
Ray
80dbbef0f5 Update Notepad++ intellisense 2020-02-14 23:48:40 +01:00
Ray
23b75281ad Add function prototype 2020-02-14 23:10:02 +01:00
Ray
91b2dc2aa9 [raudio] ADDED: SetAudioStreamBufferSizeDefault()
There could be some cases where we need to define the internal audio buffer size, now it's possible.

RENAMED: InitAudioBuffer() to LoadAudioBuffer()
RENAMED: CloseAudioBuffer() to UnloadAudioBuffer()

Renamed some defines and reviewed some comments.
2020-02-14 17:13:37 +01:00
Ray
7459a5c6ef Remove "No Audio Buffer" traces 2020-02-14 11:44:50 +01:00
Ray
8820baf5cc Update miniaudio.h 2020-02-13 11:41:33 +01:00
Ray
3b3e163c48 [raudio] Corrected issue with OGG sound loading 2020-02-13 11:41:28 +01:00
Ray
83fb4613c1 Review some RPI issues 2020-02-13 00:13:56 +01:00
Ray
1b20182d33 Updated periodSize reference 2020-02-12 14:45:02 +01:00
Ray
7dfe42d6d0 Trace log comment review 2020-02-12 13:49:08 +01:00
Ray
55f0647213 [core] Avoid pixel bleeding issue on MSAA 2020-02-12 13:48:50 +01:00
Ray
484c6b360f Reviewed Cppcheck issues #1098 2020-02-12 13:16:18 +01:00
SasLuca
dec85f741a Fixed memory leaks in textures.c (#1097) 2020-02-11 22:25:27 +01:00
Ray
87d5b51256 REVIEWED: GetDirectoryPath()
Check if provided path is a full path containing system root letter: C:\
2020-02-11 19:12:49 +01:00
Ray
aa3b413390 SUPPORT_HALFBUSY_WAIT_LOOP 2020-02-11 19:01:29 +01:00
Ray
ee43a14f19 Update CHANGELOG 2020-02-11 16:52:52 +01:00
raysan5
64c23f8477 REVIEWED: VS2017.UWP project
It seems there is some problem on drawing... :(
2020-02-10 17:45:50 +01:00
raysan5
49145e90a2 Remove spacing 2020-02-10 13:16:34 +01:00
raysan5
28e12a6c6a [raudio] Update to latest miniaudio 0.10 2020-02-10 12:42:40 +01:00
raysan5
131132f17d Minor tweaks 2020-02-10 10:56:48 +01:00
raysan5
884e868e92 Review DEBUG trace log and custom allocators
Not exposing some data structures
2020-02-10 10:56:39 +01:00
raysan5
eb2483338f REVIEWED: Makefile, examples clean target #1087 2020-02-09 21:06:51 +01:00
raysan5
becd3c3831 REVIEWED: GenMeshCylinder(), solved issue #1088 2020-02-09 21:04:03 +01:00
raysan5
34fafb733f Corrected issue with toupper() usage 2020-02-09 16:11:32 +01:00
raysan5
90c129fd61 Review some libc dependency comments 2020-02-09 16:11:11 +01:00
raysan5
9922160ab4 Minor tweaks 2020-02-09 13:23:12 +01:00
Ray
1d324d5496 Update CHANGELOG 2020-02-07 18:02:09 +01:00
Ray
03c38396f3 Update CHANGELOG 2020-02-07 17:55:10 +01:00
Ray
85cecb2aae Update CHANGELOG for raylib 3.0 -WIP- 2020-02-07 17:39:29 +01:00
Ray
d15b93839b Update ROADMAP.md 2020-02-07 16:32:57 +01:00
Ray
b06497cad6 Update BINDINGS.md 2020-02-07 12:09:54 +01:00
Ray
f632e32100 Corrected typo 2020-02-07 12:09:34 +01:00
Ray
52a6d756f4 Added raylib-chibi binding 2020-02-07 12:09:05 +01:00
Ray
f4ca5b378a Review missing include 2020-02-06 18:10:52 +01:00
Ray
97054e4e0f Review ALL games to raylib 3.0 2020-02-06 18:07:25 +01:00
Ray
86bdf60887 Corrected issue with TextToUpper() and TextToLower()
This issue was breaking multiple things...
2020-02-06 17:52:33 +01:00
Ray
4b4f052fea Review game templates 2020-02-06 16:56:01 +01:00
Ray
2de92e3c07 Minor format tweaks 2020-02-06 16:44:04 +01:00
Ray
85e7856989 Update resource files 2020-02-06 16:37:38 +01:00
Ray
b4293edd70 Update GLFW to latest master 2020-02-06 16:30:48 +01:00
Ray
6c7685da3f Update external libraries 2020-02-06 16:29:57 +01:00
Ray
ea40bda88c Added func used in comments 2020-02-04 17:52:40 +01:00
Ray
1184db83f7 Review GetCurrentTime() 2020-02-04 17:06:08 +01:00
Ray
ca600b44a0 Update gestures.h 2020-02-04 17:02:06 +01:00
Ray
b5fe41f41a Review libc dependencies and remove when possible
Just for clarification, no plans to remove libc dependency, just did some code analysis to see how much raylib depend on stardard C library. My conclusions:

 - stdlib.h: primary dependency is for malloc() and free()
 - stdio.h: primary dependency is for FILE access, maybe it could go through a custom ABI?
 - string.h: just around 8 functions required
 - math.h: just around 8 functions required
 - others: 1-2 functions required for some other headers
2020-02-04 16:55:24 +01:00
Ray
3cd9e3896a tweak 2020-02-04 15:43:14 +01:00
David Reid
7024628c65 Update to miniaudio 0.10 (#1092)
* Update to miniaudio 0.10

This replaces the old ma_pcm_converter with ma_data_converter.

At this time of this commit, miniaudio 0.10 is still in the testing
phase. To make it easier to update miniaudio.h during this period, I've
temporarily moved the @raysan5 Win32 customizations to raudio.c because
there may be quite a few updates to miniaudio.h during this time.

* Use miniaudio's built-in volume control.
2020-02-04 13:43:31 +01:00
Ray
d2bb6185f1 Review issue with RLGL TraceLog() 2020-02-03 20:20:00 +01:00
Ray
c3f06b7470 Remove all trail spaces 2020-02-03 19:26:28 +01:00
Ray
a7afd8de99 Update rlgl.h 2020-02-03 19:25:05 +01:00
Ray
cde26c743c Replace TraceLog() function by TRACELOG macro
Added SUPPORT_TRACELOG_DEBUG config
2020-02-03 19:13:24 +01:00
Ray
40b73a8a91 Develop branch integration (#1091)
* [core] REDESIGNED: Implement global context

* [rlgl] REDESIGNED: Implement global context

* Reviewed globals for Android

* Review Android globals usage

* Update Android globals

* Bump raylib version to 3.0 !!!

* [raudio] REDESIGNED: Implement global context

* [raudio] Reorder functions

* [core] Tweaks on descriptions

* Issues with SUPPORT_MOUSE_GESTURES

* [camera] Use global context

* REDESIGN: Move shapes drawing texture/rec to RLGL context

* Review some issues on standalone mode

* Update to use global context

* [GAME] Upload RE-PAIR game from GGJ2020 -WIP-

* Update game: RE-PAIR

* [utils] TRACELOG macros proposal

* Update config.h
2020-02-03 18:31:30 +01:00
168 changed files with 23346 additions and 16779 deletions

27
.gitignore vendored
View File

@@ -30,6 +30,7 @@ Thumbs.db
*.cache
*.ilk
*.log
.vs
[Bb]in
[Dd]ebug/
@@ -54,7 +55,6 @@ packages/
*.a
*.bc
*.so
!raylib.rc.o
# Ignore all examples files
examples/*
@@ -76,7 +76,6 @@ games/*
!games/*/
# Unignore all games files with extension
!games/*.c
!games/*.lua
!games/*.png
# Unignore games makefile
!games/Makefile
@@ -96,22 +95,9 @@ xcschememanagement.plist
xcuserdata/
DerivedData/
# Visual Studio project
project/VS2015.UWP/packages
project/VS2017/packages
# 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
# Jetbrains project
.idea/
cmake-build-debug/
# CMake stuff
CMakeCache.txt
@@ -124,17 +110,12 @@ install_manifest.txt
compile_commands.json
CTestTestfile.cmake
build
!templates/android_project/Makefile
# Unignore These makefiles...
!examples/CMakeLists.txt
!games/CMakeLists.txt
# Ignore Android generated files and folders
templates/android_project/output
# Ignore GNU global tags
GPATH
GRTAGS
GTAGS
.vs

View File

@@ -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:
@@ -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-ffi | Lua | https://github.com/raysan5/raylib/issues/693 |
| 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://github.com/Skrylar/raylib-nim |
| 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 |
| cl-raylib | Common Lisp | https://github.com/longlene/cl-raylib |
| 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 |
| raylib-wren | Wren | https://github.com/TSnake41/raylib-wren |
| 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 |
| raylib-Ada | Ada | https://github.com/mimo/raylib-Ada |
| jaylib | Janet | https://github.com/janet-lang/jaylib |
| raykit | Kit | https://github.com/Gamerfiend/raykit |
| 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)* |
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
View File

@@ -1,7 +1,174 @@
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)

View File

@@ -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?
- 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?
- Web Development - Can you help [with the website](https://github.com/raysan5/raylib.com)?
- 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.
@@ -16,10 +16,10 @@ Use your best judgement, and feel free to propose changes to this document in a
### raylib philosophy
- 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 open source and free; educators and institutions can use this tool to TEACH videogames programming completely by free.
- 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 for free.
- 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
@@ -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,
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
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:
@@ -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
- [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!

View File

@@ -1,19 +1,19 @@
![raylib logo](logo/raylib_256x256.png)
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.
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.
@@ -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.
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.
@@ -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.
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.
@@ -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).
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.
@@ -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.
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,
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.
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.
@@ -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:
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.
@@ -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:
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...
@@ -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:
[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).
@@ -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:
**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).
@@ -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.
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.
`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.
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**.

View File

@@ -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)
[![Build Status](https://travis-ci.org/raysan5/raylib.svg?branch=master)](https://travis-ci.org/raysan5/raylib)
[![https://ci.appveyor.com/api/projects/status/github/raysan5/raylib?svg=true](https://ci.appveyor.com/api/projects/status/github/raysan5/raylib?svg=true)](https://ci.appveyor.com/project/raysan5/raylib)
[![Chat on Discord](https://img.shields.io/discord/426912293134270465.svg?logo=discord)](https://discord.gg/VkzNHUE)
<br>
[![GitHub contributors](https://img.shields.io/github/contributors/raysan5/raylib)](https://github.com/raysan5/raylib/graphs/contributors)
[![GitHub All Releases](https://img.shields.io/github/downloads/raysan5/raylib/total)](https://github.com/raysan5/raylib/releases)
[![GitHub commits since tagged version](https://img.shields.io/github/commits-since/raysan5/raylib/2.6.0)](https://github.com/raysan5/raylib/commits/master)
[![License](https://img.shields.io/badge/license-zlib%2Flibpng-blue.svg)](LICENSE)
[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Follow)](https://twitter.com/raysan5)
[![Chat on Discord](https://img.shields.io/discord/426912293134270465.svg?logo=discord)](https://discord.gg/VkzNHUE)
[![GitHub stars](https://img.shields.io/github/stars/raysan5/raylib?style=social)](https://github.com/raysan5/raylib/stargazers)
[![Twitter Follow](https://img.shields.io/twitter/follow/raysan5?style=social)](https://twitter.com/raysan5)
[![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/raylib?style=social)](https://www.reddit.com/r/raylib/)
[![Travis (.org)](https://img.shields.io/travis/raysan5/raylib?label=Travis%20CI%20Build%20Status%20-%20Linux,%20OSX,%20Android,%20Windows)](https://travis-ci.org/raysan5/raylib)
[![AppVeyor](https://img.shields.io/appveyor/build/raysan5/raylib?label=AppVeyor%20CI%20Build%20Status%20-%20Windows%20(mingw,%20msvc15))](https://ci.appveyor.com/project/raysan5/raylib)
[![Actions Status](https://github.com/raysan5/raylib/workflows/CI%20-%20Source%20&%20Examples%20-%20Windows/badge.svg)](https://github.com/raysan5/raylib/actions)
[![Actions Status](https://github.com/raysan5/raylib/workflows/CI%20-%20Source%20&%20Examples%20-%20Linux/badge.svg)](https://github.com/raysan5/raylib/actions)
@@ -21,46 +30,77 @@ Ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html)
features
--------
- **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
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3 or ES 2.0**)
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
- Multiple **Fonts** formats supported (XNA fonts, AngelCode fonts, TTF)
- Multiple **Fonts** formats supported (TTF, XNA fonts, AngelCode fonts)
- Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC)
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
- Flexible Materials system, supporting classic maps and **PBR maps**
- **Animated 3D models** supported (skeletal bones animation)
- 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)
- Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD)
- **VR stereo rendering** support with configurable HMD device parameters
- Huge examples collection with [+95 code examples](https://www.raylib.com/examples.html)!
- Bindings to [+25 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
- Huge examples collection with [+115 code examples](https://github.com/raysan5/raylib/tree/master/examples)!
- 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 [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 Web platform, raylib uses `emscripten` provided libraries for several input events management, specially noticeable the touch events support.*
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/)
* MinGW (GCC compiler) - [http://www.mingw.org](http://www.mingw.org/)
You can download and install raylib using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
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
-------
@@ -73,7 +113,7 @@ contact
* Patreon: [https://www.patreon.com/raylib](https://www.patreon.com/raylib)
* 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
-------

View File

@@ -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.
[raylib source code](https://github.com/raysan5/raylib/tree/master/src) has some *TODO* marks around code with pending things to review and improve.
Also, check [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details!
[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!
**raylib 2.x**
- [ ] rnet: raylib network module
- [ ] rres: raylib resource packer
- [ ] rlvk: raylib Vulkan API support (GRAPHICS_API_VULKAN)
- [ ] Basic CPU/GPU stats sytem (memory, draws, time...)
**raylib 3.x**
- [ ] Network module (UDP): `rnet` ([info](https://github.com/raysan5/raylib/issues/753))
- [ ] Custom raylib resource packer: `rres` ([info](https://github.com/raysan5/rres))
- [ ] Basic CPU/GPU stats system (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**
- [x] Support Animated models

View File

@@ -39,7 +39,7 @@ before_build:
- cd build
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
after_build:

View File

@@ -25,8 +25,8 @@
# Define required raylib variables
PROJECT_NAME ?= raylib_examples
RAYLIB_VERSION ?= 2.5.0
RAYLIB_API_VERSION ?= 2
RAYLIB_VERSION ?= 3.0.0
RAYLIB_API_VERSION ?= 3
RAYLIB_PATH ?= ..
# Define default options
@@ -116,9 +116,9 @@ 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
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
CLANG_PATH = $(EMSDK_PATH)/upstream/bin
PYTHON_PATH = $(EMSDK_PATH)/python/3.7.4_64bit
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
@@ -196,7 +196,7 @@ ifeq ($(BUILD_MODE),DEBUG)
endif
else
ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS += -Os
CFLAGS += -O3
else
CFLAGS += -s -O1
endif
@@ -205,11 +205,6 @@ endif
# Additional flags for compiler (if desired)
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
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 ($(RAYLIB_LIBTYPE),STATIC)
CFLAGS += -D_DEFAULT_SOURCE
@@ -238,7 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# --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 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,
# 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
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
@@ -453,7 +456,8 @@ SHADERS = \
shaders/shaders_eratosthenes \
shaders/shaders_basic_lighting \
shaders/shaders_fog \
shaders/shaders_simple_mask
shaders/shaders_simple_mask \
shaders/shaders_spotlight
AUDIO = \
audio/audio_module_playing \
@@ -500,7 +504,8 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
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
find . -type f -executable -delete
rm -fv *.o
endif
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete

View File

@@ -26,8 +26,10 @@ PLATFORM ?= PLATFORM_ANDROID
RAYLIB_PATH ?= ..\..
# 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_API_VERSION = 21
ANDROID_API_VERSION = 28
ifeq ($(ANDROID_ARCH),ARM)
ANDROID_ARCH_NAME = armeabi-v7a
endif
@@ -36,11 +38,11 @@ ifeq ($(ANDROID_ARCH),ARM64)
endif
# Required path variables
# NOTE: JAVA_HOME must be set to JDK
JAVA_HOME ?= C:/JavaJDK
# NOTE: JAVA_HOME must be set to JDK (using OpenJDK 13)
JAVA_HOME ?= C:/open-jdk
ANDROID_HOME = C:/android-sdk
ANDROID_TOOLCHAIN = C:/android_toolchain_$(ANDROID_ARCH)_API$(ANDROID_API_VERSION)
ANDROID_BUILD_TOOLS = $(ANDROID_HOME)/build-tools/28.0.1
ANDROID_TOOLCHAIN = C:/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64
ANDROID_BUILD_TOOLS = $(ANDROID_HOME)/build-tools/29.0.3
ANDROID_PLATFORM_TOOLS = $(ANDROID_HOME)/platform-tools
# Android project configuration variables
@@ -81,13 +83,12 @@ ifeq ($(RAYLIB_LIBTYPE),SHARED)
endif
# Compiler and archiver
# NOTE: GCC is being deprecated in Android NDK r16
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
endif
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
endif
@@ -274,7 +275,7 @@ zipalign_project_apk_package:
# Install $(PROJECT_NAME).apk to default emulator/device
# NOTE: Use -e (emulator) or -d (device) parameters if required
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_device_abi:

View File

@@ -4,18 +4,19 @@
*
* 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
*
* You can find all basic examples on C:\raylib\raylib\examples folder or
* raylib official webpage: www.raylib.com
* You can find all basic examples on [C:\raylib\raylib\examples] directory and
* raylib official webpage: [www.raylib.com]
*
* Enjoy using raylib. :)
*
* 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)
*
* Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
* Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
*
********************************************************************************************/

View File

@@ -12,7 +12,10 @@
#include "raylib.h"
// 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)
{
@@ -43,14 +46,14 @@ int main(void)
if (IsKeyPressed(KEY_ENTER))
{
StorageSaveValue(STORAGE_SCORE, score);
StorageSaveValue(STORAGE_HISCORE, hiscore);
SaveStorageValue(STORAGE_POSITION_SCORE, score);
SaveStorageValue(STORAGE_POSITION_HISCORE, hiscore);
}
else if (IsKeyPressed(KEY_SPACE))
{
// NOTE: If requested position could not be found, value 0 is returned
score = StorageLoadValue(STORAGE_SCORE);
hiscore = StorageLoadValue(STORAGE_HISCORE);
score = LoadStorageValue(STORAGE_POSITION_SCORE);
hiscore = LoadStorageValue(STORAGE_POSITION_HISCORE);
}
framesCounter++;

View File

@@ -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)
* 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 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)
{
const int windowWidth = 800;
@@ -52,6 +64,13 @@ int main(void)
// 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 };
}
// 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
@@ -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(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();
// Draw RenderTexture2D to window, properly scaled

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -37,7 +37,6 @@ int main(void)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.type = CAMERA_PERSPECTIVE; // Camera mode type
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
SetMaterialTexture(&model.materials[0], MAP_DIFFUSE, texture); // Set model material map texture

View File

@@ -2,6 +2,9 @@
*
* 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)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -15,7 +15,7 @@ in vec3 fragPosition;
uniform samplerCube environmentMap;
// Constant values
const float PI = 3.14159265359f;
const float PI = 3.14159265359;
// Output fragment color
out vec4 finalColor;
@@ -31,8 +31,8 @@ void main()
vec3 right = cross(up, normal);
up = cross(normal, right);
float sampleDelta = 0.025f;
float nrSamples = 0.0f;
float sampleDelta = 0.025;
float nrSamples = 0.0;
for (float phi = 0.0; phi < 2.0*PI; phi += sampleDelta)
{

View File

@@ -34,7 +34,7 @@ void main()
mat3 normalMatrix = transpose(inverse(mat3(matModel)));
// 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
fragTexCoord = vertexTexCoord;

View File

@@ -18,7 +18,7 @@ uniform samplerCube environmentMap;
uniform float roughness;
// Constant values
const float PI = 3.14159265359f;
const float PI = 3.14159265359;
// Output fragment color
out vec4 finalColor;

View File

@@ -2,78 +2,71 @@
*
* 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
*
* 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)
* Copyright (c) 2019-2020 Jak Barnes (@syphonx) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#include "rnet.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
#define RNET_IMPLEMENTATION
#include "rnet.h"
float elapsed = 0.0f;
float delay = 1.0f;
bool ping = false;
bool pong = false;
bool connected = false;
bool client_connected = false;
bool clientConnected = 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 client_cfg = {.host = "127.0.0.1", .port = "4950", .type = SOCKET_TCP, .nonblocking = true};
SocketConfig connection_cfg = {.nonblocking = true};
SocketResult *server_res = NULL;
SocketResult *client_res = NULL;
SocketSet * socket_set = NULL;
SocketConfig serverConfig = { .host = "127.0.0.1", .port = "4950", .type = SOCKET_TCP, .server = true, .nonblocking = true };
SocketConfig clientConfig = { .host = "127.0.0.1", .port = "4950", .type = SOCKET_TCP, .nonblocking = true };
SocketConfig connectionConfig = { .nonblocking = true };
SocketResult *serverResult = NULL;
SocketResult *clientResult = NULL;
SocketSet *socketSet = NULL;
Socket *connection = NULL;
char recvBuffer[512];
char receiveBuffer[512] = { 0 };
// 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 (server_cfg.type == SOCKET_UDP && client_cfg.type == SOCKET_UDP) {
if ((serverConfig.type == SOCKET_UDP) && (clientConfig.type == SOCKET_UDP))
{
ping = true;
connected = true;
} else {
}
else
{
// If the client is connected, run the server code to check for a connection
if (client_connected) {
int active = CheckSockets(socket_set, 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(server_res->socket, &connection_cfg)) != NULL) {
AddSocket(socket_set, connection);
ping = true;
if (clientConnected)
{
int active = CheckSockets(socketSet, 0);
if (active != 0) TraceLog(LOG_INFO, "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;
}
}
} else {
}
else
{
// Check if we're connected every _delay_ seconds
elapsed += GetFrameTime();
if (elapsed > delay) {
if (IsSocketConnected(client_res->socket)) {
client_connected = true;
}
if (elapsed > delay)
{
if (IsSocketConnected(clientResult->socket)) clientConnected = true;
elapsed = 0.0f;
}
}
@@ -82,144 +75,138 @@ void NetworkConnect()
// 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()
static void UpdateNetwork(void)
{
// 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);
}
// 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
// IsSocketReady, if the socket is ready, attempt to receive data from the socket
int bytesRecv = 0;
if (server_cfg.type == SOCKET_UDP && client_cfg.type == SOCKET_UDP) {
if (IsSocketReady(client_res->socket)) {
bytesRecv = SocketReceive(client_res->socket, recvBuffer, msglen);
}
if (IsSocketReady(server_res->socket)) {
bytesRecv = SocketReceive(server_res->socket, recvBuffer, msglen);
}
} else {
if (IsSocketReady(connection)) {
bytesRecv = SocketReceive(connection, recvBuffer, msglen);
}
if ((serverConfig.type == SOCKET_UDP) && (clientConfig.type == SOCKET_UDP))
{
if (IsSocketReady(clientResult->socket)) bytesRecv = SocketReceive(clientResult->socket, receiveBuffer, msglen);
if (IsSocketReady(serverResult->socket)) bytesRecv = SocketReceive(serverResult->socket, receiveBuffer, msglen);
}
else if (IsSocketReady(connection)) bytesRecv = SocketReceive(connection, receiveBuffer, 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; }
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) {
if (elapsed > delay)
{
if (ping)
{
ping = false;
if (server_cfg.type == SOCKET_UDP && client_cfg.type == SOCKET_UDP) {
SocketSend(client_res->socket, pingmsg, msglen);
} else {
SocketSend(client_res->socket, pingmsg, msglen);
if (serverConfig.type == SOCKET_UDP && clientConfig.type == SOCKET_UDP) SocketSend(clientResult->socket, pingmsg, msglen);
else SocketSend(clientResult->socket, pingmsg, msglen);
}
} else if (pong) {
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);
}
if (serverConfig.type == SOCKET_UDP && clientConfig.type == SOCKET_UDP) SocketSend(clientResult->socket, pongmsg, msglen);
else SocketSend(clientResult->socket, pongmsg, msglen);
}
elapsed = 0.0f;
}
}
int main()
int main(void)
{
// Setup
int screenWidth = 800;
int screenHeight = 450;
InitWindow(
screenWidth, screenHeight, "raylib [network] example - ping pong");
SetTargetFPS(60);
SetTraceLogLevel(LOG_DEBUG);
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
// Networking
InitNetwork();
InitWindow(screenWidth, screenHeight, "raylib [network] example - ping pong");
// 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);
InitNetworkDevice(); // Init network communications
// 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);
}
else
{
if (!SocketBind(&serverConfig, serverResult))
{
TraceLog(LOG_WARNING, "Failed to bind server: status %d, errno %d", serverResult->status, serverResult->socket->status);
}
else
{
if (!(serverConfig.type == SOCKET_UDP))
{
if (!SocketListen(&serverConfig, serverResult))
{
TraceLog(LOG_WARNING, "Failed to start listen server: status %d, errno %d", serverResult->status, serverResult->socket->status);
}
}
}
}
// 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);
} 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 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);
}
else
{
if (!(clientConfig.type == SOCKET_UDP))
{
if (!SocketConnect(&clientConfig, clientResult))
{
TraceLog(LOG_WARNING, "Failed to connect to server: status %d, errno %d", clientResult->status, clientResult->socket->status);
}
}
}
// Create & Add sockets to the socket set
socket_set = AllocSocketSet(3);
msglen = strlen(pingmsg) + 1;
memset(recvBuffer, '\0', sizeof(recvBuffer));
AddSocket(socket_set, server_res->socket);
AddSocket(socket_set, client_res->socket);
// Create and add sockets to the socket set
socketSet = LoadSocketSet(3);
AddSocket(socketSet, serverResult->socket);
AddSocket(socketSet, clientResult->socket);
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) {
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (connected) UpdateNetwork();
//else NetworkConnect();
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
if (connected) {
NetworkUpdate();
} else {
NetworkConnect();
}
// TODO: Draw relevant connection info
EndDrawing();
//----------------------------------------------------------------------------------
}
// Cleanup
CloseWindow();
// De-Initialization
//--------------------------------------------------------------------------------------
CloseNetworkDevice(); // Close network communication
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -2,79 +2,77 @@
*
* 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
*
* 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)
* Copyright (c) 2019-2020 Jak Barnes (@syphonx) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#define RNET_IMPLEMENTATION
#include "rnet.h"
char buffer[ADDRESS_IPV6_ADDRSTRLEN];
uint16_t port = 0;
int main()
int main(void)
{
// Setup
int screenWidth = 800;
int screenHeight = 450;
InitWindow(
screenWidth, screenHeight, "raylib [network] example - ping pong");
SetTargetFPS(60);
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
SetTraceLogLevel(LOG_DEBUG);
InitWindow(screenWidth, screenHeight, "raylib [network] example - resolve host");
// Networking
InitNetwork();
InitNetworkDevice(); // Init network communications
AddressInformation* addr = AllocAddressList(1);
int count = ResolveHost(
NULL,
"5210",
ADDRESS_TYPE_IPV4,
0 // Uncomment any of these flags
char buffer[ADDRESS_IPV6_ADDRSTRLEN];
unsigned short port = 0;
AddressInformation *address = LoadAddressList(1);
// Address info flags
// ADDRESS_INFO_NUMERICHOST // or try them in conjunction to
// ADDRESS_INFO_NUMERICSERV // specify custom behaviour from
// ADDRESS_INFO_DNS_ONLY // the function getaddrinfo()
// ADDRESS_INFO_ALL //
// ADDRESS_INFO_FQDN // e.g. ADDRESS_INFO_CANONNAME | ADDRESS_INFO_NUMERICSERV
,
addr
);
int count = ResolveHost(NULL, "5210", ADDRESS_TYPE_IPV4, 0, address);
if (count > 0)
{
GetAddressHostAndPort(addr[0], buffer, &port);
TraceLog(LOG_INFO, "Resolved to ip %s::%d\n", buffer, port);
GetAddressHostAndPort(address[0], 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
while (!WindowShouldClose())
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
// Clear
ClearBackground(RAYWHITE);
// End draw
// TODO: Draw relevant connection info
EndDrawing();
//----------------------------------------------------------------------------------
}
// Cleanup
CloseWindow();
// De-Initialization
//--------------------------------------------------------------------------------------
CloseNetworkDevice(); // Close network communication
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -2,150 +2,141 @@
*
* 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
*
* 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)
* Copyright (c) 2019-2020 Jak Barnes (@syphonx) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#define RNET_IMPLEMENTATION
#include "rnet.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [network] example - tcp client");
InitNetworkDevice(); // Init network communications
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()
bool ping = false;
bool pong = false;
float elapsed = 0.0f;
float delay = 1.0f;
bool connected = false;
SocketConfig clientConfig = {
.host = "127.0.0.1",
.port = "4950",
.type = SOCKET_TCP,
.nonblocking = true
};
SocketSet *socketSet = NULL;
SocketResult *clientResult = 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);
else
{
// Check if we're connected every _delay_ seconds
elapsed += GetFrameTime();
if (elapsed > delay) {
if (IsSocketConnected(client_res->socket)) { connected = true; }
elapsed = 0.0f;
if (!(clientConfig.type == SOCKET_UDP))
{
if (!SocketConnect(&clientConfig, clientResult)) TraceLog(LOG_WARNING, "Failed to connect to server: status %d, errno %d", clientResult->status, clientResult->socket->status);
}
}
// Create and add sockets to the socket set
socketSet = LoadSocketSet(1);
AddSocket(socketSet, clientResult->socket);
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (connected)
{
// 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
//
// 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
// 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(client_res->socket)) {
bytesRecv = SocketReceive(client_res->socket, recvBuffer, msglen);
}
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(recvBuffer, pingmsg) == 0) { pong = true; }
if (strcmp(recvBuffer, pongmsg) == 0) { ping = true; }
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) {
if (elapsed > delay)
{
if (ping)
{
ping = false;
SocketSend(client_res->socket, pingmsg, msglen);
} else if (pong) {
pong = false;
SocketSend(client_res->socket, pongmsg, msglen);
SocketSend(clientResult->socket, pingmsg, strlen(pingmsg) + 1);
}
else if (pong)
{
pong = false;
SocketSend(clientResult->socket, pongmsg, strlen(pingmsg) + 1);
}
elapsed = 0.0f;
}
}
int main()
else
{
// Setup
int screenWidth = 800;
int screenHeight = 450;
InitWindow(
screenWidth, screenHeight, "raylib [network] example - tcp 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);
} 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);
}
// Check if we're connected every delay seconds
elapsed += GetFrameTime();
if (elapsed > delay)
{
if (IsSocketConnected(clientResult->socket)) { connected = true; }
elapsed = 0.0f;
}
}
//----------------------------------------------------------------------------------
// Create & Add sockets to the socket set
socket_set = AllocSocketSet(1);
msglen = strlen(pingmsg) + 1;
memset(recvBuffer, '\0', sizeof(recvBuffer));
AddSocket(socket_set, client_res->socket);
// Main game loop
while (!WindowShouldClose()) {
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
if (connected) {
NetworkUpdate();
} else {
NetworkConnect();
}
// TODO: Draw relevant connection info
EndDrawing();
//----------------------------------------------------------------------------------
}
// Cleanup
CloseWindow();
// De-Initialization
//--------------------------------------------------------------------------------------
CloseNetworkDevice(); // Close network communication
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -2,164 +2,161 @@
*
* 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
*
* 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)
* Copyright (c) 2019-2020 Jak Barnes (@syphonx) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#define RNET_IMPLEMENTATION
#include "rnet.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [network] example - tcp server");
InitNetworkDevice(); // Init network communications
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;
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;
char recvBuffer[512];
SocketSet *socketSet = NULL;
SocketResult *serverResult = NULL;
char receiveBuffer[512] = { 0 };
// Attempt to connect to the network (Either TCP, or UDP)
void NetworkConnect()
// Create the server: getaddrinfo + socket + setsockopt + bind + listen
serverResult = LoadSocketResult();
if (!SocketCreate(&serverConfig, serverResult))
{
int active = CheckSockets(socket_set, 0);
if (active != 0) {
TraceLog(LOG_DEBUG,
"There are currently %d socket(s) with data to be processed.", active);
TraceLog(LOG_WARNING, "Failed to open server: status %d, errno %d", serverResult->status, serverResult->socket->status);
}
if (active > 0) {
if ((connection = SocketAccept(server_res->socket, &connection_cfg)) != NULL) {
AddSocket(socket_set, connection);
ping = true;
connected = true;
else
{
if (!SocketBind(&serverConfig, serverResult))
{
TraceLog(LOG_WARNING, "Failed to bind server: status %d, errno %d", serverResult->status, serverResult->socket->status);
}
else
{
if (!(serverConfig.type == SOCKET_UDP))
{
if (!SocketListen(&serverConfig, serverResult)) TraceLog(LOG_WARNING, "Failed to start listen server: status %d, errno %d", serverResult->status, serverResult->socket->status);
}
}
}
// Create and add sockets to the socket set
socketSet = LoadSocketSet(2);
AddSocket(socketSet, serverResult->socket);
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (connected)
{
// 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
//
// 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
// 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, recvBuffer, msglen);
}
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(recvBuffer, pingmsg) == 0) { pong = true; }
if (strcmp(recvBuffer, pongmsg) == 0) { ping = true; }
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) {
if (elapsed > delay)
{
if (ping)
{
ping = false;
SocketSend(connection, pingmsg, msglen);
} else if (pong) {
pong = false;
SocketSend(connection, pongmsg, msglen);
SocketSend(connection, pingmsg, strlen(pingmsg) + 1);
}
else if (pong)
{
pong = false;
SocketSend(connection, pongmsg, strlen(pingmsg) + 1);
}
elapsed = 0.0f;
}
}
int main()
else
{
// Setup
int screenWidth = 800;
int screenHeight = 450;
InitWindow(
screenWidth, screenHeight, "raylib [network] example - tcp server");
SetTargetFPS(60);
SetTraceLogLevel(LOG_DEBUG);
// 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);
// 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);
}
if (active > 0)
{
if ((connection = SocketAccept(serverResult->socket, &connectionConfig)) != NULL)
{
AddSocket(socketSet, connection);
connected = true;
ping = true;
}
}
}
//----------------------------------------------------------------------------------
// Create & Add sockets to the socket set
socket_set = AllocSocketSet(2);
msglen = strlen(pingmsg) + 1;
memset(recvBuffer, '\0', sizeof(recvBuffer));
AddSocket(socket_set, server_res->socket);
// Main game loop
while (!WindowShouldClose()) {
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
if (connected) {
NetworkUpdate();
} else {
NetworkConnect();
}
// TODO: Draw relevant connection info
EndDrawing();
//----------------------------------------------------------------------------------
}
// Cleanup
CloseWindow();
// De-Initialization
//--------------------------------------------------------------------------------------
CloseNetworkDevice(); // Close network communication
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -2,47 +2,38 @@
*
* 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
*
* 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)
* Copyright (c) 2019-2020 Jak Barnes (@syphonx) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#define RNET_IMPLEMENTATION
#include "rnet.h"
#include <assert.h>
void test_network_initialise()
{
assert(InitNetwork() == true);
assert(InitNetworkDevice() == true);
}
void test_socket_result()
{
SocketResult *result = AllocSocketResult();
SocketResult *result = LoadSocketResult();
assert(result != NULL);
FreeSocketResult(&result);
UnloadSocketResult(&result);
assert(result == NULL);
}
void test_socket()
{
Socket *socket = AllocSocket();
Socket *socket = LoadSocket();
assert(socket != NULL);
FreeSocket(&socket);
UnloadSocket(&socket);
assert(socket == NULL);
}
@@ -93,7 +84,7 @@ void test_resolve_host()
{
const char *address = "localhost";
const char *port = "80";
AddressInformation *addr = AllocAddressList(3);
AddressInformation *addr = LoadAddressList(3);
int count = ResolveHost(address, port, ADDRESS_TYPE_ANY, 0, addr);
assert(GetAddressFamily(addr[0]) == ADDRESS_TYPE_IPV6);
@@ -114,35 +105,60 @@ void test_address_list()
void test_socket_create()
{
SocketConfig server_cfg = { .host = "127.0.0.1", .port = "8080", .server = true, .nonblocking = true };
Socket * socket = AllocSocket();
SocketResult *server_res = AllocSocketResult();
SocketSet * socket_set = AllocSocketSet(1);
Socket *socket = LoadSocket();
SocketResult *server_res = LoadSocketResult();
SocketSet *socket_set = LoadSocketSet(1);
assert(SocketCreate(&server_cfg, server_res));
assert(AddSocket(socket_set, server_res->socket));
assert(SocketListen(&server_cfg, server_res));
}
int main()
int main(void)
{
int screenWidth = 800;
int screenHeight = 450;
InitWindow(
screenWidth, screenHeight, "raylib [network] example - network test");
SetTargetFPS(60);
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
// Run the tests
test_network_initialise();
InitWindow(screenWidth, screenHeight, "raylib [network] example - network test");
InitNetworkDevice(); // Init network communications
// Run some tests
test_resolve_host();
//test_socket_create();
//test_resolve_ip();
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) {
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
// TODO: Draw relevant connection info
EndDrawing();
//----------------------------------------------------------------------------------
}
CloseWindow();
// De-Initialization
//--------------------------------------------------------------------------------------
CloseNetworkDevice(); // Close network communication
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -2,127 +2,123 @@
*
* 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
*
* 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)
* Copyright (c) 2019-2020 Jak Barnes (@syphonx) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#define RNET_IMPLEMENTATION
#include "rnet.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [network] example - udp client");
InitNetworkDevice(); // Init network communications
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()
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))
{
// 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);
TraceLog(LOG_WARNING, "Failed to open client: status %d, errno %d", clientResult->status, clientResult->socket->status);
}
// IsSocketReady
//
// 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);
}
// Create and add sockets to the socket set
socketSet = LoadSocketSet(1);
AddSocket(socketSet, clientResult->socket);
// 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(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);
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) {
BeginDrawing();
ClearBackground(RAYWHITE);
NetworkUpdate();
EndDrawing();
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; }
}
// Cleanup
CloseWindow();
// 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();
ClearBackground(RAYWHITE);
// TODO: Draw relevant connection info
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseNetworkDevice(); // Close network communication
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -2,133 +2,127 @@
*
* 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
*
* 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)
* Copyright (c) 2019-2020 Jak Barnes (@syphonx) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#define RNET_IMPLEMENTATION
#include "rnet.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [network] example - udp server");
InitNetworkDevice(); // Init network communications
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
//
// 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);
}
bool ping = false;
bool pong = false;
float elapsed = 0.0f;
float delay = 1.0f;
// IsSocketReady
//
// 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);
SocketConfig serverConfig = {
.host = "127.0.0.1",
.port = "4950",
.server = true,
.type = SOCKET_UDP,
.nonblocking = true
};
// 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; }
}
SocketResult *serverResult = NULL;
SocketSet *socketSet = NULL;
char receiveBuffer[512] = { 0 };
// 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(server_res->socket, pingmsg, msglen);
} else if (pong) {
pong = false;
SocketSend(server_res->socket, pongmsg, msglen);
}
elapsed = 0.0f;
}
}
// Create the server: getaddrinfo + socket + setsockopt + bind + listen
serverResult = LoadSocketResult();
int main()
{
// Setup
int screenWidth = 800;
int screenHeight = 450;
InitWindow(
screenWidth, screenHeight, "raylib [network] example - udp server");
SetTargetFPS(60);
SetTraceLogLevel(LOG_DEBUG);
if (!SocketCreate(&serverConfig, serverResult)) TraceLog(LOG_WARNING, "Failed to open server: status %d, errno %d", serverResult->status, serverResult->socket->status);
else if (!SocketBind(&serverConfig, serverResult)) TraceLog(LOG_WARNING, "Failed to bind server: status %d, errno %d", serverResult->status, serverResult->socket->status);
// Networking
InitNetwork();
// Create and add sockets to the socket set
socketSet = LoadSocketSet(1);
AddSocket(socketSet, serverResult->socket);
// 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);
}
}
// Create & Add sockets to the socket set
socket_set = AllocSocketSet(1);
msglen = strlen(pingmsg) + 1;
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
while (!WindowShouldClose()) {
BeginDrawing();
ClearBackground(RAYWHITE);
NetworkUpdate();
EndDrawing();
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; }
}
// Cleanup
CloseWindow();
// 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();
ClearBackground(RAYWHITE);
// TODO: Draw relevant connection info
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseNetworkDevice(); // Close network communication
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -45,14 +45,17 @@
#define RLGL_IMPLEMENTATION
#define RLGL_STANDALONE
#define RLGL_SUPPORT_TRACELOG
#include "rlgl.h" // OpenGL 1.1 immediate-mode style coding
#ifdef __EMSCRIPTEN__
#if defined(__EMSCRIPTEN__)
#define GLFW_INCLUDE_ES2
#endif
#include <GLFW/glfw3.h> // Windows/Context and inputs management
#include <stdio.h> // Required for: printf()
#define RED (Color){ 230, 41, 55, 255 } // Red
#define RAYWHITE (Color){ 245, 245, 245, 255 } // My own White (raylib logo)
#define DARKGRAY (Color){ 80, 80, 80, 255 } // Dark Gray
@@ -85,10 +88,10 @@ int main(void)
if (!glfwInit())
{
TraceLog(LOG_WARNING, "GLFW3: Can not initialize GLFW");
printf("GLFW3: Can not initialize GLFW\n");
return 1;
}
else TraceLog(LOG_INFO, "GLFW3: GLFW initialized successfully");
else printf("GLFW3: GLFW initialized successfully\n");
glfwWindowHint(GLFW_SAMPLES, 4);
glfwWindowHint(GLFW_DEPTH_BITS, 16);
@@ -104,7 +107,7 @@ int main(void)
glfwTerminate();
return 2;
}
else TraceLog(LOG_INFO, "GLFW3: Window created successfully");
else printf("GLFW3: Window created successfully\n");
glfwSetWindowPos(window, 200, 200);
@@ -216,7 +219,7 @@ int main(void)
// GLFW3: Error callback
static void ErrorCallback(int error, const char *description)
{
TraceLog(LOG_ERROR, description);
fprintf(stderr, description);
}
// GLFW3: Keyboard callback

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -11,7 +11,6 @@ uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
uniform vec2 resolution = vec2(800, 450);
void main()
{

View 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);
}

View 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);
}

View 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));
}

View 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;
}

View 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);
}

View 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);
}

View 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);
}

View File

@@ -21,7 +21,7 @@ out vec3 fragNormal;
void main()
{
// Send vertex attributes to fragment shader
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0f));
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
fragTexCoord = vertexTexCoord;
fragColor = vertexColor;

View File

@@ -55,20 +55,16 @@ void main()
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);
}
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);//16 =shine
if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewD, reflect(-(light), normal))), 16.0); // Shine: 16.0
specular += specCo;
}
}

View File

@@ -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);
}

View File

@@ -69,7 +69,7 @@ void main()
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); // 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;
}
}

View File

@@ -2,6 +2,7 @@
// Input vertex attributes (from vertex shader)
in vec2 fragTexCoord;
in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;

View File

@@ -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);
}

View 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);
}

View File

@@ -68,17 +68,11 @@ typedef enum {
extern "C" { // Prevents name mangling of functions
#endif
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
int lightsCount = 0; // Current amount of created lights
//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
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 InitLightLocations(Shader shader, Light *light); // Init light shader locations
#ifdef __cplusplus
}
@@ -110,7 +104,7 @@ void UpdateLightValues(Shader shader, Light light); // Send light proper
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
// ...
static int lightsCount = 0; // Current amount of created lights
//----------------------------------------------------------------------------------
// 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 targetName[32] = "lights[x].target\0";
char colorName[32] = "lights[x].color\0";
// Set location name [x] depending on lights count
enabledName[7] = '0' + lightsCount;
typeName[7] = '0' + lightsCount;
posName[7] = '0' + lightsCount;

View File

@@ -69,8 +69,8 @@ int main(void)
modelB.materials[0].maps[MAP_DIFFUSE].texture = texture;
modelC.materials[0].maps[MAP_DIFFUSE].texture = texture;
Shader shader = LoadShader("resources/shaders/glsl330/basic_lighting.vs",
"resources/shaders/glsl330/basic_lighting.fs");
Shader shader = LoadShader(FormatText("resources/shaders/glsl%i/base_lighting.vs", GLSL_VERSION),
FormatText("resources/shaders/glsl%i/lighting.fs", GLSL_VERSION));
// Get some shader loactions
shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel");
@@ -112,7 +112,7 @@ int main(void)
UpdateCamera(&camera); // Update camera
// Make the lights do differing orbits
angle -= 0.02;
angle -= 0.02f;
lights[0].position.x = cosf(angle)*4.0f;
lights[0].position.z = sinf(angle)*4.0f;
lights[1].position.x = cosf(-angle*0.6f)*4.0f;
@@ -128,8 +128,8 @@ int main(void)
UpdateLightValues(shader, lights[3]);
// Rotate the torus
modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateX(-0.025));
modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateZ(0.012));
modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateX(-0.025f));
modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateZ(0.012f));
// Update the light shader with the camera view position
float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z };
@@ -161,7 +161,7 @@ int main(void)
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();
//----------------------------------------------------------------------------------

View File

@@ -32,6 +32,12 @@
#define RLIGHTS_IMPLEMENTATION
#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)
{
// Initialization
@@ -61,7 +67,8 @@ int main(void)
modelC.materials[0].maps[MAP_DIFFUSE].texture = texture;
// 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_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos");

View File

@@ -2,12 +2,8 @@
*
* raylib [shaders] example - Raymarching shapes generation
*
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
*
* 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
* 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 2.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
@@ -20,7 +16,7 @@
#if defined(PLATFORM_DESKTOP)
#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
#endif

View File

@@ -21,6 +21,12 @@
#include "raylib.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)
{
// Initialization
@@ -50,7 +56,7 @@ int main(void)
Model model3 = LoadModelFromMesh(sphere);
// 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)
Texture texDiffuse = LoadTexture("resources/plasma.png");
@@ -66,7 +72,7 @@ int main(void)
shader.locs[LOC_MAP_EMISSION] = GetShaderLocation(shader, "mask");
// 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
model1.materials[0].shader = shader;

View 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);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

View File

@@ -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);
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
// Load custom font for frawing on image

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 KiB

After

Width:  |  Height:  |  Size: 234 KiB

View File

@@ -106,7 +106,7 @@ int main(void)
EndTextureMode();
}
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON) || (GetGestureDetected() == GESTURE_DRAG))
{
// Paint circle into render texture
// NOTE: To avoid discontinuous circles, we could store
@@ -166,7 +166,7 @@ int main(void)
// Draw drawing circle for reference
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]);
}

View File

@@ -2,7 +2,7 @@
#
# 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
# will the authors be held liable for any damages arising from the use of this software.
@@ -25,8 +25,8 @@
# Define required raylib variables
PROJECT_NAME ?= raylib_examples
RAYLIB_VERSION ?= 2.5.0
RAYLIB_API_VERSION ?= 2
RAYLIB_VERSION ?= 3.0.0
RAYLIB_API_VERSION ?= 3
RAYLIB_PATH ?= ..
# Define default options
@@ -115,13 +115,12 @@ endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables
EMSDK_PATH ?= D:/emsdk
EMSCRIPTEN_VERSION ?= 1.38.31
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
NODE_VERSION = 8.9.1_64bit
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)
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
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.
@@ -188,10 +187,19 @@ endif
# -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 += -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)
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)
@@ -200,7 +208,10 @@ 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
CFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
ifeq ($(BUILD_MODE), RELEASE)
CFLAGS += -Wl,--subsystem,windows
endif
endif
ifeq ($(PLATFORM_OS),LINUX)
ifeq ($(RAYLIB_LIBTYPE),STATIC)
@@ -230,10 +241,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# --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 += -Os -s USE_GLFW=3
ifeq ($(BUILD_MODE), DEBUG)
CFLAGS += -s ASSERTIONS=1 --profiling
endif
CFLAGS += -s USE_GLFW=3
# Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling
# 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
ifeq ($(PLATFORM_OS),BSD)
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
@@ -372,7 +380,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
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' | 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
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete

View File

@@ -2,7 +2,7 @@
#
# 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
# will the authors be held liable for any damages arising from the use of this software.
@@ -25,8 +25,8 @@
# Define required raylib variables
PROJECT_NAME ?= roomba
RAYLIB_VERSION ?= 2.5.0
RAYLIB_API_VERSION ?= 2
RAYLIB_VERSION ?= 3.0.0
RAYLIB_API_VERSION ?= 3
RAYLIB_PATH ?= C:\GitHub\raylib
# Define default options
@@ -116,12 +116,11 @@ endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables
EMSDK_PATH ?= C:/emsdk
EMSCRIPTEN_VERSION ?= 1.38.31
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
NODE_VERSION = 8.9.1_64bit
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)
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
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.
@@ -188,20 +187,24 @@ endif
# -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 += -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)
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),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 ($(RAYLIB_LIBTYPE),STATIC)
CFLAGS += -D_DEFAULT_SOURCE
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# --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 += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=16777216 --preload-file resources
ifeq ($(BUILD_MODE), DEBUG)
CFLAGS += -s ASSERTIONS=1 --profiling
endif
CFLAGS += -s USE_GLFW=3 -s TOTAL_MEMORY=16777216 --preload-file resources
# Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
@@ -267,6 +267,14 @@ endif
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
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# NOTE: WinMM library required to set high-res timer resolution
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
# Required for physac examples
#LDLIBS += -static -lpthread
LDLIBS += -static -lpthread
endif
ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling
# 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
ifeq ($(PLATFORM_OS),BSD)
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
@@ -380,7 +388,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
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' | 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
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete

View File

@@ -19,6 +19,11 @@
#include <emscripten/emscripten.h>
#endif
GameScreen currentScreen = 0;
Font font = { 0 };
Font font2 = { 0 };
Music music = { 0 };
Sound fxCoin = { 0 };
//----------------------------------------------------------------------------------
// Global Variables Definition (local to this module)
//----------------------------------------------------------------------------------

View File

@@ -36,11 +36,11 @@ typedef enum GameScreen { LOGO = 0, TITLE, OPTIONS, GAMEPLAY, ENDING } GameScree
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
GameScreen currentScreen;
Font font;
Font font2;
Music music;
Sound fxCoin;
extern GameScreen currentScreen;
extern Font font;
extern Font font2;
extern Music music;
extern Sound fxCoin;
int score;
int result; // 0-Loose, 1-Win

View File

@@ -2,7 +2,7 @@
#
# 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
# will the authors be held liable for any damages arising from the use of this software.
@@ -25,8 +25,8 @@
# Define required raylib variables
PROJECT_NAME ?= drturtle
RAYLIB_VERSION ?= 2.5.0
RAYLIB_API_VERSION ?= 2
RAYLIB_VERSION ?= 3.0.0
RAYLIB_API_VERSION ?= 3
RAYLIB_PATH ?= C:\GitHub\raylib
# Define default options
@@ -116,12 +116,11 @@ endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables
EMSDK_PATH ?= C:/emsdk
EMSCRIPTEN_VERSION ?= 1.38.32
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
NODE_VERSION = 8.9.1_64bit
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)
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
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.
@@ -188,20 +187,24 @@ endif
# -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 += -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)
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),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 ($(RAYLIB_LIBTYPE),STATIC)
CFLAGS += -D_DEFAULT_SOURCE
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# --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 += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
ifeq ($(BUILD_MODE), DEBUG)
CFLAGS += -s ASSERTIONS=1 --profiling
endif
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
@@ -267,6 +267,14 @@ endif
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
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# NOTE: WinMM library required to set high-res timer resolution
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
# Required for physac examples
#LDLIBS += -static -lpthread
LDLIBS += -static -lpthread
endif
ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling
# 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
ifeq ($(PLATFORM_OS),BSD)
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
@@ -359,7 +367,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
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' | 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
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete

View File

@@ -2,7 +2,7 @@
#
# 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
# will the authors be held liable for any damages arising from the use of this software.
@@ -25,8 +25,8 @@
# Define required raylib variables
PROJECT_NAME ?= just_do
RAYLIB_VERSION ?= 2.5.0
RAYLIB_API_VERSION ?= 2
RAYLIB_VERSION ?= 3.0.0
RAYLIB_API_VERSION ?= 3
RAYLIB_PATH ?= C:\GitHub\raylib
# Define default options
@@ -116,12 +116,11 @@ endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables
EMSDK_PATH ?= C:/emsdk
EMSCRIPTEN_VERSION ?= 1.38.31
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
NODE_VERSION = 8.9.1_64bit
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)
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
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.
@@ -188,20 +187,24 @@ endif
# -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 += -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)
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),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 ($(RAYLIB_LIBTYPE),STATIC)
CFLAGS += -D_DEFAULT_SOURCE
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# --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 += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=16777216 --preload-file resources
ifeq ($(BUILD_MODE), DEBUG)
CFLAGS += -s ASSERTIONS=1 --profiling
endif
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
@@ -267,6 +267,14 @@ endif
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
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# NOTE: WinMM library required to set high-res timer resolution
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
# Required for physac examples
#LDLIBS += -static -lpthread
LDLIBS += -static -lpthread
endif
ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling
# 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
ifeq ($(PLATFORM_OS),BSD)
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
@@ -387,7 +395,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
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' | 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
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete

View File

@@ -2,7 +2,7 @@
#
# 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
# will the authors be held liable for any damages arising from the use of this software.
@@ -25,8 +25,8 @@
# Define required raylib variables
PROJECT_NAME ?= koala_seasons
RAYLIB_VERSION ?= 2.5.0
RAYLIB_API_VERSION ?= 2
RAYLIB_VERSION ?= 3.0.0
RAYLIB_API_VERSION ?= 3
RAYLIB_PATH ?= C:\GitHub\raylib
# Define default options
@@ -116,12 +116,11 @@ endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables
EMSDK_PATH ?= C:/emsdk
EMSCRIPTEN_VERSION ?= 1.38.32
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
NODE_VERSION = 8.9.1_64bit
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)
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
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.
@@ -188,20 +187,24 @@ endif
# -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 += -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)
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),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 ($(RAYLIB_LIBTYPE),STATIC)
CFLAGS += -D_DEFAULT_SOURCE
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# --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 += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
ifeq ($(BUILD_MODE), DEBUG)
CFLAGS += -s ASSERTIONS=1 --profiling
endif
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
@@ -267,6 +267,14 @@ endif
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
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# NOTE: WinMM library required to set high-res timer resolution
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
# Required for physac examples
#LDLIBS += -static -lpthread
LDLIBS += -static -lpthread
endif
ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling
# 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
ifeq ($(PLATFORM_OS),BSD)
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
@@ -380,7 +388,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
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' | 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
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete

View File

@@ -2,7 +2,7 @@
#
# 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
# will the authors be held liable for any damages arising from the use of this software.
@@ -25,8 +25,8 @@
# Define required raylib variables
PROJECT_NAME ?= light_my_ritual
RAYLIB_VERSION ?= 2.5.0
RAYLIB_API_VERSION ?= 2
RAYLIB_VERSION ?= 3.0.0
RAYLIB_API_VERSION ?= 3
RAYLIB_PATH ?= C:\GitHub\raylib
# Define default options
@@ -116,12 +116,11 @@ endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables
EMSDK_PATH ?= C:/emsdk
EMSCRIPTEN_VERSION ?= 1.38.32
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
NODE_VERSION = 8.9.1_64bit
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)
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
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.
@@ -188,20 +187,24 @@ endif
# -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 += -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)
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),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 ($(RAYLIB_LIBTYPE),STATIC)
CFLAGS += -D_DEFAULT_SOURCE
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# --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 += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
ifeq ($(BUILD_MODE), DEBUG)
CFLAGS += -s ASSERTIONS=1 --profiling
endif
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
@@ -267,6 +267,14 @@ endif
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
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# NOTE: WinMM library required to set high-res timer resolution
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
# Required for physac examples
#LDLIBS += -static -lpthread
LDLIBS += -static -lpthread
endif
ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling
# 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
ifeq ($(PLATFORM_OS),BSD)
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
@@ -379,7 +387,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
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' | 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
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete

20
games/repair/LICENSE.txt Normal file
View 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
View 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
View 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();
//----------------------------------------------------------------------------------
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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

View File

@@ -2,7 +2,7 @@
#
# 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
# will the authors be held liable for any damages arising from the use of this software.
@@ -25,8 +25,8 @@
# Define required raylib variables
PROJECT_NAME ?= skully_escape
RAYLIB_VERSION ?= 2.5.0
RAYLIB_API_VERSION ?= 2
RAYLIB_VERSION ?= 3.0.0
RAYLIB_API_VERSION ?= 3
RAYLIB_PATH ?= C:\GitHub\raylib
# Define default options
@@ -116,12 +116,11 @@ endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables
EMSDK_PATH ?= C:/emsdk
EMSCRIPTEN_VERSION ?= 1.38.32
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
NODE_VERSION = 8.9.1_64bit
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)
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
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.
@@ -188,20 +187,24 @@ endif
# -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 += -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)
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),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 ($(RAYLIB_LIBTYPE),STATIC)
CFLAGS += -D_DEFAULT_SOURCE
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# --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 += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
ifeq ($(BUILD_MODE), DEBUG)
CFLAGS += -s ASSERTIONS=1 --profiling
endif
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
@@ -267,6 +267,14 @@ endif
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
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# NOTE: WinMM library required to set high-res timer resolution
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
# Required for physac examples
#LDLIBS += -static -lpthread
LDLIBS += -static -lpthread
endif
ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling
# 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
ifeq ($(PLATFORM_OS),BSD)
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
@@ -389,7 +397,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
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' | 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
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete

View File

@@ -2,7 +2,7 @@
#
# 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
# will the authors be held liable for any damages arising from the use of this software.
@@ -25,8 +25,8 @@
# Define required raylib variables
PROJECT_NAME ?= transmission
RAYLIB_VERSION ?= 2.5.0
RAYLIB_API_VERSION ?= 2
RAYLIB_VERSION ?= 3.0.0
RAYLIB_API_VERSION ?= 3
RAYLIB_PATH ?= C:\GitHub\raylib
# Define default options
@@ -116,12 +116,11 @@ endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables
EMSDK_PATH ?= C:/emsdk
EMSCRIPTEN_VERSION ?= 1.38.32
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
NODE_VERSION = 8.9.1_64bit
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)
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
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.
@@ -188,20 +187,24 @@ endif
# -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 += -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)
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),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 ($(RAYLIB_LIBTYPE),STATIC)
CFLAGS += -D_DEFAULT_SOURCE
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# --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 += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
ifeq ($(BUILD_MODE), DEBUG)
CFLAGS += -s ASSERTIONS=1 --profiling
endif
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
@@ -267,6 +267,14 @@ endif
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
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# NOTE: WinMM library required to set high-res timer resolution
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
# Required for physac examples
#LDLIBS += -static -lpthread
LDLIBS += -static -lpthread
endif
ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling
# 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
ifeq ($(PLATFORM_OS),BSD)
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
@@ -381,7 +389,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
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' | 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
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete

View File

@@ -2,7 +2,7 @@
#
# 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
# will the authors be held liable for any damages arising from the use of this software.
@@ -25,8 +25,8 @@
# Define required raylib variables
PROJECT_NAME ?= wave_collector
RAYLIB_VERSION ?= 2.5.0
RAYLIB_API_VERSION ?= 2
RAYLIB_VERSION ?= 3.0.0
RAYLIB_API_VERSION ?= 3
RAYLIB_PATH ?= C:\GitHub\raylib
# Define default options
@@ -116,12 +116,11 @@ endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables
EMSDK_PATH ?= C:/emsdk
EMSCRIPTEN_VERSION ?= 1.38.32
CLANG_VERSION = e$(EMSCRIPTEN_VERSION)_64bit
PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64
NODE_VERSION = 8.9.1_64bit
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)
EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
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.
@@ -188,20 +187,24 @@ endif
# -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 += -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)
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),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 ($(RAYLIB_LIBTYPE),STATIC)
CFLAGS += -D_DEFAULT_SOURCE
@@ -230,10 +233,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# --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 += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources
ifeq ($(BUILD_MODE), DEBUG)
CFLAGS += -s ASSERTIONS=1 --profiling
endif
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
@@ -267,6 +267,14 @@ endif
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
@@ -290,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# NOTE: WinMM library required to set high-res timer resolution
LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
# Required for physac examples
#LDLIBS += -static -lpthread
LDLIBS += -static -lpthread
endif
ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling
@@ -314,7 +322,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling
# 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
ifeq ($(PLATFORM_OS),BSD)
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
@@ -380,7 +388,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
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' | 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
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete

View File

@@ -982,12 +982,93 @@
</KeyWord>
<KeyWord name="ImageDrawRectangle" func="yes">
<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="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="Color color" />
</Overload>
</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">
<Overload retVal="void" descr="Draw text (default font) within an image (destination)">
<Param name="Image *dst" />

View File

@@ -102,6 +102,9 @@
<Param name="int monitor" />
</Overload>
</KeyWord>
<KeyWord name="GetWindowPosition" func="yes">
<Overload retVal="Vector2" descr="Get window position XY on monitor"></Overload>
</KeyWord>
<KeyWord name="GetMonitorName" func="yes">
<Overload retVal="const char" descr="Get the human-readable, UTF-8 encoded name of the primary monitor">
<Param name="int monitor" />
@@ -169,6 +172,17 @@
<KeyWord name="EndTextureMode" func="yes">
<Overload retVal="void" descr="Ends drawing to render texture"></Overload>
</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 -->
<KeyWord name="GetMouseRay" func="yes">
@@ -177,15 +191,40 @@
<Param name="Camera camera" />
</Overload>
</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">
<Overload retVal="Vector2" descr="Returns the screen space position for a 3d world space position">
<Param name="Vector3 position" />
<Param name="Camera camera" />
</Overload>
</KeyWord>
<KeyWord name="GetCameraMatrix" func="yes">
<Overload retVal="Matrix" descr="Returns camera transform matrix (view matrix)">
<KeyWord name="GetWorldToScreenEx" func="yes">
<Overload retVal="Vector2" descr="Returns size position for a 3d world space position">
<Param name="Vector3 position" />
<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>
</KeyWord>
@@ -216,6 +255,11 @@
<Param name="Color color" />
</Overload>
</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">
<Overload retVal="Vector3" descr="Returns HSV values for a Color">
<Param name="Color color" />
@@ -241,7 +285,7 @@
<!-- Misc. functions -->
<KeyWord name="SetConfigFlags" func="yes">
<Overload retVal="void" descr="Setup window configuration flags (view FLAGS)">
<Param name="unsigned char flags" />
<Param name="unsigned int flags" />
</Overload>
</KeyWord>
<KeyWord name="SetTraceLogLevel" func="yes">
@@ -290,6 +334,11 @@
<Param name="const char *ext" />
</Overload>
</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">
<Overload retVal="const char" descr="Get pointer to extension for a filename string">
<Param name="const char *fileName" />
@@ -301,13 +350,18 @@
</Overload>
</KeyWord>
<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" />
</Overload>
</KeyWord>
<KeyWord name="GetDirectoryPath" func="yes">
<Overload retVal="const char" descr="Get full path for a given fileName (uses static string)">
<Param name="const char *fileName" />
<Overload retVal="const char" descr="Get full path for a given fileName with path (uses static string)">
<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>
</KeyWord>
<KeyWord name="GetWorkingDirectory" func="yes">
@@ -344,6 +398,21 @@
</Overload>
</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 -->
<KeyWord name="StorageSaveValue" func="yes">
<Overload retVal="void" descr="Save integer value to storage file (to defined position)">
@@ -703,6 +772,24 @@
<Param name="Color color" />
</Overload>
</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">
<Overload retVal="void" descr="Draw ring">
<Param name="Vector2 center" />
@@ -818,7 +905,7 @@
</Overload>
</KeyWord>
<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 v2" />
<Param name="Vector2 v3" />
@@ -826,7 +913,7 @@
</Overload>
</KeyWord>
<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 v2" />
<Param name="Vector2 v3" />
@@ -834,12 +921,19 @@
</Overload>
</KeyWord>
<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="int numPoints" />
<Param name="Color color" />
</Overload>
</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">
<Overload retVal="void" descr="Draw a regular polygon (Vector version)">
<Param name="Vector2 center" />
@@ -849,11 +943,13 @@
<Param name="Color color" />
</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" />
<KeyWord name="DrawPolyLines" func="yes">
<Overload retVal="void" descr="Draw a polygon outline of n sides">
<Param name="Vector2 center" />
<Param name="int sides" />
<Param name="float radius" />
<Param name="float rotation" />
<Param name="Color color" />
</Overload>
</KeyWord>
@@ -995,6 +1091,12 @@
<Param name="Image image" />
</Overload>
</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">
<Overload retVal="int" descr="Get pixel data size in bytes (image or texture)">
<Param name="int width" />
@@ -1023,6 +1125,12 @@
<Param name="Image image" />
</Overload>
</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">
<Overload retVal="void" descr="Convert image to POT (power-of-two)">
<Param name="Image *image" />
@@ -1127,11 +1235,12 @@
</Overload>
</KeyWord>
<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 src" />
<Param name="Rectangle srcRec" />
<Param name="Rectangle dstRec" />
<Param name="Color tint" />
</Overload>
</KeyWord>
<KeyWord name="ImageDrawRectangle" func="yes">
@@ -1413,7 +1522,8 @@
</KeyWord>
<KeyWord name="GenImageFontAtlas" func="yes">
<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 fontSize" />
<Param name="int padding" />
@@ -1463,17 +1573,14 @@
<Param name="Color tint" />
</Overload>
</KeyWord>
<KeyWord name="DrawTextRecEx" func="yes">
<Overload retVal="void" descr="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 -->
<KeyWord name="DrawTextCodepoint" func="yes">
<Overload retVal="void" descr="Draw one character (codepoint)">
<Param name="Font font" />
<Param name="const char *text" />
<Param name="Rectangle rec" />
<Param name="float fontSize" />
<Param name="float spacing" />
<Param name="bool wordWrap" />
<Param name="int codepoint" />
<Param name="Vector2 position" />
<Param name="float scale" />
<Param name="Color tint" />
<Param name="int selectStart" />
<Param name="int selecFont" />
</Overload>
</KeyWord>
@@ -1495,18 +1602,18 @@
<KeyWord name="GetGlyphIndex" func="yes">
<Overload retVal="int" descr="Get index position for a unicode character on font">
<Param name="Font font" />
<Param name="int character" />
</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" />
<Param name="int codepoint" />
</Overload>
</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! -->
<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">
<Overload retVal="bool" descr="Check if two text string are equal">
<Param name="const char *text1" />
@@ -1518,11 +1625,6 @@
<Param name="const char *text" />
</Overload>
</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">
<Overload retVal="const char" descr="Text formatting with variables (sprintf style)">
<Param name="const char *text" />
@@ -1537,14 +1639,14 @@
</Overload>
</KeyWord>
<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="const char *replace" />
<Param name="const char *by" />
</Overload>
</KeyWord>
<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 *insert" />
<Param name="int position" />
@@ -1597,6 +1699,37 @@
<Param name="const char *text" />
</Overload>
</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) -->
@@ -1610,6 +1743,12 @@
<Param name="Color color" />
</Overload>
</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">
<Overload retVal="void" descr="Draw a circle in 3D world space">
<Param name="Vector3 center" />
@@ -1730,7 +1869,6 @@
<Param name="Vector3 position" />
</Overload>
</KeyWord>
<!--DrawTorus(), DrawTeapot() could be useful? -->
<!-------------------------------------------------------------------------------------- -->
<!-- Model 3d Loading and Drawing Functions (Module: models) -->
@@ -1768,7 +1906,7 @@
</KeyWord>
<KeyWord name="UnloadMesh" func="yes">
<Overload retVal="void" descr="Unload mesh from memory (RAM and/or VRAM)">
<Param name="Mesh *mesh" />
<Param name="Mesh mesh" />
</Overload>
</KeyWord>
@@ -1998,22 +2136,22 @@
<KeyWord name="CheckCollisionBoxSphere" func="yes">
<Overload retVal="bool" descr="Detect collision between box and sphere">
<Param name="BoundingBox box" />
<Param name="Vector3 centerSphere" />
<Param name="float radiusSphere" />
<Param name="Vector3 center" />
<Param name="float radius" />
</Overload>
</KeyWord>
<KeyWord name="CheckCollisionRaySphere" func="yes">
<Overload retVal="bool" descr="Detect collision between ray and sphere">
<Param name="Ray ray" />
<Param name="Vector3 spherePosition" />
<Param name="float sphereRadius" />
<Param name="Vector3 center" />
<Param name="float radius" />
</Overload>
</KeyWord>
<KeyWord name="CheckCollisionRaySphereEx" func="yes">
<Overload retVal="bool" descr="Detect collision between ray and sphere, returns collision point">
<Param name="Ray ray" />
<Param name="Vector3 spherePosition" />
<Param name="float sphereRadius" />
<Param name="Vector3 center" />
<Param name="float radius" />
<Param name="Vector3 *collisionPoint" />
</Overload>
</KeyWord>
@@ -2026,7 +2164,7 @@
<KeyWord name="GetCollisionRayModel" func="yes">
<Overload retVal="RayHitInfo" descr="Get collision info between ray and model">
<Param name="Ray ray" />
<Param name="Model *model" />
<Param name="Model model" />
</Overload>
</KeyWord>
<KeyWord name="GetCollisionRayTriangle" func="yes">
@@ -2063,8 +2201,8 @@
</KeyWord>
<KeyWord name="LoadShaderCode" func="yes">
<Overload retVal="Shader" descr="Load shader from code strings and bind default locations">
<Param name="char *vsCode" />
<Param name="char *fsCode" />
<Param name="const char *vsCode" />
<Param name="const char *fsCode" />
</Overload>
</KeyWord>
<KeyWord name="UnloadShader" func="yes">
@@ -2079,6 +2217,18 @@
<KeyWord name="GetTextureDefault" func="yes">
<Overload retVal="Texture2D" descr="Get default texture"></Overload>
</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 -->
<KeyWord name="GetShaderLocation" func="yes">
@@ -2129,17 +2279,18 @@
</Overload>
</KeyWord>
<KeyWord name="GetMatrixModelview" func="yes">
<Overload retVal="Matrix" descr="Get internal modelview matrix">
<Param name="Matrix view" />
</Overload>
<Overload retVal="Matrix" descr="Get internal modelview matrix"></Overload>
</KeyWord>
<KeyWord name="GetMatrixProjection" func="yes">
<Overload retVal="Matrix" descr="Get internal projection matrix"></Overload>
</KeyWord>
<!-- Texture maps generation (PBR) -->
<!-- NOTE: Required shaders should be provided -->
<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="Texture2D skyHDR" />
<Param name="Texture2D map" />
<Param name="int size" />
</Overload>
</KeyWord>
@@ -2181,17 +2332,6 @@
<KeyWord name="EndBlendMode" func="yes">
<Overload retVal="void" descr="End blending mode (reset to default: alpha blending)"></Overload>
</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 -->
<KeyWord name="InitVrSimulator" func="yes">
@@ -2250,9 +2390,6 @@
<Param name="const char *fileName" />
</Overload>
</KeyWord>
<KeyWord name="LoadWaveEx" func="yes">
<Overload retVal="Wave" descr="Load wave data from raw array data"></Overload>
</KeyWord>
<KeyWord name="LoadSound" func="yes">
<Overload retVal="Sound" descr="Load sound from file">
<Param name="const char *fileName" />
@@ -2299,6 +2436,11 @@
<Param name="Sound sound" />
</Overload>
</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">
<Overload retVal="void" descr="Pause a sound">
<Param name="Sound sound" />
@@ -2309,11 +2451,17 @@
<Param name="Sound sound" />
</Overload>
</KeyWord>
<KeyWord name="StopSound" func="yes">
<Overload retVal="void" descr="Stop playing a sound">
<KeyWord name="PlaySoundMulti" func="yes">
<Overload retVal="void" descr="Play a sound (using multichannel buffer pool)">
<Param name="Sound sound" />
</Overload>
</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">
<Overload retVal="bool" descr="Check if a sound is currently playing">
<Param name="Sound sound" />
@@ -2447,7 +2595,7 @@
<Param name="AudioStream stream" />
</Overload>
</KeyWord>
<KeyWord name="IsAudioBufferProcessed" func="yes">
<KeyWord name="IsAudioStreamProcessed" func="yes">
<Overload retVal="bool" descr="Check if any audio stream buffers requires refill">
<Param name="AudioStream stream" />
</Overload>
@@ -2489,3 +2637,8 @@
<Param name="float pitch" />
</Overload>
</KeyWord>
<KeyWord name="SetAudioStreamBufferSizeDefault" func="yes">
<Overload retVal="void" descr="Default size for new audio streams">
<Param name="int size" />
</Overload>
</KeyWord>

View File

@@ -27,6 +27,7 @@ RLAPI int GetMonitorWidth(int monitor); // Get primary
RLAPI int GetMonitorHeight(int monitor); // Get primary monitor height
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 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 *GetClipboardText(void); // Get 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 BeginTextureMode(RenderTexture2D target); // Initializes render texture for drawing
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
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 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
RLAPI void SetTargetFPS(int fps); // Set target FPS (maximum)
@@ -63,13 +70,14 @@ RLAPI double GetTime(void); // Returns ela
// Color-related functions
RLAPI int ColorToInt(Color color); // Returns hexadecimal value for a Color
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 Color ColorFromHSV(Vector3 hsv); // Returns a Color from HSV values
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
// 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 SetTraceLogExit(int logType); // Set the exit threshold (minimum) log level
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
RLAPI bool FileExists(const char *fileName); // Check if file exists
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 *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 *GetDirectoryPath(const char *fileName); // Get full path for a given fileName (uses static string)
RLAPI const char *GetFileNameWithoutExt(const char *filePath); // Get filename string without extension (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 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)
@@ -93,6 +103,9 @@ RLAPI char **GetDroppedFiles(int *count); // Get dropped
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 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
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)
@@ -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 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 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 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
@@ -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 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 DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle
RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline
RLAPI void DrawTriangleFan(Vector2 *points, int numPoints, Color color); // Draw a triangle fan defined by points
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 (vertex in counter-clockwise order!)
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 SetShapesTexture(Texture2D texture, Rectangle source); // Define default texture used to draw shapes
RLAPI void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides
// Basic shapes collision detection functions
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 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 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 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)
@@ -239,6 +255,7 @@ RLAPI void UpdateTexture(Texture2D texture, const void *pixels);
// Image manipulation functions
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 ImageFormat(Image *image, int newFormat); // Convert image data to desired format
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 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 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 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)
@@ -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 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 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)
// 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 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 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
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 int GetGlyphIndex(Font font, int character); // 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
RLAPI int GetGlyphIndex(Font font, int codepoint); // Get index position for a unicode character on font
// 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!
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 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 *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 const char *TextInsert(const char *text, const char *insert, int position); // Insert text in a position (memory should be freed!)
RLAPI char *TextReplace(char *text, const char *replace, const char *by); // Replace text string (memory must 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 **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!
@@ -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 *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 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)
@@ -345,6 +368,7 @@ RLAPI int TextToInteger(const char *text); // Get int
// Basic geometric 3D shapes drawing functions
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 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)
@@ -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 DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
RLAPI void DrawGizmo(Vector3 position); // Draw simple gizmo
//DrawTorus(), DrawTeapot() could be useful?
//------------------------------------------------------------------------------------
// Model 3d Loading and Drawing Functions (Module: models)
@@ -374,7 +397,7 @@ RLAPI void UnloadModel(Model model);
// Mesh loading/unloading functions
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 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
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
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 CheckCollisionBoxSphere(BoundingBox box, Vector3 centerSphere, float radiusSphere); // Detect collision between box and sphere
RLAPI bool CheckCollisionRaySphere(Ray ray, Vector3 spherePosition, float sphereRadius); // 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 CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius); // Detect collision between box and sphere
RLAPI bool CheckCollisionRaySphere(Ray ray, Vector3 center, float radius); // Detect collision between ray and sphere
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 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 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
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 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 Shader GetShaderDefault(void); // Get default shader
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
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 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 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)
// 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 GenTexturePrefilter(Shader shader, Texture2D cubemap, int size); // Generate prefilter texture using cubemap data
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 BeginBlendMode(int mode); // Begin blending mode (alpha, additive, multiplied)
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
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
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 LoadSoundFromWave(Wave wave); // Load sound from wave 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
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 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 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)
@@ -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 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 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 PauseAudioStream(AudioStream stream); // Pause 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 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 SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams

View File

@@ -57,9 +57,9 @@ void App::Update()
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
ClearBackground(RED);
DrawRectangle(posX, posY, 400, 100, RED);
DrawRectangle(posX, posY, 400, 100, WHITE);
DrawLine(0, 0, GetScreenWidth(), GetScreenHeight(), BLUE);

View File

@@ -59,7 +59,7 @@ using namespace Windows::Graphics::Display;
using namespace Microsoft::WRL;
using namespace Platform;
extern "C" { EGLNativeWindowType uwpWindow; };
extern "C" { EGLNativeWindowType handle; };
/*
TODO list:
@@ -117,7 +117,7 @@ public:
// The CoreWindow has been created, so EGL can be initialized.
uwpWindow = (EGLNativeWindowType)window;
handle = (EGLNativeWindowType)window;
InitWindow(width, height, NULL);
}

View File

@@ -64,7 +64,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Platform)'=='ARM'">
<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>
</Link>
</ItemDefinitionGroup>

View File

@@ -10,6 +10,9 @@ set SOURCES=core_basic_window.c
REM Set your raylib\src location here (relative path!)
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 very simple. It has 3 compiler invocations: building raylib (which
REM is not done always, see logic by searching "Build raylib"), building
@@ -63,7 +66,7 @@ IF NOT "%1" == "" (
:HELP
echo Usage: windows-build.bat [-hdurcqqv]
echo Usage: build-windows.bat [-hdurcqqv]
echo -h Show this information
echo -d Faster builds that have debug symbols, and enable warnings
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.
echo Examples:
echo Build a release build: windows-build.bat
echo Build a release build, full recompile: windows-build.bat -c
echo Build a debug build and run: windows-build.bat -d -r
echo Build in debug, run, don't print at all: windows-build.bat -drqq
echo Build a release build: build-windows.bat
echo Build a release build, full recompile: build-windows.bat -c
echo Build a debug build and run: build-windows.bat -d -r
echo Build in debug, run, don't print at all: build-windows.bat -drqq
exit /B
@@ -104,9 +107,9 @@ IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxil
exit /B
)
IF DEFINED VERBOSE (
call !VC_INIT! x86
call !VC_INIT! !TARGET_PLATFORM!
) 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 COMPILATION_FLAGS=/Od /Zi
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 OUTPUT_DIR=builds-debug\windows-msvc
)

View File

@@ -3,8 +3,8 @@ project(raylib C)
include(GNUInstallDirs)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
set(PROJECT_VERSION 2.6.0)
set(API_VERSION 261)
set(PROJECT_VERSION 3.0.0)
set(API_VERSION 301)
include("CMakeOptions.txt")
include(BuildType)
@@ -263,6 +263,11 @@ file(COPY "raymath.h" DESTINATION ".")
file(COPY "raudio.h" DESTINATION ".")
# 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 " PLATFORM=" ${PLATFORM_CPP})
message(STATUS " GRAPHICS=" ${GRAPHICS})

Some files were not shown because too many files have changed in this diff Show More