From e563ebe240c16c142157c3d21df50c72fe27ff14 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 16 May 2017 00:43:57 +0200 Subject: Update README.md Reviewed comments and added acknowledgements --- README.md | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index fde1e279..f46a30fa 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ features * Powerful fonts module with multiple SpriteFonts formats support (XNA bitmap fonts, AngelCode fonts, TTF) * Outstanding texture formats support, including compressed formats (DXT, ETC, PVRT, ASTC) * Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps - * Materials (diffuse, normal, specular) and Lighting (point, directional, spot) support + * Flexible Materials system, supporting by default diffuse, normal and specular maps * 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) * Audio loading and playing with streaming support and mixing channels (WAV, OGG, FLAC, XM, MOD) @@ -43,31 +43,17 @@ On Raspberry Pi, raylib uses Videocore API and EGL for window/context management raylib is licensed under a zlib/libpng license. View [LICENSE](https://github.com/raysan5/raylib/blob/master/LICENSE.md). -tools requirements ------------------- +building +-------- + +For detailed building instructions, check [raylib Wiki](https://github.com/raysan5/raylib/wiki). raylib has been developed using exclusively two tools: * Notepad++ (text editor) - [http://notepad-plus-plus.org/](http://notepad-plus-plus.org/) * MinGW (GCC compiler) - [http://www.mingw.org/](http://www.mingw.org/) -Those are the tools I recommend to develop with raylib, in fact, those are the tools my students use. -I believe those are the best tools to train spartan-programmers. - -Someone could argue about debugging. raylib is a library intended for learning and I think C it's a clear enough language -to allow writing small-mid size programs with a printf-based debugging. All raylib examples have also been written this way. - -Since raylib v1.1, you can download a Windows Installer package for easy installation and configuration. Check [raylib Webpage](http://www.raylib.com/) - -building source (generate libraylib.a) --------------------------------------- - -Check raylib wiki page: [Compile for...](https://github.com/raysan5/raylib/wiki) - -building examples ------------------ - -Check raylib wiki page: [Compile for...](https://github.com/raysan5/raylib/wiki) +Those are the tools recommended to develop with raylib, in fact, those are the tools my students use. contact ------- @@ -98,7 +84,7 @@ contributing (in some way or another) to make raylib project better. Huge thanks - Marc Agüera for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com)) - Daniel Moreno for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com)) - Daniel Gomez for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com)) - - Sergio Martinez for helping on raygui development and tools development (raygui_styler). + - [Sergio Martinez](https://github.com/anidealgift) for helping on raygui development and tools development (raygui_styler). - [Victor Fisac](https://github.com/victorfisac) for developing physics raylib module (physac) and implementing materials and lighting systems... among multiple other improvements and multiple tools and games. - Albert Martos for helping on raygui and porting examples and game-templates to Android and HTML5. - Ian Eito for helping on raygui and porting examples and game-templates to Android and HTML5. @@ -106,15 +92,22 @@ contributing (in some way or another) to make raylib project better. Huge thanks - [Chris Hemingway](https://github.com/cHemingway) for improving raylib on OSX build system. - [Emanuele Petriglia](https://github.com/LelixSuper) for working on multiple GNU/Linux improvements and developing [TicTacToe](https://github.com/LelixSuper/TicTacToe) raylib game. - [Joshua Reisenauer](https://github.com/kd7tck) for adding audio modules support (XM, MOD) and reviewing audio system. - - Marcelo Paez (paezao) for his help on OSX to solve High DPI display issue. Thanks Marcelo! + - [Marcelo Paez](https://github.com/paezao) for his help on OSX to solve High DPI display issue. Thanks Marcelo! - [Ghassan Al-Mashareqa](https://github.com/ghassanpl) for his amazing contribution with raylib Lua module, I just work over his code to implement [rlua](https://github.com/raysan5/raylib/blob/master/src/rlua.h) - [Teodor Stoenescu](https://github.com/teodor-stoenescu) for his improvements on OBJ object loading. + - [RDR8](https://github.com/RDR8) for helping with Linux build improvements + - [Saggi Mizrahi](https://github.com/ficoos) for multiple fixes on Linux and audio system + - [Daniel Lemos](https://github.com/xspager) for fixing issues on Linux games building + - [Joel Davis](https://github.com/joeld42) for adding raycast picking utilities and a [great example](https://github.com/raysan5/raylib/blob/master/examples/models/models_mesh_picking.c) + - [Richard Goodwin](https://github.com/AudioMorphology) for adding RPI touchscreen support + - [Milan Nikolic](https://github.com/gen2brain) for adding Android build support with custom standalone toolchain Please, if I forget someone in this list, excuse me and write me an email to remind me to add you! -[raysan5]: mailto:ray@raylib.com "Ramon Santamaria - Ray San" - license ------- raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE.md) for further details. + +[raysan5]: mailto:ray@raylib.com "Ramon Santamaria - Ray San" + -- cgit v1.2.3 From a5bfd7db228b90b5ddc183a03e1f0630d7321091 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 16 May 2017 15:23:01 +0200 Subject: Some reviews for RPI --- docs/examples/src/shaders/shaders_postprocessing.c | 89 +++++++++++++++++++-- .../web/shaders/shaders_postprocessing.png | Bin 237145 -> 193424 bytes examples/Makefile | 15 ++-- examples/models/models_mesh_picking.c | 26 +++--- examples/shaders/shaders_postprocessing.png | Bin 237145 -> 193424 bytes examples/text/text_ttf_loading.c | 10 ++- src/physac.h | 4 +- 7 files changed, 113 insertions(+), 31 deletions(-) diff --git a/docs/examples/src/shaders/shaders_postprocessing.c b/docs/examples/src/shaders/shaders_postprocessing.c index 43d1af72..bb239efa 100644 --- a/docs/examples/src/shaders/shaders_postprocessing.c +++ b/docs/examples/src/shaders/shaders_postprocessing.c @@ -18,6 +18,48 @@ #include "raylib.h" +#if defined(PLATFORM_DESKTOP) + #define GLSL_VERSION 330 + #define DEFAULT_VERTEX_SHADER "resources/shaders/glsl330/base.vs" +#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB + #define GLSL_VERSION 100 + #define DEFAULT_VERTEX_SHADER "resources/shaders/glsl100/base.vs" +#endif + +#define MAX_POSTPRO_SHADERS 12 + +typedef enum { + FX_GRAYSCALE = 0, + FX_POSTERIZATION, + FX_DREAM_VISION, + FX_PIXELIZER, + FX_CROSS_HATCHING, + FX_CROSS_STITCHING, + FX_PREDATOR_VIEW, + FX_SCANLINES, + FX_FISHEYE, + FX_SOBEL, + FX_BLOOM, + FX_BLUR, + //FX_FXAA +} PostproShader; + +static const char *postproShaderText[] = { + "GRAYSCALE", + "POSTERIZATION", + "DREAM_VISION", + "PIXELIZER", + "CROSS_HATCHING", + "CROSS_STITCHING", + "PREDATOR_VIEW", + "SCANLINES", + "FISHEYE", + "SOBEL", + "BLOOM", + "BLUR", + //"FXAA" +}; + int main() { // Initialization @@ -38,8 +80,25 @@ int main() Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position - Shader shader = LoadShader("resources/shaders/glsl330/base.vs", - "resources/shaders/glsl330/bloom.fs"); // Load postpro shader + // Load all postpro shaders + // NOTE 1: All postpro shader use the base vertex shader (DEFAULT_VERTEX_SHADER) + // NOTE 2: We load the correct shader depending on GLSL version + Shader shaders[MAX_POSTPRO_SHADERS]; + + shaders[FX_GRAYSCALE] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION)); + shaders[FX_POSTERIZATION] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/posterization.fs", GLSL_VERSION)); + shaders[FX_DREAM_VISION] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/dream_vision.fs", GLSL_VERSION)); + shaders[FX_PIXELIZER] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/pixelizer.fs", GLSL_VERSION)); + shaders[FX_CROSS_HATCHING] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/cross_hatching.fs", GLSL_VERSION)); + shaders[FX_CROSS_STITCHING] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/cross_stitching.fs", GLSL_VERSION)); + shaders[FX_PREDATOR_VIEW] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/predator.fs", GLSL_VERSION)); + shaders[FX_SCANLINES] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/scanlines.fs", GLSL_VERSION)); + shaders[FX_FISHEYE] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/fisheye.fs", GLSL_VERSION)); + shaders[FX_SOBEL] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/sobel.fs", GLSL_VERSION)); + shaders[FX_BLOOM] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/bloom.fs", GLSL_VERSION)); + shaders[FX_BLUR] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/blur.fs", GLSL_VERSION)); + + int currentShader = FX_GRAYSCALE; // Create a RenderTexture2D to be used for render to texture RenderTexture2D target = LoadRenderTexture(screenWidth, screenHeight); @@ -56,6 +115,12 @@ int main() // Update //---------------------------------------------------------------------------------- UpdateCamera(&camera); // Update camera + + if (IsKeyPressed(KEY_RIGHT)) currentShader++; + else if (IsKeyPressed(KEY_LEFT)) currentShader--; + + if (currentShader >= MAX_POSTPRO_SHADERS) currentShader = 0; + else if (currentShader < 0) currentShader = MAX_POSTPRO_SHADERS - 1; //---------------------------------------------------------------------------------- // Draw @@ -73,21 +138,26 @@ int main() DrawGrid(10, 1.0f); // Draw a grid End3dMode(); - - DrawText("HELLO POSTPROCESSING!", 70, 190, 50, RED); EndTextureMode(); // End drawing to texture (now we have a texture available for next passes) - BeginShaderMode(shader); + // Render previously generated texture using selected postpro shader + BeginShaderMode(shaders[currentShader]); // 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(); + DrawRectangle(0, 9, 580, 30, Fade(LIGHTGRAY, 0.7f)); + DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, DARKGRAY); - - DrawFPS(10, 10); + + DrawText("CURRENT POSTPRO SHADER:", 10, 15, 20, BLACK); + DrawText(postproShaderText[currentShader], 330, 15, 20, RED); + DrawText("< >", 540, 10, 30, DARKBLUE); + + DrawFPS(700, 15); EndDrawing(); //---------------------------------------------------------------------------------- @@ -95,7 +165,10 @@ int main() // De-Initialization //-------------------------------------------------------------------------------------- - UnloadShader(shader); // Unload shader + + // Unload all postpro shaders + for (int i = 0; i < MAX_POSTPRO_SHADERS; i++) UnloadShader(shaders[i]); + UnloadTexture(texture); // Unload texture UnloadModel(dwarf); // Unload model UnloadRenderTexture(target); // Unload render texture diff --git a/docs/examples/web/shaders/shaders_postprocessing.png b/docs/examples/web/shaders/shaders_postprocessing.png index 684cbd41..628ab810 100644 Binary files a/docs/examples/web/shaders/shaders_postprocessing.png and b/docs/examples/web/shaders/shaders_postprocessing.png differ diff --git a/examples/Makefile b/examples/Makefile index c3728b3b..969edd0c 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -162,9 +162,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),WINDOWS) # external libraries to link with # GLFW3 - LFLAGS += -L$(RAYLIB_PATH)/src/external/glfw3/lib/$(LIBPATH) + LFLAGS += -L$(RAYLIB_PATH)/src/external/glfw3/lib/$(LIBPATH) # OpenAL Soft - LFLAGS += -L$(RAYLIB_PATH)/src/external/openal_soft/lib/$(LIBPATH) + LFLAGS += -L$(RAYLIB_PATH)/src/external/openal_soft/lib/$(LIBPATH) endif endif @@ -195,6 +195,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) else LIBS += -lopenal32dll endif + PHYSAC_LIBS = -static -lpthread endif endif endif @@ -524,23 +525,23 @@ audio/audio_raw_stream: audio/audio_raw_stream.c # compile [physac] example - physics demo physac/physics_demo: physac/physics_demo.c - $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -static -lpthread -D$(PLATFORM) $(WINFLAGS) + $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) $(PHYSAC_LIBS) -D$(PLATFORM) $(WINFLAGS) # compile [physac] example - physics friction physac/physics_friction: physac/physics_friction.c - $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -static -lpthread -D$(PLATFORM) $(WINFLAGS) + $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) $(PHYSAC_LIBS) -D$(PLATFORM) $(WINFLAGS) # compile [physac] example - physics movement physac/physics_movement: physac/physics_movement.c - $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -static -lpthread -D$(PLATFORM) $(WINFLAGS) + $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) $(PHYSAC_LIBS) -D$(PLATFORM) $(WINFLAGS) # compile [physac] example - physics restitution physac/physics_restitution: physac/physics_restitution.c - $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -static -lpthread -D$(PLATFORM) $(WINFLAGS) + $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) $(PHYSAC_LIBS) -D$(PLATFORM) $(WINFLAGS) # compile [physac] example - physics shatter physac/physics_shatter: physac/physics_shatter.c - $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -static -lpthread -D$(PLATFORM) $(WINFLAGS) + $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) $(PHYSAC_LIBS) -D$(PLATFORM) $(WINFLAGS) ifeq ($(PLATFORM),PLATFORM_ANDROID) external/native_app_glue.o : native_app_glue.c native_app_glue.h diff --git a/examples/models/models_mesh_picking.c b/examples/models/models_mesh_picking.c index 0b5247ec..ec151599 100644 --- a/examples/models/models_mesh_picking.c +++ b/examples/models/models_mesh_picking.c @@ -89,7 +89,7 @@ int main() cursorColor = PURPLE; hitObjectName = "Triangle"; - bary = VectorBarycenter(nearestHit.hitPosition, ta, tb, tc); + bary = VectorBarycenter(nearestHit.position, ta, tb, tc); hitTriangle = true; } else hitTriangle = false; @@ -136,15 +136,15 @@ int main() // If we hit something, draw the cursor at the hit point if (nearestHit.hit) { - DrawCube(nearestHit.hitPosition, 0.3, 0.3, 0.3, cursorColor); - DrawCubeWires(nearestHit.hitPosition, 0.3, 0.3, 0.3, RED); + DrawCube(nearestHit.position, 0.3, 0.3, 0.3, cursorColor); + DrawCubeWires(nearestHit.position, 0.3, 0.3, 0.3, RED); Vector3 normalEnd; - normalEnd.x = nearestHit.hitPosition.x + nearestHit.hitNormal.x; - normalEnd.y = nearestHit.hitPosition.y + nearestHit.hitNormal.y; - normalEnd.z = nearestHit.hitPosition.z + nearestHit.hitNormal.z; + normalEnd.x = nearestHit.position.x + nearestHit.normal.x; + normalEnd.y = nearestHit.position.y + nearestHit.normal.y; + normalEnd.z = nearestHit.position.z + nearestHit.normal.z; - DrawLine3D(nearestHit.hitPosition, normalEnd, RED); + DrawLine3D(nearestHit.position, normalEnd, RED); } DrawRay(ray, MAROON); @@ -163,14 +163,14 @@ int main() DrawText(FormatText("Distance: %3.2f", nearestHit.distance), 10, ypos, 10, BLACK); DrawText(FormatText("Hit Pos: %3.2f %3.2f %3.2f", - nearestHit.hitPosition.x, - nearestHit.hitPosition.y, - nearestHit.hitPosition.z), 10, ypos + 15, 10, BLACK); + nearestHit.position.x, + nearestHit.position.y, + nearestHit.position.z), 10, ypos + 15, 10, BLACK); DrawText(FormatText("Hit Norm: %3.2f %3.2f %3.2f", - nearestHit.hitNormal.x, - nearestHit.hitNormal.y, - nearestHit.hitNormal.z), 10, ypos + 30, 10, BLACK); + nearestHit.normal.x, + nearestHit.normal.y, + nearestHit.normal.z), 10, ypos + 30, 10, BLACK); if (hitTriangle) DrawText(FormatText("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK); } diff --git a/examples/shaders/shaders_postprocessing.png b/examples/shaders/shaders_postprocessing.png index 684cbd41..628ab810 100644 Binary files a/examples/shaders/shaders_postprocessing.png and b/examples/shaders/shaders_postprocessing.png differ diff --git a/examples/text/text_ttf_loading.c b/examples/text/text_ttf_loading.c index 02b7f95f..c9c2fb27 100644 --- a/examples/text/text_ttf_loading.c +++ b/examples/text/text_ttf_loading.c @@ -38,8 +38,11 @@ int main() SetTextureFilter(font.texture, FILTER_POINT); int currentFontFilter = 0; // FILTER_POINT + // NOTE: Drag and drop support only available for desktop platforms: Windows, Linux, OSX +#if defined(PLATFORM_DESKTOP) int count = 0; char **droppedFiles; +#endif SetTargetFPS(60); //-------------------------------------------------------------------------------------- @@ -74,6 +77,7 @@ int main() if (IsKeyDown(KEY_LEFT)) fontPosition.x -= 10; else if (IsKeyDown(KEY_RIGHT)) fontPosition.x += 10; +#if defined(PLATFORM_DESKTOP) // Load a dropped TTF file dynamically (at current fontSize) if (IsFileDropped()) { @@ -86,6 +90,7 @@ int main() ClearDroppedFiles(); } } +#endif //---------------------------------------------------------------------------------- // Draw @@ -119,10 +124,11 @@ int main() // De-Initialization //-------------------------------------------------------------------------------------- +#if defined(PLATFORM_DESKTOP) + ClearDroppedFiles(); // Clear internal buffers +#endif UnloadSpriteFont(font); // SpriteFont unloading - ClearDroppedFiles(); // Clear internal buffers - CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- diff --git a/src/physac.h b/src/physac.h index b71f2877..d3fdaca4 100644 --- a/src/physac.h +++ b/src/physac.h @@ -246,12 +246,14 @@ PHYSACDEF void ClosePhysics(void); #include // Required for: malloc(), free(), srand(), rand() #include // Required for: cosf(), sinf(), fabs(), sqrtf() +#include "raymath.h" // Required for: Vector2Add(), Vector2Subtract() + #if defined(_WIN32) // Functions required to query time on Windows int __stdcall QueryPerformanceCounter(unsigned long long int *lpPerformanceCount); int __stdcall QueryPerformanceFrequency(unsigned long long int *lpFrequency); #elif defined(__linux__) || defined(PLATFORM_WEB) - #define _DEFAULT_SOURCE // Enables BSD function definitions and C99 POSIX compliance + //#define _DEFAULT_SOURCE // Enables BSD function definitions and C99 POSIX compliance #include // Required for: timespec #include // Required for: clock_gettime() #include -- cgit v1.2.3 From 0780cd4e6a4545fb2a45231c11f4aa54e624734e Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 17 May 2017 00:33:29 +0200 Subject: Web review --- docs/cheatsheet/cheatsheet.html | 4 +-- docs/cheatsheet/raylib_audio.c | 3 +- docs/cheatsheet/raylib_core.c | 64 ++++++++++++++++++++++---------------- docs/cheatsheet/raylib_models.c | 19 ++++++----- docs/cheatsheet/raylib_shaders.c | 20 ++++++------ docs/cheatsheet/raylib_shapes.c | 3 ++ docs/cheatsheet/raylib_structs.c | 1 + docs/cheatsheet/raylib_text.c | 4 +-- docs/cheatsheet/raylib_textures.c | 5 ++- docs/common/src/libraylib.a | Bin 997970 -> 0 bytes docs/index.html | 16 +++++----- 11 files changed, 77 insertions(+), 62 deletions(-) delete mode 100644 docs/common/src/libraylib.a diff --git a/docs/cheatsheet/cheatsheet.html b/docs/cheatsheet/cheatsheet.html index be1e696a..b5404614 100644 --- a/docs/cheatsheet/cheatsheet.html +++ b/docs/cheatsheet/cheatsheet.html @@ -127,7 +127,7 @@

[simple and easy-to-use library to learn videogames programming]

-

v1.6.0 quick reference card

+

v1.7.0 quick reference card


@@ -154,7 +154,7 @@

colors

- + diff --git a/docs/cheatsheet/raylib_audio.c b/docs/cheatsheet/raylib_audio.c index 85b58ebf..3d0447bf 100644 --- a/docs/cheatsheet/raylib_audio.c +++ b/docs/cheatsheet/raylib_audio.c @@ -3,6 +3,7 @@ void InitAudioDevice(void); // Initialize audio device and context void CloseAudioDevice(void); // Close the audio device and context (and music stream) bool IsAudioDeviceReady(void); // Check if audio device is ready + void SetMasterVolume(float volume); // Set master volume (listener) // Wave/Sound loading/unloading functions Wave LoadWave(const char *fileName); // Load wave data from file into RAM @@ -10,7 +11,6 @@ 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 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 UnloadWave(Wave wave); // Unload wave data void UnloadSound(Sound sound); // Unload sound @@ -39,6 +39,7 @@ bool IsMusicPlaying(Music music); // Check if music is playing void SetMusicVolume(Music music, float volume); // Set volume for music (1.0 is max level) void SetMusicPitch(Music music, float pitch); // Set pitch for a music (1.0 is base level) + void SetMusicLoopCount(Music music, float count); // Set music loop count (loop repeats) float GetMusicTimeLength(Music music); // Get music time length (in seconds) float GetMusicTimePlayed(Music music); // Get current music time played (in seconds) diff --git a/docs/cheatsheet/raylib_core.c b/docs/cheatsheet/raylib_core.c index 25fe1fc1..b2827c41 100644 --- a/docs/cheatsheet/raylib_core.c +++ b/docs/cheatsheet/raylib_core.c @@ -1,62 +1,72 @@ // Window-related functions void InitWindow(int width, int height, char* title); // Initialize Window and Graphics Context (OpenGL) - void CloseWindow(void); // Close Window and Terminate Context - bool WindowShouldClose(void); // Detect if KEY_ESCAPE pressed or Close icon pressed - bool IsWindowMinimized(void); // Detect if window has been minimized (or lost focus) - void ToggleFullscreen(void); // Fullscreen toggle (by default F11) + void CloseWindow(void); // Close window and unload OpenGL context + bool WindowShouldClose(void); // Check if KEY_ESCAPE pressed or Close icon pressed + bool IsWindowMinimized(void); // Check if window has been minimized (or lost focus) + void ToggleFullscreen(void); // Toggle fullscreen mode (only PLATFORM_DESKTOP) + void SetWindowIcon(Image image); // Set icon for window (only PLATFORM_DESKTOP) + void SetWindowPosition(int x, int y); // Set window position on screen (only PLATFORM_DESKTOP) + void SetWindowMonitor(int monitor); // Set monitor for the current window (fullscreen mode) + void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) int GetScreenWidth(void); // Get current screen width int GetScreenHeight(void); // Get current screen height // Cursor-related functions void ShowCursor(void); // Shows cursor void HideCursor(void); // Hides cursor - bool IsCursorHidden(void); // Returns true if cursor is not visible - void EnableCursor(void); // Enables cursor - void DisableCursor(void); // Disables cursor + bool IsCursorHidden(void); // Check if cursor is not visible + void EnableCursor(void); // Enables cursor (unlock cursor) + void DisableCursor(void); // Disables cursor (lock cursor) // Drawing-related functions - void ClearBackground(Color color); // Sets Background Color - void BeginDrawing(void); // Setup drawing canvas to start drawing - void EndDrawing(void); // End canvas drawing and Swap Buffers (Double Buffering) - - void Begin2dMode(Camera2D camera); // Initialize 2D mode with custom camera - void End2dMode(void); // Ends 2D mode custom camera usage - void Begin3dMode(Camera camera); // Initializes 3D mode for drawing (Camera setup) + void ClearBackground(Color color); // Set background color (framebuffer clear color) + void BeginDrawing(void); // Setup canvas (framebuffer) to start drawing + void EndDrawing(void); // End canvas drawing and swap buffers (double buffering) + void Begin2dMode(Camera2D camera); // Initialize 2D mode with custom camera (2D) + void End2dMode(void); // Ends 2D mode with custom camera + void Begin3dMode(Camera camera); // Initializes 3D mode with custom camera (3D) void End3dMode(void); // Ends 3D mode and returns to default 2D orthographic mode void BeginTextureMode(RenderTexture2D target); // Initializes render texture for drawing void EndTextureMode(void); // Ends drawing to render texture - + + // Screen-space-related functions Ray GetMouseRay(Vector2 mousePosition, Camera camera); // Returns a ray trace from mouse position - Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Returns the screen space position from a 3d world space position + Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Returns the screen space position for a 3d world space position Matrix GetCameraMatrix(Camera camera); // Returns camera transform matrix (view matrix) // Timming-related functions void SetTargetFPS(int fps); // Set target FPS (maximum) - float GetFPS(void); // Returns current FPS - float GetFrameTime(void); // Returns time in seconds for one frame + int GetFPS(void); // Returns current FPS + float GetFrameTime(void); // Returns time in seconds for last frame drawn // Color-related functions - Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value int GetHexValue(Color color); // Returns hexadecimal value for a Color + Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value + Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f float *ColorToFloat(Color color); // Converts Color to float array and normalizes float *VectorToFloat(Vector3 vec); // Converts Vector3 to float array float *MatrixToFloat(Matrix mat); // Converts Matrix to float array // Misc. functions + void ShowLogo(void); // Activate raylib logo at startup (can be done with flags) + void SetConfigFlags(char flags); // Setup window configuration flags (view FLAGS) + void TraceLog(int logType, const char *text, ...); // Show trace log messages (INFO, WARNING, ERROR, DEBUG) + void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (saved a .png) int GetRandomValue(int min, int max); // Returns a random value between min and max (both included) - Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0 to 1.0 - void SetConfigFlags(char flags); // Setup some window configuration flags - void ShowLogo(void); // Activates raylib logo at startup (can be done with flags) - // Drag-and-drop files functions - bool IsFileDropped(void); // Check if a file have been dropped into window - char **GetDroppedFiles(int *count); // Retrieve dropped files into window + // Files management functions + bool IsFileExtension(const char *fileName, const char *ext); // Check file extension + const char *GetDirectoryPath(const char *fileName); // Get directory for a given fileName (with path) + const char *GetWorkingDirectory(void); // Get current working directory + bool ChangeDirectory(const char *dir); // Change working directory, returns true if success + bool IsFileDropped(void); // Check if a file has been dropped into window + char **GetDroppedFiles(int *count); // Get dropped files names void ClearDroppedFiles(void); // Clear dropped files paths buffer // Persistent storage management - void StorageSaveValue(int position, int value); // Storage save integer value (to defined position) - int StorageLoadValue(int position); // Storage load integer value (from defined position) + void StorageSaveValue(int position, int value); // Save integer value to storage file (to defined position) + int StorageLoadValue(int position); // Load integer value from storage file (from defined position) // Input-related functions: keyboard bool IsKeyPressed(int key); // Detect if a key has been pressed once diff --git a/docs/cheatsheet/raylib_models.c b/docs/cheatsheet/raylib_models.c index 34f9668e..909d7bee 100644 --- a/docs/cheatsheet/raylib_models.c +++ b/docs/cheatsheet/raylib_models.c @@ -19,20 +19,20 @@ void DrawRay(Ray ray, Color color); // Draw a ray line void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0)) void DrawGizmo(Vector3 position); // Draw simple gizmo - void DrawLight(Light light); // Draw light in 3D world // Model loading/unloading functions - Model LoadModel(const char *fileName); // Load a 3d model (.OBJ) - Model LoadModelEx(Mesh data, bool dynamic); // Load a 3d model (from mesh data) - Model LoadModelFromRES(const char *rresName, int resId); // Load a 3d model from rRES file (raylib Resource) - Model LoadHeightmap(Image heightmap, Vector3 size); // Load a heightmap image as a 3d model - Model LoadCubicmap(Image cubicmap); // Load a map image as a 3d model (cubes based) - void UnloadModel(Model model); // Unload 3d model from memory + Mesh LoadMesh(const char *fileName); // Load mesh from file + Mesh LoadMeshEx(int numVertex, float *vData, float *vtData, float *vnData, Color *cData); // Load mesh from vertex data + Model LoadModel(const char *fileName); // Load model from file + Model LoadModelFromMesh(Mesh data, bool dynamic); // Load model from mesh data + Model LoadHeightmap(Image heightmap, Vector3 size); // Load heightmap model from image data + Model LoadCubicmap(Image cubicmap); // Load cubes-based map model from image data + void UnloadMesh(Mesh *mesh); // Unload mesh from memory (RAM and/or VRAM) + void UnloadModel(Model model); // Unload model from memory (RAM and/or VRAM) // Material loading/unloading functions Material LoadMaterial(const char *fileName); // Load material data (from file) Material LoadDefaultMaterial(void); // Load default material (uses default models shader) - Material LoadStandardMaterial(void); // Load standard material (uses material attributes and lighting shader) void UnloadMaterial(Material material); // Unload material textures from VRAM // Model drawing functions @@ -55,4 +55,7 @@ bool CheckCollisionRaySphereEx(Ray ray, Vector3 spherePosition, float sphereRadius, Vector3 *collisionPoint); // Detect collision between ray and sphere ex. bool CheckCollisionRayBox(Ray ray, Vector3 minBBox, Vector3 maxBBox); // Detect collision between ray and box BoundingBox CalculateBoundingBox(Mesh mesh); // Calculate mesh bounding box limits + RayHitInfo GetCollisionRayMesh(Ray ray, Mesh *mesh); // Get collision info between ray and mesh + RayHitInfo GetCollisionRayTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); // Get collision info between ray and triangle + RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight); // Get collision info between ray and ground plane (Y-normal plane) diff --git a/docs/cheatsheet/raylib_shaders.c b/docs/cheatsheet/raylib_shaders.c index de77ee1a..c321a502 100644 --- a/docs/cheatsheet/raylib_shaders.c +++ b/docs/cheatsheet/raylib_shaders.c @@ -1,9 +1,10 @@ // Shader loading/unloading functions + char *LoadText(const char *fileName); // Load chars array from text file Shader LoadShader(char *vsFileName, char *fsFileName); // Load a custom shader and bind default locations void UnloadShader(Shader shader); // Unload a custom shader from memory + Shader GetDefaultShader(void); // Get default shader - Shader GetStandardShader(void); // Get standard shader Texture2D GetDefaultTexture(void); // Get default texture // Shader access functions @@ -19,16 +20,13 @@ void EndShaderMode(void); // End custom shader drawing (use default shader) void BeginBlendMode(int mode); // Begin blending mode (alpha, additive, multiplied) void EndBlendMode(void); // End blending mode (reset to default: alpha blending) - - // Light creation/destruction functions - Light CreateLight(int type, Vector3 position, Color diffuse); // Create a new light, initialize it and add to pool - void DestroyLight(Light light); // Destroy a light and take it out of the list - + // VR control functions - void InitVrDevice(int vrDevice); // Init VR device - void CloseVrDevice(void); // Close VR device - bool IsVrDeviceReady(void); // Detect if VR device is ready - bool IsVrSimulator(void); // Detect if VR simulator is running + void InitVrSimulator(int vrDevice); // Init VR simulator for selected device + void CloseVrSimulator(void); // Close VR simulator for current device + bool IsVrSimulatorReady(void); // Detect if VR simulator is ready 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 + void BeginVrDrawing(void); // Begin VR simulator stereo rendering + void EndVrDrawing(void); // End VR simulator stereo rendering diff --git a/docs/cheatsheet/raylib_shapes.c b/docs/cheatsheet/raylib_shapes.c index 534efbe3..7bf4eaaa 100644 --- a/docs/cheatsheet/raylib_shapes.c +++ b/docs/cheatsheet/raylib_shapes.c @@ -4,12 +4,15 @@ void DrawPixelV(Vector2 position, Color color); // Draw a pixel (Vector version) void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (Vector version) + void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line defining thickness + void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line using cubic-bezier curves in-out void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); // Draw a gradient-filled circle void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version) void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle + void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters void DrawRectangleGradient(int posX, int posY, int width, int height, Color color1, Color color2); // Draw a gradient-filled rectangle void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version) void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline diff --git a/docs/cheatsheet/raylib_structs.c b/docs/cheatsheet/raylib_structs.c index dd7aa665..96441470 100644 --- a/docs/cheatsheet/raylib_structs.c +++ b/docs/cheatsheet/raylib_structs.c @@ -20,6 +20,7 @@ struct Light; // Light type, defines light properties struct Model; // Basic 3d Model type struct Ray; // Ray type (useful for raycast) + struct RayHitInfo; // Raycast hit information struct Wave; // Wave type, defines audio wave data struct Sound; // Basic Sound source and buffer diff --git a/docs/cheatsheet/raylib_text.c b/docs/cheatsheet/raylib_text.c index 1e231c29..1c164e5b 100644 --- a/docs/cheatsheet/raylib_text.c +++ b/docs/cheatsheet/raylib_text.c @@ -2,14 +2,14 @@ // SpriteFont loading/unloading functions SpriteFont GetDefaultFont(void); // Get the default SpriteFont SpriteFont LoadSpriteFont(const char *fileName); // Load a SpriteFont image into GPU memory - SpriteFont LoadSpriteFontTTF(const char *fileName, int fontSize, int numChars, int *fontChars); // Load a SpriteFont from TTF font with parameters + SpriteFont LoadSpriteFontEx(const char *fileName, int fontSize, int numChars, int *fontChars); // Load a SpriteFont from TTF font with parameters void UnloadSpriteFont(SpriteFont spriteFont); // Unload SpriteFont from GPU memory // Text drawing functions + void DrawFPS(int posX, int posY); // Shows current FPS on top-left corner void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, // Draw text using SpriteFont and additional parameters int fontSize, int spacing, Color tint); - void DrawFPS(int posX, int posY); // Shows current FPS on top-left corner // Text misc. functions int MeasureText(const char *text, int fontSize); // Measure string width for default font diff --git a/docs/cheatsheet/raylib_textures.c b/docs/cheatsheet/raylib_textures.c index df7c3d05..d776c567 100644 --- a/docs/cheatsheet/raylib_textures.c +++ b/docs/cheatsheet/raylib_textures.c @@ -2,11 +2,9 @@ // Image/Texture2D data loading/unloading functions Image LoadImage(const char *fileName); // Load an image into CPU memory (RAM) Image LoadImageEx(Color *pixels, int width, int height); // Load image data from Color array data (RGBA - 32bit) + Image LoadImagePro(void *data, int width, int height, int format); // Load image from raw data with parameters Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image data from RAW file - Image LoadImageFromRES(const char *rresName, int resId); // Load an image from rRES file (raylib Resource) Texture2D LoadTexture(const char *fileName); // Load an image as texture into GPU memory - Texture2D LoadTextureEx(void *data, int width, int height, int textureFormat, int mipmapCount); // Load a texture from raw data into GPU memory - Texture2D LoadTextureFromRES(const char *rresName, int resId); // Load an image as texture from rRES file (raylib Resource) Texture2D LoadTextureFromImage(Image image); // Load a texture from image data RenderTexture2D LoadRenderTexture(int width, int height); // Load a texture to be used for rendering void UnloadImage(Image image); // Unload image from CPU memory (RAM) @@ -19,6 +17,7 @@ // Image manipulation functions void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two) void ImageFormat(Image *image, int newFormat); // Convert image data to desired format + void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering) Image ImageCopy(Image image); // Create an image duplicate (useful for transformations) void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle diff --git a/docs/common/src/libraylib.a b/docs/common/src/libraylib.a deleted file mode 100644 index 1606a411..00000000 Binary files a/docs/common/src/libraylib.a and /dev/null differ diff --git a/docs/index.html b/docs/index.html index 847e4346..b5a73a42 100644 --- a/docs/index.html +++ b/docs/index.html @@ -86,7 +86,7 @@

-

raylib is highly inspired by Borland BGI graphics lib and by XNA framework. Allegro and SDL have also been analyzed for reference.

+

raylib is highly inspired by Borland BGI graphics lib and by XNA framework. Allegro and SDL have also been used as reference.


NOTE for ADVENTURERS: raylib is a programming library to learn videogames programming; no fancy interface, no visual helpers, no auto-debugging... just coding in the most pure spartan-programmers way. Are you ready to learn? Jump to code examples!.


@@ -99,16 +99,16 @@ - Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
- Powerful fonts module with SpriteFonts support (XNA fonts, AngelCode fonts, TTF)
- Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC)
- - Basic 3d support for Geometrics, Models, Heightmaps and Billboards
- - Materials (diffuse, normal, specular) and Lighting (point, directional, spot)
+ - Basic 3d support for Geometrics, Models, Billboards, Heightmaps ann Cubicmaps
+ - Flexible Materials system, supporting by default diffuse, normal and specular maps
- Shaders support, including Model shaders and Postprocessing shaders
- - Powerful math module for Vector and Matrix operations: [raymath]
+ - Powerful math module for Vector, Matrix and Quaternion operations: [raymath]
- Audio loading and playing with streaming support (WAV, OGG, FLAC, XM, MOD)
+ - Multiple platforms support: Windows, Linux, Mac, Android, Raspberry Pi and HTML5
- VR stereo rendering support with configurable HMD device parameters
- - Multiplatform support: Android, Raspberry Pi, HTML5, Oculus Rift CV1
- Custom color palette for fancy visuals on raywhite background
- Minimal external dependencies (GLFW3, OpenGL, OpenAL)
- - Complete binding to Lua, Go and Pascal.
+ - Complete bindings to Lua (raylib-lua) and Go (raylib-go).

