Merge branch 'master' into overridable_config
This commit is contained in:
commit
e3ac719fb1
24 changed files with 391 additions and 257 deletions
46
BINDINGS.md
46
BINDINGS.md
|
|
@ -6,10 +6,10 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
|||
|
||||
| Name | raylib Version | Language | License |
|
||||
| :--------------------------------------------------------------------------------------- | :--------------: | :------------------------------------------------------------------: | :------------------: |
|
||||
| [raylib](https://github.com/raysan5/raylib) | **5.0** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib |
|
||||
| [raylib](https://github.com/raysan5/raylib) | **5.5** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib |
|
||||
| [raylib-beef](https://github.com/Starpelly/raylib-beef) | **5.5** | [Beef](https://www.beeflang.org) | MIT |
|
||||
| [raylib-boo](https://github.com/Rabios/raylib-boo) | 3.7 | [Boo](http://boo-language.github.io) | MIT |
|
||||
| [raybit](https://github.com/Alex-Velez/raybit) | **5.0** | [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) | MIT |
|
||||
| [raybit](https://github.com/Alex-Velez/raybit) | **5.0** | [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) | MIT |
|
||||
| [raylib-c3](https://github.com/c3lang/vendor/tree/main/libraries/raylib55.c3l) | **5.5** | [C3](https://c3-lang.org) | MIT |
|
||||
| [Raylib-cs](https://github.com/ChrisDill/Raylib-cs) | **5.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib |
|
||||
| [Raylib-CsLo](https://github.com/NotNotTech/Raylib-CsLo) | 4.2 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
|
||||
| [Raylib-CSharp-Vinculum](https://github.com/ZeroElectric/Raylib-CSharp-Vinculum) | **5.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
|
||||
|
|
@ -18,36 +18,38 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
|||
| [claylib/wrap](https://github.com/defun-games/claylib) | 4.5 | [Common Lisp](https://common-lisp.net) | Zlib |
|
||||
| [claw-raylib](https://github.com/bohonghuang/claw-raylib) | **auto** | [Common Lisp](https://common-lisp.net) | Apache-2.0 |
|
||||
| [chez-raylib](https://github.com/Yunoinsky/chez-raylib) | **auto** | [Chez Scheme](https://cisco.github.io/ChezScheme) | GPLv3 |
|
||||
| [CLIPSraylib](https://github.com/mrryanjohnston/CLIPSraylib) | **auto** | [CLIPS](https://www.clipsrules.net/) | MIT |
|
||||
| [raylib-cr](https://github.com/sol-vin/raylib-cr) | 4.6-dev (5e1a81) | [Crystal](https://crystal-lang.org) | Apache-2.0 |
|
||||
| [ray-cyber](https://github.com/fubark/ray-cyber) | **5.0** | [Cyber](https://cyberscript.dev) | MIT |
|
||||
| [dart-raylib](https://gitlab.com/wolfenrain/dart-raylib) | 4.0 | [Dart](https://dart.dev) | MIT |
|
||||
| [bindbc-raylib3](https://github.com/o3o/bindbc-raylib3) | **5.0** | [D](https://dlang.org) | BSL-1.0 |
|
||||
| [dray](https://github.com/redthing1/dray) | **5.0** | [D](https://dlang.org) | Apache-2.0 |
|
||||
| [dray](https://github.com/redthing1/dray) | **5.0** | [D](https://dlang.org) | Apache-2.0 |
|
||||
| [raylib-d](https://github.com/schveiguy/raylib-d) | **5.5** | [D](https://dlang.org) | Zlib |
|
||||
| [rayex](https://github.com/shiryel/rayex) | 3.7 | [elixir](https://elixir-lang.org) | Apache-2.0 |
|
||||
| [raylib-factor](https://github.com/factor/factor/blob/master/extra/raylib/raylib.factor) | 4.5 | [Factor](https://factorcode.org) | BSD |
|
||||
| [raylib-freebasic](https://github.com/WIITD/raylib-freebasic) | **5.0** | [FreeBASIC](https://www.freebasic.net) | MIT |
|
||||
| [fortran-raylib](https://github.com/interkosmos/fortran-raylib) | **5.5** | [Fortran](https://fortran-lang.org) | ISC |
|
||||
| [raylib-go](https://github.com/gen2brain/raylib-go) | **5.0** | [Go](https://golang.org) | Zlib |
|
||||
| [raylib-go](https://github.com/gen2brain/raylib-go) | **5.5** | [Go](https://golang.org) | Zlib |
|
||||
| [raylib-guile](https://github.com/petelliott/raylib-guile) | **auto** | [Guile](https://www.gnu.org/software/guile) | Zlib |
|
||||
| [gforth-raylib](https://github.com/ArnautDaniel/gforth-raylib) | 3.5 | [Gforth](https://gforth.org) | **???** |
|
||||
| [h-raylib](https://github.com/Anut-py/h-raylib) | **5.5-dev** | [Haskell](https://haskell.org) | Apache-2.0 |
|
||||
| [raylib-hx](https://github.com/foreignsasquatch/raylib-hx) | 4.2 | [Haxe](https://haxe.org) | Zlib |
|
||||
| [hb-raylib](https://github.com/MarcosLeonardoMendezGerencir/hb-raylib) | 3.5 | [Harbour](https://harbour.github.io) | MIT |
|
||||
| [jaylib](https://github.com/janet-lang/jaylib) | **5.0** | [Janet](https://janet-lang.org) | MIT |
|
||||
| [jaylib](https://github.com/electronstudio/jaylib/) | **5.5** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE |
|
||||
| [jaylib](https://github.com/electronstudio/jaylib/) | **5.5** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE |
|
||||
| [raylib-j](https://github.com/CreedVI/Raylib-J) | 4.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | Zlib |
|
||||
| [Raylib.jl](https://github.com/chengchingwen/Raylib.jl) | 4.2 | [Julia](https://julialang.org) | Zlib |
|
||||
| [Raylib.jl](https://github.com/chengchingwen/Raylib.jl) | 4.2 | [Julia](https://julialang.org) | Zlib |
|
||||
| [kaylib](https://github.com/electronstudio/kaylib) | 3.7 | [Kotlin/native](https://kotlinlang.org) | **???** |
|
||||
| [KaylibKit](https://codeberg.org/Kenta/KaylibKit) | 4.5 | [Kotlin/native](https://kotlinlang.org) | Zlib |
|
||||
| [raylib-lua](https://github.com/TSnake41/raylib-lua) | 4.5 | [Lua](http://www.lua.org) | ISC |
|
||||
| [raylua](https://github.com/Rabios/raylua) | 4.0 | [Lua](http://www.lua.org) | MIT |
|
||||
| [raylib-matte](https://github.com/jcorks/raylib-matte) | 4.6-dev | [Matte](https://github.com/jcorks/matte) | MIT |
|
||||
| [raylib-lua](https://github.com/TSnake41/raylib-lua) | 5.0 | [Lua](http://www.lua.org) | ISC |
|
||||
| [raylib-lua-bindings (WIP)](https://github.com/legendaryredfox/raylib-lua-bindings) | 5.5 | [Lua](http://www.lua.org) | ISC |
|
||||
| [ReiLua](https://github.com/nullstare/ReiLua) | 5.5 | [Lua](http://www.lua.org) | MIT |
|
||||
| [raylib-matte](https://github.com/jcorks/raylib-matte) | 4.6-dev | [Matte](https://github.com/jcorks/matte) | **???** |
|
||||
| [Raylib.nelua](https://github.com/AuzFox/Raylib.nelua) | **5.0** | [nelua](https://nelua.io) | Zlib |
|
||||
| [raylib-bindings](https://github.com/vaiorabbit/raylib-bindings) | 4.5 | [Ruby](https://www.ruby-lang.org/en) | Zlib |
|
||||
| [raylib-bindings](https://github.com/vaiorabbit/raylib-bindings) | 5.6-dev | [Ruby](https://www.ruby-lang.org/en) | Zlib |
|
||||
| [naylib](https://github.com/planetis-m/naylib) | **5.1-dev** | [Nim](https://nim-lang.org) | MIT |
|
||||
| [node-raylib](https://github.com/RobLoach/node-raylib) | 4.5 | [Node.js](https://nodejs.org/en) | Zlib |
|
||||
| [raylib-odin](https://github.com/odin-lang/Odin/tree/master/vendor/raylib) | **5.0** | [Odin](https://odin-lang.org) | BSD-3Clause |
|
||||
| [raylib-odin](https://github.com/odin-lang/Odin/tree/master/vendor/raylib) | **5.5** | [Odin](https://odin-lang.org) | BSD-3Clause |
|
||||
| [raylib_odin_bindings](https://github.com/Deathbat2190/raylib_odin_bindings) | 4.0-dev | [Odin](https://odin-lang.org) | MIT |
|
||||
| [raylib-ocaml](https://github.com/tjammer/raylib-ocaml) | **5.0** | [OCaml](https://ocaml.org) | MIT |
|
||||
| [TurboRaylib](https://github.com/turborium/TurboRaylib) | 4.5 | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | MIT |
|
||||
|
|
@ -55,25 +57,25 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
|||
| [Raylib.4.0.Pascal](https://github.com/sysrpl/Raylib.4.0.Pascal) | 4.0 | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal) | Zlib |
|
||||
| [pyraylib](https://github.com/Ho011/pyraylib) | 3.7 | [Python](https://www.python.org) | Zlib |
|
||||
| [raylib-python-cffi](https://github.com/electronstudio/raylib-python-cffi) | **5.5** | [Python](https://www.python.org) | EPL-2.0 |
|
||||
| [raylibpyctbg](https://github.com/overdev/raylibpyctbg) | 4.5 | [Python](https://www.python.org) | MIT |
|
||||
| [raylibpyctbg](https://github.com/overdev/raylibpyctbg) | 5.5 | [Python](https://www.python.org) | MIT |
|
||||
| [raylib-py](https://github.com/overdev/raylib-py) | 5.5 | [Python](https://www.python.org) | MIT |
|
||||
| [raylib-python-ctypes](https://github.com/sDos280/raylib-python-ctypes) | 4.6-dev | [Python](https://www.python.org) | MIT |
|
||||
| [raylib-pkpy-bindings](https://github.com/blueloveTH/pkpy-bindings) | 4.6-dev | [pocketpy](https://pocketpy.dev) | MIT |
|
||||
| [raylib-pkpy-bindings](https://github.com/blueloveTH/pkpy-bindings) | 5.1-dev | [pocketpy](https://pocketpy.dev) | MIT |
|
||||
| [raylib-php](https://github.com/joseph-montanez/raylib-php) | 4.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib |
|
||||
| [raylib-phpcpp](https://github.com/oraoto/raylib-phpcpp) | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib |
|
||||
| [raylibr](https://github.com/jeroenjanssens/raylibr) | 4.0 | [R](https://www.r-project.org) | MIT |
|
||||
| [raylib-ffi](https://github.com/ewpratten/raylib-ffi) | 4.5 | [Rust](https://www.rust-lang.org) | GPLv3 |
|
||||
| [raylib-rs](https://github.com/raylib-rs/raylib-rs) | **5.0** | [Rust](https://www.rust-lang.org) | Zlib |
|
||||
| [raylib-ffi](https://github.com/ewpratten/raylib-ffi) | 5.5 | [Rust](https://www.rust-lang.org) | GPLv3 |
|
||||
| [raylib-rs](https://github.com/raylib-rs/raylib-rs) | **5.5** | [Rust](https://www.rust-lang.org) | Zlib |
|
||||
| [Relib](https://github.com/RedCubeDev-ByteSpace/Relib) | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | **???** |
|
||||
| [racket-raylib](https://github.com/eutro/racket-raylib) | 4.0 | [Racket](https://racket-lang.org) | MIT/Apache-2.0 |
|
||||
| [raylib-swift](https://github.com/STREGAsGate/Raylib) | 4.0 | [Swift](https://swift.org) | MIT |
|
||||
| [raylib-scopes](https://github.com/salotz/raylib-scopes) | auto | [Scopes](http://scopes.rocks) | MIT |
|
||||
| [raylib-SmallBASIC](https://github.com/smallbasic/smallbasic.plugins/tree/master/raylib) | **5.0** | [SmallBASIC](https://github.com/smallbasic/SmallBASIC) | GPLv3 |
|
||||
| [raylib-SmallBASIC](https://github.com/smallbasic/smallbasic.plugins/tree/master/raylib) | **5.5** | [SmallBASIC](https://github.com/smallbasic/SmallBASIC) | GPLv3 |
|
||||
| [raylib-umka](https://github.com/robloach/raylib-umka) | 4.5 | [Umka](https://github.com/vtereshkov/umka-lang) | Zlib |
|
||||
| [raylib.v](https://github.com/irishgreencitrus/raylib.v) | 4.2 | [V](https://vlang.io) | Zlib |
|
||||
| [raylib-vapi](https://github.com/lxmcf/raylib-vapi) | **5.0** | [Vala](https://vala.dev) | Zlib |
|
||||
| [raylib-wren](https://github.com/TSnake41/raylib-wren) | 4.0 | [Wren](http://wren.io) | ISC |
|
||||
| [raylib-zig](https://github.com/Not-Nik/raylib-zig) | **5.0** | [Zig](https://ziglang.org) | MIT |
|
||||
| [raylib-wren](https://github.com/TSnake41/raylib-wren) | 4.5 | [Wren](http://wren.io) | ISC |
|
||||
| [raylib-zig](https://github.com/Not-Nik/raylib-zig) | **5.5** | [Zig](https://ziglang.org) | MIT |
|
||||
| [raylib.zig](https://github.com/ryupold/raylib.zig) | **5.1-dev** | [Zig](https://ziglang.org) | MIT |
|
||||
| [raylib-zig-bindings](https://github.com/L-Briand/raylib-zig-bindings) | **5.0** | [Zig](https://ziglang.org) | Zlib |
|
||||
| [hare-raylib](https://git.sr.ht/~evantj/hare-raylib) | **auto** | [Hare](https://harelang.org) | Zlib |
|
||||
|
|
@ -84,6 +86,8 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
|||
| [Raylib.lean](https://github.com/KislyjKisel/Raylib.lean) | **5.5-dev** | [Lean4](https://lean-lang.org) | BSD-3-Clause |
|
||||
| [raylib-cobol](https://codeberg.org/glowiak/raylib-cobol) | **auto** | [COBOL](https://gnucobol.sourceforge.io) | Public domain |
|
||||
| [raylib-apl](https://github.com/Brian-ED/raylib-apl) | **5.0** | [Dyalog APL](https://www.dyalog.com/) | MIT |
|
||||
| [raylib-jai](https://github.com/ahmedqarmout2/raylib-jai) | **5.5** | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | MIT |
|
||||
| [fnl-raylib](https://github.com/0riginaln0/fnl-raylib) | **5.5** | [Fennel](https://fennel-lang.org/) | MIT |
|
||||
|
||||
### Utility Wrapers
|
||||
|
||||
|
|
@ -93,7 +97,7 @@ These are utility wrappers for specific languages, they are not required to use
|
|||
| [raylib-cpp](https://github.com/robloach/raylib-cpp) | **5.5** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib |
|
||||
| [claylib](https://github.com/defun-games/claylib) | 4.5 | [Common Lisp](https://common-lisp.net) | Zlib |
|
||||
| [rayed-bqn](https://github.com/Brian-ED/rayed-bqn) | **5.0** | [BQN](https://mlochbaum.github.io/BQN) | MIT |
|
||||
| [DOOR](https://github.com/RealDoigt/DOOR) | 4.0 | [D](https://dlang.org) | MIT |
|
||||
| [DOOR](https://github.com/RealDoigt/DOOR) | 4.0 | [D](https://dlang.org) | MIT |
|
||||
|
||||
### Older or Unmaintained Language Bindings
|
||||
|
||||
|
|
@ -153,7 +157,7 @@ These are older raylib bindings that are more than 2 versions old or have not be
|
|||
| [ray.mod](https://github.com/bmx-ng/ray.mod) | 3.0 | [BlitzMax](https://blitzmax.org) |
|
||||
| [raylib-mosaic](https://github.com/pluckyporcupine/raylib-mosaic) | 3.0 | [Mosaic](https://github.com/sal55/langs/tree/master/Mosaic) |
|
||||
| [raylib-xdpw](https://github.com/vtereshkov/raylib-xdpw) | 2.6 | [XD Pascal](https://github.com/vtereshkov/xdpw) |
|
||||
| [raylib-carp](https://github.com/sacredbirdman/raylib-carp) | 3.0 | [Carp](https://github.com/carp-lang/Carp) |
|
||||
| [raylib-carp](https://github.com/sacredbirdman/raylib-carp) | 3.0 | [Carp](https://github.com/carp-lang/Carp) |
|
||||
| [raylib-fb](https://github.com/IchMagBier/raylib-fb) | 3.0 | [FreeBasic](https://www.freebasic.net) |
|
||||
| [raylib-purebasic](https://github.com/D-a-n-i-l-o/raylib-purebasic) | 3.0 | [PureBasic](https://www.purebasic.com) |
|
||||
| [raylib-ats2](https://github.com/mephistopheles-8/raylib-ats2) | 3.0 | [ATS2](http://www.ats-lang.org) |
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ To open new issues for raylib (bug, enhancement, discussion...), just try to fol
|
|||
- If applicable, attach some screenshot of the issue and a .zip file with the code sample and required resources.
|
||||
- On issue description, add a brackets tag about the raylib module that relates to this issue.
|
||||
If don't know which module, just report the issue, I will review it.
|
||||
- You can check other issues to see how is being done!
|
||||
- You can check other issues to see how it's being done!
|
||||
|
||||
### Sending a Pull-Request
|
||||
|
||||
|
|
|
|||
2
FAQ.md
2
FAQ.md
|
|
@ -90,7 +90,7 @@ I personally consider raylib a graphics library with some high-level features ra
|
|||
|
||||
### What does raylib provide that other engines or libraries don't?
|
||||
|
||||
I would say "simplicity" and "enjoyment" at a really low level of coding but actually is up to the user to discover it, to try it and to see if it fits their needs. raylib is not good for everyone but it's worth a try.
|
||||
I would say "simplicity" and "enjoyment" at a really low level of coding but actually it is up to the user to discover it, to try it and to see if it fits their needs. raylib is not good for everyone but it's worth a try.
|
||||
|
||||
### How does raylib compare to Unity/Unreal/Godot?
|
||||
|
||||
|
|
|
|||
|
|
@ -54,10 +54,15 @@
|
|||
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DESKTOP_SDL, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
PLATFORM ?= PLATFORM_DESKTOP
|
||||
|
||||
ifeq ($(PLATFORM), PLATFORM_DESKTOP)
|
||||
TARGET_PLATFORM = PLATFORM_DESKTOP_GLFW
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW))
|
||||
TARGET_PLATFORM := $(PLATFORM)
|
||||
override PLATFORM = PLATFORM_DESKTOP
|
||||
else
|
||||
TARGET_PLATFORM = $(PLATFORM)
|
||||
ifeq ($(PLATFORM), PLATFORM_DESKTOP)
|
||||
TARGET_PLATFORM = PLATFORM_DESKTOP_GLFW
|
||||
else
|
||||
TARGET_PLATFORM = $(PLATFORM)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Define required raylib variables
|
||||
|
|
@ -653,7 +658,7 @@ OTHERS = \
|
|||
ifeq ($(TARGET_PLATFORM), PLATFORM_DESKTOP_GFLW)
|
||||
OTHERS += others/rlgl_standalone
|
||||
endif
|
||||
|
||||
|
||||
|
||||
CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@
|
|||
*
|
||||
* Example create by GreenSnakeLinux (@GreenSnakeLinux),
|
||||
* lighter by oblerion (@oblerion) and
|
||||
* reviewed by Ramon Santamaria (@raysan5)
|
||||
* reviewed by Ramon Santamaria (@raysan5) and
|
||||
* improved by danilwhale (@danilwhale)
|
||||
*
|
||||
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||
* BSD-like license that allows static linking with closed source software
|
||||
|
|
@ -17,6 +18,16 @@
|
|||
|
||||
#include "raylib.h"
|
||||
#include <math.h>
|
||||
|
||||
typedef enum {
|
||||
BUTTON_NONE = -1,
|
||||
BUTTON_UP,
|
||||
BUTTON_LEFT,
|
||||
BUTTON_RIGHT,
|
||||
BUTTON_DOWN,
|
||||
BUTTON_MAX
|
||||
} PadButton;
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
|
|
@ -29,24 +40,38 @@ int main(void)
|
|||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - input virtual controls");
|
||||
|
||||
const float dpadX = 90;
|
||||
const float dpadY = 300;
|
||||
const float dpadRad = 25.0f;//radius of each pad
|
||||
Color dpadColor = BLUE;
|
||||
int dpadKeydown = -1;//-1 if not down, else 0,1,2,3
|
||||
Vector2 padPosition = { 100, 350 };
|
||||
float buttonRadius = 30;
|
||||
|
||||
|
||||
const float dpadCollider[4][2]= // collider array with x,y position
|
||||
Vector2 buttonPositions[BUTTON_MAX] =
|
||||
{
|
||||
{dpadX,dpadY-dpadRad*1.5f},//up
|
||||
{dpadX-dpadRad*1.5f,dpadY},//left
|
||||
{dpadX+dpadRad*1.5f,dpadY},//right
|
||||
{dpadX,dpadY+dpadRad*1.5f}//down
|
||||
{ padPosition.x,padPosition.y - buttonRadius*1.5f }, // Up
|
||||
{ padPosition.x - buttonRadius*1.5f, padPosition.y }, // Left
|
||||
{ padPosition.x + buttonRadius*1.5f, padPosition.y }, // Right
|
||||
{ padPosition.x, padPosition.y + buttonRadius*1.5f } // Down
|
||||
};
|
||||
const char dpadLabel[4]="XYBA";//label of Dpad
|
||||
|
||||
float playerX=100;
|
||||
float playerY=100;
|
||||
const char *buttonLabels[BUTTON_MAX] =
|
||||
{
|
||||
"Y", // Up
|
||||
"X", // Left
|
||||
"B", // Right
|
||||
"A" // Down
|
||||
};
|
||||
|
||||
Color buttonLabelColors[BUTTON_MAX] =
|
||||
{
|
||||
YELLOW, // Up
|
||||
BLUE, // Left
|
||||
RED, // Right
|
||||
GREEN // Down
|
||||
};
|
||||
|
||||
int pressedButton = BUTTON_NONE;
|
||||
Vector2 inputPosition = { 0, 0 };
|
||||
|
||||
Vector2 playerPosition = { (float)screenWidth/2, (float)screenHeight/2 };
|
||||
float playerSpeed = 75;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
@ -54,63 +79,89 @@ int main(void)
|
|||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//--------------------------------------------------------------------------
|
||||
dpadKeydown = -1; //reset
|
||||
int inputX = 0;
|
||||
int inputY = 0;
|
||||
if(GetTouchPointCount()>0)
|
||||
{//use touch pos
|
||||
inputX = GetTouchX();
|
||||
inputY = GetTouchY();
|
||||
// Update
|
||||
//--------------------------------------------------------------------------
|
||||
if ((GetTouchPointCount() > 0))
|
||||
{
|
||||
// Use touch position
|
||||
inputPosition = GetTouchPosition(0);
|
||||
}
|
||||
else
|
||||
{//use mouse pos
|
||||
inputX = GetMouseX();
|
||||
inputY = GetMouseY();
|
||||
}
|
||||
for(int i=0;i<4;i++)
|
||||
{
|
||||
//test distance each collider and input < radius
|
||||
if( fabsf(dpadCollider[i][1]-inputY) + fabsf(dpadCollider[i][0]-inputX) < dpadRad)
|
||||
{
|
||||
dpadKeydown = i;
|
||||
break;
|
||||
}
|
||||
// Use mouse position
|
||||
inputPosition = GetMousePosition();
|
||||
}
|
||||
// move player
|
||||
switch(dpadKeydown){
|
||||
case 0: playerY -= 50*GetFrameTime();
|
||||
break;
|
||||
case 1: playerX -= 50*GetFrameTime();
|
||||
break;
|
||||
case 2: playerX += 50*GetFrameTime();
|
||||
break;
|
||||
case 3: playerY += 50*GetFrameTime();
|
||||
default:;
|
||||
};
|
||||
//--------------------------------------------------------------------------
|
||||
// Draw
|
||||
//--------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(RAYWHITE);
|
||||
for(int i=0;i<4;i++)
|
||||
|
||||
// Reset pressed button to none
|
||||
pressedButton = BUTTON_NONE;
|
||||
|
||||
// Make sure user is pressing left mouse button if they're from desktop
|
||||
if ((GetTouchPointCount() > 0) || ((GetTouchPointCount() == 0) && IsMouseButtonDown(MOUSE_BUTTON_LEFT)))
|
||||
{
|
||||
// Find nearest D-Pad button to the input position
|
||||
for (int i = 0; i < BUTTON_MAX; i++)
|
||||
{
|
||||
//draw all pad
|
||||
DrawCircleV((Vector2) { dpadCollider[i][0], dpadCollider[i][1] }, dpadRad, dpadColor);
|
||||
if(i!=dpadKeydown)
|
||||
float distX = fabsf(buttonPositions[i].x - inputPosition.x);
|
||||
float distY = fabsf(buttonPositions[i].y - inputPosition.y);
|
||||
|
||||
if ((distX + distY < buttonRadius))
|
||||
{
|
||||
//draw label
|
||||
DrawText(TextSubtext(dpadLabel,i,1),
|
||||
(int)dpadCollider[i][0]-7,
|
||||
(int)dpadCollider[i][1]-8,20,BLACK);
|
||||
pressedButton = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Move player according to pressed button
|
||||
switch (pressedButton)
|
||||
{
|
||||
case BUTTON_UP:
|
||||
{
|
||||
playerPosition.y -= playerSpeed*GetFrameTime();
|
||||
break;
|
||||
}
|
||||
case BUTTON_LEFT:
|
||||
{
|
||||
playerPosition.x -= playerSpeed*GetFrameTime();
|
||||
break;
|
||||
}
|
||||
case BUTTON_RIGHT:
|
||||
{
|
||||
playerPosition.x += playerSpeed*GetFrameTime();
|
||||
break;
|
||||
}
|
||||
case BUTTON_DOWN:
|
||||
{
|
||||
playerPosition.y += playerSpeed*GetFrameTime();
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Draw
|
||||
//--------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
// Draw world
|
||||
DrawCircleV(playerPosition, 50, MAROON);
|
||||
|
||||
// Draw GUI
|
||||
for (int i = 0; i < BUTTON_MAX; i++)
|
||||
{
|
||||
DrawCircleV(buttonPositions[i], buttonRadius, (i == pressedButton)? DARKGRAY : BLACK);
|
||||
|
||||
DrawText(buttonLabels[i],
|
||||
(int)buttonPositions[i].x - 7, (int)buttonPositions[i].y - 8,
|
||||
20, buttonLabelColors[i]);
|
||||
}
|
||||
|
||||
DrawText("move the player with D-Pad buttons", 10, 10, 20, DARKGRAY);
|
||||
|
||||
DrawRectangleRec((Rectangle) { playerX - 4, playerY - 4, 75, 28 }, RED);
|
||||
DrawText("Player", (int)playerX, (int)playerY, 20, WHITE);
|
||||
EndDrawing();
|
||||
//--------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 1.8 KiB |
|
|
@ -1,6 +1,6 @@
|
|||
#version 100
|
||||
|
||||
precision highp float;
|
||||
precision highp float;
|
||||
|
||||
#define MAX_LIGHTS 4
|
||||
#define LIGHT_DIRECTIONAL 0
|
||||
|
|
@ -24,7 +24,6 @@ varying vec3 fragNormal;
|
|||
varying vec4 shadowPos;
|
||||
varying mat3 TBN;
|
||||
|
||||
|
||||
// Input uniform values
|
||||
uniform int numOfLights;
|
||||
uniform sampler2D albedoMap;
|
||||
|
|
@ -153,4 +152,4 @@ void main()
|
|||
|
||||
gl_FragColor = vec4(color,1.0);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#version 100
|
||||
|
||||
// Input vertex attributes
|
||||
attribute vec3 vertexPosition;
|
||||
attribute vec2 vertexTexCoord;
|
||||
attribute vec3 vertexNormal;
|
||||
attribute vec3 vertexTangent;
|
||||
attribute vec4 vertexColor;
|
||||
attribute vec3 vertexPosition;
|
||||
attribute vec2 vertexTexCoord;
|
||||
attribute vec3 vertexNormal;
|
||||
attribute vec3 vertexTangent;
|
||||
attribute vec4 vertexColor;
|
||||
|
||||
// Input uniform values
|
||||
uniform mat4 mvp;
|
||||
|
|
@ -72,4 +72,4 @@ void main()
|
|||
|
||||
// Calculate final vertex position
|
||||
gl_Position = mvp * vec4(vertexPosition, 1.0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ void main()
|
|||
// Send vertex attributes to fragment shader
|
||||
fragPosition = vec3(instanceTransform*vec4(vertexPosition, 1.0));
|
||||
fragTexCoord = vertexTexCoord;
|
||||
//fragColor = vertexColor;
|
||||
fragColor = vec4(1.0);
|
||||
fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
|
||||
|
||||
// Calculate final vertex position, note that we multiply mvp by instanceTransform
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ int main(void)
|
|||
{
|
||||
Matrix translation = MatrixTranslate((float)GetRandomValue(-50, 50), (float)GetRandomValue(-50, 50), (float)GetRandomValue(-50, 50));
|
||||
Vector3 axis = Vector3Normalize((Vector3){ (float)GetRandomValue(0, 360), (float)GetRandomValue(0, 360), (float)GetRandomValue(0, 360) });
|
||||
float angle = (float)GetRandomValue(0, 10)*DEG2RAD;
|
||||
float angle = (float)GetRandomValue(0, 180)*DEG2RAD;
|
||||
Matrix rotation = MatrixRotate(axis, angle);
|
||||
|
||||
transforms[i] = MatrixMultiply(rotation, translation);
|
||||
|
|
@ -73,7 +73,6 @@ int main(void)
|
|||
// Get shader locations
|
||||
shader.locs[SHADER_LOC_MATRIX_MVP] = GetShaderLocation(shader, "mvp");
|
||||
shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos");
|
||||
shader.locs[SHADER_LOC_MATRIX_MODEL] = GetShaderLocationAttrib(shader, "instanceTransform");
|
||||
|
||||
// Set shader value: ambient light level
|
||||
int ambientLoc = GetShaderLocation(shader, "ambient");
|
||||
|
|
|
|||
|
|
@ -2543,6 +2543,11 @@
|
|||
"name": "SHADER_LOC_BONE_MATRICES",
|
||||
"value": 28,
|
||||
"description": "Shader location: array of matrices uniform: boneMatrices"
|
||||
},
|
||||
{
|
||||
"name": "SHADER_LOC_VERTEX_INSTANCE_TX",
|
||||
"value": 29,
|
||||
"description": "Shader location: vertex attribute: instanceTransform"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -2591,8 +2596,28 @@
|
|||
"description": "Shader uniform type: ivec4 (4 int)"
|
||||
},
|
||||
{
|
||||
"name": "SHADER_UNIFORM_SAMPLER2D",
|
||||
"name": "SHADER_UNIFORM_UINT",
|
||||
"value": 8,
|
||||
"description": "Shader uniform type: unsigned int"
|
||||
},
|
||||
{
|
||||
"name": "SHADER_UNIFORM_UIVEC2",
|
||||
"value": 9,
|
||||
"description": "Shader uniform type: uivec2 (2 unsigned int)"
|
||||
},
|
||||
{
|
||||
"name": "SHADER_UNIFORM_UIVEC3",
|
||||
"value": 10,
|
||||
"description": "Shader uniform type: uivec3 (3 unsigned int)"
|
||||
},
|
||||
{
|
||||
"name": "SHADER_UNIFORM_UIVEC4",
|
||||
"value": 11,
|
||||
"description": "Shader uniform type: uivec4 (4 unsigned int)"
|
||||
},
|
||||
{
|
||||
"name": "SHADER_UNIFORM_SAMPLER2D",
|
||||
"value": 12,
|
||||
"description": "Shader uniform type: sampler2d"
|
||||
}
|
||||
]
|
||||
|
|
@ -4882,9 +4907,9 @@
|
|||
"returnType": "int"
|
||||
},
|
||||
{
|
||||
"name": "SetExitKey",
|
||||
"description": "Set a custom key to exit program (default is ESC)",
|
||||
"returnType": "void",
|
||||
"name": "GetKeyName",
|
||||
"description": "Get name of a QWERTY key on the current keyboard layout (eg returns string 'q' for KEY_A on an AZERTY keyboard)",
|
||||
"returnType": "const char *",
|
||||
"params": [
|
||||
{
|
||||
"type": "int",
|
||||
|
|
@ -4893,9 +4918,9 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"name": "GetKeyName",
|
||||
"description": "Get name of a QWERTY key on the current keyboard layout (eg returns string "q" for KEY_A on an AZERTY keyboard)",
|
||||
"returnType": "const char *",
|
||||
"name": "SetExitKey",
|
||||
"description": "Set a custom key to exit program (default is ESC)",
|
||||
"returnType": "void",
|
||||
"params": [
|
||||
{
|
||||
"type": "int",
|
||||
|
|
|
|||
|
|
@ -2543,6 +2543,11 @@ return {
|
|||
name = "SHADER_LOC_BONE_MATRICES",
|
||||
value = 28,
|
||||
description = "Shader location: array of matrices uniform: boneMatrices"
|
||||
},
|
||||
{
|
||||
name = "SHADER_LOC_VERTEX_INSTANCE_TX",
|
||||
value = 29,
|
||||
description = "Shader location: vertex attribute: instanceTransform"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -2591,8 +2596,28 @@ return {
|
|||
description = "Shader uniform type: ivec4 (4 int)"
|
||||
},
|
||||
{
|
||||
name = "SHADER_UNIFORM_SAMPLER2D",
|
||||
name = "SHADER_UNIFORM_UINT",
|
||||
value = 8,
|
||||
description = "Shader uniform type: unsigned int"
|
||||
},
|
||||
{
|
||||
name = "SHADER_UNIFORM_UIVEC2",
|
||||
value = 9,
|
||||
description = "Shader uniform type: uivec2 (2 unsigned int)"
|
||||
},
|
||||
{
|
||||
name = "SHADER_UNIFORM_UIVEC3",
|
||||
value = 10,
|
||||
description = "Shader uniform type: uivec3 (3 unsigned int)"
|
||||
},
|
||||
{
|
||||
name = "SHADER_UNIFORM_UIVEC4",
|
||||
value = 11,
|
||||
description = "Shader uniform type: uivec4 (4 unsigned int)"
|
||||
},
|
||||
{
|
||||
name = "SHADER_UNIFORM_SAMPLER2D",
|
||||
value = 12,
|
||||
description = "Shader uniform type: sampler2d"
|
||||
}
|
||||
}
|
||||
|
|
@ -4327,17 +4352,17 @@ return {
|
|||
returnType = "int"
|
||||
},
|
||||
{
|
||||
name = "SetExitKey",
|
||||
description = "Set a custom key to exit program (default is ESC)",
|
||||
returnType = "void",
|
||||
name = "GetKeyName",
|
||||
description = "Get name of a QWERTY key on the current keyboard layout (eg returns string 'q' for KEY_A on an AZERTY keyboard)",
|
||||
returnType = "const char *",
|
||||
params = {
|
||||
{type = "int", name = "key"}
|
||||
}
|
||||
},
|
||||
{
|
||||
name = "GetKeyName",
|
||||
description = "Get name of a QWERTY key on the current keyboard layout (eg returns string "q" for KEY_A on an AZERTY keyboard)",
|
||||
returnType = "const char *",
|
||||
name = "SetExitKey",
|
||||
description = "Set a custom key to exit program (default is ESC)",
|
||||
returnType = "void",
|
||||
params = {
|
||||
{type = "int", name = "key"}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -795,7 +795,7 @@ Enum 08: MaterialMapIndex (11 values)
|
|||
Value[MATERIAL_MAP_IRRADIANCE]: 8
|
||||
Value[MATERIAL_MAP_PREFILTER]: 9
|
||||
Value[MATERIAL_MAP_BRDF]: 10
|
||||
Enum 09: ShaderLocationIndex (29 values)
|
||||
Enum 09: ShaderLocationIndex (30 values)
|
||||
Name: ShaderLocationIndex
|
||||
Description: Shader location index
|
||||
Value[SHADER_LOC_VERTEX_POSITION]: 0
|
||||
|
|
@ -827,7 +827,8 @@ Enum 09: ShaderLocationIndex (29 values)
|
|||
Value[SHADER_LOC_VERTEX_BONEIDS]: 26
|
||||
Value[SHADER_LOC_VERTEX_BONEWEIGHTS]: 27
|
||||
Value[SHADER_LOC_BONE_MATRICES]: 28
|
||||
Enum 10: ShaderUniformDataType (9 values)
|
||||
Value[SHADER_LOC_VERTEX_INSTANCE_TX]: 29
|
||||
Enum 10: ShaderUniformDataType (13 values)
|
||||
Name: ShaderUniformDataType
|
||||
Description: Shader uniform data type
|
||||
Value[SHADER_UNIFORM_FLOAT]: 0
|
||||
|
|
@ -838,7 +839,11 @@ Enum 10: ShaderUniformDataType (9 values)
|
|||
Value[SHADER_UNIFORM_IVEC2]: 5
|
||||
Value[SHADER_UNIFORM_IVEC3]: 6
|
||||
Value[SHADER_UNIFORM_IVEC4]: 7
|
||||
Value[SHADER_UNIFORM_SAMPLER2D]: 8
|
||||
Value[SHADER_UNIFORM_UINT]: 8
|
||||
Value[SHADER_UNIFORM_UIVEC2]: 9
|
||||
Value[SHADER_UNIFORM_UIVEC3]: 10
|
||||
Value[SHADER_UNIFORM_UIVEC4]: 11
|
||||
Value[SHADER_UNIFORM_SAMPLER2D]: 12
|
||||
Enum 11: ShaderAttributeDataType (4 values)
|
||||
Name: ShaderAttributeDataType
|
||||
Description: Shader attribute data types
|
||||
|
|
@ -1886,16 +1891,16 @@ Function 167: GetCharPressed() (0 input parameters)
|
|||
Return type: int
|
||||
Description: Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty
|
||||
No input parameters
|
||||
Function 168: SetExitKey() (1 input parameters)
|
||||
Function 168: GetKeyName() (1 input parameters)
|
||||
Name: GetKeyName
|
||||
Return type: const char *
|
||||
Description: Get name of a QWERTY key on the current keyboard layout (eg returns string 'q' for KEY_A on an AZERTY keyboard)
|
||||
Param[1]: key (type: int)
|
||||
Function 169: SetExitKey() (1 input parameters)
|
||||
Name: SetExitKey
|
||||
Return type: void
|
||||
Description: Set a custom key to exit program (default is ESC)
|
||||
Param[1]: key (type: int)
|
||||
Function 169: GetKeyName() (1 input parameters)
|
||||
Name: GetKeyName
|
||||
Return type: const char *
|
||||
Description: Get name of a QWERTY key on the current keyboard layout (eg returns string "q" for KEY_A on an AZERTY keyboard)
|
||||
Param[1]: key (type: int)
|
||||
Function 170: IsGamepadAvailable() (1 input parameters)
|
||||
Name: IsGamepadAvailable
|
||||
Return type: bool
|
||||
|
|
|
|||
|
|
@ -507,7 +507,7 @@
|
|||
<Value name="MATERIAL_MAP_PREFILTER" integer="9" desc="Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP)" />
|
||||
<Value name="MATERIAL_MAP_BRDF" integer="10" desc="Brdf material" />
|
||||
</Enum>
|
||||
<Enum name="ShaderLocationIndex" valueCount="29" desc="Shader location index">
|
||||
<Enum name="ShaderLocationIndex" valueCount="30" desc="Shader location index">
|
||||
<Value name="SHADER_LOC_VERTEX_POSITION" integer="0" desc="Shader location: vertex attribute: position" />
|
||||
<Value name="SHADER_LOC_VERTEX_TEXCOORD01" integer="1" desc="Shader location: vertex attribute: texcoord01" />
|
||||
<Value name="SHADER_LOC_VERTEX_TEXCOORD02" integer="2" desc="Shader location: vertex attribute: texcoord02" />
|
||||
|
|
@ -537,8 +537,9 @@
|
|||
<Value name="SHADER_LOC_VERTEX_BONEIDS" integer="26" desc="Shader location: vertex attribute: boneIds" />
|
||||
<Value name="SHADER_LOC_VERTEX_BONEWEIGHTS" integer="27" desc="Shader location: vertex attribute: boneWeights" />
|
||||
<Value name="SHADER_LOC_BONE_MATRICES" integer="28" desc="Shader location: array of matrices uniform: boneMatrices" />
|
||||
<Value name="SHADER_LOC_VERTEX_INSTANCE_TX" integer="29" desc="Shader location: vertex attribute: instanceTransform" />
|
||||
</Enum>
|
||||
<Enum name="ShaderUniformDataType" valueCount="9" desc="Shader uniform data type">
|
||||
<Enum name="ShaderUniformDataType" valueCount="13" desc="Shader uniform data type">
|
||||
<Value name="SHADER_UNIFORM_FLOAT" integer="0" desc="Shader uniform type: float" />
|
||||
<Value name="SHADER_UNIFORM_VEC2" integer="1" desc="Shader uniform type: vec2 (2 float)" />
|
||||
<Value name="SHADER_UNIFORM_VEC3" integer="2" desc="Shader uniform type: vec3 (3 float)" />
|
||||
|
|
@ -547,7 +548,11 @@
|
|||
<Value name="SHADER_UNIFORM_IVEC2" integer="5" desc="Shader uniform type: ivec2 (2 int)" />
|
||||
<Value name="SHADER_UNIFORM_IVEC3" integer="6" desc="Shader uniform type: ivec3 (3 int)" />
|
||||
<Value name="SHADER_UNIFORM_IVEC4" integer="7" desc="Shader uniform type: ivec4 (4 int)" />
|
||||
<Value name="SHADER_UNIFORM_SAMPLER2D" integer="8" desc="Shader uniform type: sampler2d" />
|
||||
<Value name="SHADER_UNIFORM_UINT" integer="8" desc="Shader uniform type: unsigned int" />
|
||||
<Value name="SHADER_UNIFORM_UIVEC2" integer="9" desc="Shader uniform type: uivec2 (2 unsigned int)" />
|
||||
<Value name="SHADER_UNIFORM_UIVEC3" integer="10" desc="Shader uniform type: uivec3 (3 unsigned int)" />
|
||||
<Value name="SHADER_UNIFORM_UIVEC4" integer="11" desc="Shader uniform type: uivec4 (4 unsigned int)" />
|
||||
<Value name="SHADER_UNIFORM_SAMPLER2D" integer="12" desc="Shader uniform type: sampler2d" />
|
||||
</Enum>
|
||||
<Enum name="ShaderAttributeDataType" valueCount="4" desc="Shader attribute data types">
|
||||
<Value name="SHADER_ATTRIB_FLOAT" integer="0" desc="Shader attribute type: float" />
|
||||
|
|
@ -1181,10 +1186,10 @@
|
|||
</Function>
|
||||
<Function name="GetCharPressed" retType="int" paramCount="0" desc="Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty">
|
||||
</Function>
|
||||
<Function name="SetExitKey" retType="void" paramCount="1" desc="Set a custom key to exit program (default is ESC)">
|
||||
<Function name="GetKeyName" retType="const char *" paramCount="1" desc="Get name of a QWERTY key on the current keyboard layout (eg returns string 'q' for KEY_A on an AZERTY keyboard)">
|
||||
<Param type="int" name="key" desc="" />
|
||||
</Function>
|
||||
<Function name="GetKeyName" retType="const char *" paramCount="1" desc="Get name of a QWERTY key on the current keyboard layout (eg returns string "q" for KEY_A on an AZERTY keyboard)">
|
||||
<Function name="SetExitKey" retType="void" paramCount="1" desc="Set a custom key to exit program (default is ESC)">
|
||||
<Param type="int" name="key" desc="" />
|
||||
</Function>
|
||||
<Function name="IsGamepadAvailable" retType="bool" paramCount="1" desc="Check if a gamepad is available">
|
||||
|
|
|
|||
|
|
@ -284,6 +284,8 @@
|
|||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 8
|
||||
#endif
|
||||
#endif
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCE_TX 9
|
||||
|
||||
|
||||
// Default shader vertex attribute names to set location points
|
||||
// NOTE: When a new shader is loaded, the following locations are tried to be set for convenience
|
||||
|
|
|
|||
21
src/raudio.c
21
src/raudio.c
|
|
@ -1550,7 +1550,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
|||
else if ((strcmp(fileType, ".ogg") == 0) || (strcmp(fileType, ".OGG") == 0))
|
||||
{
|
||||
// Open ogg audio stream
|
||||
stb_vorbis* ctxOgg = stb_vorbis_open_memory((const unsigned char *)data, dataSize, NULL, NULL);
|
||||
stb_vorbis *ctxOgg = stb_vorbis_open_memory((const unsigned char *)data, dataSize, NULL, NULL);
|
||||
|
||||
if (ctxOgg != NULL)
|
||||
{
|
||||
|
|
@ -2461,23 +2461,18 @@ static ma_uint32 ReadAudioBufferFramesInMixingFormat(AudioBuffer *audioBuffer, f
|
|||
|
||||
float *runningFramesOut = framesOut + (totalOutputFramesProcessed*audioBuffer->converter.channelsOut);
|
||||
|
||||
/* At this point we can convert the data to our mixing format. */
|
||||
ma_uint64 inputFramesProcessedThisIteration = ReadAudioBufferFramesInInternalFormat(audioBuffer, inputBuffer, (ma_uint32)inputFramesToProcessThisIteration); /* Safe cast. */
|
||||
// At this point we can convert the data to our mixing format
|
||||
ma_uint64 inputFramesProcessedThisIteration = ReadAudioBufferFramesInInternalFormat(audioBuffer, inputBuffer, (ma_uint32)inputFramesToProcessThisIteration);
|
||||
ma_uint64 outputFramesProcessedThisIteration = outputFramesToProcessThisIteration;
|
||||
ma_data_converter_process_pcm_frames(&audioBuffer->converter, inputBuffer, &inputFramesProcessedThisIteration, runningFramesOut, &outputFramesProcessedThisIteration);
|
||||
|
||||
totalOutputFramesProcessed += (ma_uint32)outputFramesProcessedThisIteration; /* Safe cast. */
|
||||
totalOutputFramesProcessed += (ma_uint32)outputFramesProcessedThisIteration; // Safe cast
|
||||
|
||||
if (inputFramesProcessedThisIteration < inputFramesToProcessThisIteration)
|
||||
{
|
||||
break; /* Ran out of input data. */
|
||||
}
|
||||
if (inputFramesProcessedThisIteration < inputFramesToProcessThisIteration) break; // Ran out of input data
|
||||
|
||||
/* This should never be hit, but will add it here for safety. Ensures we get out of the loop when no input nor output frames are processed. */
|
||||
if (inputFramesProcessedThisIteration == 0 && outputFramesProcessedThisIteration == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
// This should never be hit, but added here for safety
|
||||
// Ensures we get out of the loop when no input nor output frames are processed
|
||||
if ((inputFramesProcessedThisIteration == 0) && (outputFramesProcessedThisIteration == 0)) break;
|
||||
}
|
||||
|
||||
return totalOutputFramesProcessed;
|
||||
|
|
|
|||
|
|
@ -801,7 +801,8 @@ typedef enum {
|
|||
SHADER_LOC_MAP_BRDF, // Shader location: sampler2d texture: brdf
|
||||
SHADER_LOC_VERTEX_BONEIDS, // Shader location: vertex attribute: boneIds
|
||||
SHADER_LOC_VERTEX_BONEWEIGHTS, // Shader location: vertex attribute: boneWeights
|
||||
SHADER_LOC_BONE_MATRICES // Shader location: array of matrices uniform: boneMatrices
|
||||
SHADER_LOC_BONE_MATRICES, // Shader location: array of matrices uniform: boneMatrices
|
||||
SHADER_LOC_VERTEX_INSTANCE_TX // Shader location: vertex attribute: instanceTransform
|
||||
} ShaderLocationIndex;
|
||||
|
||||
#define SHADER_LOC_MAP_DIFFUSE SHADER_LOC_MAP_ALBEDO
|
||||
|
|
@ -817,6 +818,10 @@ typedef enum {
|
|||
SHADER_UNIFORM_IVEC2, // Shader uniform type: ivec2 (2 int)
|
||||
SHADER_UNIFORM_IVEC3, // Shader uniform type: ivec3 (3 int)
|
||||
SHADER_UNIFORM_IVEC4, // Shader uniform type: ivec4 (4 int)
|
||||
SHADER_UNIFORM_UINT, // Shader uniform type: unsigned int
|
||||
SHADER_UNIFORM_UIVEC2, // Shader uniform type: uivec2 (2 unsigned int)
|
||||
SHADER_UNIFORM_UIVEC3, // Shader uniform type: uivec3 (3 unsigned int)
|
||||
SHADER_UNIFORM_UIVEC4, // Shader uniform type: uivec4 (4 unsigned int)
|
||||
SHADER_UNIFORM_SAMPLER2D // Shader uniform type: sampler2d
|
||||
} ShaderUniformDataType;
|
||||
|
||||
|
|
@ -1177,8 +1182,8 @@ RLAPI bool IsKeyReleased(int key); // Check if a key
|
|||
RLAPI bool IsKeyUp(int key); // Check if a key is NOT being pressed
|
||||
RLAPI int GetKeyPressed(void); // Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty
|
||||
RLAPI int GetCharPressed(void); // Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty
|
||||
RLAPI const char *GetKeyName(int key); // Get name of a QWERTY key on the current keyboard layout (eg returns string 'q' for KEY_A on an AZERTY keyboard)
|
||||
RLAPI void SetExitKey(int key); // Set a custom key to exit program (default is ESC)
|
||||
RLAPI const char *GetKeyName(int key); // Get name of a QWERTY key on the current keyboard layout (eg returns string "q" for KEY_A on an AZERTY keyboard)
|
||||
|
||||
// Input-related functions: gamepads
|
||||
RLAPI bool IsGamepadAvailable(int gamepad); // Check if a gamepad is available
|
||||
|
|
|
|||
|
|
@ -328,8 +328,9 @@ RMAPI float Vector2DistanceSqr(Vector2 v1, Vector2 v2)
|
|||
return result;
|
||||
}
|
||||
|
||||
// Calculate angle between two vectors
|
||||
// NOTE: Angle is calculated from origin point (0, 0)
|
||||
// Calculate the signed angle from v1 to v2, relative to the origin (0, 0)
|
||||
// NOTE: Coordinate system convention: positive X right, positive Y down,
|
||||
// positive angles appear clockwise, and negative angles appear counterclockwise
|
||||
RMAPI float Vector2Angle(Vector2 v1, Vector2 v2)
|
||||
{
|
||||
float result = 0.0f;
|
||||
|
|
@ -2664,12 +2665,12 @@ inline const Vector2& operator *= (Vector2& lhs, const Matrix& rhs)
|
|||
|
||||
inline Vector2 operator / (const Vector2& lhs, const float& rhs)
|
||||
{
|
||||
return Vector2Scale(lhs, 1.0f / rhs);
|
||||
return Vector2Scale(lhs, 1.0f/rhs);
|
||||
}
|
||||
|
||||
inline const Vector2& operator /= (Vector2& lhs, const float& rhs)
|
||||
{
|
||||
lhs = Vector2Scale(lhs, 1.0f / rhs);
|
||||
lhs = Vector2Scale(lhs, 1.0f/rhs);
|
||||
return lhs;
|
||||
}
|
||||
|
||||
|
|
@ -2758,12 +2759,12 @@ inline const Vector3& operator *= (Vector3& lhs, const Matrix& rhs)
|
|||
|
||||
inline Vector3 operator / (const Vector3& lhs, const float& rhs)
|
||||
{
|
||||
return Vector3Scale(lhs, 1.0f / rhs);
|
||||
return Vector3Scale(lhs, 1.0f/rhs);
|
||||
}
|
||||
|
||||
inline const Vector3& operator /= (Vector3& lhs, const float& rhs)
|
||||
{
|
||||
lhs = Vector3Scale(lhs, 1.0f / rhs);
|
||||
lhs = Vector3Scale(lhs, 1.0f/rhs);
|
||||
return lhs;
|
||||
}
|
||||
|
||||
|
|
@ -2842,12 +2843,12 @@ inline const Vector4& operator *= (Vector4& lhs, const Vector4& rhs)
|
|||
|
||||
inline Vector4 operator / (const Vector4& lhs, const float& rhs)
|
||||
{
|
||||
return Vector4Scale(lhs, 1.0f / rhs);
|
||||
return Vector4Scale(lhs, 1.0f/rhs);
|
||||
}
|
||||
|
||||
inline const Vector4& operator /= (Vector4& lhs, const float& rhs)
|
||||
{
|
||||
lhs = Vector4Scale(lhs, 1.0f / rhs);
|
||||
lhs = Vector4Scale(lhs, 1.0f/rhs);
|
||||
return lhs;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ RLAPI void CameraPitch(Camera *camera, float angle, bool lockView, bool rotateAr
|
|||
RLAPI void CameraRoll(Camera *camera, float angle);
|
||||
|
||||
RLAPI Matrix GetCameraViewMatrix(Camera *camera);
|
||||
RLAPI Matrix GetCameraProjectionMatrix(Camera* camera, float aspect);
|
||||
RLAPI Matrix GetCameraProjectionMatrix(Camera *camera, float aspect);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
|
|
|||
37
src/rcore.c
37
src/rcore.c
|
|
@ -1346,6 +1346,7 @@ Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
|
|||
shader.locs[SHADER_LOC_VERTEX_COLOR] = rlGetLocationAttrib(shader.id, RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR);
|
||||
shader.locs[SHADER_LOC_VERTEX_BONEIDS] = rlGetLocationAttrib(shader.id, RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS);
|
||||
shader.locs[SHADER_LOC_VERTEX_BONEWEIGHTS] = rlGetLocationAttrib(shader.id, RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS);
|
||||
shader.locs[SHADER_LOC_VERTEX_INSTANCE_TX] = rlGetLocationAttrib(shader.id, RL_DEFAULT_SHADER_ATTRIB_NAME_INSTANCE_TX);
|
||||
|
||||
// Get handles to GLSL uniform locations (vertex shader)
|
||||
shader.locs[SHADER_LOC_MATRIX_MVP] = rlGetLocationUniform(shader.id, RL_DEFAULT_SHADER_UNIFORM_NAME_MVP);
|
||||
|
|
@ -2765,7 +2766,8 @@ unsigned int *ComputeMD5(unsigned char *data, int dataSize)
|
|||
|
||||
// Compute SHA-1 hash code
|
||||
// NOTE: Returns a static int[5] array (20 bytes)
|
||||
unsigned int *ComputeSHA1(unsigned char *data, int dataSize) {
|
||||
unsigned int *ComputeSHA1(unsigned char *data, int dataSize)
|
||||
{
|
||||
#define ROTATE_LEFT(x, c) (((x) << (c)) | ((x) >> (32 - (c))))
|
||||
|
||||
static unsigned int hash[5] = { 0 }; // Hash to be returned
|
||||
|
|
@ -2800,17 +2802,16 @@ unsigned int *ComputeSHA1(unsigned char *data, int dataSize) {
|
|||
{
|
||||
// Break chunk into sixteen 32-bit words w[j], 0 <= j <= 15
|
||||
unsigned int w[80] = {0};
|
||||
for (int i = 0; i < 16; i++) {
|
||||
w[i] = (msg[offset + (i * 4) + 0] << 24) |
|
||||
(msg[offset + (i * 4) + 1] << 16) |
|
||||
(msg[offset + (i * 4) + 2] << 8) |
|
||||
(msg[offset + (i * 4) + 3]);
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
w[i] = (msg[offset + (i*4) + 0] << 24) |
|
||||
(msg[offset + (i*4) + 1] << 16) |
|
||||
(msg[offset + (i*4) + 2] << 8) |
|
||||
(msg[offset + (i*4) + 3]);
|
||||
}
|
||||
|
||||
// Message schedule: extend the sixteen 32-bit words into eighty 32-bit words:
|
||||
for (int i = 16; i < 80; ++i) {
|
||||
w[i] = ROTATE_LEFT(w[i-3] ^ w[i-8] ^ w[i-14] ^ w[i-16], 1);
|
||||
}
|
||||
for (int i = 16; i < 80; i++) w[i] = ROTATE_LEFT(w[i-3] ^ w[i-8] ^ w[i-14] ^ w[i-16], 1);
|
||||
|
||||
// Initialize hash value for this chunk
|
||||
unsigned int a = hash[0];
|
||||
|
|
@ -2824,16 +2825,23 @@ unsigned int *ComputeSHA1(unsigned char *data, int dataSize) {
|
|||
unsigned int f = 0;
|
||||
unsigned int k = 0;
|
||||
|
||||
if (i < 20) {
|
||||
if (i < 20)
|
||||
{
|
||||
f = (b & c) | ((~b) & d);
|
||||
k = 0x5A827999;
|
||||
} else if (i < 40) {
|
||||
}
|
||||
else if (i < 40)
|
||||
{
|
||||
f = b ^ c ^ d;
|
||||
k = 0x6ED9EBA1;
|
||||
} else if (i < 60) {
|
||||
}
|
||||
else if (i < 60)
|
||||
{
|
||||
f = (b & c) | (b & d) | (c & d);
|
||||
k = 0x8F1BBCDC;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
f = b ^ c ^ d;
|
||||
k = 0xCA62C1D6;
|
||||
}
|
||||
|
|
@ -3315,7 +3323,8 @@ float GetGamepadAxisMovement(int gamepad, int axis)
|
|||
{
|
||||
float value = (axis == GAMEPAD_AXIS_LEFT_TRIGGER || axis == GAMEPAD_AXIS_RIGHT_TRIGGER)? -1.0f : 0.0f;
|
||||
|
||||
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (axis < MAX_GAMEPAD_AXIS)) {
|
||||
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (axis < MAX_GAMEPAD_AXIS))
|
||||
{
|
||||
float movement = value < 0.0f ? CORE.Input.Gamepad.axisState[gamepad][axis] : fabsf(CORE.Input.Gamepad.axisState[gamepad][axis]);
|
||||
|
||||
if (movement > value) value = CORE.Input.Gamepad.axisState[gamepad][axis];
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue