Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop
60
CHANGELOG
@ -1,10 +1,64 @@
|
|||||||
changelog
|
changelog
|
||||||
---------
|
---------
|
||||||
|
|
||||||
Current Release: raylib 1.5.0 (18 July 2016)
|
Current Release: raylib 1.6.0 (20 November 2016)
|
||||||
|
|
||||||
NOTE: Only versions marked as 'Release' are available in installer, updates are only available as source.
|
-----------------------------------------------
|
||||||
NOTE: Current Release includes all previous updates.
|
Release: raylib 1.6.0 (20 November 2016)
|
||||||
|
-----------------------------------------------
|
||||||
|
NOTE:
|
||||||
|
This new raylib version commemorates raylib 3rd anniversary and represents another complete review of the library.
|
||||||
|
It includes some interesting new features and is a stepping stone towards raylib future.
|
||||||
|
|
||||||
|
HUGE changes:
|
||||||
|
[rlua] LUA BINDING: Complete raylib LUA binding, ALL raylib functions ported to LUA plus the +60 code examples.
|
||||||
|
[audio] COMPLETE REDESIGN: Improved music support and also raw audio data processing and playing, +20 new functions added.
|
||||||
|
[physac] COMPLETE REWRITE: Improved performance, functionality and simplified usage, moved to own repository and added multiple examples!
|
||||||
|
|
||||||
|
Other changes:
|
||||||
|
|
||||||
|
[core] Corrected issue on OSX with HighDPI display
|
||||||
|
[core] Added flag to allow resizable window
|
||||||
|
[core] Allow no default font loading
|
||||||
|
[core] Corrected old issue with mouse buttons on web
|
||||||
|
[core] Improved gamepad support, unified across platforms
|
||||||
|
[core] Gamepad id functionality: GetGamepadName(), IsGamepadName()
|
||||||
|
[core] Gamepad buttons/axis checking functionality:
|
||||||
|
[core] Reviewed Android key inputs system, unified with desktop
|
||||||
|
[rlgl] Redesigned lighting shader system
|
||||||
|
[rlgl] Updated standard shader for better performance
|
||||||
|
[rlgl] Support alpha on framebuffer: rlglLoadRenderTexture()
|
||||||
|
[rlgl] Reviewed UpdateVrTracking() to update camera
|
||||||
|
[rlgl] Added IsVrSimulator() to check for VR simulator
|
||||||
|
[shapes] Corrected issue on DrawPolyEx()
|
||||||
|
[textures] Simplified supported image formats support
|
||||||
|
[textures] Improved text drawing within an image: ImageDrawText()
|
||||||
|
[textures] Support image alpha mixing: ImageAlphaMask()
|
||||||
|
[textures] Support textures filtering: SetTextureFilter()
|
||||||
|
[textures] Support textures wrap modes: SetTextureWrap()
|
||||||
|
[text] Improved TTF spritefont generation: LoadSpriteFontTTF()
|
||||||
|
[text] Improved AngelCode fonts support (unordered chars)
|
||||||
|
[text] Added TraceLog info on image spritefont loading
|
||||||
|
[text] Improved text measurement: MeasureTextEx()
|
||||||
|
[models] Improved OBJ loading flexibility
|
||||||
|
[models] Reviewed functions: DrawLine3D(), DrawCircle3D()
|
||||||
|
[models] Removed function: ResolveCollisionCubicmap()
|
||||||
|
[camera] Redesigned camera system and ported to header-only
|
||||||
|
[camera] Removed function: UpdateCameraPlayer()
|
||||||
|
[gestures] Redesigned gestures module to header-only
|
||||||
|
[audio] Simplified Music loading and playing system
|
||||||
|
[audio] Added trace on audio device closing
|
||||||
|
[audio] Reviewed Wave struct, improved flexibility
|
||||||
|
[audio] Support sound data update: UpdateSound()
|
||||||
|
[audio] Added support for FLAC audio loading/streaming
|
||||||
|
[raygui] Removed raygui from raylib repo (moved to own repo)
|
||||||
|
[build] Added OpenAL static library
|
||||||
|
[build] Added Visual Studio 2015 projects
|
||||||
|
[build] Support shared/dynamic raylib compilation
|
||||||
|
[*] Updated LibOVR to SDK version 1.8
|
||||||
|
[*] Updated games to latest raylib version
|
||||||
|
[*] Improved examples and added new ones
|
||||||
|
[*] Improved Android support
|
||||||
|
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
Release: raylib 1.5.0 (18 July 2016)
|
Release: raylib 1.5.0 (18 July 2016)
|
||||||
|
|||||||
26
README.md
@ -153,11 +153,33 @@ Up to 8 new code examples have been added to show the new raylib features and al
|
|||||||
|
|
||||||
Lots of code changes (+400 commits) and lots of hours of hard work have concluded in this amazing new raylib 1.5.
|
Lots of code changes (+400 commits) and lots of hours of hard work have concluded in this amazing new raylib 1.5.
|
||||||
|
|
||||||
|
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. 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. 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 has also been added. In the same line, 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 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, 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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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 with raylib project and C/C++ examples for users that prefer that professional IDE and compiler.
|
||||||
|
|
||||||
|
New examples, new functions, complete code-base review, multiple bugs corrected... this is raylib 1.6. Enjoy making games.
|
||||||
|
|
||||||
|
|
||||||
features
|
features
|
||||||
--------
|
--------
|
||||||
|
|
||||||
* Written in plain C code (C99)
|
* Written in plain C code (C99)
|
||||||
* Uses C# PascalCase/camelCase notation
|
* Uses PascalCase/camelCase notation
|
||||||
* Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES2)
|
* Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES2)
|
||||||
* Unique OpenGL abstraction layer (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c)
|
* Unique OpenGL abstraction layer (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c)
|
||||||
* Powerful fonts module with multiple SpriteFonts formats support (XNA bitmap fonts, AngelCode fonts, TTF)
|
* Powerful fonts module with multiple SpriteFonts formats support (XNA bitmap fonts, AngelCode fonts, TTF)
|
||||||
@ -166,7 +188,7 @@ features
|
|||||||
* Materials (diffuse, normal, specular) and Lighting (point, directional, spot) support
|
* Materials (diffuse, normal, specular) and Lighting (point, directional, spot) support
|
||||||
* Shaders support, including Model shaders and Postprocessing shaders
|
* Shaders support, including Model shaders and Postprocessing shaders
|
||||||
* Powerful math module for Vector and Matrix operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.c)
|
* Powerful math module for Vector and Matrix operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.c)
|
||||||
* Audio loading and playing with streaming support and mixing channels (WAV, OGG, XM, MOD)
|
* Audio loading and playing with streaming support and mixing channels (WAV, OGG, FLAC, XM, MOD)
|
||||||
* VR stereo rendering support with configurable HMD device parameters
|
* VR stereo rendering support with configurable HMD device parameters
|
||||||
* Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi**, **HTML5** and **Oculus Rift CV1**
|
* Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi**, **HTML5** and **Oculus Rift CV1**
|
||||||
* Custom color palette for fancy visuals on raywhite background
|
* Custom color palette for fancy visuals on raywhite background
|
||||||
|
|||||||
11
ROADMAP.md
@ -4,16 +4,21 @@ roadmap
|
|||||||
Current version of raylib is quite complete and functional but there is still a lot of things to add and improve.
|
Current version of raylib is quite complete and functional but there is still a lot of things to add and improve.
|
||||||
Here it is a wish list of features I would like to add and functions to improve.
|
Here it is a wish list of features I would like to add and functions to improve.
|
||||||
|
|
||||||
Note that around the raylib source code there are multiple TODO points with pending revisions/bugs. Check [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details!
|
Note raylib source code has multiple TODO points with pending things to review and improve. Check [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details!
|
||||||
|
|
||||||
raylib 1.x
|
raylib 1.x
|
||||||
|
|
||||||
[IN PROGRESS] LUA scripting support (wrapper to lua lib)
|
|
||||||
Basic GPU stats sytem (memory, draws, time...)
|
Basic GPU stats sytem (memory, draws, time...)
|
||||||
|
Improved custom file-format (.rres) and packaging tool
|
||||||
Procedural image generation functions (spot, gradient, noise...)
|
Procedural image generation functions (spot, gradient, noise...)
|
||||||
Procedural mesh generation functions (cube, cone, sphere...)
|
Procedural mesh generation functions (cube, cone, sphere...)
|
||||||
Touch-based camera controls for Android
|
Touch-based camera controls for Android
|
||||||
Skybox and Fog support
|
Gamepad support on HTML5
|
||||||
|
|
||||||
|
raylib 1.6
|
||||||
|
|
||||||
|
[DONE] LUA scripting support (raylib lua wrapper)
|
||||||
|
[DONE] Redesigned audio module
|
||||||
|
|
||||||
raylib 1.5
|
raylib 1.5
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
#
|
#
|
||||||
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
|
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
|
||||||
#
|
#
|
||||||
|
# NOTE: By default examples are compiled using raylib static library and OpenAL Soft shared library
|
||||||
|
#
|
||||||
# Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
|
# Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
|
||||||
#
|
#
|
||||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
# This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
@ -26,6 +28,9 @@
|
|||||||
# WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
|
# WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
|
||||||
PLATFORM ?= PLATFORM_DESKTOP
|
PLATFORM ?= PLATFORM_DESKTOP
|
||||||
|
|
||||||
|
# define NO to use OpenAL Soft as static library (shared by default)
|
||||||
|
SHARED_OPENAL ?= YES
|
||||||
|
|
||||||
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected
|
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
|
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
|
||||||
@ -62,12 +67,13 @@ endif
|
|||||||
|
|
||||||
# define compiler flags:
|
# define compiler flags:
|
||||||
# -O2 defines optimization level
|
# -O2 defines optimization level
|
||||||
|
# -s strip unnecessary data from build
|
||||||
# -Wall turns on most, but not all, compiler warnings
|
# -Wall turns on most, but not all, compiler warnings
|
||||||
# -std=c99 use standard C from 1999 revision
|
# -std=c99 use standard C from 1999 revision
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
CFLAGS = -O2 -Wall -std=gnu99 -fgnu89-inline
|
CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
|
||||||
else
|
else
|
||||||
CFLAGS = -O2 -Wall -std=c99
|
CFLAGS = -O2 -s -Wall -std=c99
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 -s ASSERTIONS=1 --preload-file resources
|
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 -s ASSERTIONS=1 --preload-file resources
|
||||||
@ -151,7 +157,14 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
else
|
else
|
||||||
# libraries for Windows desktop compiling
|
# libraries for Windows desktop compiling
|
||||||
# NOTE: GLFW3 and OpenAL Soft libraries should be installed
|
# NOTE: GLFW3 and OpenAL Soft libraries should be installed
|
||||||
LIBS = -lraylib -lglfw3 -lopengl32 -lopenal32 -lgdi32
|
LIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
|
||||||
|
# if static OpenAL Soft required, define the corresponding libs
|
||||||
|
ifeq ($(SHARED_OPENAL),NO)
|
||||||
|
LIBS += -lopenal32 -lwinmm
|
||||||
|
CFLAGS += -Wl,-allow-multiple-definition
|
||||||
|
else
|
||||||
|
LIBS += -lopenal32dll
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -215,6 +228,8 @@ EXAMPLES = \
|
|||||||
text_format_text \
|
text_format_text \
|
||||||
text_font_select \
|
text_font_select \
|
||||||
text_writing_anim \
|
text_writing_anim \
|
||||||
|
text_ttf_loading \
|
||||||
|
text_bmfont_unordered \
|
||||||
models_geometric_shapes \
|
models_geometric_shapes \
|
||||||
models_box_collisions \
|
models_box_collisions \
|
||||||
models_billboard \
|
models_billboard \
|
||||||
@ -400,6 +415,14 @@ text_font_select: text_font_select.c
|
|||||||
text_writing_anim: text_writing_anim.c
|
text_writing_anim: text_writing_anim.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [text] example - text ttf loading
|
||||||
|
text_ttf_loading: text_ttf_loading.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [text] example - text bmfont unordered
|
||||||
|
text_bmfont_unordered: text_bmfont_unordered.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
# compile [models] example - basic geometric 3d shapes
|
# compile [models] example - basic geometric 3d shapes
|
||||||
models_geometric_shapes: models_geometric_shapes.c
|
models_geometric_shapes: models_geometric_shapes.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|||||||
@ -30,6 +30,8 @@ int main()
|
|||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 450;
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
SetConfigFlags(FLAG_MSAA_4X_HINT); // NOTE: Try to enable MSAA 4X
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [audio] example - module playing (streaming)");
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - module playing (streaming)");
|
||||||
|
|
||||||
InitAudioDevice(); // Initialize audio device
|
InitAudioDevice(); // Initialize audio device
|
||||||
@ -50,13 +52,6 @@ int main()
|
|||||||
circles[i].color = colors[GetRandomValue(0, 13)];
|
circles[i].color = colors[GetRandomValue(0, 13)];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load postprocessing bloom shader
|
|
||||||
Shader shader = LoadShader("resources/shaders/glsl330/base.vs",
|
|
||||||
"resources/shaders/glsl330/bloom.fs");
|
|
||||||
|
|
||||||
// Create a RenderTexture2D to be used for render to texture
|
|
||||||
RenderTexture2D target = LoadRenderTexture(screenWidth, screenHeight);
|
|
||||||
|
|
||||||
Music xm = LoadMusicStream("resources/audio/mini1111.xm");
|
Music xm = LoadMusicStream("resources/audio/mini1111.xm");
|
||||||
|
|
||||||
PlayMusicStream(xm);
|
PlayMusicStream(xm);
|
||||||
@ -117,28 +112,17 @@ int main()
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(BLACK);
|
ClearBackground(WHITE);
|
||||||
|
|
||||||
BeginTextureMode(target); // Enable drawing to texture
|
|
||||||
|
|
||||||
for (int i = MAX_CIRCLES - 1; i >= 0; i--)
|
for (int i = MAX_CIRCLES - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
DrawCircleV(circles[i].position, circles[i].radius, Fade(circles[i].color, circles[i].alpha));
|
DrawCircleV(circles[i].position, circles[i].radius, Fade(circles[i].color, circles[i].alpha));
|
||||||
}
|
}
|
||||||
|
|
||||||
EndTextureMode(); // End drawing to texture (now we have a texture available for next passes)
|
|
||||||
|
|
||||||
BeginShaderMode(shader);
|
|
||||||
|
|
||||||
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
|
||||||
DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE);
|
|
||||||
|
|
||||||
EndShaderMode();
|
|
||||||
|
|
||||||
// Draw time bar
|
// Draw time bar
|
||||||
DrawRectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, LIGHTGRAY);
|
DrawRectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, LIGHTGRAY);
|
||||||
DrawRectangle(20, screenHeight - 20 - 12, (int)timePlayed, 12, MAROON);
|
DrawRectangle(20, screenHeight - 20 - 12, (int)timePlayed, 12, MAROON);
|
||||||
DrawRectangleLines(20, screenHeight - 20 - 12, screenWidth - 40, 12, WHITE);
|
DrawRectangleLines(20, screenHeight - 20 - 12, screenWidth - 40, 12, GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
@ -146,9 +130,6 @@ int main()
|
|||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadShader(shader); // Unload shader
|
|
||||||
UnloadRenderTexture(target); // Unload render texture
|
|
||||||
|
|
||||||
UnloadMusicStream(xm); // Unload music stream buffers from RAM
|
UnloadMusicStream(xm); // Unload music stream buffers from RAM
|
||||||
|
|
||||||
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
|
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 47 KiB |
BIN
examples/audio_raw_stream.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
unsigned char key;
|
unsigned char key;
|
||||||
|
|
||||||
InitAudioDevice();
|
InitAudioDevice();
|
||||||
@ -43,7 +45,9 @@ int main()
|
|||||||
PlayMusicStream(music);
|
PlayMusicStream(music);
|
||||||
|
|
||||||
printf("\nPress s or d to play sounds...\n");
|
printf("\nPress s or d to play sounds...\n");
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main loop
|
||||||
while (key != KEY_ESCAPE)
|
while (key != KEY_ESCAPE)
|
||||||
{
|
{
|
||||||
if (kbhit()) key = getch();
|
if (kbhit()) key = getch();
|
||||||
@ -63,15 +67,15 @@ int main()
|
|||||||
UpdateMusicStream(music);
|
UpdateMusicStream(music);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadSound(fxWav); // Unload sound data
|
UnloadSound(fxWav); // Unload sound data
|
||||||
UnloadSound(fxOgg); // Unload sound data
|
UnloadSound(fxOgg); // Unload sound data
|
||||||
|
|
||||||
UnloadMusicStream(music); // Unload music stream data
|
UnloadMusicStream(music); // Unload music stream data
|
||||||
|
|
||||||
CloseAudioDevice();
|
CloseAudioDevice();
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
printf("\n\nPress ENTER to close...");
|
|
||||||
getchar();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -23,7 +23,7 @@ int main()
|
|||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files");
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
char **droppedFiles;
|
char **droppedFiles = { 0 };
|
||||||
|
|
||||||
SetTargetFPS(60);
|
SetTargetFPS(60);
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -3,17 +3,29 @@
|
|||||||
* raylib [core] example - Gamepad input
|
* raylib [core] example - Gamepad input
|
||||||
*
|
*
|
||||||
* NOTE: This example requires a Gamepad connected to the system
|
* NOTE: This example requires a Gamepad connected to the system
|
||||||
* raylib is configured to work with Xbox 360 gamepad, check raylib.h for buttons configuration
|
* raylib is configured to work with the following gamepads:
|
||||||
|
* Xbox 360 Controller (Xbox 360, Xbox One)
|
||||||
|
* PLAYSTATION(R)3 Controller
|
||||||
|
* Check raylib.h for buttons configuration
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
|
// NOTE: Gamepad name ID depends on drivers and OS
|
||||||
|
#if defined(PLATFORM_RPI)
|
||||||
|
#define XBOX360_NAME_ID "Microsoft X-Box 360 pad"
|
||||||
|
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
||||||
|
#else
|
||||||
|
#define XBOX360_NAME_ID "Xbox 360 Controller"
|
||||||
|
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
||||||
|
#endif
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// Initialization
|
// Initialization
|
||||||
@ -21,12 +33,14 @@ int main()
|
|||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 450;
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
SetConfigFlags(FLAG_MSAA_4X_HINT); // Set MSAA 4X hint before windows creation
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input");
|
||||||
|
|
||||||
Vector2 ballPosition = { (float)screenWidth/2, (float)screenHeight/2 };
|
Texture2D texPs3Pad = LoadTexture("resources/ps3.png");
|
||||||
Vector2 gamepadMovement = { 0.0f, 0.0f };
|
Texture2D texXboxPad = LoadTexture("resources/xbox.png");
|
||||||
|
|
||||||
SetTargetFPS(60); // Set target frames-per-second
|
SetTargetFPS(60);
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
@ -34,20 +48,7 @@ int main()
|
|||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsGamepadAvailable(GAMEPAD_PLAYER1))
|
// ...
|
||||||
{
|
|
||||||
gamepadMovement.x = GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_X);
|
|
||||||
gamepadMovement.y = GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_Y);
|
|
||||||
|
|
||||||
ballPosition.x += gamepadMovement.x;
|
|
||||||
ballPosition.y -= gamepadMovement.y;
|
|
||||||
|
|
||||||
if (IsGamepadButtonPressed(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_A))
|
|
||||||
{
|
|
||||||
ballPosition.x = (float)screenWidth/2;
|
|
||||||
ballPosition.y = (float)screenHeight/2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
@ -56,9 +57,126 @@ int main()
|
|||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
DrawText("move the ball with gamepad", 10, 10, 20, DARKGRAY);
|
if (IsGamepadAvailable(GAMEPAD_PLAYER1))
|
||||||
|
{
|
||||||
|
DrawText(FormatText("GP1: %s", GetGamepadName(GAMEPAD_PLAYER1)), 10, 10, 10, BLACK);
|
||||||
|
|
||||||
DrawCircleV(ballPosition, 50, MAROON);
|
if (IsGamepadName(GAMEPAD_PLAYER1, XBOX360_NAME_ID))
|
||||||
|
{
|
||||||
|
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
|
||||||
|
|
||||||
|
// Draw buttons: xbox home
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_HOME)) DrawCircle(394, 89, 19, RED);
|
||||||
|
|
||||||
|
// Draw buttons: basic
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_START)) DrawCircle(436, 150, 9, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_SELECT)) DrawCircle(352, 150, 9, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_X)) DrawCircle(501, 151, 15, BLUE);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_A)) DrawCircle(536, 187, 15, LIME);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_B)) DrawCircle(572, 151, 15, MAROON);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_Y)) DrawCircle(536, 115, 15, GOLD);
|
||||||
|
|
||||||
|
// Draw buttons: d-pad
|
||||||
|
DrawRectangle(317, 202, 19, 71, BLACK);
|
||||||
|
DrawRectangle(293, 228, 69, 19, BLACK);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_UP)) DrawRectangle(317, 202, 19, 26, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_DOWN)) DrawRectangle(317, 202 + 45, 19, 26, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_LEFT)) DrawRectangle(292, 228, 25, 19, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_RIGHT)) DrawRectangle(292 + 44, 228, 26, 19, RED);
|
||||||
|
|
||||||
|
// Draw buttons: left-right back
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_LB)) DrawCircle(259, 61, 20, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_RB)) DrawCircle(536, 61, 20, RED);
|
||||||
|
|
||||||
|
// Draw axis: left joystick
|
||||||
|
DrawCircle(259, 152, 39, BLACK);
|
||||||
|
DrawCircle(259, 152, 34, LIGHTGRAY);
|
||||||
|
DrawCircle(259 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_X)*20),
|
||||||
|
152 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_Y)*20), 25, BLACK);
|
||||||
|
|
||||||
|
// Draw axis: right joystick
|
||||||
|
DrawCircle(461, 237, 38, BLACK);
|
||||||
|
DrawCircle(461, 237, 33, LIGHTGRAY);
|
||||||
|
DrawCircle(461 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RIGHT_X)*20),
|
||||||
|
237 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RIGHT_Y)*20), 25, BLACK);
|
||||||
|
|
||||||
|
// Draw axis: left-right triggers
|
||||||
|
DrawRectangle(170, 30, 15, 70, GRAY);
|
||||||
|
DrawRectangle(604, 30, 15, 70, GRAY);
|
||||||
|
DrawRectangle(170, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT))/2.0f)*70), RED);
|
||||||
|
DrawRectangle(604, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT))/2.0f)*70), RED);
|
||||||
|
|
||||||
|
//DrawText(FormatText("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT)), 10, 40, 10, BLACK);
|
||||||
|
//DrawText(FormatText("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT)), 10, 60, 10, BLACK);
|
||||||
|
}
|
||||||
|
else if (IsGamepadName(GAMEPAD_PLAYER1, PS3_NAME_ID))
|
||||||
|
{
|
||||||
|
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
|
||||||
|
|
||||||
|
// Draw buttons: ps
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_PS)) DrawCircle(396, 222, 13, RED);
|
||||||
|
|
||||||
|
// Draw buttons: basic
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_SELECT)) DrawRectangle(328, 170, 32, 13, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_START)) DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_TRIANGLE)) DrawCircle(557, 144, 13, LIME);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_CIRCLE)) DrawCircle(586, 173, 13, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_CROSS)) DrawCircle(557, 203, 13, VIOLET);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_SQUARE)) DrawCircle(527, 173, 13, PINK);
|
||||||
|
|
||||||
|
// Draw buttons: d-pad
|
||||||
|
DrawRectangle(225, 132, 24, 84, BLACK);
|
||||||
|
DrawRectangle(195, 161, 84, 25, BLACK);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_UP)) DrawRectangle(225, 132, 24, 29, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_DOWN)) DrawRectangle(225, 132 + 54, 24, 30, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_LEFT)) DrawRectangle(195, 161, 30, 25, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_RIGHT)) DrawRectangle(195 + 54, 161, 30, 25, RED);
|
||||||
|
|
||||||
|
// Draw buttons: left-right back buttons
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_L1)) DrawCircle(239, 82, 20, RED);
|
||||||
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_R1)) DrawCircle(557, 82, 20, RED);
|
||||||
|
|
||||||
|
// Draw axis: left joystick
|
||||||
|
DrawCircle(319, 255, 35, BLACK);
|
||||||
|
DrawCircle(319, 255, 31, LIGHTGRAY);
|
||||||
|
DrawCircle(319 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_X)*20),
|
||||||
|
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_Y)*20), 25, BLACK);
|
||||||
|
|
||||||
|
// Draw axis: right joystick
|
||||||
|
DrawCircle(475, 255, 35, BLACK);
|
||||||
|
DrawCircle(475, 255, 31, LIGHTGRAY);
|
||||||
|
DrawCircle(475 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_RIGHT_X)*20),
|
||||||
|
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_RIGHT_Y)*20), 25, BLACK);
|
||||||
|
|
||||||
|
// Draw axis: left-right triggers
|
||||||
|
DrawRectangle(169, 48, 15, 70, GRAY);
|
||||||
|
DrawRectangle(611, 48, 15, 70, GRAY);
|
||||||
|
DrawRectangle(169, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_L2))/2.0f)*70), RED);
|
||||||
|
DrawRectangle(611, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_R2))/2.0f)*70), RED);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawText("- GENERIC GAMEPAD -", 280, 180, 20, GRAY);
|
||||||
|
|
||||||
|
// TODO: Draw generic gamepad
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawText(FormatText("DETECTED AXIS [%i]:", GetGamepadAxisCount(GAMEPAD_PLAYER1)), 10, 50, 10, MAROON);
|
||||||
|
|
||||||
|
for (int i = 0; i < GetGamepadAxisCount(GAMEPAD_PLAYER1); i++)
|
||||||
|
{
|
||||||
|
DrawText(FormatText("AXIS %i: %.02f", i, GetGamepadAxisMovement(GAMEPAD_PLAYER1, i)), 20, 70 + 20*i, 10, DARKGRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetGamepadButtonPressed() != -1) DrawText(FormatText("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED);
|
||||||
|
else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawText("GP1: NOT DETECTED", 10, 10, 10, GRAY);
|
||||||
|
|
||||||
|
DrawTexture(texXboxPad, 0, 0, LIGHTGRAY);
|
||||||
|
}
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
@ -66,6 +184,9 @@ int main()
|
|||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadTexture(texPs3Pad);
|
||||||
|
UnloadTexture(texXboxPad);
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 37 KiB |
@ -48,7 +48,7 @@ int main()
|
|||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsVrSimulator()) UpdateCamera(&camera); // Update camera (simulator mode)
|
if (IsVrSimulator()) UpdateCamera(&camera); // Update camera (simulator mode)
|
||||||
else UpdateVrTracking(&camera); // Update camera with device tracking data
|
else if (IsVrDeviceReady()) UpdateVrTracking(&camera); // Update camera with device tracking data
|
||||||
|
|
||||||
if (IsKeyPressed(KEY_SPACE)) ToggleVrMode(); // Toggle VR mode
|
if (IsKeyPressed(KEY_SPACE)) ToggleVrMode(); // Toggle VR mode
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|||||||
BIN
examples/resources/fonts/KAISG.ttf
Normal file
188
examples/resources/fonts/pixantiqua.fnt
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
info face="PixAntiqua" size=32 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=2,2,2,2 spacing=2,2 outline=0
|
||||||
|
common lineHeight=32 base=27 scaleW=512 scaleH=512 pages=1 packed=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4
|
||||||
|
page id=0 file="pixantiqua_0.png"
|
||||||
|
chars count=184
|
||||||
|
char id=32 x=9 y=304 width=7 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=33 x=391 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=34 x=240 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=35 x=468 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=36 x=152 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=37 x=176 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=38 x=303 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=39 x=495 y=266 width=8 height=36 xoffset=-3 yoffset=-2 xadvance=5 page=0 chnl=15
|
||||||
|
char id=40 x=256 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=199 x=432 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=200 x=126 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=201 x=147 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=202 x=288 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=203 x=189 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=204 x=468 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=205 x=486 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=206 x=0 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=207 x=72 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=208 x=329 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=209 x=277 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=210 x=182 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=211 x=26 y=76 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=41 x=272 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=42 x=288 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=43 x=414 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=44 x=378 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=45 x=414 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=46 x=443 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=47 x=392 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=48 x=485 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=49 x=450 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=50 x=21 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=51 x=42 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=59 x=456 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=60 x=168 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=61 x=309 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=62 x=336 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=63 x=315 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=64 x=364 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=65 x=390 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=66 x=120 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=67 x=144 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=68 x=168 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=69 x=294 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=52 x=488 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=53 x=63 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=54 x=24 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=55 x=48 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=56 x=72 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=57 x=96 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=58 x=404 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=70 x=252 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=71 x=192 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=72 x=78 y=76 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=78 x=78 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=79 x=355 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=80 x=264 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=81 x=381 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=82 x=288 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=83 x=312 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=91 x=144 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=92 x=108 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=93 x=304 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=94 x=34 y=0 width=32 height=36 xoffset=-3 yoffset=-2 xadvance=29 page=0 chnl=15
|
||||||
|
char id=95 x=231 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=96 x=442 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=97 x=408 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=98 x=432 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=99 x=210 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=84 x=336 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=85 x=360 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=86 x=0 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=87 x=68 y=0 width=30 height=36 xoffset=-3 yoffset=-2 xadvance=27 page=0 chnl=15
|
||||||
|
char id=88 x=26 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=89 x=384 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=90 x=84 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=100 x=456 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=101 x=480 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=102 x=54 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=103 x=0 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=104 x=24 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=105 x=469 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=106 x=18 y=266 width=16 height=36 xoffset=-8 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=107 x=48 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=108 x=417 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=109 x=161 y=0 width=27 height=36 xoffset=-3 yoffset=-2 xadvance=24 page=0 chnl=15
|
||||||
|
char id=110 x=72 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=111 x=96 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=117 x=192 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=118 x=216 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=119 x=248 y=0 width=27 height=36 xoffset=-3 yoffset=-2 xadvance=24 page=0 chnl=15
|
||||||
|
char id=120 x=240 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=121 x=264 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=122 x=288 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=123 x=432 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=124 x=365 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=125 x=378 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=126 x=393 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=127 x=132 y=0 width=27 height=36 xoffset=-3 yoffset=-2 xadvance=24 page=0 chnl=15
|
||||||
|
char id=160 x=0 y=304 width=7 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=161 x=352 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=162 x=351 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=163 x=336 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=165 x=360 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=167 x=384 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=169 x=433 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=170 x=224 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=171 x=105 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=172 x=0 y=0 width=32 height=36 xoffset=-3 yoffset=-2 xadvance=29 page=0 chnl=15
|
||||||
|
char id=173 x=494 y=38 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=174 x=52 y=76 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=175 x=52 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=176 x=126 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=177 x=435 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=178 x=320 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=179 x=336 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=181 x=459 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=112 x=120 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=113 x=144 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=114 x=396 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=115 x=168 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=116 x=36 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=182 x=408 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=183 x=498 y=190 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=185 x=192 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=186 x=208 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=187 x=477 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=191 x=456 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=192 x=407 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=193 x=234 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=194 x=416 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=195 x=156 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=196 x=130 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=197 x=104 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=198 x=190 y=0 width=27 height=36 xoffset=-3 yoffset=-2 xadvance=24 page=0 chnl=15
|
||||||
|
char id=212 x=0 y=76 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=213 x=338 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=214 x=312 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=215 x=357 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=216 x=286 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=217 x=456 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=218 x=480 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=219 x=0 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=220 x=24 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=221 x=48 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=222 x=260 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=223 x=72 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=224 x=96 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=225 x=120 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=226 x=144 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=227 x=168 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=228 x=192 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=229 x=216 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=230 x=219 y=0 width=27 height=36 xoffset=-3 yoffset=-2 xadvance=24 page=0 chnl=15
|
||||||
|
char id=231 x=372 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=73 x=90 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=74 x=216 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=75 x=240 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=76 x=273 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=77 x=100 y=0 width=30 height=36 xoffset=-3 yoffset=-2 xadvance=27 page=0 chnl=15
|
||||||
|
char id=232 x=312 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=233 x=240 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=234 x=264 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=235 x=104 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=236 x=430 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=237 x=482 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=238 x=160 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=239 x=176 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=240 x=128 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=241 x=200 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=242 x=224 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=243 x=248 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=244 x=272 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=245 x=296 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=246 x=320 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=247 x=330 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=248 x=208 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=249 x=344 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=250 x=368 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=251 x=416 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=252 x=440 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=253 x=464 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=254 x=0 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=255 x=0 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
BIN
examples/resources/fonts/pixantiqua_0.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
examples/resources/ps3.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
examples/resources/xbox.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
@ -7,7 +7,8 @@
|
|||||||
* Compile example using:
|
* Compile example using:
|
||||||
* gcc -o $(NAME_PART).exe $(FILE_NAME) $(RAYLIB_DIR)\raylib_icon /
|
* gcc -o $(NAME_PART).exe $(FILE_NAME) $(RAYLIB_DIR)\raylib_icon /
|
||||||
* -I../src -I../src/external/lua/include -L../src/external/lua/lib /
|
* -I../src -I../src/external/lua/include -L../src/external/lua/lib /
|
||||||
* -lraylib -lglfw3 -lopengl32 -lopenal32 -llua53 -lgdi32 -std=c99
|
* -lraylib -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -llua53 /
|
||||||
|
* -std=c99 -Wl,-allow-multiple-definition -Wl,--subsystem,windows
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.6 (www.raylib.com)
|
* This example has been created using raylib 1.6 (www.raylib.com)
|
||||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
@ -28,7 +29,7 @@ int main()
|
|||||||
InitLuaDevice();
|
InitLuaDevice();
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// ExecuteLuaFile("core_basic_window.lua"); // OK!
|
ExecuteLuaFile("core_basic_window.lua"); // OK!
|
||||||
// ExecuteLuaFile("core_input_keys.lua"); // OK!
|
// ExecuteLuaFile("core_input_keys.lua"); // OK!
|
||||||
// ExecuteLuaFile("core_input_mouse.lua"); // OK!
|
// ExecuteLuaFile("core_input_mouse.lua"); // OK!
|
||||||
// ExecuteLuaFile("core_mouse_wheel.lua"); // OK!
|
// ExecuteLuaFile("core_mouse_wheel.lua"); // OK!
|
||||||
|
|||||||
65
examples/text_bmfont_unordered.c
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [text] example - BMFont unordered chars loading and drawing
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.4 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [text] example - bmfont unordered loading and drawing");
|
||||||
|
|
||||||
|
// NOTE: Using chars outside the [32..127] limits!
|
||||||
|
// NOTE: If a character is not found in the font, it just renders a space
|
||||||
|
const char msg[256] = "ASCII extended characters:\n¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆ\nÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæ\nçèéêëìíîïðñòóôõö÷øùúûüýþÿ";
|
||||||
|
|
||||||
|
// NOTE: Loaded font has an unordered list of characters (chars in the range 32..255)
|
||||||
|
SpriteFont font = LoadSpriteFont("resources/fonts/pixantiqua.fnt"); // BMFont (AngelCode)
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// TODO: Update variables here...
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawText("Font name: PixAntiqua", 40, 50, 20, GRAY);
|
||||||
|
DrawText(FormatText("Font base size: %i", font.size), 40, 80, 20, GRAY);
|
||||||
|
DrawText(FormatText("Font chars number: %i", font.numChars), 40, 110, 20, GRAY);
|
||||||
|
|
||||||
|
DrawTextEx(font, msg, (Vector2){ 40, 180 }, font.size, 0, MAROON);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadSpriteFont(font); // AngelCode SpriteFont unloading
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/text_bmfont_unordered.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
124
examples/text_ttf_loading.c
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [text] example - TTF loading and usage
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3.0 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [text] example - ttf loading");
|
||||||
|
|
||||||
|
const char msg1[50] = "TTF SpriteFont";
|
||||||
|
|
||||||
|
// NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
|
||||||
|
|
||||||
|
// TTF SpriteFont loading with custom generation parameters
|
||||||
|
SpriteFont font = LoadSpriteFontTTF("resources/fonts/KAISG.ttf", 96, 0, 0);
|
||||||
|
|
||||||
|
float fontSize = font.size;
|
||||||
|
Vector2 fontPosition = { 40, screenHeight/2 + 50 };
|
||||||
|
Vector2 textSize;
|
||||||
|
|
||||||
|
int currentFontFilter = 0; // FILTER_POINT
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
char **droppedFiles;
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
fontSize += GetMouseWheelMove()*4.0f;
|
||||||
|
|
||||||
|
// Choose font texture filter method
|
||||||
|
if (IsKeyPressed(KEY_ONE))
|
||||||
|
{
|
||||||
|
SetTextureFilter(font.texture, FILTER_POINT);
|
||||||
|
currentFontFilter = 0;
|
||||||
|
}
|
||||||
|
else if (IsKeyPressed(KEY_TWO))
|
||||||
|
{
|
||||||
|
SetTextureFilter(font.texture, FILTER_BILINEAR);
|
||||||
|
currentFontFilter = 1;
|
||||||
|
}
|
||||||
|
else if (IsKeyPressed(KEY_THREE))
|
||||||
|
{
|
||||||
|
// NOTE: Trilinear filter not supported in font because there are not mipmap levels
|
||||||
|
SetTextureFilter(font.texture, FILTER_TRILINEAR);
|
||||||
|
//currentFontFilter = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
textSize = MeasureTextEx(font, msg1, fontSize, 0);
|
||||||
|
|
||||||
|
if (IsKeyDown(KEY_LEFT)) fontPosition.x -= 10;
|
||||||
|
else if (IsKeyDown(KEY_RIGHT)) fontPosition.x += 10;
|
||||||
|
|
||||||
|
// Load a dropped TTF file dynamically (at current fontSize)
|
||||||
|
if (IsFileDropped())
|
||||||
|
{
|
||||||
|
droppedFiles = GetDroppedFiles(&count);
|
||||||
|
|
||||||
|
if (count == 1) // Only support one ttf file dropped
|
||||||
|
{
|
||||||
|
UnloadSpriteFont(font);
|
||||||
|
font = LoadSpriteFontTTF(droppedFiles[0], fontSize, 0, 0);
|
||||||
|
ClearDroppedFiles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawText("Use mouse wheel to change font size", 20, 20, 10, GRAY);
|
||||||
|
DrawText("Use KEY_RIGHT and KEY_LEFT to move text", 20, 40, 10, GRAY);
|
||||||
|
DrawText("Use 1, 2, 3 to change texture filter", 20, 60, 10, GRAY);
|
||||||
|
DrawText("Drop a new TTF font for dynamic loading", 20, 80, 10, DARKGRAY);
|
||||||
|
|
||||||
|
DrawTextEx(font, msg1, fontPosition, fontSize, 0, BLACK);
|
||||||
|
|
||||||
|
// TODO: It seems texSize measurement is not accurate due to chars offsets...
|
||||||
|
//DrawRectangleLines(fontPosition.x, fontPosition.y, textSize.x, textSize.y, RED);
|
||||||
|
|
||||||
|
DrawRectangle(0, screenHeight - 80, screenWidth, 80, LIGHTGRAY);
|
||||||
|
DrawText(FormatText("Font size: %02.02f", fontSize), 20, screenHeight - 50, 10, DARKGRAY);
|
||||||
|
DrawText(FormatText("Text size: [%02.02f, %02.02f]", textSize.x, textSize.y), 20, screenHeight - 30, 10, DARKGRAY);
|
||||||
|
DrawText("CURRENT TEXTURE FILTER:", 250, 400, 20, GRAY);
|
||||||
|
|
||||||
|
if (currentFontFilter == 0) DrawText("POINT", 570, 400, 20, BLACK);
|
||||||
|
else if (currentFontFilter == 1) DrawText("BILINEAR", 570, 400, 20, BLACK);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadSpriteFont(font); // SpriteFont unloading
|
||||||
|
|
||||||
|
ClearDroppedFiles(); // Clear internal buffers
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/text_ttf_loading.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
@ -32,7 +32,8 @@ int main()
|
|||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
framesCounter++;
|
if (IsKeyDown(KEY_SPACE)) framesCounter += 8;
|
||||||
|
else framesCounter++;
|
||||||
|
|
||||||
if (IsKeyPressed(KEY_ENTER)) framesCounter = 0;
|
if (IsKeyPressed(KEY_ENTER)) framesCounter = 0;
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
@ -45,7 +46,8 @@ int main()
|
|||||||
|
|
||||||
DrawText(SubText(message, 0, framesCounter/10), 210, 160, 20, MAROON);
|
DrawText(SubText(message, 0, framesCounter/10), 210, 160, 20, MAROON);
|
||||||
|
|
||||||
DrawText("PRESS [ENTER] to RESTART!", 240, 280, 20, LIGHTGRAY);
|
DrawText("PRESS [ENTER] to RESTART!", 240, 260, 20, LIGHTGRAY);
|
||||||
|
DrawText("PRESS [SPACE] to SPEED UP!", 239, 300, 20, LIGHTGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|||||||
BIN
release/win32/mingw32/libraylibdll.a
Normal file
@ -1,32 +0,0 @@
|
|||||||
cmake_minimum_required (VERSION 3.0)
|
|
||||||
project (raylib)
|
|
||||||
SET(PLATFORM_TO_USE "PLATFORM_DESKTOP" CACHE STRING "Platform to compile for")
|
|
||||||
SET_PROPERTY(CACHE PLATFORM_TO_USE PROPERTY STRINGS PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB)
|
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "-O1 -Wall -std=gnu99 -fgnu89-inline -Wno-missing-braces")
|
|
||||||
|
|
||||||
IF(${PLATFORM_TO_USE} MATCHES "PLATFORM_DESKTOP")
|
|
||||||
|
|
||||||
add_definitions(-DPLATFORM_DESKTOP, -DGRAPHICS_API_OPENGL_33)
|
|
||||||
include_directories("." "external/" "external/openal_soft/include" "external/glfw3/include")
|
|
||||||
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(${PLATFORM_TO_USE} MATCHES "PLATFORM_RPI")
|
|
||||||
|
|
||||||
add_definitions(-DPLATFORM_RPI, -GRAPHICS_API_OPENGL_ES2)
|
|
||||||
include_directories("." "external/" "/opt/vc/include" "/opt/vc/include/interface/vmcs_host/linux" "/opt/vc/include/interface/vcos/pthreads")
|
|
||||||
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(${PLATFORM_TO_USE} MATCHES "PLATFORM_WEB")
|
|
||||||
|
|
||||||
add_definitions(-DPLATFORM_WEB, -GRAPHICS_API_OPENGL_ES2)
|
|
||||||
include_directories("." "external/" "external/openal_soft/include" "external/glfw3/include")
|
|
||||||
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
|
|
||||||
file(GLOB SOURCES "*.c" "external/*.c")
|
|
||||||
add_library(raylib STATIC ${SOURCES})
|
|
||||||
install(TARGETS raylib DESTINATION ../lib/)
|
|
||||||
28
src/Makefile
@ -38,6 +38,14 @@ PLATFORM ?= PLATFORM_DESKTOP
|
|||||||
# define YES if you want shared/dynamic version of library instead of static (default)
|
# define YES if you want shared/dynamic version of library instead of static (default)
|
||||||
SHARED ?= NO
|
SHARED ?= NO
|
||||||
|
|
||||||
|
# define NO to use OpenAL Soft as static library (or shared by default)
|
||||||
|
SHARED_OPENAL ?= YES
|
||||||
|
|
||||||
|
# on PLATFORM_WEB force OpenAL Soft shared library
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
SHARED_OPENAL ?= YES
|
||||||
|
endif
|
||||||
|
|
||||||
# determine if the file has root access (only for installing raylib)
|
# determine if the file has root access (only for installing raylib)
|
||||||
# "whoami" prints the name of the user that calls him (so, if it is the root
|
# "whoami" prints the name of the user that calls him (so, if it is the root
|
||||||
# user, "whoami" prints "root").
|
# user, "whoami" prints "root").
|
||||||
@ -99,11 +107,20 @@ CFLAGS = -O1 -Wall -std=gnu99 -fgnu89-inline -Wno-missing-braces
|
|||||||
ifeq ($(SHARED),YES)
|
ifeq ($(SHARED),YES)
|
||||||
CFLAGS += -fPIC
|
CFLAGS += -fPIC
|
||||||
SHAREDFLAG = BUILDING_DLL
|
SHAREDFLAG = BUILDING_DLL
|
||||||
SHAREDLIBS = -Lexternal/glfw3/lib/win32 -Lexternal/openal_soft/lib/win32 -lglfw3 -lopenal32 -lgdi32
|
SHAREDLIBS = -Lexternal/glfw3/lib/win32 -Lexternal/openal_soft/lib/win32 -lglfw3 -lgdi32
|
||||||
else
|
else
|
||||||
SHAREDFLAG = BUILDING_STATIC
|
SHAREDFLAG = BUILDING_STATIC
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# if static OpenAL Soft required, define the corresponding flags
|
||||||
|
ifeq ($(SHARED_OPENAL),NO)
|
||||||
|
SHAREDLIBS += -lopenal32 -lwinmm
|
||||||
|
SHAREDOPENALFLAG = AL_LIBTYPE_STATIC
|
||||||
|
else
|
||||||
|
SHAREDLIBS += -lopenal32dll
|
||||||
|
SHAREDOPENALFLAG = SHARED_OPENAL
|
||||||
|
endif
|
||||||
|
|
||||||
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
||||||
|
|
||||||
# define any directories containing required header files
|
# define any directories containing required header files
|
||||||
@ -165,12 +182,17 @@ else
|
|||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
$(CC) -shared -o $(OUTPUT_PATH)/raylib.dll $(OBJS) $(SHAREDLIBS) -Wl,--out-implib,$(OUTPUT_PATH)/libraylibdll.a
|
$(CC) -shared -o $(OUTPUT_PATH)/raylib.dll $(OBJS) $(SHAREDLIBS) -Wl,--out-implib,$(OUTPUT_PATH)/libraylibdll.a
|
||||||
@echo "raylib dynamic library (raylib.dll) and MSVC required import library (libraylibdll.a) generated!"
|
@echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!"
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
# compile raylib static library for desktop platforms.
|
# compile raylib static library for desktop platforms.
|
||||||
ar rcs $(OUTPUT_PATH)/libraylib.a $(OBJS)
|
ar rcs $(OUTPUT_PATH)/libraylib.a $(OBJS)
|
||||||
@echo "libraylib.a generated (static library)!"
|
@echo "libraylib.a generated (static library)!"
|
||||||
|
ifeq ($(SHARED_OPENAL),NO)
|
||||||
|
@echo "expected OpenAL Soft static library linking"
|
||||||
|
else
|
||||||
|
@echo "expected OpenAL Soft shared library linking"
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -202,7 +224,7 @@ models.o : models.c raylib.h rlgl.h raymath.h
|
|||||||
|
|
||||||
# compile audio module
|
# compile audio module
|
||||||
audio.o : audio.c raylib.h
|
audio.o : audio.c raylib.h
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(SHAREDFLAG)
|
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(SHAREDFLAG) -D$(SHAREDOPENALFLAG)
|
||||||
|
|
||||||
# compile stb_vorbis library
|
# compile stb_vorbis library
|
||||||
external/stb_vorbis.o: external/stb_vorbis.c external/stb_vorbis.h
|
external/stb_vorbis.o: external/stb_vorbis.c external/stb_vorbis.h
|
||||||
|
|||||||
27
src/audio.c
@ -2,18 +2,22 @@
|
|||||||
*
|
*
|
||||||
* raylib.audio
|
* raylib.audio
|
||||||
*
|
*
|
||||||
* Basic functions to manage Audio:
|
* This module provides basic functionality to work with audio:
|
||||||
* Manage audio device (init/close)
|
* Manage audio device (init/close)
|
||||||
* Load and Unload audio files
|
* Load and Unload audio files (WAV, OGG, FLAC, XM, MOD)
|
||||||
* Play/Stop/Pause/Resume loaded audio
|
* Play/Stop/Pause/Resume loaded audio
|
||||||
* Manage mixing channels
|
* Manage mixing channels
|
||||||
* Manage raw audio context
|
* Manage raw audio context
|
||||||
*
|
*
|
||||||
* Uses external lib:
|
* External libs:
|
||||||
* OpenAL Soft - Audio device management lib (http://kcat.strangesoft.net/openal.html)
|
* OpenAL Soft - Audio device management (http://kcat.strangesoft.net/openal.html)
|
||||||
* stb_vorbis - Ogg audio files loading (http://www.nothings.org/stb_vorbis/)
|
* stb_vorbis - OGG audio files loading (http://www.nothings.org/stb_vorbis/)
|
||||||
* jar_xm - XM module file loading
|
* jar_xm - XM module file loading
|
||||||
* jar_mod - MOD audio file loading
|
* jar_mod - MOD audio file loading
|
||||||
|
* dr_flac - FLAC audio file loading
|
||||||
|
*
|
||||||
|
* Module Configuration Flags:
|
||||||
|
* AUDIO_STANDALONE - Use this module as standalone library (independently of raylib)
|
||||||
*
|
*
|
||||||
* Many thanks to Joshua Reisenauer (github: @kd7tck) for the following additions:
|
* Many thanks to Joshua Reisenauer (github: @kd7tck) for the following additions:
|
||||||
* XM audio module support (jar_xm)
|
* XM audio module support (jar_xm)
|
||||||
@ -21,6 +25,7 @@
|
|||||||
* Mixing channels support
|
* Mixing channels support
|
||||||
* Raw audio context support
|
* Raw audio context support
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
@ -44,8 +49,11 @@
|
|||||||
|
|
||||||
#if defined(AUDIO_STANDALONE)
|
#if defined(AUDIO_STANDALONE)
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
|
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
|
||||||
#else
|
#else
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
#include "utils.h" // Required for: DecompressData()
|
||||||
|
// NOTE: Includes Android fopen() function map
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "AL/al.h" // OpenAL basic header
|
#include "AL/al.h" // OpenAL basic header
|
||||||
@ -63,13 +71,6 @@
|
|||||||
#define AL_FORMAT_STEREO_FLOAT32 0x10011
|
#define AL_FORMAT_STEREO_FLOAT32 0x10011
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(AUDIO_STANDALONE)
|
|
||||||
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
|
|
||||||
#else
|
|
||||||
#include "utils.h" // Required for: DecompressData()
|
|
||||||
// NOTE: Includes Android fopen() function map
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//#define STB_VORBIS_HEADER_ONLY
|
//#define STB_VORBIS_HEADER_ONLY
|
||||||
#include "external/stb_vorbis.h" // OGG loading functions
|
#include "external/stb_vorbis.h" // OGG loading functions
|
||||||
|
|
||||||
@ -117,7 +118,7 @@ typedef struct MusicData {
|
|||||||
bool loop; // Repeat music after finish (loop)
|
bool loop; // Repeat music after finish (loop)
|
||||||
unsigned int totalSamples; // Total number of samples
|
unsigned int totalSamples; // Total number of samples
|
||||||
unsigned int samplesLeft; // Number of samples left to end
|
unsigned int samplesLeft; // Number of samples left to end
|
||||||
} MusicData, *Music;
|
} MusicData;
|
||||||
|
|
||||||
#if defined(AUDIO_STANDALONE)
|
#if defined(AUDIO_STANDALONE)
|
||||||
typedef enum { INFO = 0, ERROR, WARNING, DEBUG, OTHER } TraceLogType;
|
typedef enum { INFO = 0, ERROR, WARNING, DEBUG, OTHER } TraceLogType;
|
||||||
|
|||||||
47
src/audio.h
@ -2,18 +2,19 @@
|
|||||||
*
|
*
|
||||||
* raylib.audio
|
* raylib.audio
|
||||||
*
|
*
|
||||||
* Basic functions to manage Audio:
|
* This module provides basic functionality to work with audio:
|
||||||
* Manage audio device (init/close)
|
* Manage audio device (init/close)
|
||||||
* Load and Unload audio files
|
* Load and Unload audio files (WAV, OGG, FLAC, XM, MOD)
|
||||||
* Play/Stop/Pause/Resume loaded audio
|
* Play/Stop/Pause/Resume loaded audio
|
||||||
* Manage mixing channels
|
* Manage mixing channels
|
||||||
* Manage raw audio context
|
* Manage raw audio context
|
||||||
*
|
*
|
||||||
* Uses external lib:
|
* External libs:
|
||||||
* OpenAL Soft - Audio device management lib (http://kcat.strangesoft.net/openal.html)
|
* OpenAL Soft - Audio device management (http://kcat.strangesoft.net/openal.html)
|
||||||
* stb_vorbis - Ogg audio files loading (http://www.nothings.org/stb_vorbis/)
|
* stb_vorbis - OGG audio files loading (http://www.nothings.org/stb_vorbis/)
|
||||||
* jar_xm - XM module file loading
|
* jar_xm - XM module file loading
|
||||||
* jar_mod - MOD audio file loading
|
* jar_mod - MOD audio file loading
|
||||||
|
* dr_flac - FLAC audio file loading
|
||||||
*
|
*
|
||||||
* Many thanks to Joshua Reisenauer (github: @kd7tck) for the following additions:
|
* Many thanks to Joshua Reisenauer (github: @kd7tck) for the following additions:
|
||||||
* XM audio module support (jar_xm)
|
* XM audio module support (jar_xm)
|
||||||
@ -21,6 +22,7 @@
|
|||||||
* Mixing channels support
|
* Mixing channels support
|
||||||
* Raw audio context support
|
* Raw audio context support
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
@ -60,12 +62,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Sound source type
|
|
||||||
typedef struct Sound {
|
|
||||||
unsigned int source; // Sound audio source id
|
|
||||||
unsigned int buffer; // Sound audio buffer id
|
|
||||||
} Sound;
|
|
||||||
|
|
||||||
// Wave type, defines audio wave data
|
// Wave type, defines audio wave data
|
||||||
typedef struct Wave {
|
typedef struct Wave {
|
||||||
unsigned int sampleCount; // Number of samples
|
unsigned int sampleCount; // Number of samples
|
||||||
@ -75,9 +71,16 @@ typedef struct Wave {
|
|||||||
void *data; // Buffer data pointer
|
void *data; // Buffer data pointer
|
||||||
} Wave;
|
} Wave;
|
||||||
|
|
||||||
|
// Sound source type
|
||||||
|
typedef struct Sound {
|
||||||
|
unsigned int source; // OpenAL audio source id
|
||||||
|
unsigned int buffer; // OpenAL audio buffer id
|
||||||
|
int format; // OpenAL audio format specifier
|
||||||
|
} Sound;
|
||||||
|
|
||||||
// Music type (file streaming from memory)
|
// Music type (file streaming from memory)
|
||||||
// NOTE: Anything longer than ~10 seconds should be streamed
|
// NOTE: Anything longer than ~10 seconds should be streamed
|
||||||
typedef struct Music *Music;
|
typedef struct MusicData *Music;
|
||||||
|
|
||||||
// Audio stream type
|
// Audio stream type
|
||||||
// NOTE: Useful to create custom audio streams not bound to a specific file
|
// NOTE: Useful to create custom audio streams not bound to a specific file
|
||||||
@ -104,13 +107,16 @@ extern "C" { // Prevents name mangling of functions
|
|||||||
// Module Functions Declaration
|
// Module Functions Declaration
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
void InitAudioDevice(void); // Initialize audio device and context
|
void InitAudioDevice(void); // Initialize audio device and context
|
||||||
void CloseAudioDevice(void); // Close the audio device and context (and music stream)
|
void CloseAudioDevice(void); // Close the audio device and context
|
||||||
bool IsAudioDeviceReady(void); // Check if audio device has been initialized successfully
|
bool IsAudioDeviceReady(void); // Check if audio device has been initialized successfully
|
||||||
|
|
||||||
Sound LoadSound(char *fileName); // Load sound to memory
|
Wave LoadWave(const char *fileName); // Load wave data from file into RAM
|
||||||
|
Wave LoadWaveEx(float *data, int sampleCount, int sampleRate, int sampleSize, int channels); // Load wave data from float array data (32bit)
|
||||||
|
Sound LoadSound(const char *fileName); // Load sound to memory
|
||||||
Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data
|
Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data
|
||||||
Sound LoadSoundFromRES(const char *rresName, int resId); // Load sound to memory from rRES file (raylib Resource)
|
Sound LoadSoundFromRES(const char *rresName, int resId); // Load sound to memory from rRES file (raylib Resource)
|
||||||
void UpdateSound(Sound sound, void *data, int numSamples); // Update sound buffer with new data
|
void UpdateSound(Sound sound, void *data, int numSamples); // Update sound buffer with new data
|
||||||
|
void UnloadWave(Wave wave); // Unload wave data
|
||||||
void UnloadSound(Sound sound); // Unload sound
|
void UnloadSound(Sound sound); // Unload sound
|
||||||
void PlaySound(Sound sound); // Play a sound
|
void PlaySound(Sound sound); // Play a sound
|
||||||
void PauseSound(Sound sound); // Pause a sound
|
void PauseSound(Sound sound); // Pause a sound
|
||||||
@ -119,12 +125,15 @@ void StopSound(Sound sound); // Stop playing
|
|||||||
bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
|
bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
|
||||||
void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
|
void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
|
||||||
void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
||||||
|
void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format
|
||||||
Music LoadMusicStream(char *fileName); // Load music stream from file
|
Wave WaveCopy(Wave wave); // Copy a wave to a new wave
|
||||||
|
void WaveCrop(Wave *wave, int initSample, int finalSample); // Crop a wave to defined samples range
|
||||||
|
float *GetWaveData(Wave wave); // Get samples data from wave as a floats array
|
||||||
|
Music LoadMusicStream(const char *fileName); // Load music stream from file
|
||||||
void UnloadMusicStream(Music music); // Unload music stream
|
void UnloadMusicStream(Music music); // Unload music stream
|
||||||
void PlayMusicStream(Music music); // Start music playing (open stream)
|
void PlayMusicStream(Music music); // Start music playing
|
||||||
void UpdateMusicStream(Music music); // Updates buffers for music streaming
|
void UpdateMusicStream(Music music); // Updates buffers for music streaming
|
||||||
void StopMusicStream(Music music); // Stop music playing (close stream)
|
void StopMusicStream(Music music); // Stop music playing
|
||||||
void PauseMusicStream(Music music); // Pause music playing
|
void PauseMusicStream(Music music); // Pause music playing
|
||||||
void ResumeMusicStream(Music music); // Resume playing paused music
|
void ResumeMusicStream(Music music); // Resume playing paused music
|
||||||
bool IsMusicPlaying(Music music); // Check if music is playing
|
bool IsMusicPlaying(Music music); // Check if music is playing
|
||||||
@ -135,7 +144,7 @@ float GetMusicTimePlayed(Music music); // Get current m
|
|||||||
|
|
||||||
AudioStream InitAudioStream(unsigned int sampleRate,
|
AudioStream InitAudioStream(unsigned int sampleRate,
|
||||||
unsigned int sampleSize,
|
unsigned int sampleSize,
|
||||||
unsigned int channels); // Init audio stream (to stream audio pcm data)
|
unsigned int channels); // Init audio stream (to stream raw audio pcm data)
|
||||||
void UpdateAudioStream(AudioStream stream, void *data, int numSamples); // Update audio stream buffers with data
|
void UpdateAudioStream(AudioStream stream, void *data, int numSamples); // Update audio stream buffers with data
|
||||||
void CloseAudioStream(AudioStream stream); // Close audio stream and free memory
|
void CloseAudioStream(AudioStream stream); // Close audio stream and free memory
|
||||||
bool IsAudioBufferProcessed(AudioStream stream); // Check if any audio stream buffers requires refill
|
bool IsAudioBufferProcessed(AudioStream stream); // Check if any audio stream buffers requires refill
|
||||||
|
|||||||
54
src/core.c
@ -4,24 +4,25 @@
|
|||||||
*
|
*
|
||||||
* Basic functions to manage windows, OpenGL context and input on multiple platforms
|
* Basic functions to manage windows, OpenGL context and input on multiple platforms
|
||||||
*
|
*
|
||||||
* The following platforms are supported:
|
* The following platforms are supported: Windows, Linux, Mac (OSX), Android, Raspberry Pi, HTML5, Oculus Rift CV1
|
||||||
* PLATFORM_DESKTOP - Windows, Linux, Mac (OSX)
|
|
||||||
* PLATFORM_ANDROID - Only OpenGL ES 2.0 devices
|
|
||||||
* PLATFORM_RPI - Rapsberry Pi (tested on Raspbian)
|
|
||||||
* PLATFORM_WEB - Emscripten, HTML5
|
|
||||||
* Oculus Rift CV1 (with desktop mirror) - View [rlgl] module to enable it
|
|
||||||
*
|
*
|
||||||
* On PLATFORM_DESKTOP, the external lib GLFW3 (www.glfw.com) is used to manage graphic
|
* External libs:
|
||||||
* device, OpenGL context and input on multiple operating systems (Windows, Linux, OSX).
|
* GLFW3 - Manage graphic device, OpenGL context and inputs on PLATFORM_DESKTOP (Windows, Linux, OSX)
|
||||||
*
|
* raymath - 3D math functionality (Vector3, Matrix, Quaternion)
|
||||||
* On PLATFORM_ANDROID, graphic device is managed by EGL and input system by Android activity.
|
* camera - Multiple 3D camera modes (free, orbital, 1st person, 3rd person)
|
||||||
*
|
* gestures - Gestures system for touch-ready devices (or simulated from mouse inputs)
|
||||||
* On PLATFORM_RPI, graphic device is managed by EGL and input system is coded in raw mode.
|
|
||||||
*
|
*
|
||||||
* Module Configuration Flags:
|
* Module Configuration Flags:
|
||||||
|
* PLATFORM_DESKTOP - Windows, Linux, Mac (OSX)
|
||||||
|
* PLATFORM_ANDROID - Android (only OpenGL ES 2.0 devices), graphic device is managed by EGL and input system by Android activity.
|
||||||
|
* PLATFORM_RPI - Rapsberry Pi (tested on Raspbian), graphic device is managed by EGL and input system is coded in raw mode.
|
||||||
|
* PLATFORM_WEB - HTML5 (using emscripten compiler)
|
||||||
*
|
*
|
||||||
* RL_LOAD_DEFAULT_FONT - Use external module functions to load default raylib font (module: text)
|
* RL_LOAD_DEFAULT_FONT - Use external module functions to load default raylib font (module: text)
|
||||||
*
|
*
|
||||||
|
* NOTE: Oculus Rift CV1 requires PLATFORM_DESKTOP for render mirror - View [rlgl] module to enable it
|
||||||
|
*
|
||||||
|
*
|
||||||
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
@ -96,7 +97,7 @@
|
|||||||
#include <sys/ioctl.h> // UNIX System call for device-specific input/output operations - ioctl()
|
#include <sys/ioctl.h> // UNIX System call for device-specific input/output operations - ioctl()
|
||||||
#include <linux/kd.h> // Linux: KDSKBMODE, K_MEDIUMRAM constants definition
|
#include <linux/kd.h> // Linux: KDSKBMODE, K_MEDIUMRAM constants definition
|
||||||
#include <linux/input.h> // Linux: Keycodes constants definition (KEY_A, ...)
|
#include <linux/input.h> // Linux: Keycodes constants definition (KEY_A, ...)
|
||||||
#include <linux/joystick.h>
|
#include <linux/joystick.h> // Linux: Joystick support library
|
||||||
|
|
||||||
#include "bcm_host.h" // Raspberry Pi VideoCore IV access functions
|
#include "bcm_host.h" // Raspberry Pi VideoCore IV access functions
|
||||||
|
|
||||||
@ -175,6 +176,7 @@ static pthread_t mouseThreadId; // Mouse reading thread id
|
|||||||
// Gamepad input variables
|
// Gamepad input variables
|
||||||
static int gamepadStream[MAX_GAMEPADS] = { -1 };// Gamepad device file descriptor
|
static int gamepadStream[MAX_GAMEPADS] = { -1 };// Gamepad device file descriptor
|
||||||
static pthread_t gamepadThreadId; // Gamepad reading thread id
|
static pthread_t gamepadThreadId; // Gamepad reading thread id
|
||||||
|
static char gamepadName[64]; // Gamepad name holder
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI)
|
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI)
|
||||||
@ -666,7 +668,7 @@ void Begin3dMode(Camera camera)
|
|||||||
{
|
{
|
||||||
rlglDraw(); // Draw Buffers (Only OpenGL 3+ and ES2)
|
rlglDraw(); // Draw Buffers (Only OpenGL 3+ and ES2)
|
||||||
|
|
||||||
if (IsVrDeviceReady()) BeginVrDrawing();
|
if (IsVrDeviceReady() || IsVrSimulator()) BeginVrDrawing();
|
||||||
|
|
||||||
rlMatrixMode(RL_PROJECTION); // Switch to projection matrix
|
rlMatrixMode(RL_PROJECTION); // Switch to projection matrix
|
||||||
|
|
||||||
@ -696,7 +698,7 @@ void End3dMode(void)
|
|||||||
{
|
{
|
||||||
rlglDraw(); // Process internal buffers (update + draw)
|
rlglDraw(); // Process internal buffers (update + draw)
|
||||||
|
|
||||||
if (IsVrDeviceReady()) EndVrDrawing();
|
if (IsVrDeviceReady() || IsVrSimulator()) EndVrDrawing();
|
||||||
|
|
||||||
rlMatrixMode(RL_PROJECTION); // Switch to projection matrix
|
rlMatrixMode(RL_PROJECTION); // Switch to projection matrix
|
||||||
rlPopMatrix(); // Restore previous matrix (PROJECTION) from matrix stack
|
rlPopMatrix(); // Restore previous matrix (PROJECTION) from matrix stack
|
||||||
@ -1173,11 +1175,13 @@ bool IsGamepadAvailable(int gamepad)
|
|||||||
bool IsGamepadName(int gamepad, const char *name)
|
bool IsGamepadName(int gamepad, const char *name)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
|
#if !defined(PLATFORM_ANDROID)
|
||||||
const char *gamepadName = NULL;
|
const char *gamepadName = NULL;
|
||||||
|
|
||||||
if (gamepadReady[gamepad]) gamepadName = GetGamepadName(gamepad);
|
if (gamepadReady[gamepad]) gamepadName = GetGamepadName(gamepad);
|
||||||
|
|
||||||
if ((name != NULL) && (gamepadName != NULL)) result = (strcmp(name, gamepadName) == 0);
|
if ((name != NULL) && (gamepadName != NULL)) result = (strcmp(name, gamepadName) == 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1188,6 +1192,10 @@ const char *GetGamepadName(int gamepad)
|
|||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
if (gamepadReady[gamepad]) return glfwGetJoystickName(gamepad);
|
if (gamepadReady[gamepad]) return glfwGetJoystickName(gamepad);
|
||||||
else return NULL;
|
else return NULL;
|
||||||
|
#elif defined(PLATFORM_RPI)
|
||||||
|
if (gamepadReady[gamepad]) ioctl(gamepadStream[gamepad], JSIOCGNAME(64), &gamepadName);
|
||||||
|
|
||||||
|
return gamepadName;
|
||||||
#else
|
#else
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
@ -1196,6 +1204,11 @@ const char *GetGamepadName(int gamepad)
|
|||||||
// Return gamepad axis count
|
// Return gamepad axis count
|
||||||
int GetGamepadAxisCount(int gamepad)
|
int GetGamepadAxisCount(int gamepad)
|
||||||
{
|
{
|
||||||
|
#if defined(PLATFORM_RPI)
|
||||||
|
int axisCount = 0;
|
||||||
|
if (gamepadReady[gamepad]) ioctl(gamepadStream[gamepad], JSIOCGAXES, &axisCount);
|
||||||
|
gamepadAxisCount = axisCount;
|
||||||
|
#endif
|
||||||
return gamepadAxisCount;
|
return gamepadAxisCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1939,9 +1952,11 @@ static void PollInputEvents(void)
|
|||||||
// Reset last key pressed registered
|
// Reset last key pressed registered
|
||||||
lastKeyPressed = -1;
|
lastKeyPressed = -1;
|
||||||
|
|
||||||
// Reset last gamepad button pressed registered
|
#if !defined(PLATFORM_RPI)
|
||||||
|
// Reset last gamepad button/axis registered state
|
||||||
lastGamepadButtonPressed = -1;
|
lastGamepadButtonPressed = -1;
|
||||||
gamepadAxisCount = 0;
|
gamepadAxisCount = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||||
// Mouse input polling
|
// Mouse input polling
|
||||||
@ -1963,7 +1978,11 @@ static void PollInputEvents(void)
|
|||||||
|
|
||||||
previousMouseWheelY = currentMouseWheelY;
|
previousMouseWheelY = currentMouseWheelY;
|
||||||
currentMouseWheelY = 0;
|
currentMouseWheelY = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// NOTE: GLFW3 joystick functionality not available in web
|
||||||
|
// TODO: Support joysticks using emscripten API
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
// Check if gamepads are ready
|
// Check if gamepads are ready
|
||||||
// NOTE: We do it here in case of disconection
|
// NOTE: We do it here in case of disconection
|
||||||
for (int i = 0; i < MAX_GAMEPADS; i++)
|
for (int i = 0; i < MAX_GAMEPADS; i++)
|
||||||
@ -2850,6 +2869,7 @@ static void *GamepadThread(void *arg)
|
|||||||
currentGamepadState[i][gamepadEvent.number] = (int)gamepadEvent.value;
|
currentGamepadState[i][gamepadEvent.number] = (int)gamepadEvent.value;
|
||||||
|
|
||||||
if ((int)gamepadEvent.value == 1) lastGamepadButtonPressed = gamepadEvent.number;
|
if ((int)gamepadEvent.value == 1) lastGamepadButtonPressed = gamepadEvent.number;
|
||||||
|
else lastGamepadButtonPressed = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (gamepadEvent.type == JS_EVENT_AXIS)
|
else if (gamepadEvent.type == JS_EVENT_AXIS)
|
||||||
|
|||||||
4
src/external/stb_image.h
vendored
@ -390,7 +390,7 @@ publish, and distribute this file as you see fit.
|
|||||||
|
|
||||||
|
|
||||||
#define STBI_NO_HDR // RaySan: not required by raylib
|
#define STBI_NO_HDR // RaySan: not required by raylib
|
||||||
#define STBI_NO_SIMD // RaySan: issues when compiling with GCC 4.7.2
|
//#define STBI_NO_SIMD // RaySan: issues when compiling with GCC 4.7.2
|
||||||
|
|
||||||
#ifndef STBI_NO_STDIO
|
#ifndef STBI_NO_STDIO
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -398,7 +398,7 @@ publish, and distribute this file as you see fit.
|
|||||||
|
|
||||||
// NOTE: Added to work with raylib on Android
|
// NOTE: Added to work with raylib on Android
|
||||||
#if defined(PLATFORM_ANDROID)
|
#if defined(PLATFORM_ANDROID)
|
||||||
#include "utils.h" // Android fopen function map
|
#include "utils.h" // RaySan: Android fopen function map
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STBI_VERSION 1
|
#define STBI_VERSION 1
|
||||||
|
|||||||
62
src/models.c
@ -4,6 +4,12 @@
|
|||||||
*
|
*
|
||||||
* Basic functions to draw 3d shapes and load/draw 3d models (.OBJ)
|
* Basic functions to draw 3d shapes and load/draw 3d models (.OBJ)
|
||||||
*
|
*
|
||||||
|
* External libs:
|
||||||
|
* rlgl - raylib OpenGL abstraction layer
|
||||||
|
*
|
||||||
|
* Module Configuration Flags:
|
||||||
|
* ...
|
||||||
|
*
|
||||||
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
@ -34,8 +40,7 @@
|
|||||||
#include <string.h> // Required for: strcmp()
|
#include <string.h> // Required for: strcmp()
|
||||||
#include <math.h> // Required for: sin(), cos()
|
#include <math.h> // Required for: sin(), cos()
|
||||||
|
|
||||||
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2
|
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2
|
||||||
#include "raymath.h" // Matrix data type and Matrix functions
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Defines and Macros
|
// Defines and Macros
|
||||||
@ -76,11 +81,11 @@ void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw a circle in 3D world space
|
// Draw a circle in 3D world space
|
||||||
void DrawCircle3D(Vector3 center, float radius, float rotationAngle, Vector3 rotation, Color color)
|
void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color)
|
||||||
{
|
{
|
||||||
rlPushMatrix();
|
rlPushMatrix();
|
||||||
rlTranslatef(center.x, center.y, center.z);
|
rlTranslatef(center.x, center.y, center.z);
|
||||||
rlRotatef(rotationAngle, rotation.x, rotation.y, rotation.z);
|
rlRotatef(rotationAngle, rotationAxis.x, rotationAxis.y, rotationAxis.z);
|
||||||
|
|
||||||
rlBegin(RL_LINES);
|
rlBegin(RL_LINES);
|
||||||
for (int i = 0; i < 360; i += 10)
|
for (int i = 0; i < 360; i += 10)
|
||||||
@ -579,9 +584,9 @@ void DrawLight(Light light)
|
|||||||
{
|
{
|
||||||
DrawSphereWires(light->position, 0.3f*light->intensity, 8, 8, (light->enabled ? light->diffuse : GRAY));
|
DrawSphereWires(light->position, 0.3f*light->intensity, 8, 8, (light->enabled ? light->diffuse : GRAY));
|
||||||
|
|
||||||
DrawCircle3D(light->position, light->radius, 0.0f, (Vector3){ 0, 0, 0 }, (light->enabled ? light->diffuse : GRAY));
|
DrawCircle3D(light->position, light->radius, (Vector3){ 0, 0, 0 }, 0.0f, (light->enabled ? light->diffuse : GRAY));
|
||||||
DrawCircle3D(light->position, light->radius, 90.0f, (Vector3){ 1, 0, 0 }, (light->enabled ? light->diffuse : GRAY));
|
DrawCircle3D(light->position, light->radius, (Vector3){ 1, 0, 0 }, 90.0f, (light->enabled ? light->diffuse : GRAY));
|
||||||
DrawCircle3D(light->position, light->radius, 90.0f, (Vector3){ 0, 1, 0 }, (light->enabled ? light->diffuse : GRAY));
|
DrawCircle3D(light->position, light->radius, (Vector3){ 0, 1, 0 },90.0f, (light->enabled ? light->diffuse : GRAY));
|
||||||
} break;
|
} break;
|
||||||
case LIGHT_DIRECTIONAL:
|
case LIGHT_DIRECTIONAL:
|
||||||
{
|
{
|
||||||
@ -597,7 +602,7 @@ void DrawLight(Light light)
|
|||||||
Vector3 dir = VectorSubtract(light->target, light->position);
|
Vector3 dir = VectorSubtract(light->target, light->position);
|
||||||
VectorNormalize(&dir);
|
VectorNormalize(&dir);
|
||||||
|
|
||||||
DrawCircle3D(light->position, 0.5f, 0.0f, dir, (light->enabled ? light->diffuse : GRAY));
|
DrawCircle3D(light->position, 0.5f, dir, 0.0f, (light->enabled ? light->diffuse : GRAY));
|
||||||
|
|
||||||
//DrawCylinderWires(light->position, 0.0f, 0.3f*light->coneAngle/50, 0.6f, 5, (light->enabled ? light->diffuse : GRAY));
|
//DrawCylinderWires(light->position, 0.0f, 0.3f*light->coneAngle/50, 0.6f, 5, (light->enabled ? light->diffuse : GRAY));
|
||||||
DrawCubeWires(light->target, 0.3f, 0.3f, 0.3f, (light->enabled ? light->diffuse : GRAY));
|
DrawCubeWires(light->target, 0.3f, 0.3f, 0.3f, (light->enabled ? light->diffuse : GRAY));
|
||||||
@ -1411,7 +1416,7 @@ bool CheckCollisionSpheres(Vector3 centerA, float radiusA, Vector3 centerB, floa
|
|||||||
float dy = centerA.y - centerB.y; // Y distance between centers
|
float dy = centerA.y - centerB.y; // Y distance between centers
|
||||||
float dz = centerA.z - centerB.z; // Y distance between centers
|
float dz = centerA.z - centerB.z; // Y distance between centers
|
||||||
|
|
||||||
float distance = sqrt(dx*dx + dy*dy + dz*dz); // Distance between centers
|
float distance = sqrtf(dx*dx + dy*dy + dz*dz); // Distance between centers
|
||||||
|
|
||||||
if (distance <= (radiusA + radiusB)) collision = true;
|
if (distance <= (radiusA + radiusB)) collision = true;
|
||||||
|
|
||||||
@ -1441,14 +1446,14 @@ bool CheckCollisionBoxSphere(BoundingBox box, Vector3 centerSphere, float radius
|
|||||||
|
|
||||||
float dmin = 0;
|
float dmin = 0;
|
||||||
|
|
||||||
if (centerSphere.x < box.min.x) dmin += pow(centerSphere.x - box.min.x, 2);
|
if (centerSphere.x < box.min.x) dmin += powf(centerSphere.x - box.min.x, 2);
|
||||||
else if (centerSphere.x > box.max.x) dmin += pow(centerSphere.x - box.max.x, 2);
|
else if (centerSphere.x > box.max.x) dmin += powf(centerSphere.x - box.max.x, 2);
|
||||||
|
|
||||||
if (centerSphere.y < box.min.y) dmin += pow(centerSphere.y - box.min.y, 2);
|
if (centerSphere.y < box.min.y) dmin += powf(centerSphere.y - box.min.y, 2);
|
||||||
else if (centerSphere.y > box.max.y) dmin += pow(centerSphere.y - box.max.y, 2);
|
else if (centerSphere.y > box.max.y) dmin += powf(centerSphere.y - box.max.y, 2);
|
||||||
|
|
||||||
if (centerSphere.z < box.min.z) dmin += pow(centerSphere.z - box.min.z, 2);
|
if (centerSphere.z < box.min.z) dmin += powf(centerSphere.z - box.min.z, 2);
|
||||||
else if (centerSphere.z > box.max.z) dmin += pow(centerSphere.z - box.max.z, 2);
|
else if (centerSphere.z > box.max.z) dmin += powf(centerSphere.z - box.max.z, 2);
|
||||||
|
|
||||||
if (dmin <= (radiusSphere*radiusSphere)) collision = true;
|
if (dmin <= (radiusSphere*radiusSphere)) collision = true;
|
||||||
|
|
||||||
@ -1487,8 +1492,8 @@ bool CheckCollisionRaySphereEx(Ray ray, Vector3 spherePosition, float sphereRadi
|
|||||||
float collisionDistance = 0;
|
float collisionDistance = 0;
|
||||||
|
|
||||||
// Check if ray origin is inside the sphere to calculate the correct collision point
|
// Check if ray origin is inside the sphere to calculate the correct collision point
|
||||||
if (distance < sphereRadius) collisionDistance = vector + sqrt(d);
|
if (distance < sphereRadius) collisionDistance = vector + sqrtf(d);
|
||||||
else collisionDistance = vector - sqrt(d);
|
else collisionDistance = vector - sqrtf(d);
|
||||||
|
|
||||||
VectorScale(&offset, collisionDistance);
|
VectorScale(&offset, collisionDistance);
|
||||||
Vector3 cPoint = VectorAdd(ray.position, offset);
|
Vector3 cPoint = VectorAdd(ray.position, offset);
|
||||||
@ -1811,7 +1816,8 @@ static Material LoadMTL(const char *fileName)
|
|||||||
|
|
||||||
char buffer[MAX_BUFFER_SIZE];
|
char buffer[MAX_BUFFER_SIZE];
|
||||||
Vector3 color = { 1.0f, 1.0f, 1.0f };
|
Vector3 color = { 1.0f, 1.0f, 1.0f };
|
||||||
char *mapFileName = NULL;
|
char mapFileName[128];
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
FILE *mtlFile;
|
FILE *mtlFile;
|
||||||
|
|
||||||
@ -1896,13 +1902,13 @@ static Material LoadMTL(const char *fileName)
|
|||||||
{
|
{
|
||||||
if (buffer[5] == 'd') // map_Kd string Diffuse color texture map.
|
if (buffer[5] == 'd') // map_Kd string Diffuse color texture map.
|
||||||
{
|
{
|
||||||
sscanf(buffer, "map_Kd %s", mapFileName);
|
result = sscanf(buffer, "map_Kd %s", mapFileName);
|
||||||
if (mapFileName != NULL) material.texDiffuse = LoadTexture(mapFileName);
|
if (result != EOF) material.texDiffuse = LoadTexture(mapFileName);
|
||||||
}
|
}
|
||||||
else if (buffer[5] == 's') // map_Ks string Specular color texture map.
|
else if (buffer[5] == 's') // map_Ks string Specular color texture map.
|
||||||
{
|
{
|
||||||
sscanf(buffer, "map_Ks %s", mapFileName);
|
result = sscanf(buffer, "map_Ks %s", mapFileName);
|
||||||
if (mapFileName != NULL) material.texSpecular = LoadTexture(mapFileName);
|
if (result != EOF) material.texSpecular = LoadTexture(mapFileName);
|
||||||
}
|
}
|
||||||
else if (buffer[5] == 'a') // map_Ka string Ambient color texture map.
|
else if (buffer[5] == 'a') // map_Ka string Ambient color texture map.
|
||||||
{
|
{
|
||||||
@ -1911,13 +1917,13 @@ static Material LoadMTL(const char *fileName)
|
|||||||
} break;
|
} break;
|
||||||
case 'B': // map_Bump string Bump texture map.
|
case 'B': // map_Bump string Bump texture map.
|
||||||
{
|
{
|
||||||
sscanf(buffer, "map_Bump %s", mapFileName);
|
result = sscanf(buffer, "map_Bump %s", mapFileName);
|
||||||
if (mapFileName != NULL) material.texNormal = LoadTexture(mapFileName);
|
if (result != EOF) material.texNormal = LoadTexture(mapFileName);
|
||||||
} break;
|
} break;
|
||||||
case 'b': // map_bump string Bump texture map.
|
case 'b': // map_bump string Bump texture map.
|
||||||
{
|
{
|
||||||
sscanf(buffer, "map_bump %s", mapFileName);
|
result = sscanf(buffer, "map_bump %s", mapFileName);
|
||||||
if (mapFileName != NULL) material.texNormal = LoadTexture(mapFileName);
|
if (result != EOF) material.texNormal = LoadTexture(mapFileName);
|
||||||
} break;
|
} break;
|
||||||
case 'd': // map_d string Opacity texture map.
|
case 'd': // map_d string Opacity texture map.
|
||||||
{
|
{
|
||||||
@ -1941,8 +1947,8 @@ static Material LoadMTL(const char *fileName)
|
|||||||
} break;
|
} break;
|
||||||
case 'b': // bump string Bump texture map
|
case 'b': // bump string Bump texture map
|
||||||
{
|
{
|
||||||
sscanf(buffer, "bump %s", mapFileName);
|
result = sscanf(buffer, "bump %s", mapFileName);
|
||||||
if (mapFileName != NULL) material.texNormal = LoadTexture(mapFileName);
|
if (result != EOF) material.texNormal = LoadTexture(mapFileName);
|
||||||
} break;
|
} break;
|
||||||
case 'T': // Tr float Transparency Tr (alpha). Tr is inverse of d
|
case 'T': // Tr float Transparency Tr (alpha). Tr is inverse of d
|
||||||
{
|
{
|
||||||
|
|||||||
89
src/raylib.h
@ -6,37 +6,39 @@
|
|||||||
*
|
*
|
||||||
* Features:
|
* Features:
|
||||||
* Library written in plain C code (C99)
|
* Library written in plain C code (C99)
|
||||||
* Uses C# PascalCase/camelCase notation
|
* Uses PascalCase/camelCase notation
|
||||||
* Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES 2.0)
|
* Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES 2.0)
|
||||||
* Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
|
* Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
|
||||||
* Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF)
|
* Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF)
|
||||||
* Multiple textures support, including compressed formats and mipmaps generation
|
* Multiple textures support, including compressed formats and mipmaps generation
|
||||||
* Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps
|
* Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps
|
||||||
* Materials (diffuse, normal, specular) and Lighting (point, directional, spot) support
|
* Materials (diffuse, normal, specular) and Lighting (point, directional, spot) support
|
||||||
* Powerful math module for Vector, Matrix and Quaternion operations [raymath]
|
* Powerful math module for Vector, Matrix and Quaternion operations: [raymath]
|
||||||
* Audio loading and playing with streaming support and mixing channels (WAV, OGG, XM, MOD)
|
* Audio loading and playing with streaming support and mixing channels [audio]
|
||||||
* VR stereo rendering support with configurable HMD device parameters
|
* VR stereo rendering support with configurable HMD device parameters
|
||||||
* Multiple platforms support: Windows, Linux, Mac, Android, Raspberry Pi, HTML5 and Oculus Rift CV1
|
* Multiple platforms support: Windows, Linux, Mac, Android, Raspberry Pi, HTML5 and Oculus Rift CV1
|
||||||
* Custom color palette for fancy visuals on raywhite background
|
* Custom color palette for fancy visuals on raywhite background
|
||||||
* Minimal external dependencies (GLFW3, OpenGL, OpenAL)
|
* Minimal external dependencies (GLFW3, OpenGL, OpenAL)
|
||||||
|
* Complete binding for LUA [rlua]
|
||||||
*
|
*
|
||||||
* Used external libs:
|
* External libs:
|
||||||
* GLFW3 (www.glfw.org) for window/context management and input
|
* GLFW3 (www.glfw.org) for window/context management and input [core]
|
||||||
* GLAD for OpenGL extensions loading (3.3 Core profile, only PLATFORM_DESKTOP)
|
* GLAD for OpenGL extensions loading (3.3 Core profile, only PLATFORM_DESKTOP) [rlgl]
|
||||||
* stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA, PSD, GIF, HDR, PIC)
|
* stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA) [textures]
|
||||||
* stb_image_write (Sean Barret) for image writting (PNG)
|
* stb_image_write (Sean Barret) for image writting (PNG) [utils]
|
||||||
* stb_vorbis (Sean Barret) for ogg audio loading
|
* stb_truetype (Sean Barret) for ttf fonts loading [text]
|
||||||
* stb_truetype (Sean Barret) for ttf fonts loading
|
* stb_vorbis (Sean Barret) for ogg audio loading [audio]
|
||||||
* jar_xm (Joshua Reisenauer) for XM audio module loading
|
* jar_xm (Joshua Reisenauer) for XM audio module loading [audio]
|
||||||
* jar_mod (Joshua Reisenauer) for MOD audio module loading
|
* jar_mod (Joshua Reisenauer) for MOD audio module loading [audio]
|
||||||
* OpenAL Soft for audio device/context management
|
* dr_flac (David Reid) for FLAC audio file loading [audio]
|
||||||
* tinfl for data decompression (DEFLATE algorithm)
|
* OpenAL Soft for audio device/context management [audio]
|
||||||
|
* tinfl for data decompression (DEFLATE algorithm) [utils]
|
||||||
*
|
*
|
||||||
* Some design decisions:
|
* Some design decisions:
|
||||||
* 32bit Colors - All defined color are always RGBA (struct Color is 4 byte)
|
* 32bit Colors - All defined color are always RGBA (struct Color is 4 byte)
|
||||||
* One custom default font is loaded automatically when InitWindow()
|
* One custom default font could be loaded automatically when InitWindow() [core]
|
||||||
* If using OpenGL 3.3 or ES2, several vertex buffers (VAO/VBO) are created to manage lines-triangles-quads
|
* If using OpenGL 3.3 or ES2, several vertex buffers (VAO/VBO) are created to manage lines-triangles-quads
|
||||||
* If using OpenGL 3.3 or ES2, two default shaders are loaded automatically (internally defined)
|
* If using OpenGL 3.3 or ES2, two default shaders could be loaded automatically (internally defined)
|
||||||
*
|
*
|
||||||
* -- LICENSE --
|
* -- LICENSE --
|
||||||
*
|
*
|
||||||
@ -216,8 +218,8 @@
|
|||||||
#define GAMEPAD_PS3_AXIS_LEFT_Y 1
|
#define GAMEPAD_PS3_AXIS_LEFT_Y 1
|
||||||
#define GAMEPAD_PS3_AXIS_RIGHT_X 2
|
#define GAMEPAD_PS3_AXIS_RIGHT_X 2
|
||||||
#define GAMEPAD_PS3_AXIS_RIGHT_Y 5
|
#define GAMEPAD_PS3_AXIS_RIGHT_Y 5
|
||||||
#define GAMEPAD_PS3_AXIS_L2 3 // 1.0(not pressed) --> -1.0(completely pressed)
|
#define GAMEPAD_PS3_AXIS_L2 3 // [1..-1] (pressure-level)
|
||||||
#define GAMEPAD_PS3_AXIS_R2 4 // 1.0(not pressed) --> -1.0(completely pressed)
|
#define GAMEPAD_PS3_AXIS_R2 4 // [1..-1] (pressure-level)
|
||||||
|
|
||||||
// Xbox360 USB Controller Buttons
|
// Xbox360 USB Controller Buttons
|
||||||
#define GAMEPAD_XBOX_BUTTON_A 0
|
#define GAMEPAD_XBOX_BUTTON_A 0
|
||||||
@ -232,27 +234,25 @@
|
|||||||
#define GAMEPAD_XBOX_BUTTON_RIGHT 11
|
#define GAMEPAD_XBOX_BUTTON_RIGHT 11
|
||||||
#define GAMEPAD_XBOX_BUTTON_DOWN 12
|
#define GAMEPAD_XBOX_BUTTON_DOWN 12
|
||||||
#define GAMEPAD_XBOX_BUTTON_LEFT 13
|
#define GAMEPAD_XBOX_BUTTON_LEFT 13
|
||||||
#define GAMEPAD_XBOX_BUTTON_HOME 9
|
#define GAMEPAD_XBOX_BUTTON_HOME 8
|
||||||
|
|
||||||
// Xbox360 USB Controller Axis
|
// Xbox360 USB Controller Axis
|
||||||
#define GAMEPAD_XBOX_AXIS_LEFT_X 0
|
|
||||||
#define GAMEPAD_XBOX_AXIS_LEFT_Y 1
|
|
||||||
#define GAMEPAD_XBOX_AXIS_RIGHT_X 2
|
|
||||||
#define GAMEPAD_XBOX_AXIS_RIGHT_Y 3
|
|
||||||
#define GAMEPAD_XBOX_AXIS_LT 4 // -1.0(not pressed) --> 1.0(completely pressed)
|
|
||||||
#define GAMEPAD_XBOX_AXIS_RT 5 // -1.0(not pressed) --> 1.0(completely pressed)
|
|
||||||
|
|
||||||
/*
|
|
||||||
// NOTE: For Raspberry Pi, axis must be reconfigured
|
// NOTE: For Raspberry Pi, axis must be reconfigured
|
||||||
#if defined(PLATFORM_RPI)
|
#if defined(PLATFORM_RPI)
|
||||||
#define GAMEPAD_XBOX_AXIS_LEFT_X 7
|
#define GAMEPAD_XBOX_AXIS_LEFT_X 0 // [-1..1] (left->right)
|
||||||
#define GAMEPAD_XBOX_AXIS_LEFT_Y 6
|
#define GAMEPAD_XBOX_AXIS_LEFT_Y 1 // [-1..1] (up->down)
|
||||||
#define GAMEPAD_XBOX_AXIS_RIGHT_X 3
|
#define GAMEPAD_XBOX_AXIS_RIGHT_X 3 // [-1..1] (left->right)
|
||||||
#define GAMEPAD_XBOX_AXIS_RIGHT_Y 4
|
#define GAMEPAD_XBOX_AXIS_RIGHT_Y 4 // [-1..1] (up->down)
|
||||||
#define GAMEPAD_XBOX_AXIS_LT 2
|
#define GAMEPAD_XBOX_AXIS_LT 2 // [-1..1] (pressure-level)
|
||||||
#define GAMEPAD_XBOX_AXIS_RT 5
|
#define GAMEPAD_XBOX_AXIS_RT 5 // [-1..1] (pressure-level)
|
||||||
|
#else
|
||||||
|
#define GAMEPAD_XBOX_AXIS_LEFT_X 0 // [-1..1] (left->right)
|
||||||
|
#define GAMEPAD_XBOX_AXIS_LEFT_Y 1 // [1..-1] (up->down)
|
||||||
|
#define GAMEPAD_XBOX_AXIS_RIGHT_X 2 // [-1..1] (left->right)
|
||||||
|
#define GAMEPAD_XBOX_AXIS_RIGHT_Y 3 // [1..-1] (up->down)
|
||||||
|
#define GAMEPAD_XBOX_AXIS_LT 4 // [-1..1] (pressure-level)
|
||||||
|
#define GAMEPAD_XBOX_AXIS_RT 5 // [-1..1] (pressure-level)
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
|
|
||||||
// NOTE: MSC C++ compiler does not support compound literals (C99 feature)
|
// NOTE: MSC C++ compiler does not support compound literals (C99 feature)
|
||||||
// Plain structures in C++ (without constructors) can be initialized from { } initializers.
|
// Plain structures in C++ (without constructors) can be initialized from { } initializers.
|
||||||
@ -307,9 +307,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// byte type
|
|
||||||
typedef unsigned char byte;
|
|
||||||
|
|
||||||
// Vector2 type
|
// Vector2 type
|
||||||
typedef struct Vector2 {
|
typedef struct Vector2 {
|
||||||
float x;
|
float x;
|
||||||
@ -727,7 +724,7 @@ RLAPI float GetGesturePinchAngle(void); // Get gesture pin
|
|||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Camera System Functions (Module: camera)
|
// Camera System Functions (Module: camera)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
RLAPI void SetCameraMode(Camera, int mode); // Set camera mode (multiple camera modes available)
|
RLAPI void SetCameraMode(Camera camera, int mode); // Set camera mode (multiple camera modes available)
|
||||||
RLAPI void UpdateCamera(Camera *camera); // Update camera position for selected mode
|
RLAPI void UpdateCamera(Camera *camera); // Update camera position for selected mode
|
||||||
|
|
||||||
RLAPI void SetCameraPanControl(int panKey); // Set camera pan key to combine with mouse movement (free camera)
|
RLAPI void SetCameraPanControl(int panKey); // Set camera pan key to combine with mouse movement (free camera)
|
||||||
@ -828,7 +825,7 @@ RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color co
|
|||||||
RLAPI void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, // Draw text using SpriteFont and additional parameters
|
RLAPI void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, // Draw text using SpriteFont and additional parameters
|
||||||
float fontSize, int spacing, Color tint);
|
float fontSize, int spacing, Color tint);
|
||||||
RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font
|
RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font
|
||||||
RLAPI Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int spacing); // Measure string size for SpriteFont
|
RLAPI Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, float fontSize, int spacing); // Measure string size for SpriteFont
|
||||||
|
|
||||||
RLAPI void DrawFPS(int posX, int posY); // Shows current FPS on top-left corner
|
RLAPI void DrawFPS(int posX, int posY); // Shows current FPS on top-left corner
|
||||||
RLAPI const char *FormatText(const char *text, ...); // Formatting of text with variables to 'embed'
|
RLAPI const char *FormatText(const char *text, ...); // Formatting of text with variables to 'embed'
|
||||||
@ -838,7 +835,7 @@ RLAPI const char *SubText(const char *text, int position, int length);
|
|||||||
// Basic 3d Shapes Drawing Functions (Module: models)
|
// Basic 3d Shapes Drawing Functions (Module: models)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
RLAPI void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); // Draw a line in 3D world space
|
RLAPI void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); // Draw a line in 3D world space
|
||||||
RLAPI void DrawCircle3D(Vector3 center, float radius, float rotationAngle, Vector3 rotation, Color color); // Draw a circle in 3D world space
|
RLAPI void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space
|
||||||
RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
|
RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
|
||||||
RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
|
RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
|
||||||
RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires
|
RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires
|
||||||
@ -853,7 +850,7 @@ RLAPI void DrawRay(Ray ray, Color color);
|
|||||||
RLAPI void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
|
RLAPI void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
|
||||||
RLAPI void DrawGizmo(Vector3 position); // Draw simple gizmo
|
RLAPI void DrawGizmo(Vector3 position); // Draw simple gizmo
|
||||||
RLAPI void DrawLight(Light light); // Draw light in 3D world
|
RLAPI void DrawLight(Light light); // Draw light in 3D world
|
||||||
//DrawTorus(), DrawTeapot() are useless...
|
//DrawTorus(), DrawTeapot() could be useful?
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Model 3d Loading and Drawing Functions (Module: models)
|
// Model 3d Loading and Drawing Functions (Module: models)
|
||||||
@ -920,7 +917,7 @@ RLAPI void DestroyLight(Light light); // Des
|
|||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
RLAPI void InitVrDevice(int vdDevice); // Init VR device
|
RLAPI void InitVrDevice(int vdDevice); // Init VR device
|
||||||
RLAPI void CloseVrDevice(void); // Close VR device
|
RLAPI void CloseVrDevice(void); // Close VR device
|
||||||
RLAPI bool IsVrDeviceReady(void); // Detect if VR device (or simulator) is ready
|
RLAPI bool IsVrDeviceReady(void); // Detect if VR device is ready
|
||||||
RLAPI bool IsVrSimulator(void); // Detect if VR simulator is running
|
RLAPI bool IsVrSimulator(void); // Detect if VR simulator is running
|
||||||
RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
|
RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
|
||||||
RLAPI void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
|
RLAPI void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
|
||||||
@ -929,7 +926,7 @@ RLAPI void ToggleVrMode(void); // Enable/Disable VR experienc
|
|||||||
// Audio Loading and Playing Functions (Module: audio)
|
// Audio Loading and Playing Functions (Module: audio)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
RLAPI void InitAudioDevice(void); // Initialize audio device and context
|
RLAPI void InitAudioDevice(void); // Initialize audio device and context
|
||||||
RLAPI void CloseAudioDevice(void); // Close the audio device and context (and music stream)
|
RLAPI void CloseAudioDevice(void); // Close the audio device and context
|
||||||
RLAPI bool IsAudioDeviceReady(void); // Check if audio device has been initialized successfully
|
RLAPI bool IsAudioDeviceReady(void); // Check if audio device has been initialized successfully
|
||||||
|
|
||||||
RLAPI Wave LoadWave(const char *fileName); // Load wave data from file into RAM
|
RLAPI Wave LoadWave(const char *fileName); // Load wave data from file into RAM
|
||||||
@ -953,9 +950,9 @@ RLAPI void WaveCrop(Wave *wave, int initSample, int finalSample); // Crop a
|
|||||||
RLAPI float *GetWaveData(Wave wave); // Get samples data from wave as a floats array
|
RLAPI float *GetWaveData(Wave wave); // Get samples data from wave as a floats array
|
||||||
RLAPI Music LoadMusicStream(const char *fileName); // Load music stream from file
|
RLAPI Music LoadMusicStream(const char *fileName); // Load music stream from file
|
||||||
RLAPI void UnloadMusicStream(Music music); // Unload music stream
|
RLAPI void UnloadMusicStream(Music music); // Unload music stream
|
||||||
RLAPI void PlayMusicStream(Music music); // Start music playing (open stream)
|
RLAPI void PlayMusicStream(Music music); // Start music playing
|
||||||
RLAPI void UpdateMusicStream(Music music); // Updates buffers for music streaming
|
RLAPI void UpdateMusicStream(Music music); // Updates buffers for music streaming
|
||||||
RLAPI void StopMusicStream(Music music); // Stop music playing (close stream)
|
RLAPI void StopMusicStream(Music music); // Stop music playing
|
||||||
RLAPI void PauseMusicStream(Music music); // Pause music playing
|
RLAPI void PauseMusicStream(Music music); // Pause music playing
|
||||||
RLAPI void ResumeMusicStream(Music music); // Resume playing paused music
|
RLAPI void ResumeMusicStream(Music music); // Resume playing paused music
|
||||||
RLAPI bool IsMusicPlaying(Music music); // Check if music is playing
|
RLAPI bool IsMusicPlaying(Music music); // Check if music is playing
|
||||||
@ -966,7 +963,7 @@ RLAPI float GetMusicTimePlayed(Music music); // Get cur
|
|||||||
|
|
||||||
RLAPI AudioStream InitAudioStream(unsigned int sampleRate,
|
RLAPI AudioStream InitAudioStream(unsigned int sampleRate,
|
||||||
unsigned int sampleSize,
|
unsigned int sampleSize,
|
||||||
unsigned int channels); // Init audio stream (to stream audio pcm data)
|
unsigned int channels); // Init audio stream (to stream raw audio pcm data)
|
||||||
RLAPI void UpdateAudioStream(AudioStream stream, void *data, int numSamples); // Update audio stream buffers with data
|
RLAPI void UpdateAudioStream(AudioStream stream, void *data, int numSamples); // Update audio stream buffers with data
|
||||||
RLAPI void CloseAudioStream(AudioStream stream); // Close audio stream and free memory
|
RLAPI void CloseAudioStream(AudioStream stream); // Close audio stream and free memory
|
||||||
RLAPI bool IsAudioBufferProcessed(AudioStream stream); // Check if any audio stream buffers requires refill
|
RLAPI bool IsAudioBufferProcessed(AudioStream stream); // Check if any audio stream buffers requires refill
|
||||||
|
|||||||
BIN
src/resources
35
src/rlgl.c
@ -2,11 +2,30 @@
|
|||||||
*
|
*
|
||||||
* rlgl - raylib OpenGL abstraction layer
|
* rlgl - raylib OpenGL abstraction layer
|
||||||
*
|
*
|
||||||
* raylib now uses OpenGL 1.1 style functions (rlVertex) that are mapped to selected OpenGL version:
|
* rlgl allows usage of OpenGL 1.1 style functions (rlVertex) that are internally mapped to
|
||||||
* OpenGL 1.1 - Direct map rl* -> gl*
|
* selected OpenGL version (1.1, 2.1, 3.3 Core, ES 2.0).
|
||||||
* OpenGL 2.1 - Vertex data is stored in VBOs, call rlglDraw() to render
|
*
|
||||||
* OpenGL 3.3 - Vertex data is stored in VAOs, call rlglDraw() to render
|
* When chosing an OpenGL version greater than OpenGL 1.1, rlgl stores vertex data on internal
|
||||||
* OpenGL ES 2 - Vertex data is stored in VBOs or VAOs (when available), call rlglDraw() to render
|
* VBO buffers (and VAOs if available). It requires calling 3 functions:
|
||||||
|
* rlglInit() - Initialize internal buffers and auxiliar resources
|
||||||
|
* rlglDraw() - Process internal buffers and send required draw calls
|
||||||
|
* rlglClose() - De-initialize internal buffers data and other auxiliar resources
|
||||||
|
*
|
||||||
|
* External libs:
|
||||||
|
* raymath - 3D math functionality (Vector3, Matrix, Quaternion)
|
||||||
|
* GLAD - OpenGL extensions loading (OpenGL 3.3 Core only)
|
||||||
|
*
|
||||||
|
* Module Configuration Flags:
|
||||||
|
* GRAPHICS_API_OPENGL_11 - Use OpenGL 1.1 backend
|
||||||
|
* GRAPHICS_API_OPENGL_21 - Use OpenGL 2.1 backend
|
||||||
|
* GRAPHICS_API_OPENGL_33 - Use OpenGL 3.3 Core profile backend
|
||||||
|
* GRAPHICS_API_OPENGL_ES2 - Use OpenGL ES 2.0 backend
|
||||||
|
*
|
||||||
|
* RLGL_STANDALONE - Use rlgl as standalone library (no raylib dependency)
|
||||||
|
* RLGL_NO_STANDARD_SHADER - Avoid standard shader (shader_standard.h) inclusion
|
||||||
|
* RLGL_NO_DISTORTION_SHADER - Avoid stereo rendering distortion sahder (shader_distortion.h) inclusion
|
||||||
|
* RLGL_OCULUS_SUPPORT - Enable Oculus Rift CV1 functionality
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
@ -2767,13 +2786,13 @@ void CloseVrDevice(void)
|
|||||||
// Detect if VR device is available
|
// Detect if VR device is available
|
||||||
bool IsVrDeviceReady(void)
|
bool IsVrDeviceReady(void)
|
||||||
{
|
{
|
||||||
return (vrDeviceReady || vrSimulator) && vrEnabled;
|
return (vrDeviceReady && vrEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect if VR simulator is running
|
// Detect if VR simulator is running
|
||||||
bool IsVrSimulator(void)
|
bool IsVrSimulator(void)
|
||||||
{
|
{
|
||||||
return vrSimulator;
|
return (vrSimulator && vrEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable/Disable VR experience (device or simulator)
|
// Enable/Disable VR experience (device or simulator)
|
||||||
@ -3882,7 +3901,7 @@ static void SetStereoConfig(VrDeviceInfo hmd)
|
|||||||
// Fovy is normally computed with: 2*atan2(hmd.vScreenSize, 2*hmd.eyeToScreenDistance)*RAD2DEG
|
// Fovy is normally computed with: 2*atan2(hmd.vScreenSize, 2*hmd.eyeToScreenDistance)*RAD2DEG
|
||||||
// ...but with lens distortion it is increased (see Oculus SDK Documentation)
|
// ...but with lens distortion it is increased (see Oculus SDK Documentation)
|
||||||
//float fovy = 2.0f*atan2(hmd.vScreenSize*0.5f*distortionScale, hmd.eyeToScreenDistance)*RAD2DEG; // Really need distortionScale?
|
//float fovy = 2.0f*atan2(hmd.vScreenSize*0.5f*distortionScale, hmd.eyeToScreenDistance)*RAD2DEG; // Really need distortionScale?
|
||||||
float fovy = 2.0f*atan2(hmd.vScreenSize*0.5f, hmd.eyeToScreenDistance)*RAD2DEG;
|
float fovy = 2.0f*(float)atan2(hmd.vScreenSize*0.5f, hmd.eyeToScreenDistance)*RAD2DEG;
|
||||||
|
|
||||||
// Compute camera projection matrices
|
// Compute camera projection matrices
|
||||||
float projOffset = 4.0f*lensShift; // Scaled to projection space coordinates [-1..1]
|
float projOffset = 4.0f*lensShift; // Scaled to projection space coordinates [-1..1]
|
||||||
|
|||||||
34
src/rlgl.h
@ -2,11 +2,27 @@
|
|||||||
*
|
*
|
||||||
* rlgl - raylib OpenGL abstraction layer
|
* rlgl - raylib OpenGL abstraction layer
|
||||||
*
|
*
|
||||||
* raylib now uses OpenGL 1.1 style functions (rlVertex) that are mapped to selected OpenGL version:
|
* rlgl allows usage of OpenGL 1.1 style functions (rlVertex) that are internally mapped to
|
||||||
* OpenGL 1.1 - Direct map rl* -> gl*
|
* selected OpenGL version (1.1, 2.1, 3.3 Core, ES 2.0).
|
||||||
* OpenGL 2.1 - Vertex data is stored in VBOs, call rlglDraw() to render
|
*
|
||||||
* OpenGL 3.3 - Vertex data is stored in VAOs, call rlglDraw() to render
|
* When chosing an OpenGL version greater than OpenGL 1.1, rlgl stores vertex data on internal
|
||||||
* OpenGL ES 2 - Vertex data is stored in VBOs or VAOs (when available), call rlglDraw() to render
|
* VBO buffers (and VAOs if available). It requires calling 3 functions:
|
||||||
|
* rlglInit() - Initialize internal buffers and auxiliar resources
|
||||||
|
* rlglDraw() - Process internal buffers and send required draw calls
|
||||||
|
* rlglClose() - De-initialize internal buffers data and other auxiliar resources
|
||||||
|
*
|
||||||
|
* External libs:
|
||||||
|
* raymath - 3D math functionality (Vector3, Matrix, Quaternion)
|
||||||
|
* GLAD - OpenGL extensions loading (OpenGL 3.3 Core only)
|
||||||
|
*
|
||||||
|
* Module Configuration Flags:
|
||||||
|
* GRAPHICS_API_OPENGL_11 - Use OpenGL 1.1 backend
|
||||||
|
* GRAPHICS_API_OPENGL_21 - Use OpenGL 2.1 backend
|
||||||
|
* GRAPHICS_API_OPENGL_33 - Use OpenGL 3.3 Core profile backend
|
||||||
|
* GRAPHICS_API_OPENGL_ES2 - Use OpenGL ES 2.0 backend
|
||||||
|
*
|
||||||
|
* RLGL_STANDALONE - Use rlgl as standalone library (no raylib dependency)
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
@ -117,15 +133,14 @@ typedef enum { RL_PROJECTION, RL_MODELVIEW, RL_TEXTURE } MatrixMode;
|
|||||||
|
|
||||||
typedef enum { RL_LINES, RL_TRIANGLES, RL_QUADS } DrawMode;
|
typedef enum { RL_LINES, RL_TRIANGLES, RL_QUADS } DrawMode;
|
||||||
|
|
||||||
|
typedef unsigned char byte;
|
||||||
|
|
||||||
#if defined(RLGL_STANDALONE)
|
#if defined(RLGL_STANDALONE)
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
// Boolean type
|
// Boolean type
|
||||||
typedef enum { false, true } bool;
|
typedef enum { false, true } bool;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// byte type
|
|
||||||
typedef unsigned char byte;
|
|
||||||
|
|
||||||
// Color type, RGBA (32bit)
|
// Color type, RGBA (32bit)
|
||||||
typedef struct Color {
|
typedef struct Color {
|
||||||
unsigned char r;
|
unsigned char r;
|
||||||
@ -408,7 +423,8 @@ float *MatrixToFloat(Matrix mat);
|
|||||||
|
|
||||||
void InitVrDevice(int vrDevice); // Init VR device
|
void InitVrDevice(int vrDevice); // Init VR device
|
||||||
void CloseVrDevice(void); // Close VR device
|
void CloseVrDevice(void); // Close VR device
|
||||||
bool IsVrDeviceReady(void); // Detect if VR device (or simulator) is ready
|
bool IsVrDeviceReady(void); // Detect if VR device is ready
|
||||||
|
bool IsVrSimulator(void); // Detect if VR simulator is running
|
||||||
void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
|
void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
|
||||||
void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
|
void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
|
||||||
|
|
||||||
|
|||||||
195
src/rlua.h
@ -1130,7 +1130,6 @@ int lua_StorageLoadValue(lua_State* L)
|
|||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// raylib [core] module functions - Input Handling
|
// raylib [core] module functions - Input Handling
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB)
|
|
||||||
int lua_IsKeyPressed(lua_State* L)
|
int lua_IsKeyPressed(lua_State* L)
|
||||||
{
|
{
|
||||||
int arg1 = LuaGetArgument_int(L, 1);
|
int arg1 = LuaGetArgument_int(L, 1);
|
||||||
@ -1185,12 +1184,22 @@ int lua_IsGamepadAvailable(lua_State* L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lua_GetGamepadAxisMovement(lua_State* L)
|
int lua_IsGamepadName(lua_State* L)
|
||||||
{
|
{
|
||||||
int arg1 = LuaGetArgument_int(L, 1);
|
int arg1 = LuaGetArgument_int(L, 1);
|
||||||
int arg2 = LuaGetArgument_int(L, 2);
|
const char * arg2 = LuaGetArgument_string(L, 2);
|
||||||
float result = GetGamepadAxisMovement(arg1, arg2);
|
bool result = IsGamepadName(arg1, arg2);
|
||||||
lua_pushnumber(L, result);
|
lua_pushboolean(L, result);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lua_GetGamepadName(lua_State* L)
|
||||||
|
{
|
||||||
|
// TODO: Return gamepad name id
|
||||||
|
|
||||||
|
int arg1 = LuaGetArgument_int(L, 1);
|
||||||
|
char * result = GetGamepadName(arg1);
|
||||||
|
//lua_pushboolean(L, result);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1229,7 +1238,30 @@ int lua_IsGamepadButtonUp(lua_State* L)
|
|||||||
lua_pushboolean(L, result);
|
lua_pushboolean(L, result);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
int lua_GetGamepadButtonPressed(lua_State* L)
|
||||||
|
{
|
||||||
|
int result = GetGamepadButtonPressed();
|
||||||
|
lua_pushinteger(L, result);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lua_GetGamepadAxisCount(lua_State* L)
|
||||||
|
{
|
||||||
|
int arg1 = LuaGetArgument_int(L, 1);
|
||||||
|
int result = GetGamepadAxisCount(arg1);
|
||||||
|
lua_pushinteger(L, result);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lua_GetGamepadAxisMovement(lua_State* L)
|
||||||
|
{
|
||||||
|
int arg1 = LuaGetArgument_int(L, 1);
|
||||||
|
int arg2 = LuaGetArgument_int(L, 2);
|
||||||
|
float result = GetGamepadAxisMovement(arg1, arg2);
|
||||||
|
lua_pushnumber(L, result);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int lua_IsMouseButtonPressed(lua_State* L)
|
int lua_IsMouseButtonPressed(lua_State* L)
|
||||||
{
|
{
|
||||||
@ -1419,8 +1451,9 @@ int lua_GetGesturePinchAngle(lua_State* L)
|
|||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
int lua_SetCameraMode(lua_State* L)
|
int lua_SetCameraMode(lua_State* L)
|
||||||
{
|
{
|
||||||
int arg1 = LuaGetArgument_int(L, 1);
|
Camera arg1 = LuaGetArgument_Camera(L, 1);
|
||||||
SetCameraMode(arg1);
|
int arg2 = LuaGetArgument_int(L, 2);
|
||||||
|
SetCameraMode(arg1, arg2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1432,37 +1465,6 @@ int lua_UpdateCamera(lua_State* L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lua_UpdateCameraPlayer(lua_State* L)
|
|
||||||
{
|
|
||||||
Camera arg1 = LuaGetArgument_Camera(L, 1);
|
|
||||||
Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
|
|
||||||
UpdateCameraPlayer(&arg1, &arg2);
|
|
||||||
LuaPush_Camera(L, arg1);
|
|
||||||
LuaPush_Vector3(L, arg2);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lua_SetCameraPosition(lua_State* L)
|
|
||||||
{
|
|
||||||
Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
|
|
||||||
SetCameraPosition(arg1);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lua_SetCameraTarget(lua_State* L)
|
|
||||||
{
|
|
||||||
Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
|
|
||||||
SetCameraTarget(arg1);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lua_SetCameraFovy(lua_State* L)
|
|
||||||
{
|
|
||||||
float arg1 = LuaGetArgument_float(L, 1);
|
|
||||||
SetCameraFovy(arg1);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lua_SetCameraPanControl(lua_State* L)
|
int lua_SetCameraPanControl(lua_State* L)
|
||||||
{
|
{
|
||||||
int arg1 = LuaGetArgument_int(L, 1);
|
int arg1 = LuaGetArgument_int(L, 1);
|
||||||
@ -1496,13 +1498,6 @@ int lua_SetCameraMoveControls(lua_State* L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lua_SetCameraMouseSensitivity(lua_State* L)
|
|
||||||
{
|
|
||||||
float arg1 = LuaGetArgument_float(L, 1);
|
|
||||||
SetCameraMouseSensitivity(arg1);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// raylib [shapes] module functions - Basic Shapes Drawing
|
// raylib [shapes] module functions - Basic Shapes Drawing
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
@ -1790,6 +1785,8 @@ int lua_LoadImage(lua_State* L)
|
|||||||
|
|
||||||
int lua_LoadImageEx(lua_State* L)
|
int lua_LoadImageEx(lua_State* L)
|
||||||
{
|
{
|
||||||
|
// TODO: Image LoadImageEx(Color *pixels, int width, int height);
|
||||||
|
|
||||||
GET_TABLE(Color, arg1, 1);
|
GET_TABLE(Color, arg1, 1);
|
||||||
int arg2 = LuaGetArgument_int(L, 2);
|
int arg2 = LuaGetArgument_int(L, 2);
|
||||||
int arg3 = LuaGetArgument_int(L, 3);
|
int arg3 = LuaGetArgument_int(L, 3);
|
||||||
@ -1888,6 +1885,8 @@ int lua_UnloadRenderTexture(lua_State* L)
|
|||||||
|
|
||||||
int lua_GetImageData(lua_State* L)
|
int lua_GetImageData(lua_State* L)
|
||||||
{
|
{
|
||||||
|
// TODO: Color *GetImageData(Image image);
|
||||||
|
|
||||||
Image arg1 = LuaGetArgument_Image(L, 1);
|
Image arg1 = LuaGetArgument_Image(L, 1);
|
||||||
Color * result = GetImageData(arg1);
|
Color * result = GetImageData(arg1);
|
||||||
lua_createtable(L, arg1.width*arg1.height, 0);
|
lua_createtable(L, arg1.width*arg1.height, 0);
|
||||||
@ -1908,6 +1907,16 @@ int lua_GetTextureData(lua_State* L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lua_UpdateTexture(lua_State* L)
|
||||||
|
{
|
||||||
|
// TODO: void UpdateTexture(Texture2D texture, void *pixels);
|
||||||
|
|
||||||
|
Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
|
||||||
|
void * arg2 = (char *)LuaGetArgument_string(L, 2); // NOTE: Getting (void *) as string?
|
||||||
|
UpdateTexture(arg1, arg2); // ISSUE: #2 string expected, got table -> GetImageData() returns a table!
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int lua_ImageToPOT(lua_State* L)
|
int lua_ImageToPOT(lua_State* L)
|
||||||
{
|
{
|
||||||
Image arg1 = LuaGetArgument_Image(L, 1);
|
Image arg1 = LuaGetArgument_Image(L, 1);
|
||||||
@ -2100,11 +2109,19 @@ int lua_GenTextureMipmaps(lua_State* L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lua_UpdateTexture(lua_State* L)
|
int lua_SetTextureFilter(lua_State* L)
|
||||||
{
|
{
|
||||||
Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
|
Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
|
||||||
void * arg2 = (char *)LuaGetArgument_string(L, 2); // NOTE: Getting (void *) as string?
|
int arg2 = LuaGetArgument_int(L, 2);
|
||||||
UpdateTexture(arg1, arg2); // ISSUE: #2 string expected, got table -> GetImageData() returns a table!
|
SetTextureFilter(arg1, arg2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lua_SetTextureWrap(lua_State* L)
|
||||||
|
{
|
||||||
|
Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
|
||||||
|
int arg2 = LuaGetArgument_int(L, 2);
|
||||||
|
SetTextureWrap(arg1, arg2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2178,6 +2195,18 @@ int lua_LoadSpriteFont(lua_State* L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lua_LoadSpriteFontTTF(lua_State* L)
|
||||||
|
{
|
||||||
|
const char * arg1 = LuaGetArgument_string(L, 1);
|
||||||
|
int arg2 = LuaGetArgument_int(L, 2);
|
||||||
|
int arg3 = LuaGetArgument_int(L, 3);
|
||||||
|
int arg4 = LuaGetArgument_int(L, 4);
|
||||||
|
//LoadSpriteFontTTF(const char *fileName, int fontSize, int numChars, int *fontChars);
|
||||||
|
SpriteFont result = LoadSpriteFontTTF(arg1, arg2, arg3, &arg4);
|
||||||
|
LuaPush_SpriteFont(L, result);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int lua_UnloadSpriteFont(lua_State* L)
|
int lua_UnloadSpriteFont(lua_State* L)
|
||||||
{
|
{
|
||||||
SpriteFont arg1 = LuaGetArgument_SpriteFont(L, 1);
|
SpriteFont arg1 = LuaGetArgument_SpriteFont(L, 1);
|
||||||
@ -2255,8 +2284,8 @@ int lua_DrawCircle3D(lua_State* L)
|
|||||||
{
|
{
|
||||||
Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
|
Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
|
||||||
float arg2 = LuaGetArgument_float(L, 2);
|
float arg2 = LuaGetArgument_float(L, 2);
|
||||||
float arg3 = LuaGetArgument_float(L, 3);
|
Vector3 arg3 = LuaGetArgument_Vector3(L, 3);
|
||||||
Vector3 arg4 = LuaGetArgument_Vector3(L, 4);
|
float arg4 = LuaGetArgument_float(L, 4);
|
||||||
Color arg5 = LuaGetArgument_Color(L, 5);
|
Color arg5 = LuaGetArgument_Color(L, 5);
|
||||||
DrawCircle3D(arg1, arg2, arg3, arg4, arg5);
|
DrawCircle3D(arg1, arg2, arg3, arg4, arg5);
|
||||||
return 0;
|
return 0;
|
||||||
@ -2619,18 +2648,6 @@ int lua_CheckCollisionRayBox(lua_State* L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lua_ResolveCollisionCubicmap(lua_State* L)
|
|
||||||
{
|
|
||||||
Image arg1 = LuaGetArgument_Image(L, 1);
|
|
||||||
Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
|
|
||||||
Vector3 arg3 = LuaGetArgument_Vector3(L, 3);
|
|
||||||
float arg4 = LuaGetArgument_float(L, 4);
|
|
||||||
Vector3 result = ResolveCollisionCubicmap(arg1, arg2, &arg3, arg4);
|
|
||||||
LuaPush_Vector3(L, result);
|
|
||||||
LuaPush_Vector3(L, arg3);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// raylib [raymath] module functions - Shaders
|
// raylib [raymath] module functions - Shaders
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
@ -2790,10 +2807,19 @@ int lua_IsVrDeviceReady(lua_State* L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lua_IsVrSimulator(lua_State* L)
|
||||||
|
{
|
||||||
|
bool result = IsVrSimulator();
|
||||||
|
lua_pushboolean(L, result);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int lua_UpdateVrTracking(lua_State* L)
|
int lua_UpdateVrTracking(lua_State* L)
|
||||||
{
|
{
|
||||||
UpdateVrTracking();
|
Camera arg1 = LuaGetArgument_Camera(L, 1);
|
||||||
return 0;
|
UpdateVrTracking(&arg1);
|
||||||
|
LuaPush_Camera(L, arg1);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lua_ToggleVrMode(lua_State* L)
|
int lua_ToggleVrMode(lua_State* L)
|
||||||
@ -2873,6 +2899,8 @@ int lua_LoadSoundFromRES(lua_State* L)
|
|||||||
|
|
||||||
int lua_UpdateSound(lua_State* L)
|
int lua_UpdateSound(lua_State* L)
|
||||||
{
|
{
|
||||||
|
// TODO: void UpdateSound(Sound sound, void *data, int numSamples);
|
||||||
|
|
||||||
Sound arg1 = LuaGetArgument_Sound(L, 1);
|
Sound arg1 = LuaGetArgument_Sound(L, 1);
|
||||||
const char * arg2 = LuaGetArgument_string(L, 2);
|
const char * arg2 = LuaGetArgument_string(L, 2);
|
||||||
int * arg3 = LuaGetArgument_int(L, 3);
|
int * arg3 = LuaGetArgument_int(L, 3);
|
||||||
@ -2952,11 +2980,11 @@ int lua_WaveFormat(lua_State* L)
|
|||||||
int arg2 = LuaGetArgument_int(L, 2);
|
int arg2 = LuaGetArgument_int(L, 2);
|
||||||
int arg3 = LuaGetArgument_int(L, 3);
|
int arg3 = LuaGetArgument_int(L, 3);
|
||||||
int arg4 = LuaGetArgument_int(L, 4);
|
int arg4 = LuaGetArgument_int(L, 4);
|
||||||
WaveFormat(arg1, arg2, arg3, arg4);
|
WaveFormat(&arg1, arg2, arg3, arg4);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lua_LoadMusicStream(lua_State* L)
|
int lua_WaveCopy(lua_State* L)
|
||||||
{
|
{
|
||||||
Wave arg1 = LuaGetArgument_Wave(L, 1);
|
Wave arg1 = LuaGetArgument_Wave(L, 1);
|
||||||
Wave result = WaveCopy(arg1);
|
Wave result = WaveCopy(arg1);
|
||||||
@ -2969,7 +2997,7 @@ int lua_WaveCrop(lua_State* L)
|
|||||||
Wave arg1 = LuaGetArgument_Wave(L, 1);
|
Wave arg1 = LuaGetArgument_Wave(L, 1);
|
||||||
int arg2 = LuaGetArgument_int(L, 2);
|
int arg2 = LuaGetArgument_int(L, 2);
|
||||||
int arg3 = LuaGetArgument_int(L, 3);
|
int arg3 = LuaGetArgument_int(L, 3);
|
||||||
WaveCrop(arg1, arg2, arg3);
|
WaveCrop(&arg1, arg2, arg3);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2978,9 +3006,10 @@ int lua_GetWaveData(lua_State* L)
|
|||||||
// TODO: float *GetWaveData(Wave wave);
|
// TODO: float *GetWaveData(Wave wave);
|
||||||
|
|
||||||
Wave arg1 = LuaGetArgument_Wave(L, 1);
|
Wave arg1 = LuaGetArgument_Wave(L, 1);
|
||||||
float result = GetWaveData(arg1);
|
float * result = GetWaveData(arg1);
|
||||||
LuaPush_float(L, result);
|
//LuaPush_float(L, result);
|
||||||
return 1;
|
//lua_pushnumber(L, result);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lua_LoadMusicStream(lua_State* L)
|
int lua_LoadMusicStream(lua_State* L)
|
||||||
@ -3012,7 +3041,6 @@ int lua_PlayMusicStream(lua_State* L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int lua_StopMusicStream(lua_State* L)
|
int lua_StopMusicStream(lua_State* L)
|
||||||
{
|
{
|
||||||
Music arg1 = LuaGetArgument_Music(L, 1);
|
Music arg1 = LuaGetArgument_Music(L, 1);
|
||||||
@ -3093,6 +3121,8 @@ int lua_CloseAudioStream(lua_State* L)
|
|||||||
|
|
||||||
int lua_UpdateAudioStream(lua_State* L)
|
int lua_UpdateAudioStream(lua_State* L)
|
||||||
{
|
{
|
||||||
|
// TODO: void UpdateAudioStream(AudioStream stream, void *data, int numSamples);
|
||||||
|
|
||||||
AudioStream arg1 = LuaGetArgument_AudioStream(L, 1);
|
AudioStream arg1 = LuaGetArgument_AudioStream(L, 1);
|
||||||
void * arg2 = (char *)LuaGetArgument_string(L, 2);
|
void * arg2 = (char *)LuaGetArgument_string(L, 2);
|
||||||
int arg3 = LuaGetArgument_int(L, 3);
|
int arg3 = LuaGetArgument_int(L, 3);
|
||||||
@ -3667,7 +3697,6 @@ static luaL_Reg raylib_functions[] = {
|
|||||||
REG(StorageSaveValue)
|
REG(StorageSaveValue)
|
||||||
REG(StorageLoadValue)
|
REG(StorageLoadValue)
|
||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB)
|
|
||||||
REG(IsKeyPressed)
|
REG(IsKeyPressed)
|
||||||
REG(IsKeyDown)
|
REG(IsKeyDown)
|
||||||
REG(IsKeyReleased)
|
REG(IsKeyReleased)
|
||||||
@ -3676,12 +3705,15 @@ static luaL_Reg raylib_functions[] = {
|
|||||||
REG(SetExitKey)
|
REG(SetExitKey)
|
||||||
|
|
||||||
REG(IsGamepadAvailable)
|
REG(IsGamepadAvailable)
|
||||||
REG(GetGamepadAxisMovement)
|
REG(IsGamepadName)
|
||||||
|
REG(GetGamepadName)
|
||||||
REG(IsGamepadButtonPressed)
|
REG(IsGamepadButtonPressed)
|
||||||
REG(IsGamepadButtonDown)
|
REG(IsGamepadButtonDown)
|
||||||
REG(IsGamepadButtonReleased)
|
REG(IsGamepadButtonReleased)
|
||||||
REG(IsGamepadButtonUp)
|
REG(IsGamepadButtonUp)
|
||||||
#endif
|
REG(GetGamepadButtonPressed)
|
||||||
|
REG(GetGamepadAxisCount)
|
||||||
|
REG(GetGamepadAxisMovement)
|
||||||
|
|
||||||
REG(IsMouseButtonPressed)
|
REG(IsMouseButtonPressed)
|
||||||
REG(IsMouseButtonDown)
|
REG(IsMouseButtonDown)
|
||||||
@ -3714,16 +3746,10 @@ static luaL_Reg raylib_functions[] = {
|
|||||||
|
|
||||||
REG(SetCameraMode)
|
REG(SetCameraMode)
|
||||||
REG(UpdateCamera)
|
REG(UpdateCamera)
|
||||||
REG(UpdateCameraPlayer)
|
|
||||||
REG(SetCameraPosition)
|
|
||||||
REG(SetCameraTarget)
|
|
||||||
REG(SetCameraFovy)
|
|
||||||
|
|
||||||
REG(SetCameraPanControl)
|
REG(SetCameraPanControl)
|
||||||
REG(SetCameraAltControl)
|
REG(SetCameraAltControl)
|
||||||
REG(SetCameraSmoothZoomControl)
|
REG(SetCameraSmoothZoomControl)
|
||||||
REG(SetCameraMoveControls)
|
REG(SetCameraMoveControls)
|
||||||
REG(SetCameraMouseSensitivity)
|
|
||||||
|
|
||||||
REG(DrawPixel)
|
REG(DrawPixel)
|
||||||
REG(DrawPixelV)
|
REG(DrawPixelV)
|
||||||
@ -3766,6 +3792,7 @@ static luaL_Reg raylib_functions[] = {
|
|||||||
REG(UnloadRenderTexture)
|
REG(UnloadRenderTexture)
|
||||||
REG(GetImageData)
|
REG(GetImageData)
|
||||||
REG(GetTextureData)
|
REG(GetTextureData)
|
||||||
|
REG(UpdateTexture)
|
||||||
REG(ImageToPOT)
|
REG(ImageToPOT)
|
||||||
REG(ImageFormat)
|
REG(ImageFormat)
|
||||||
REG(ImageDither)
|
REG(ImageDither)
|
||||||
@ -3786,7 +3813,8 @@ static luaL_Reg raylib_functions[] = {
|
|||||||
REG(ImageColorContrast)
|
REG(ImageColorContrast)
|
||||||
REG(ImageColorBrightness)
|
REG(ImageColorBrightness)
|
||||||
REG(GenTextureMipmaps)
|
REG(GenTextureMipmaps)
|
||||||
REG(UpdateTexture)
|
REG(SetTextureFilter)
|
||||||
|
REG(SetTextureWrap)
|
||||||
|
|
||||||
REG(DrawTexture)
|
REG(DrawTexture)
|
||||||
REG(DrawTextureV)
|
REG(DrawTextureV)
|
||||||
@ -3796,6 +3824,7 @@ static luaL_Reg raylib_functions[] = {
|
|||||||
|
|
||||||
REG(GetDefaultFont)
|
REG(GetDefaultFont)
|
||||||
REG(LoadSpriteFont)
|
REG(LoadSpriteFont)
|
||||||
|
REG(LoadSpriteFontTTF)
|
||||||
REG(UnloadSpriteFont)
|
REG(UnloadSpriteFont)
|
||||||
REG(DrawText)
|
REG(DrawText)
|
||||||
REG(DrawTextEx)
|
REG(DrawTextEx)
|
||||||
@ -3845,7 +3874,6 @@ static luaL_Reg raylib_functions[] = {
|
|||||||
REG(CheckCollisionRaySphere)
|
REG(CheckCollisionRaySphere)
|
||||||
REG(CheckCollisionRaySphereEx)
|
REG(CheckCollisionRaySphereEx)
|
||||||
REG(CheckCollisionRayBox)
|
REG(CheckCollisionRayBox)
|
||||||
REG(ResolveCollisionCubicmap)
|
|
||||||
|
|
||||||
REG(LoadShader)
|
REG(LoadShader)
|
||||||
REG(UnloadShader)
|
REG(UnloadShader)
|
||||||
@ -3868,6 +3896,7 @@ static luaL_Reg raylib_functions[] = {
|
|||||||
REG(InitVrDevice)
|
REG(InitVrDevice)
|
||||||
REG(CloseVrDevice)
|
REG(CloseVrDevice)
|
||||||
REG(IsVrDeviceReady)
|
REG(IsVrDeviceReady)
|
||||||
|
REG(IsVrSimulator)
|
||||||
REG(UpdateVrTracking)
|
REG(UpdateVrTracking)
|
||||||
REG(ToggleVrMode)
|
REG(ToggleVrMode)
|
||||||
|
|
||||||
|
|||||||
10
src/shapes.c
@ -4,6 +4,12 @@
|
|||||||
*
|
*
|
||||||
* Basic functions to draw 2d Shapes and check collisions
|
* Basic functions to draw 2d Shapes and check collisions
|
||||||
*
|
*
|
||||||
|
* External libs:
|
||||||
|
* rlgl - raylib OpenGL abstraction layer
|
||||||
|
*
|
||||||
|
* Module Configuration Flags:
|
||||||
|
* ...
|
||||||
|
*
|
||||||
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
@ -25,11 +31,11 @@
|
|||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2
|
||||||
|
|
||||||
#include <stdlib.h> // Required for: abs()
|
#include <stdlib.h> // Required for: abs()
|
||||||
#include <math.h> // Required for: sinf(), cosf(), sqrtf()
|
#include <math.h> // Required for: sinf(), cosf(), sqrtf()
|
||||||
|
|
||||||
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Defines and Macros
|
// Defines and Macros
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|||||||
75
src/text.c
@ -4,6 +4,12 @@
|
|||||||
*
|
*
|
||||||
* Basic functions to load SpriteFonts and draw Text
|
* Basic functions to load SpriteFonts and draw Text
|
||||||
*
|
*
|
||||||
|
* External libs:
|
||||||
|
* stb_truetype - Load TTF file and rasterize characters data
|
||||||
|
*
|
||||||
|
* Module Configuration Flags:
|
||||||
|
* ...
|
||||||
|
*
|
||||||
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
@ -33,7 +39,7 @@
|
|||||||
#include "utils.h" // Required for: GetExtension(), GetNextPOT()
|
#include "utils.h" // Required for: GetExtension(), GetNextPOT()
|
||||||
|
|
||||||
// Following libs are used on LoadTTF()
|
// Following libs are used on LoadTTF()
|
||||||
//#define STBTT_STATIC
|
#define STBTT_STATIC // Define stb_truetype functions static to this module
|
||||||
#define STB_TRUETYPE_IMPLEMENTATION
|
#define STB_TRUETYPE_IMPLEMENTATION
|
||||||
#include "external/stb_truetype.h" // Required for: stbtt_BakeFontBitmap()
|
#include "external/stb_truetype.h" // Required for: stbtt_BakeFontBitmap()
|
||||||
|
|
||||||
@ -344,12 +350,12 @@ void DrawText(const char *text, int posX, int posY, int fontSize, Color color)
|
|||||||
void DrawTextEx(SpriteFont spriteFont, const char *text, Vector2 position, float fontSize, int spacing, Color tint)
|
void DrawTextEx(SpriteFont spriteFont, const char *text, Vector2 position, float fontSize, int spacing, Color tint)
|
||||||
{
|
{
|
||||||
int length = strlen(text);
|
int length = strlen(text);
|
||||||
int textOffsetX = 0;
|
int textOffsetX = 0; // Offset between characters
|
||||||
int textOffsetY = 0; // Line break!
|
int textOffsetY = 0; // Required for line break!
|
||||||
float scaleFactor;
|
float scaleFactor;
|
||||||
unsigned char letter;
|
|
||||||
|
|
||||||
Rectangle rec;
|
unsigned char letter; // Current character
|
||||||
|
int index; // Index position in sprite font
|
||||||
|
|
||||||
scaleFactor = fontSize/spriteFont.size;
|
scaleFactor = fontSize/spriteFont.size;
|
||||||
|
|
||||||
@ -357,42 +363,38 @@ void DrawTextEx(SpriteFont spriteFont, const char *text, Vector2 position, float
|
|||||||
// written in C code files (codified by default as UTF-8)
|
// written in C code files (codified by default as UTF-8)
|
||||||
|
|
||||||
for (int i = 0; i < length; i++)
|
for (int i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
if ((unsigned char)text[i] == '\n')
|
||||||
|
{
|
||||||
|
// NOTE: Fixed line spacing of 1.5 lines
|
||||||
|
textOffsetY += ((spriteFont.size + spriteFont.size/2)*scaleFactor);
|
||||||
|
textOffsetX = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if ((unsigned char)text[i] == 0xc2) // UTF-8 encoding identification HACK!
|
if ((unsigned char)text[i] == 0xc2) // UTF-8 encoding identification HACK!
|
||||||
{
|
{
|
||||||
// Support UTF-8 encoded values from [0xc2 0x80] -> [0xc2 0xbf](¿)
|
// Support UTF-8 encoded values from [0xc2 0x80] -> [0xc2 0xbf](¿)
|
||||||
letter = (unsigned char)text[i + 1];
|
letter = (unsigned char)text[i + 1];
|
||||||
rec = spriteFont.charRecs[GetCharIndex(spriteFont, (int)letter)];
|
index = GetCharIndex(spriteFont, (int)letter);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
else if ((unsigned char)text[i] == 0xc3) // UTF-8 encoding identification HACK!
|
else if ((unsigned char)text[i] == 0xc3) // UTF-8 encoding identification HACK!
|
||||||
{
|
{
|
||||||
// Support UTF-8 encoded values from [0xc3 0x80](À) -> [0xc3 0xbf](ÿ)
|
// Support UTF-8 encoded values from [0xc3 0x80](À) -> [0xc3 0xbf](ÿ)
|
||||||
letter = (unsigned char)text[i + 1];
|
letter = (unsigned char)text[i + 1];
|
||||||
rec = spriteFont.charRecs[GetCharIndex(spriteFont, (int)letter + 64)];
|
index = GetCharIndex(spriteFont, (int)letter + 64);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
else
|
else index = GetCharIndex(spriteFont, (int)text[i]);
|
||||||
{
|
|
||||||
if ((unsigned char)text[i] == '\n')
|
|
||||||
{
|
|
||||||
// NOTE: Fixed line spacing of 1.5 lines
|
|
||||||
textOffsetY += ((spriteFont.size + spriteFont.size/2)*scaleFactor);
|
|
||||||
textOffsetX = 0;
|
|
||||||
rec.x = -1;
|
|
||||||
}
|
|
||||||
else rec = spriteFont.charRecs[GetCharIndex(spriteFont, (int)text[i])];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rec.x >= 0)
|
DrawTexturePro(spriteFont.texture, spriteFont.charRecs[index],
|
||||||
{
|
(Rectangle){ position.x + textOffsetX + spriteFont.charOffsets[index].x*scaleFactor,
|
||||||
int index = GetCharIndex(spriteFont, (int)text[i]);
|
|
||||||
|
|
||||||
DrawTexturePro(spriteFont.texture, rec, (Rectangle){ position.x + textOffsetX + spriteFont.charOffsets[index].x*scaleFactor,
|
|
||||||
position.y + textOffsetY + spriteFont.charOffsets[index].y*scaleFactor,
|
position.y + textOffsetY + spriteFont.charOffsets[index].y*scaleFactor,
|
||||||
rec.width*scaleFactor, rec.height*scaleFactor} , (Vector2){ 0, 0 }, 0.0f, tint);
|
spriteFont.charRecs[index].width*scaleFactor,
|
||||||
|
spriteFont.charRecs[index].height*scaleFactor }, (Vector2){ 0, 0 }, 0.0f, tint);
|
||||||
|
|
||||||
if (spriteFont.charAdvanceX[index] == 0) textOffsetX += (rec.width*scaleFactor + spacing);
|
if (spriteFont.charAdvanceX[index] == 0) textOffsetX += (spriteFont.charRecs[index].width*scaleFactor + spacing);
|
||||||
else textOffsetX += (spriteFont.charAdvanceX[index]*scaleFactor + spacing);
|
else textOffsetX += (spriteFont.charAdvanceX[index]*scaleFactor + spacing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,14 +450,14 @@ int MeasureText(const char *text, int fontSize)
|
|||||||
if (fontSize < defaultFontSize) fontSize = defaultFontSize;
|
if (fontSize < defaultFontSize) fontSize = defaultFontSize;
|
||||||
int spacing = fontSize/defaultFontSize;
|
int spacing = fontSize/defaultFontSize;
|
||||||
|
|
||||||
vec = MeasureTextEx(GetDefaultFont(), text, fontSize, spacing);
|
vec = MeasureTextEx(GetDefaultFont(), text, (float)fontSize, spacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int)vec.x;
|
return (int)vec.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Measure string size for SpriteFont
|
// Measure string size for SpriteFont
|
||||||
Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int spacing)
|
Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, float fontSize, int spacing)
|
||||||
{
|
{
|
||||||
int len = strlen(text);
|
int len = strlen(text);
|
||||||
int tempLen = 0; // Used to count longer text line num chars
|
int tempLen = 0; // Used to count longer text line num chars
|
||||||
@ -465,7 +467,7 @@ Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int
|
|||||||
int tempTextWidth = 0; // Used to count longer text line width
|
int tempTextWidth = 0; // Used to count longer text line width
|
||||||
|
|
||||||
int textHeight = spriteFont.size;
|
int textHeight = spriteFont.size;
|
||||||
float scaleFactor;
|
float scaleFactor = fontSize/spriteFont.size;
|
||||||
|
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
@ -491,9 +493,6 @@ Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int
|
|||||||
|
|
||||||
if (tempTextWidth < textWidth) tempTextWidth = textWidth;
|
if (tempTextWidth < textWidth) tempTextWidth = textWidth;
|
||||||
|
|
||||||
if (fontSize <= spriteFont.size) scaleFactor = 1.0f;
|
|
||||||
else scaleFactor = (float)fontSize/spriteFont.size;
|
|
||||||
|
|
||||||
Vector2 vec;
|
Vector2 vec;
|
||||||
vec.x = (float)tempTextWidth*scaleFactor + (tempLen - 1)*spacing; // Adds chars spacing to measure
|
vec.x = (float)tempTextWidth*scaleFactor + (tempLen - 1)*spacing; // Adds chars spacing to measure
|
||||||
vec.y = (float)textHeight*scaleFactor;
|
vec.y = (float)textHeight*scaleFactor;
|
||||||
@ -535,7 +534,7 @@ void DrawFPS(int posX, int posY)
|
|||||||
|
|
||||||
static int GetCharIndex(SpriteFont font, int letter)
|
static int GetCharIndex(SpriteFont font, int letter)
|
||||||
{
|
{
|
||||||
//#define UNORDERED_CHARSET
|
#define UNORDERED_CHARSET
|
||||||
#if defined(UNORDERED_CHARSET)
|
#if defined(UNORDERED_CHARSET)
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
@ -877,9 +876,17 @@ static SpriteFont LoadBMFont(const char *fileName)
|
|||||||
|
|
||||||
Image imFont = LoadImage(texPath);
|
Image imFont = LoadImage(texPath);
|
||||||
|
|
||||||
if (imFont.format == UNCOMPRESSED_GRAYSCALE) ImageAlphaMask(&imFont, imFont);
|
if (imFont.format == UNCOMPRESSED_GRAYSCALE)
|
||||||
|
{
|
||||||
|
Image imCopy = ImageCopy(imFont);
|
||||||
|
|
||||||
font.texture = LoadTextureFromImage(imFont);
|
for (int i = 0; i < imCopy.width*imCopy.height; i++) ((unsigned char *)imCopy.data)[i] = 0xff; // WHITE pixel
|
||||||
|
|
||||||
|
ImageAlphaMask(&imCopy, imFont);
|
||||||
|
font.texture = LoadTextureFromImage(imCopy);
|
||||||
|
UnloadImage(imCopy);
|
||||||
|
}
|
||||||
|
else font.texture = LoadTextureFromImage(imFont);
|
||||||
|
|
||||||
font.size = fontSize;
|
font.size = fontSize;
|
||||||
font.numChars = numChars;
|
font.numChars = numChars;
|
||||||
|
|||||||
@ -4,9 +4,13 @@
|
|||||||
*
|
*
|
||||||
* Basic functions to load and draw Textures (2d)
|
* Basic functions to load and draw Textures (2d)
|
||||||
*
|
*
|
||||||
* Uses external lib:
|
* External libs:
|
||||||
* stb_image - Multiple formats image loading (JPEG, PNG, BMP, TGA, PSD, GIF, PIC)
|
* stb_image - Multiple image formats loading (JPEG, PNG, BMP, TGA, PSD, GIF, PIC)
|
||||||
* NOTE: stb_image has been slightly modified, original library: https://github.com/nothings/stb
|
* NOTE: stb_image has been slightly modified to support Android platform.
|
||||||
|
* stb_image_resize - Multiple image resize algorythms
|
||||||
|
*
|
||||||
|
* Module Configuration Flags:
|
||||||
|
* ...
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
|
|||||||
14
src/utils.c
@ -2,12 +2,16 @@
|
|||||||
*
|
*
|
||||||
* raylib.utils
|
* raylib.utils
|
||||||
*
|
*
|
||||||
* Utils Functions Definitions
|
* Some utility functions
|
||||||
*
|
*
|
||||||
* Uses external libs:
|
* External libs:
|
||||||
* tinfl - zlib DEFLATE algorithm decompression lib
|
* tinfl - zlib DEFLATE algorithm decompression
|
||||||
* stb_image_write - PNG writting functions
|
* stb_image_write - PNG writting functions
|
||||||
*
|
*
|
||||||
|
* Module Configuration Flags:
|
||||||
|
* DO_NOT_TRACE_DEBUG_MSGS - Avoid showing DEBUG TraceLog() messages
|
||||||
|
*
|
||||||
|
*
|
||||||
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
@ -46,7 +50,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "external/tinfl.c" // Required for: tinfl_decompress_mem_to_mem()
|
#include "external/tinfl.c" // Required for: tinfl_decompress_mem_to_mem()
|
||||||
// NOTE: Deflate algorythm data decompression
|
// NOTE: DEFLATE algorythm data decompression
|
||||||
|
|
||||||
|
#define DO_NOT_TRACE_DEBUG_MSGS // Avoid DEBUG messages tracing
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Global Variables Definition
|
// Global Variables Definition
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* raylib.utils
|
* raylib.utils
|
||||||
*
|
*
|
||||||
* Some utility functions: rRES files data decompression
|
* Some utility functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
* will the authors be held liable for any damages arising from the use of this software.
|
* will the authors be held liable for any damages arising from the use of this software.
|
||||||
@ -34,8 +34,6 @@
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Some basic Defines
|
// Some basic Defines
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
#define DO_NOT_TRACE_DEBUG_MSGS // Use this define to avoid DEBUG tracing
|
|
||||||
|
|
||||||
#if defined(PLATFORM_ANDROID)
|
#if defined(PLATFORM_ANDROID)
|
||||||
#define fopen(name, mode) android_fopen(name, mode)
|
#define fopen(name, mode) android_fopen(name, mode)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -37,15 +37,14 @@ void android_main(struct android_app *app)
|
|||||||
|
|
||||||
InitAudioDevice(); // Initialize audio device
|
InitAudioDevice(); // Initialize audio device
|
||||||
|
|
||||||
Sound fx = LoadSound("coin.wav"); // Load WAV audio file (placed on assets folder)
|
|
||||||
|
|
||||||
Texture2D texture = LoadTexture("raylib_logo.png"); // Load texture (placed on assets folder)
|
Texture2D texture = LoadTexture("raylib_logo.png"); // Load texture (placed on assets folder)
|
||||||
|
|
||||||
int framesCounter = 0; // Used to count frames
|
Sound fx = LoadSound("coin.wav"); // Load WAV audio file (placed on assets folder)
|
||||||
|
|
||||||
Music ambient = LoadMusicStream("ambient.ogg");
|
Music ambient = LoadMusicStream("ambient.ogg");
|
||||||
PlayMusicStream(ambient);
|
PlayMusicStream(ambient);
|
||||||
|
|
||||||
|
int framesCounter = 0; // Used to count frames
|
||||||
|
|
||||||
SetTargetFPS(60); // Not required on Android, already locked to 60 fps
|
SetTargetFPS(60); // Not required on Android, already locked to 60 fps
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -6,37 +6,39 @@
|
|||||||
*
|
*
|
||||||
* Features:
|
* Features:
|
||||||
* Library written in plain C code (C99)
|
* Library written in plain C code (C99)
|
||||||
* Uses C# PascalCase/camelCase notation
|
* Uses PascalCase/camelCase notation
|
||||||
* Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES 2.0)
|
* Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES 2.0)
|
||||||
* Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
|
* Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
|
||||||
* Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF)
|
* Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF)
|
||||||
* Multiple textures support, including compressed formats and mipmaps generation
|
* Multiple textures support, including compressed formats and mipmaps generation
|
||||||
* Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps
|
* Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps
|
||||||
* Materials (diffuse, normal, specular) and Lighting (point, directional, spot) support
|
* Materials (diffuse, normal, specular) and Lighting (point, directional, spot) support
|
||||||
* Powerful math module for Vector, Matrix and Quaternion operations [raymath]
|
* Powerful math module for Vector, Matrix and Quaternion operations: [raymath]
|
||||||
* Audio loading and playing with streaming support and mixing channels (WAV, OGG, XM, MOD)
|
* Audio loading and playing with streaming support and mixing channels [audio]
|
||||||
* VR stereo rendering support with configurable HMD device parameters
|
* VR stereo rendering support with configurable HMD device parameters
|
||||||
* Multiple platforms support: Windows, Linux, Mac, Android, Raspberry Pi, HTML5 and Oculus Rift CV1
|
* Multiple platforms support: Windows, Linux, Mac, Android, Raspberry Pi, HTML5 and Oculus Rift CV1
|
||||||
* Custom color palette for fancy visuals on raywhite background
|
* Custom color palette for fancy visuals on raywhite background
|
||||||
* Minimal external dependencies (GLFW3, OpenGL, OpenAL)
|
* Minimal external dependencies (GLFW3, OpenGL, OpenAL)
|
||||||
|
* Complete binding for LUA [rlua]
|
||||||
*
|
*
|
||||||
* Used external libs:
|
* External libs:
|
||||||
* GLFW3 (www.glfw.org) for window/context management and input
|
* GLFW3 (www.glfw.org) for window/context management and input [core]
|
||||||
* GLAD for OpenGL extensions loading (3.3 Core profile, only PLATFORM_DESKTOP)
|
* GLAD for OpenGL extensions loading (3.3 Core profile, only PLATFORM_DESKTOP) [rlgl]
|
||||||
* stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA, PSD, GIF, HDR, PIC)
|
* stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA) [textures]
|
||||||
* stb_image_write (Sean Barret) for image writting (PNG)
|
* stb_image_write (Sean Barret) for image writting (PNG) [utils]
|
||||||
* stb_vorbis (Sean Barret) for ogg audio loading
|
* stb_truetype (Sean Barret) for ttf fonts loading [text]
|
||||||
* stb_truetype (Sean Barret) for ttf fonts loading
|
* stb_vorbis (Sean Barret) for ogg audio loading [audio]
|
||||||
* jar_xm (Joshua Reisenauer) for XM audio module loading
|
* jar_xm (Joshua Reisenauer) for XM audio module loading [audio]
|
||||||
* jar_mod (Joshua Reisenauer) for MOD audio module loading
|
* jar_mod (Joshua Reisenauer) for MOD audio module loading [audio]
|
||||||
* OpenAL Soft for audio device/context management
|
* dr_flac (David Reid) for FLAC audio file loading [audio]
|
||||||
* tinfl for data decompression (DEFLATE algorithm)
|
* OpenAL Soft for audio device/context management [audio]
|
||||||
|
* tinfl for data decompression (DEFLATE algorithm) [utils]
|
||||||
*
|
*
|
||||||
* Some design decisions:
|
* Some design decisions:
|
||||||
* 32bit Colors - All defined color are always RGBA (struct Color is 4 byte)
|
* 32bit Colors - All defined color are always RGBA (struct Color is 4 byte)
|
||||||
* One custom default font is loaded automatically when InitWindow()
|
* One custom default font could be loaded automatically when InitWindow() [core]
|
||||||
* If using OpenGL 3.3 or ES2, several vertex buffers (VAO/VBO) are created to manage lines-triangles-quads
|
* If using OpenGL 3.3 or ES2, several vertex buffers (VAO/VBO) are created to manage lines-triangles-quads
|
||||||
* If using OpenGL 3.3 or ES2, two default shaders are loaded automatically (internally defined)
|
* If using OpenGL 3.3 or ES2, two default shaders could be loaded automatically (internally defined)
|
||||||
*
|
*
|
||||||
* -- LICENSE --
|
* -- LICENSE --
|
||||||
*
|
*
|
||||||
@ -77,10 +79,6 @@
|
|||||||
#define PLATFORM_DESKTOP
|
#define PLATFORM_DESKTOP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_ANDROID)
|
|
||||||
typedef struct android_app; // Define android_app struct (android_native_app_glue.h)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_WIN32) && defined(BUILDING_DLL)
|
#if defined(_WIN32) && defined(BUILDING_DLL)
|
||||||
#define RLAPI __declspec(dllexport) // We are building raylib as a Win32 DLL
|
#define RLAPI __declspec(dllexport) // We are building raylib as a Win32 DLL
|
||||||
#elif defined(_WIN32) && defined(RAYLIB_DLL)
|
#elif defined(_WIN32) && defined(RAYLIB_DLL)
|
||||||
@ -93,7 +91,7 @@
|
|||||||
// Some basic Defines
|
// Some basic Defines
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
#ifndef PI
|
#ifndef PI
|
||||||
#define PI 3.14159265358979323846
|
#define PI 3.14159265358979323846f
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEG2RAD (PI/180.0f)
|
#define DEG2RAD (PI/180.0f)
|
||||||
@ -101,11 +99,12 @@
|
|||||||
|
|
||||||
// raylib Config Flags
|
// raylib Config Flags
|
||||||
#define FLAG_FULLSCREEN_MODE 1
|
#define FLAG_FULLSCREEN_MODE 1
|
||||||
#define FLAG_SHOW_LOGO 2
|
#define FLAG_RESIZABLE_WINDOW 2
|
||||||
#define FLAG_SHOW_MOUSE_CURSOR 4
|
#define FLAG_SHOW_LOGO 4
|
||||||
#define FLAG_CENTERED_MODE 8
|
#define FLAG_SHOW_MOUSE_CURSOR 8
|
||||||
#define FLAG_MSAA_4X_HINT 16
|
#define FLAG_CENTERED_MODE 16
|
||||||
#define FLAG_VSYNC_HINT 32
|
#define FLAG_MSAA_4X_HINT 32
|
||||||
|
#define FLAG_VSYNC_HINT 64
|
||||||
|
|
||||||
// Keyboard Function Keys
|
// Keyboard Function Keys
|
||||||
#define KEY_SPACE 32
|
#define KEY_SPACE 32
|
||||||
@ -173,15 +172,18 @@
|
|||||||
#define KEY_Y 89
|
#define KEY_Y 89
|
||||||
#define KEY_Z 90
|
#define KEY_Z 90
|
||||||
|
|
||||||
|
#if defined(PLATFORM_ANDROID)
|
||||||
|
// Android Physical Buttons
|
||||||
|
#define KEY_BACK 4
|
||||||
|
#define KEY_MENU 82
|
||||||
|
#define KEY_VOLUME_UP 24
|
||||||
|
#define KEY_VOLUME_DOWN 25
|
||||||
|
#endif
|
||||||
|
|
||||||
// Mouse Buttons
|
// Mouse Buttons
|
||||||
#define MOUSE_LEFT_BUTTON 0
|
#define MOUSE_LEFT_BUTTON 0
|
||||||
#if defined(PLATFORM_WEB)
|
#define MOUSE_RIGHT_BUTTON 1
|
||||||
#define MOUSE_RIGHT_BUTTON 2
|
#define MOUSE_MIDDLE_BUTTON 2
|
||||||
#define MOUSE_MIDDLE_BUTTON 1
|
|
||||||
#else
|
|
||||||
#define MOUSE_RIGHT_BUTTON 1
|
|
||||||
#define MOUSE_MIDDLE_BUTTON 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Touch points registered
|
// Touch points registered
|
||||||
#define MAX_TOUCH_POINTS 2
|
#define MAX_TOUCH_POINTS 2
|
||||||
@ -189,24 +191,35 @@
|
|||||||
// Gamepad Number
|
// Gamepad Number
|
||||||
#define GAMEPAD_PLAYER1 0
|
#define GAMEPAD_PLAYER1 0
|
||||||
#define GAMEPAD_PLAYER2 1
|
#define GAMEPAD_PLAYER2 1
|
||||||
#define GAMEPAD_PLAYER3 2 // Not supported
|
#define GAMEPAD_PLAYER3 2
|
||||||
#define GAMEPAD_PLAYER4 3 // Not supported
|
#define GAMEPAD_PLAYER4 3
|
||||||
|
|
||||||
// Gamepad Buttons
|
// Gamepad Buttons/Axis
|
||||||
|
|
||||||
// PS3 USB Controller
|
// PS3 USB Controller Buttons
|
||||||
#define GAMEPAD_PS3_BUTTON_A 2
|
#define GAMEPAD_PS3_BUTTON_TRIANGLE 0
|
||||||
#define GAMEPAD_PS3_BUTTON_B 1
|
#define GAMEPAD_PS3_BUTTON_CIRCLE 1
|
||||||
#define GAMEPAD_PS3_BUTTON_X 3
|
#define GAMEPAD_PS3_BUTTON_CROSS 2
|
||||||
#define GAMEPAD_PS3_BUTTON_Y 4
|
#define GAMEPAD_PS3_BUTTON_SQUARE 3
|
||||||
#define GAMEPAD_PS3_BUTTON_R1 7
|
|
||||||
#define GAMEPAD_PS3_BUTTON_R2 5
|
|
||||||
#define GAMEPAD_PS3_BUTTON_L1 6
|
#define GAMEPAD_PS3_BUTTON_L1 6
|
||||||
#define GAMEPAD_PS3_BUTTON_L2 8
|
#define GAMEPAD_PS3_BUTTON_R1 7
|
||||||
|
#define GAMEPAD_PS3_BUTTON_L2 4
|
||||||
|
#define GAMEPAD_PS3_BUTTON_R2 5
|
||||||
|
#define GAMEPAD_PS3_BUTTON_START 8
|
||||||
#define GAMEPAD_PS3_BUTTON_SELECT 9
|
#define GAMEPAD_PS3_BUTTON_SELECT 9
|
||||||
#define GAMEPAD_PS3_BUTTON_START 10
|
#define GAMEPAD_PS3_BUTTON_UP 24
|
||||||
|
#define GAMEPAD_PS3_BUTTON_RIGHT 25
|
||||||
|
#define GAMEPAD_PS3_BUTTON_DOWN 26
|
||||||
|
#define GAMEPAD_PS3_BUTTON_LEFT 27
|
||||||
|
#define GAMEPAD_PS3_BUTTON_PS 12
|
||||||
|
|
||||||
// TODO: Add PS3 d-pad axis
|
// PS3 USB Controller Axis
|
||||||
|
#define GAMEPAD_PS3_AXIS_LEFT_X 0
|
||||||
|
#define GAMEPAD_PS3_AXIS_LEFT_Y 1
|
||||||
|
#define GAMEPAD_PS3_AXIS_RIGHT_X 2
|
||||||
|
#define GAMEPAD_PS3_AXIS_RIGHT_Y 5
|
||||||
|
#define GAMEPAD_PS3_AXIS_L2 3 // [1..-1] (pressure-level)
|
||||||
|
#define GAMEPAD_PS3_AXIS_R2 4 // [1..-1] (pressure-level)
|
||||||
|
|
||||||
// Xbox360 USB Controller Buttons
|
// Xbox360 USB Controller Buttons
|
||||||
#define GAMEPAD_XBOX_BUTTON_A 0
|
#define GAMEPAD_XBOX_BUTTON_A 0
|
||||||
@ -217,33 +230,30 @@
|
|||||||
#define GAMEPAD_XBOX_BUTTON_RB 5
|
#define GAMEPAD_XBOX_BUTTON_RB 5
|
||||||
#define GAMEPAD_XBOX_BUTTON_SELECT 6
|
#define GAMEPAD_XBOX_BUTTON_SELECT 6
|
||||||
#define GAMEPAD_XBOX_BUTTON_START 7
|
#define GAMEPAD_XBOX_BUTTON_START 7
|
||||||
|
#define GAMEPAD_XBOX_BUTTON_UP 10
|
||||||
|
#define GAMEPAD_XBOX_BUTTON_RIGHT 11
|
||||||
|
#define GAMEPAD_XBOX_BUTTON_DOWN 12
|
||||||
|
#define GAMEPAD_XBOX_BUTTON_LEFT 13
|
||||||
|
#define GAMEPAD_XBOX_BUTTON_HOME 8
|
||||||
|
|
||||||
|
// Xbox360 USB Controller Axis
|
||||||
|
// NOTE: For Raspberry Pi, axis must be reconfigured
|
||||||
#if defined(PLATFORM_RPI)
|
#if defined(PLATFORM_RPI)
|
||||||
#define GAMEPAD_XBOX_AXIS_DPAD_X 7
|
#define GAMEPAD_XBOX_AXIS_LEFT_X 0 // [-1..1] (left->right)
|
||||||
#define GAMEPAD_XBOX_AXIS_DPAD_Y 6
|
#define GAMEPAD_XBOX_AXIS_LEFT_Y 1 // [-1..1] (up->down)
|
||||||
#define GAMEPAD_XBOX_AXIS_RIGHT_X 3
|
#define GAMEPAD_XBOX_AXIS_RIGHT_X 3 // [-1..1] (left->right)
|
||||||
#define GAMEPAD_XBOX_AXIS_RIGHT_Y 4
|
#define GAMEPAD_XBOX_AXIS_RIGHT_Y 4 // [-1..1] (up->down)
|
||||||
#define GAMEPAD_XBOX_AXIS_LT 2
|
#define GAMEPAD_XBOX_AXIS_LT 2 // [-1..1] (pressure-level)
|
||||||
#define GAMEPAD_XBOX_AXIS_RT 5
|
#define GAMEPAD_XBOX_AXIS_RT 5 // [-1..1] (pressure-level)
|
||||||
#else
|
#else
|
||||||
#define GAMEPAD_XBOX_BUTTON_UP 10
|
#define GAMEPAD_XBOX_AXIS_LEFT_X 0 // [-1..1] (left->right)
|
||||||
#define GAMEPAD_XBOX_BUTTON_DOWN 12
|
#define GAMEPAD_XBOX_AXIS_LEFT_Y 1 // [1..-1] (up->down)
|
||||||
#define GAMEPAD_XBOX_BUTTON_LEFT 13
|
#define GAMEPAD_XBOX_AXIS_RIGHT_X 2 // [-1..1] (left->right)
|
||||||
#define GAMEPAD_XBOX_BUTTON_RIGHT 11
|
#define GAMEPAD_XBOX_AXIS_RIGHT_Y 3 // [1..-1] (up->down)
|
||||||
#define GAMEPAD_XBOX_AXIS_RIGHT_X 4
|
#define GAMEPAD_XBOX_AXIS_LT 4 // [-1..1] (pressure-level)
|
||||||
#define GAMEPAD_XBOX_AXIS_RIGHT_Y 3
|
#define GAMEPAD_XBOX_AXIS_RT 5 // [-1..1] (pressure-level)
|
||||||
#define GAMEPAD_XBOX_AXIS_LT_RT 2
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GAMEPAD_XBOX_AXIS_LEFT_X 0
|
|
||||||
#define GAMEPAD_XBOX_AXIS_LEFT_Y 1
|
|
||||||
|
|
||||||
// Android Physic Buttons
|
|
||||||
#define ANDROID_BACK 4
|
|
||||||
#define ANDROID_MENU 82
|
|
||||||
#define ANDROID_VOLUME_UP 24
|
|
||||||
#define ANDROID_VOLUME_DOWN 25
|
|
||||||
|
|
||||||
// NOTE: MSC C++ compiler does not support compound literals (C99 feature)
|
// NOTE: MSC C++ compiler does not support compound literals (C99 feature)
|
||||||
// Plain structures in C++ (without constructors) can be initialized from { } initializers.
|
// Plain structures in C++ (without constructors) can be initialized from { } initializers.
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -297,9 +307,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// byte type
|
|
||||||
typedef unsigned char byte;
|
|
||||||
|
|
||||||
// Vector2 type
|
// Vector2 type
|
||||||
typedef struct Vector2 {
|
typedef struct Vector2 {
|
||||||
float x;
|
float x;
|
||||||
@ -427,7 +434,9 @@ typedef struct Shader {
|
|||||||
|
|
||||||
// Uniform locations
|
// Uniform locations
|
||||||
int mvpLoc; // ModelView-Projection matrix uniform location point (vertex shader)
|
int mvpLoc; // ModelView-Projection matrix uniform location point (vertex shader)
|
||||||
int tintColorLoc; // Diffuse color uniform location point (fragment shader)
|
int colDiffuseLoc; // Diffuse color uniform location point (fragment shader)
|
||||||
|
int colAmbientLoc; // Ambient color uniform location point (fragment shader)
|
||||||
|
int colSpecularLoc; // Specular color uniform location point (fragment shader)
|
||||||
|
|
||||||
// Texture map locations (generic for any kind of map)
|
// Texture map locations (generic for any kind of map)
|
||||||
int mapTexture0Loc; // Map texture uniform location point (default-texture-unit = 0)
|
int mapTexture0Loc; // Map texture uniform location point (default-texture-unit = 0)
|
||||||
@ -464,7 +473,7 @@ typedef struct LightData {
|
|||||||
int type; // Light type: LIGHT_POINT, LIGHT_DIRECTIONAL, LIGHT_SPOT
|
int type; // Light type: LIGHT_POINT, LIGHT_DIRECTIONAL, LIGHT_SPOT
|
||||||
|
|
||||||
Vector3 position; // Light position
|
Vector3 position; // Light position
|
||||||
Vector3 target; // Light target: LIGHT_DIRECTIONAL and LIGHT_SPOT (cone direction target)
|
Vector3 target; // Light direction: LIGHT_DIRECTIONAL and LIGHT_SPOT (cone direction target)
|
||||||
float radius; // Light attenuation radius light intensity reduced with distance (world distance)
|
float radius; // Light attenuation radius light intensity reduced with distance (world distance)
|
||||||
|
|
||||||
Color diffuse; // Light diffuse color
|
Color diffuse; // Light diffuse color
|
||||||
@ -482,12 +491,6 @@ typedef struct Ray {
|
|||||||
Vector3 direction; // Ray direction
|
Vector3 direction; // Ray direction
|
||||||
} Ray;
|
} Ray;
|
||||||
|
|
||||||
// Sound source type
|
|
||||||
typedef struct Sound {
|
|
||||||
unsigned int source; // OpenAL audio source id
|
|
||||||
unsigned int buffer; // OpenAL audio buffer id
|
|
||||||
} Sound;
|
|
||||||
|
|
||||||
// Wave type, defines audio wave data
|
// Wave type, defines audio wave data
|
||||||
typedef struct Wave {
|
typedef struct Wave {
|
||||||
unsigned int sampleCount; // Number of samples
|
unsigned int sampleCount; // Number of samples
|
||||||
@ -497,6 +500,13 @@ typedef struct Wave {
|
|||||||
void *data; // Buffer data pointer
|
void *data; // Buffer data pointer
|
||||||
} Wave;
|
} Wave;
|
||||||
|
|
||||||
|
// Sound source type
|
||||||
|
typedef struct Sound {
|
||||||
|
unsigned int source; // OpenAL audio source id
|
||||||
|
unsigned int buffer; // OpenAL audio buffer id
|
||||||
|
int format; // OpenAL audio format specifier
|
||||||
|
} Sound;
|
||||||
|
|
||||||
// Music type (file streaming from memory)
|
// Music type (file streaming from memory)
|
||||||
// NOTE: Anything longer than ~10 seconds should be streamed
|
// NOTE: Anything longer than ~10 seconds should be streamed
|
||||||
typedef struct MusicData *Music;
|
typedef struct MusicData *Music;
|
||||||
@ -536,6 +546,21 @@ typedef enum {
|
|||||||
COMPRESSED_ASTC_8x8_RGBA // 2 bpp
|
COMPRESSED_ASTC_8x8_RGBA // 2 bpp
|
||||||
} TextureFormat;
|
} TextureFormat;
|
||||||
|
|
||||||
|
// Texture parameters: filter mode
|
||||||
|
// NOTE 1: Filtering considers mipmaps if available in the texture
|
||||||
|
// NOTE 2: Filter is accordingly set for minification and magnification
|
||||||
|
typedef enum {
|
||||||
|
FILTER_POINT = 0, // No filter, just pixel aproximation
|
||||||
|
FILTER_BILINEAR, // Linear filtering
|
||||||
|
FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps)
|
||||||
|
FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x
|
||||||
|
FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x
|
||||||
|
FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x
|
||||||
|
} TextureFilterMode;
|
||||||
|
|
||||||
|
// Texture parameters: wrap mode
|
||||||
|
typedef enum { WRAP_REPEAT = 0, WRAP_CLAMP, WRAP_MIRROR } TextureWrapMode;
|
||||||
|
|
||||||
// Color blending modes (pre-defined)
|
// Color blending modes (pre-defined)
|
||||||
typedef enum { BLEND_ALPHA = 0, BLEND_ADDITIVE, BLEND_MULTIPLIED } BlendMode;
|
typedef enum { BLEND_ALPHA = 0, BLEND_ADDITIVE, BLEND_MULTIPLIED } BlendMode;
|
||||||
|
|
||||||
@ -556,7 +581,13 @@ typedef enum {
|
|||||||
} Gestures;
|
} Gestures;
|
||||||
|
|
||||||
// Camera system modes
|
// Camera system modes
|
||||||
typedef enum { CAMERA_CUSTOM = 0, CAMERA_FREE, CAMERA_ORBITAL, CAMERA_FIRST_PERSON, CAMERA_THIRD_PERSON } CameraMode;
|
typedef enum {
|
||||||
|
CAMERA_CUSTOM = 0,
|
||||||
|
CAMERA_FREE,
|
||||||
|
CAMERA_ORBITAL,
|
||||||
|
CAMERA_FIRST_PERSON,
|
||||||
|
CAMERA_THIRD_PERSON
|
||||||
|
} CameraMode;
|
||||||
|
|
||||||
// Head Mounted Display devices
|
// Head Mounted Display devices
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -584,7 +615,7 @@ extern "C" { // Prevents name mangling of functions
|
|||||||
// Window and Graphics Device Functions (Module: core)
|
// Window and Graphics Device Functions (Module: core)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
#if defined(PLATFORM_ANDROID)
|
#if defined(PLATFORM_ANDROID)
|
||||||
RLAPI void InitWindow(int width, int height, struct android_app *state); // Init Android Activity and OpenGL Graphics
|
RLAPI void InitWindow(int width, int height, void *state); // Init Android Activity and OpenGL Graphics (struct android_app)
|
||||||
#elif defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB)
|
#elif defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB)
|
||||||
RLAPI void InitWindow(int width, int height, const char *title); // Initialize Window and OpenGL Graphics
|
RLAPI void InitWindow(int width, int height, const char *title); // Initialize Window and OpenGL Graphics
|
||||||
#endif
|
#endif
|
||||||
@ -596,11 +627,13 @@ RLAPI void ToggleFullscreen(void); // Fullscreen
|
|||||||
RLAPI int GetScreenWidth(void); // Get current screen width
|
RLAPI int GetScreenWidth(void); // Get current screen width
|
||||||
RLAPI int GetScreenHeight(void); // Get current screen height
|
RLAPI int GetScreenHeight(void); // Get current screen height
|
||||||
|
|
||||||
|
#if !defined(PLATFORM_ANDROID)
|
||||||
RLAPI void ShowCursor(void); // Shows cursor
|
RLAPI void ShowCursor(void); // Shows cursor
|
||||||
RLAPI void HideCursor(void); // Hides cursor
|
RLAPI void HideCursor(void); // Hides cursor
|
||||||
RLAPI bool IsCursorHidden(void); // Returns true if cursor is not visible
|
RLAPI bool IsCursorHidden(void); // Returns true if cursor is not visible
|
||||||
RLAPI void EnableCursor(void); // Enables cursor
|
RLAPI void EnableCursor(void); // Enables cursor
|
||||||
RLAPI void DisableCursor(void); // Disables cursor
|
RLAPI void DisableCursor(void); // Disables cursor
|
||||||
|
#endif
|
||||||
|
|
||||||
RLAPI void ClearBackground(Color color); // Sets Background Color
|
RLAPI void ClearBackground(Color color); // Sets Background Color
|
||||||
RLAPI void BeginDrawing(void); // Setup drawing canvas to start drawing
|
RLAPI void BeginDrawing(void); // Setup drawing canvas to start drawing
|
||||||
@ -643,7 +676,6 @@ RLAPI int StorageLoadValue(int position); // Storage loa
|
|||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Input Handling Functions (Module: core)
|
// Input Handling Functions (Module: core)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB)
|
|
||||||
RLAPI bool IsKeyPressed(int key); // Detect if a key has been pressed once
|
RLAPI bool IsKeyPressed(int key); // Detect if a key has been pressed once
|
||||||
RLAPI bool IsKeyDown(int key); // Detect if a key is being pressed
|
RLAPI bool IsKeyDown(int key); // Detect if a key is being pressed
|
||||||
RLAPI bool IsKeyReleased(int key); // Detect if a key has been released once
|
RLAPI bool IsKeyReleased(int key); // Detect if a key has been released once
|
||||||
@ -652,12 +684,15 @@ RLAPI int GetKeyPressed(void); // Get latest key
|
|||||||
RLAPI void SetExitKey(int key); // Set a custom key to exit program (default is ESC)
|
RLAPI void SetExitKey(int key); // Set a custom key to exit program (default is ESC)
|
||||||
|
|
||||||
RLAPI bool IsGamepadAvailable(int gamepad); // Detect if a gamepad is available
|
RLAPI bool IsGamepadAvailable(int gamepad); // Detect if a gamepad is available
|
||||||
RLAPI float GetGamepadAxisMovement(int gamepad, int axis); // Return axis movement value for a gamepad axis
|
RLAPI bool IsGamepadName(int gamepad, const char *name); // Check gamepad name (if available)
|
||||||
|
RLAPI const char *GetGamepadName(int gamepad); // Return gamepad internal name id
|
||||||
RLAPI bool IsGamepadButtonPressed(int gamepad, int button); // Detect if a gamepad button has been pressed once
|
RLAPI bool IsGamepadButtonPressed(int gamepad, int button); // Detect if a gamepad button has been pressed once
|
||||||
RLAPI bool IsGamepadButtonDown(int gamepad, int button); // Detect if a gamepad button is being pressed
|
RLAPI bool IsGamepadButtonDown(int gamepad, int button); // Detect if a gamepad button is being pressed
|
||||||
RLAPI bool IsGamepadButtonReleased(int gamepad, int button); // Detect if a gamepad button has been released once
|
RLAPI bool IsGamepadButtonReleased(int gamepad, int button); // Detect if a gamepad button has been released once
|
||||||
RLAPI bool IsGamepadButtonUp(int gamepad, int button); // Detect if a gamepad button is NOT being pressed
|
RLAPI bool IsGamepadButtonUp(int gamepad, int button); // Detect if a gamepad button is NOT being pressed
|
||||||
#endif
|
RLAPI int GetGamepadButtonPressed(void); // Get the last gamepad button pressed
|
||||||
|
RLAPI int GetGamepadAxisCount(int gamepad); // Return gamepad axis count for a gamepad
|
||||||
|
RLAPI float GetGamepadAxisMovement(int gamepad, int axis); // Return axis movement value for a gamepad axis
|
||||||
|
|
||||||
RLAPI bool IsMouseButtonPressed(int button); // Detect if a mouse button has been pressed once
|
RLAPI bool IsMouseButtonPressed(int button); // Detect if a mouse button has been pressed once
|
||||||
RLAPI bool IsMouseButtonDown(int button); // Detect if a mouse button is being pressed
|
RLAPI bool IsMouseButtonDown(int button); // Detect if a mouse button is being pressed
|
||||||
@ -673,12 +708,6 @@ RLAPI int GetTouchX(void); // Returns touch p
|
|||||||
RLAPI int GetTouchY(void); // Returns touch position Y for touch point 0 (relative to screen size)
|
RLAPI int GetTouchY(void); // Returns touch position Y for touch point 0 (relative to screen size)
|
||||||
RLAPI Vector2 GetTouchPosition(int index); // Returns touch position XY for a touch point index (relative to screen size)
|
RLAPI Vector2 GetTouchPosition(int index); // Returns touch position XY for a touch point index (relative to screen size)
|
||||||
|
|
||||||
#if defined(PLATFORM_ANDROID)
|
|
||||||
bool IsButtonPressed(int button); // Detect if an android physic button has been pressed
|
|
||||||
bool IsButtonDown(int button); // Detect if an android physic button is being pressed
|
|
||||||
bool IsButtonReleased(int button); // Detect if an android physic button has been released
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Gestures and Touch Handling Functions (Module: gestures)
|
// Gestures and Touch Handling Functions (Module: gestures)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
@ -695,22 +724,15 @@ RLAPI float GetGesturePinchAngle(void); // Get gesture pin
|
|||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Camera System Functions (Module: camera)
|
// Camera System Functions (Module: camera)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
RLAPI void SetCameraMode(int mode); // Set camera mode (multiple camera modes available)
|
RLAPI void SetCameraMode(Camera camera, int mode); // Set camera mode (multiple camera modes available)
|
||||||
RLAPI void UpdateCamera(Camera *camera); // Update camera (player position is ignored)
|
RLAPI void UpdateCamera(Camera *camera); // Update camera position for selected mode
|
||||||
RLAPI void UpdateCameraPlayer(Camera *camera, Vector3 *position); // Update camera and player position (1st person and 3rd person cameras)
|
|
||||||
|
|
||||||
RLAPI void SetCameraPosition(Vector3 position); // Set internal camera position
|
|
||||||
RLAPI void SetCameraTarget(Vector3 target); // Set internal camera target
|
|
||||||
RLAPI void SetCameraFovy(float fovy); // Set internal camera field-of-view-y
|
|
||||||
|
|
||||||
RLAPI void SetCameraPanControl(int panKey); // Set camera pan key to combine with mouse movement (free camera)
|
RLAPI void SetCameraPanControl(int panKey); // Set camera pan key to combine with mouse movement (free camera)
|
||||||
RLAPI void SetCameraAltControl(int altKey); // Set camera alt key to combine with mouse movement (free camera)
|
RLAPI void SetCameraAltControl(int altKey); // Set camera alt key to combine with mouse movement (free camera)
|
||||||
RLAPI void SetCameraSmoothZoomControl(int szKey); // Set camera smooth zoom key to combine with mouse (free camera)
|
RLAPI void SetCameraSmoothZoomControl(int szKey); // Set camera smooth zoom key to combine with mouse (free camera)
|
||||||
|
|
||||||
RLAPI void SetCameraMoveControls(int frontKey, int backKey,
|
RLAPI void SetCameraMoveControls(int frontKey, int backKey,
|
||||||
int leftKey, int rightKey,
|
int rightKey, int leftKey,
|
||||||
int upKey, int downKey); // Set camera move controls (1st person and 3rd person cameras)
|
int upKey, int downKey); // Set camera move controls (1st person and 3rd person cameras)
|
||||||
RLAPI void SetCameraMouseSensitivity(float sensitivity); // Set camera mouse sensitivity (1st person and 3rd person cameras)
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Basic Shapes Drawing Functions (Module: shapes)
|
// Basic Shapes Drawing Functions (Module: shapes)
|
||||||
@ -759,8 +781,10 @@ RLAPI void UnloadTexture(Texture2D texture);
|
|||||||
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory
|
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory
|
||||||
RLAPI Color *GetImageData(Image image); // Get pixel data from image as a Color struct array
|
RLAPI Color *GetImageData(Image image); // Get pixel data from image as a Color struct array
|
||||||
RLAPI Image GetTextureData(Texture2D texture); // Get pixel data from GPU texture and return an Image
|
RLAPI Image GetTextureData(Texture2D texture); // Get pixel data from GPU texture and return an Image
|
||||||
|
RLAPI void UpdateTexture(Texture2D texture, void *pixels); // Update GPU texture with new data
|
||||||
RLAPI void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two)
|
RLAPI void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two)
|
||||||
RLAPI void ImageFormat(Image *image, int newFormat); // Convert image data to desired format
|
RLAPI void ImageFormat(Image *image, int newFormat); // Convert image data to desired format
|
||||||
|
RLAPI void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image
|
||||||
RLAPI void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
|
RLAPI void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
|
||||||
RLAPI Image ImageCopy(Image image); // Create an image duplicate (useful for transformations)
|
RLAPI Image ImageCopy(Image image); // Create an image duplicate (useful for transformations)
|
||||||
RLAPI void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle
|
RLAPI void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle
|
||||||
@ -779,7 +803,8 @@ RLAPI void ImageColorGrayscale(Image *image);
|
|||||||
RLAPI void ImageColorContrast(Image *image, float contrast); // Modify image color: contrast (-100 to 100)
|
RLAPI void ImageColorContrast(Image *image, float contrast); // Modify image color: contrast (-100 to 100)
|
||||||
RLAPI void ImageColorBrightness(Image *image, int brightness); // Modify image color: brightness (-255 to 255)
|
RLAPI void ImageColorBrightness(Image *image, int brightness); // Modify image color: brightness (-255 to 255)
|
||||||
RLAPI void GenTextureMipmaps(Texture2D texture); // Generate GPU mipmaps for a texture
|
RLAPI void GenTextureMipmaps(Texture2D texture); // Generate GPU mipmaps for a texture
|
||||||
RLAPI void UpdateTexture(Texture2D texture, void *pixels); // Update GPU texture with new data
|
RLAPI void SetTextureFilter(Texture2D texture, int filterMode); // Set texture scaling filter mode
|
||||||
|
RLAPI void SetTextureWrap(Texture2D texture, int wrapMode); // Set texture wrapping mode
|
||||||
|
|
||||||
RLAPI void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D
|
RLAPI void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D
|
||||||
RLAPI void DrawTextureV(Texture2D texture, Vector2 position, Color tint); // Draw a Texture2D with position defined as Vector2
|
RLAPI void DrawTextureV(Texture2D texture, Vector2 position, Color tint); // Draw a Texture2D with position defined as Vector2
|
||||||
@ -793,13 +818,14 @@ RLAPI void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle dest
|
|||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
RLAPI SpriteFont GetDefaultFont(void); // Get the default SpriteFont
|
RLAPI SpriteFont GetDefaultFont(void); // Get the default SpriteFont
|
||||||
RLAPI SpriteFont LoadSpriteFont(const char *fileName); // Load a SpriteFont image into GPU memory
|
RLAPI SpriteFont LoadSpriteFont(const char *fileName); // Load a SpriteFont image into GPU memory
|
||||||
|
RLAPI SpriteFont LoadSpriteFontTTF(const char *fileName, int fontSize, int numChars, int *fontChars); // Load a SpriteFont from TTF font with parameters
|
||||||
RLAPI void UnloadSpriteFont(SpriteFont spriteFont); // Unload SpriteFont from GPU memory
|
RLAPI void UnloadSpriteFont(SpriteFont spriteFont); // Unload SpriteFont from GPU memory
|
||||||
|
|
||||||
RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
|
RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
|
||||||
RLAPI void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, // Draw text using SpriteFont and additional parameters
|
RLAPI void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, // Draw text using SpriteFont and additional parameters
|
||||||
float fontSize, int spacing, Color tint);
|
float fontSize, int spacing, Color tint);
|
||||||
RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font
|
RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font
|
||||||
RLAPI Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int spacing); // Measure string size for SpriteFont
|
RLAPI Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, float fontSize, int spacing); // Measure string size for SpriteFont
|
||||||
|
|
||||||
RLAPI void DrawFPS(int posX, int posY); // Shows current FPS on top-left corner
|
RLAPI void DrawFPS(int posX, int posY); // Shows current FPS on top-left corner
|
||||||
RLAPI const char *FormatText(const char *text, ...); // Formatting of text with variables to 'embed'
|
RLAPI const char *FormatText(const char *text, ...); // Formatting of text with variables to 'embed'
|
||||||
@ -809,7 +835,7 @@ RLAPI const char *SubText(const char *text, int position, int length);
|
|||||||
// Basic 3d Shapes Drawing Functions (Module: models)
|
// Basic 3d Shapes Drawing Functions (Module: models)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
RLAPI void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); // Draw a line in 3D world space
|
RLAPI void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); // Draw a line in 3D world space
|
||||||
RLAPI void DrawCircle3D(Vector3 center, float radius, float rotationAngle, Vector3 rotation, Color color); // Draw a circle in 3D world space
|
RLAPI void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space
|
||||||
RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
|
RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
|
||||||
RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
|
RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
|
||||||
RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires
|
RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires
|
||||||
@ -824,7 +850,7 @@ RLAPI void DrawRay(Ray ray, Color color);
|
|||||||
RLAPI void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
|
RLAPI void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
|
||||||
RLAPI void DrawGizmo(Vector3 position); // Draw simple gizmo
|
RLAPI void DrawGizmo(Vector3 position); // Draw simple gizmo
|
||||||
RLAPI void DrawLight(Light light); // Draw light in 3D world
|
RLAPI void DrawLight(Light light); // Draw light in 3D world
|
||||||
//DrawTorus(), DrawTeapot() are useless...
|
//DrawTorus(), DrawTeapot() could be useful?
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Model 3d Loading and Drawing Functions (Module: models)
|
// Model 3d Loading and Drawing Functions (Module: models)
|
||||||
@ -836,9 +862,7 @@ RLAPI Model LoadHeightmap(Image heightmap, Vector3 size); // Load a
|
|||||||
RLAPI Model LoadCubicmap(Image cubicmap); // Load a map image as a 3d model (cubes based)
|
RLAPI Model LoadCubicmap(Image cubicmap); // Load a map image as a 3d model (cubes based)
|
||||||
RLAPI void UnloadModel(Model model); // Unload 3d model from memory
|
RLAPI void UnloadModel(Model model); // Unload 3d model from memory
|
||||||
|
|
||||||
RLAPI Mesh GenMeshCube(float width, float height, float depth); // Generate mesh: cube
|
RLAPI Material LoadMaterial(const char *fileName); // Load material data (.MTL)
|
||||||
|
|
||||||
RLAPI Material LoadMaterial(const char *fileName); // Load material data (from file)
|
|
||||||
RLAPI Material LoadDefaultMaterial(void); // Load default material (uses default models shader)
|
RLAPI Material LoadDefaultMaterial(void); // Load default material (uses default models shader)
|
||||||
RLAPI Material LoadStandardMaterial(void); // Load standard material (uses material attributes and lighting shader)
|
RLAPI Material LoadStandardMaterial(void); // Load standard material (uses material attributes and lighting shader)
|
||||||
RLAPI void UnloadMaterial(Material material); // Unload material textures from VRAM
|
RLAPI void UnloadMaterial(Material material); // Unload material textures from VRAM
|
||||||
@ -859,8 +883,7 @@ RLAPI bool CheckCollisionBoxSphere(BoundingBox box, Vector3 centerSphere, float
|
|||||||
RLAPI bool CheckCollisionRaySphere(Ray ray, Vector3 spherePosition, float sphereRadius); // Detect collision between ray 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 with extended parameters and collision point detection
|
RLAPI bool CheckCollisionRaySphereEx(Ray ray, Vector3 spherePosition, float sphereRadius, Vector3 *collisionPoint); // Detect collision between ray and sphere with extended parameters and collision point detection
|
||||||
RLAPI bool CheckCollisionRayBox(Ray ray, BoundingBox box); // Detect collision between ray and box
|
RLAPI bool CheckCollisionRayBox(Ray ray, BoundingBox box); // Detect collision between ray and box
|
||||||
RLAPI Vector3 ResolveCollisionCubicmap(Image cubicmap, Vector3 mapPosition, Vector3 *playerPosition, float radius); // Detect collision of player radius with cubicmap
|
|
||||||
// NOTE: Return the normal vector of the impacted surface
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Shaders System Functions (Module: rlgl)
|
// Shaders System Functions (Module: rlgl)
|
||||||
// NOTE: This functions are useless when using OpenGL 1.1
|
// NOTE: This functions are useless when using OpenGL 1.1
|
||||||
@ -894,20 +917,25 @@ RLAPI void DestroyLight(Light light); // Des
|
|||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
RLAPI void InitVrDevice(int vdDevice); // Init VR device
|
RLAPI void InitVrDevice(int vdDevice); // Init VR device
|
||||||
RLAPI void CloseVrDevice(void); // Close VR device
|
RLAPI void CloseVrDevice(void); // Close VR device
|
||||||
RLAPI bool IsVrDeviceReady(void); // Detect if VR device (or simulator) is ready
|
RLAPI bool IsVrDeviceReady(void); // Detect if VR device is ready
|
||||||
RLAPI void UpdateVrTracking(void); // Update VR tracking (position and orientation)
|
RLAPI bool IsVrSimulator(void); // Detect if VR simulator is running
|
||||||
|
RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
|
||||||
RLAPI void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
|
RLAPI void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Audio Loading and Playing Functions (Module: audio)
|
// Audio Loading and Playing Functions (Module: audio)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
RLAPI void InitAudioDevice(void); // Initialize audio device and context
|
RLAPI void InitAudioDevice(void); // Initialize audio device and context
|
||||||
RLAPI void CloseAudioDevice(void); // Close the audio device and context (and music stream)
|
RLAPI void CloseAudioDevice(void); // Close the audio device and context
|
||||||
RLAPI bool IsAudioDeviceReady(void); // Check if audio device has been initialized successfully
|
RLAPI bool IsAudioDeviceReady(void); // Check if audio device has been initialized successfully
|
||||||
|
|
||||||
RLAPI Sound LoadSound(char *fileName); // Load sound to memory
|
RLAPI Wave LoadWave(const char *fileName); // Load wave data from file into RAM
|
||||||
|
RLAPI Wave LoadWaveEx(float *data, int sampleCount, int sampleRate, int sampleSize, int channels); // Load wave data from float array data (32bit)
|
||||||
|
RLAPI Sound LoadSound(const char *fileName); // Load sound to memory
|
||||||
RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data
|
RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data
|
||||||
RLAPI Sound LoadSoundFromRES(const char *rresName, int resId); // Load sound to memory from rRES file (raylib Resource)
|
RLAPI Sound LoadSoundFromRES(const char *rresName, int resId); // Load sound to memory from rRES file (raylib Resource)
|
||||||
|
RLAPI void UpdateSound(Sound sound, void *data, int numSamples); // Update sound buffer with new data
|
||||||
|
RLAPI void UnloadWave(Wave wave); // Unload wave data
|
||||||
RLAPI void UnloadSound(Sound sound); // Unload sound
|
RLAPI void UnloadSound(Sound sound); // Unload sound
|
||||||
RLAPI void PlaySound(Sound sound); // Play a sound
|
RLAPI void PlaySound(Sound sound); // Play a sound
|
||||||
RLAPI void PauseSound(Sound sound); // Pause a sound
|
RLAPI void PauseSound(Sound sound); // Pause a sound
|
||||||
@ -916,12 +944,15 @@ RLAPI void StopSound(Sound sound); // Stop pl
|
|||||||
RLAPI bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
|
RLAPI bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
|
||||||
RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
|
RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
|
||||||
RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
||||||
|
RLAPI void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format
|
||||||
RLAPI Music LoadMusicStream(char *fileName); // Load music stream from file
|
RLAPI Wave WaveCopy(Wave wave); // Copy a wave to a new wave
|
||||||
|
RLAPI void WaveCrop(Wave *wave, int initSample, int finalSample); // Crop a wave to defined samples range
|
||||||
|
RLAPI float *GetWaveData(Wave wave); // Get samples data from wave as a floats array
|
||||||
|
RLAPI Music LoadMusicStream(const char *fileName); // Load music stream from file
|
||||||
RLAPI void UnloadMusicStream(Music music); // Unload music stream
|
RLAPI void UnloadMusicStream(Music music); // Unload music stream
|
||||||
RLAPI void PlayMusicStream(Music music); // Start music playing (open stream)
|
RLAPI void PlayMusicStream(Music music); // Start music playing
|
||||||
RLAPI void UpdateMusicStream(Music music); // Updates buffers for music streaming
|
RLAPI void UpdateMusicStream(Music music); // Updates buffers for music streaming
|
||||||
RLAPI void StopMusicStream(Music music); // Stop music playing (close stream)
|
RLAPI void StopMusicStream(Music music); // Stop music playing
|
||||||
RLAPI void PauseMusicStream(Music music); // Pause music playing
|
RLAPI void PauseMusicStream(Music music); // Pause music playing
|
||||||
RLAPI void ResumeMusicStream(Music music); // Resume playing paused music
|
RLAPI void ResumeMusicStream(Music music); // Resume playing paused music
|
||||||
RLAPI bool IsMusicPlaying(Music music); // Check if music is playing
|
RLAPI bool IsMusicPlaying(Music music); // Check if music is playing
|
||||||
@ -932,7 +963,7 @@ RLAPI float GetMusicTimePlayed(Music music); // Get cur
|
|||||||
|
|
||||||
RLAPI AudioStream InitAudioStream(unsigned int sampleRate,
|
RLAPI AudioStream InitAudioStream(unsigned int sampleRate,
|
||||||
unsigned int sampleSize,
|
unsigned int sampleSize,
|
||||||
unsigned int channels); // Init audio stream (to stream audio pcm data)
|
unsigned int channels); // Init audio stream (to stream raw audio pcm data)
|
||||||
RLAPI void UpdateAudioStream(AudioStream stream, void *data, int numSamples); // Update audio stream buffers with data
|
RLAPI void UpdateAudioStream(AudioStream stream, void *data, int numSamples); // Update audio stream buffers with data
|
||||||
RLAPI void CloseAudioStream(AudioStream stream); // Close audio stream and free memory
|
RLAPI void CloseAudioStream(AudioStream stream); // Close audio stream and free memory
|
||||||
RLAPI bool IsAudioBufferProcessed(AudioStream stream); // Check if any audio stream buffers requires refill
|
RLAPI bool IsAudioBufferProcessed(AudioStream stream); // Check if any audio stream buffers requires refill
|
||||||
|
|||||||