raylib architechture @@ -118,7 +118,7 @@

raylib is open-source and free to use. View license.


raylib supporters on patreon -

The following people is supporting raylib project on patreon. Many thanks to all of them for believing in the project and contributing to it.

+

The following people have supported raylib project on patreon. Many thanks to all of them for believing in the project and contributing to it.


- Jarrod - 2drealms (@2drealms)

- Kovay Hatfield

@@ -134,7 +134,7 @@

- James W. Bohnke

- Evan Sirchuk


-

And a very special thanks to Ilya Zarembsky (@wly_cdgr) for his generous contribution. Many thanks Ilya! Hope your students are enjoying raylib! :D

+

And a very special thanks to Ilya Zarembsky (@wly_cdgr) for his generous contribution. Many thanks Ilya!

-- cgit v1.2.3 From 1e2d3d93fe7808f27a4d1ac1d43133f785694019 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 17 May 2017 01:04:50 +0200 Subject: Some more patreons --- docs/index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/index.html b/docs/index.html index bf31d534..d5f824fe 100644 --- a/docs/index.html +++ b/docs/index.html @@ -133,7 +133,9 @@

- Antonio Radovcic

- James W. Bohnke

- Evan Sirchuk

+

- Justin Loudermilk

- Tazd'ij (@tazdij)

+

- James W.Bohnke


And a very special thanks to Ilya Zarembsky (@wly_cdgr) for his generous contribution. Many thanks Ilya!

-- cgit v1.2.3