diff --git a/examples/models/models_ray_picking.c b/examples/models/models_mesh_picking.c similarity index 93% rename from examples/models/models_ray_picking.c rename to examples/models/models_mesh_picking.c index 55914fa20..0b5247ec1 100644 --- a/examples/models/models_ray_picking.c +++ b/examples/models/models_mesh_picking.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [models] example - Ray picking in 3d mode, ground plane, triangle, mesh +* raylib [models] example - Mesh picking in 3d mode, ground plane, triangle, mesh * * This example has been created using raylib 1.7 (www.raylib.com) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) @@ -13,9 +13,7 @@ #include "raylib.h" #include "raymath.h" -#include -#include - +#define FLT_MAX 3.40282347E+38F // Maximum value of a float, defined in int main() { @@ -24,7 +22,7 @@ int main() int screenWidth = 800; int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [models] example - 3d ray picking"); + InitWindow(screenWidth, screenHeight, "raylib [models] example - mesh picking"); // Define the camera to look into our 3d world Camera camera; @@ -33,7 +31,7 @@ int main() camera.up = (Vector3){ 0.0f, 1.6f, 0.0f }; // Camera up vector (rotation towards target) camera.fovy = 45.0f; // Camera field-of-view Y - Ray ray; // Picking line ray + Ray ray; // Picking ray Model tower = LoadModel("resources/tower.obj"); // Load OBJ model Texture2D texture = LoadTexture("resources/tower.png"); // Load model texture @@ -91,7 +89,7 @@ int main() cursorColor = PURPLE; hitObjectName = "Triangle"; - bary = Barycenter(nearestHit.hitPosition, ta, tb, tc); + bary = VectorBarycenter(nearestHit.hitPosition, ta, tb, tc); hitTriangle = true; } else hitTriangle = false; @@ -138,15 +136,15 @@ int main() // If we hit something, draw the cursor at the hit point if (nearestHit.hit) { - DrawCube(nearestHit.hitPosition, 0.5, 0.5, 0.5, cursorColor); - DrawCubeWires(nearestHit.hitPosition, 0.5, 0.5, 0.5, YELLOW); + DrawCube(nearestHit.hitPosition, 0.3, 0.3, 0.3, cursorColor); + DrawCubeWires(nearestHit.hitPosition, 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; - DrawLine3D(nearestHit.hitPosition, normalEnd, YELLOW); + DrawLine3D(nearestHit.hitPosition, normalEnd, RED); } DrawRay(ray, MAROON); diff --git a/examples/models/models_mesh_picking.png b/examples/models/models_mesh_picking.png new file mode 100644 index 000000000..045db585c Binary files /dev/null and b/examples/models/models_mesh_picking.png differ diff --git a/examples/physac/physics_demo.c b/examples/physac/physics_demo.c index b12ac7088..9bf04d50f 100644 --- a/examples/physac/physics_demo.c +++ b/examples/physac/physics_demo.c @@ -2,9 +2,11 @@ * * Physac - Physics demo * -* NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. +* NOTE 1: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. +* NOTE 2: Physac requires static C library linkage to avoid dependency on MinGW DLL (-static -lpthread) +* +* Use the following line to compile: * -* Use the following code to compile (-static -lpthread): * gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread * -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition * @@ -15,7 +17,7 @@ #include "raylib.h" #define PHYSAC_IMPLEMENTATION -#include "../src/physac.h" +#include "physac.h" int main() { @@ -123,3 +125,4 @@ int main() return 0; } + diff --git a/examples/physac/physics_friction.c b/examples/physac/physics_friction.c index db1b5f4c1..25f31d3f6 100644 --- a/examples/physac/physics_friction.c +++ b/examples/physac/physics_friction.c @@ -2,9 +2,11 @@ * * Physac - Physics friction * -* NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. +* NOTE 1: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. +* NOTE 2: Physac requires static C library linkage to avoid dependency on MinGW DLL (-static -lpthread) +* +* Use the following line to compile: * -* Use the following code to compile (-static -lpthread): * gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread * -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition * @@ -15,7 +17,7 @@ #include "raylib.h" #define PHYSAC_IMPLEMENTATION -#include "../src/physac.h" +#include "physac.h" int main() { @@ -132,8 +134,10 @@ int main() // De-Initialization //-------------------------------------------------------------------------------------- ClosePhysics(); // Unitialize physics + CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- return 0; } + diff --git a/examples/physac/physics_movement.c b/examples/physac/physics_movement.c index 3345404d6..f81316ede 100644 --- a/examples/physac/physics_movement.c +++ b/examples/physac/physics_movement.c @@ -2,9 +2,11 @@ * * Physac - Physics movement * -* NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. +* NOTE 1: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. +* NOTE 2: Physac requires static C library linkage to avoid dependency on MinGW DLL (-static -lpthread) +* +* Use the following line to compile: * -* Use the following code to compile (-static -lpthread): * gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread * -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition * @@ -15,9 +17,9 @@ #include "raylib.h" #define PHYSAC_IMPLEMENTATION -#include "../src/physac.h" +#include "physac.h" -#define VELOCITY 0.5f +#define VELOCITY 0.5f int main() { @@ -118,8 +120,10 @@ int main() // De-Initialization //-------------------------------------------------------------------------------------- ClosePhysics(); // Unitialize physics + CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- return 0; } + diff --git a/examples/physac/physics_restitution.c b/examples/physac/physics_restitution.c index 534d125e0..d58ec6e3b 100644 --- a/examples/physac/physics_restitution.c +++ b/examples/physac/physics_restitution.c @@ -2,9 +2,11 @@ * * Physac - Physics restitution * -* NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. +* NOTE 1: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. +* NOTE 2: Physac requires static C library linkage to avoid dependency on MinGW DLL (-static -lpthread) +* +* Use the following line to compile: * -* Use the following code to compile (-static -lpthread): * gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread * -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition * @@ -15,7 +17,7 @@ #include "raylib.h" #define PHYSAC_IMPLEMENTATION -#include "../src/physac.h" +#include "physac.h" int main() { @@ -111,8 +113,10 @@ int main() // De-Initialization //-------------------------------------------------------------------------------------- ClosePhysics(); // Unitialize physics + CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- return 0; } + diff --git a/examples/physac/physics_shatter.c b/examples/physac/physics_shatter.c index fac907148..4e3b0cb6d 100644 --- a/examples/physac/physics_shatter.c +++ b/examples/physac/physics_shatter.c @@ -2,9 +2,11 @@ * * Physac - Body shatter * -* NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. +* NOTE 1: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. +* NOTE 2: Physac requires static C library linkage to avoid dependency on MinGW DLL (-static -lpthread) +* +* Use the following line to compile: * -* Use the following code to compile (-static -lpthread): * gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread * -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition * @@ -15,7 +17,7 @@ #include "raylib.h" #define PHYSAC_IMPLEMENTATION -#include "../src/physac.h" +#include "physac.h" int main() { @@ -103,8 +105,10 @@ int main() // De-Initialization //-------------------------------------------------------------------------------------- ClosePhysics(); // Unitialize physics + CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- return 0; } + diff --git a/examples/text/resources/fonts/alagard.png b/examples/text/resources/fonts/alagard.png new file mode 100644 index 000000000..3ac4bf1cf Binary files /dev/null and b/examples/text/resources/fonts/alagard.png differ diff --git a/examples/text/resources/fonts/alagard.rbmf b/examples/text/resources/fonts/alagard.rbmf deleted file mode 100644 index 8c9b68d3c..000000000 Binary files a/examples/text/resources/fonts/alagard.rbmf and /dev/null differ diff --git a/examples/text/resources/fonts/alpha_beta.png b/examples/text/resources/fonts/alpha_beta.png new file mode 100644 index 000000000..c362bfb18 Binary files /dev/null and b/examples/text/resources/fonts/alpha_beta.png differ diff --git a/examples/text/resources/fonts/alpha_beta.rbmf b/examples/text/resources/fonts/alpha_beta.rbmf deleted file mode 100644 index bdb2e7521..000000000 Binary files a/examples/text/resources/fonts/alpha_beta.rbmf and /dev/null differ diff --git a/examples/text/resources/fonts/jupiter_crash.png b/examples/text/resources/fonts/jupiter_crash.png new file mode 100644 index 000000000..1f5172fbe Binary files /dev/null and b/examples/text/resources/fonts/jupiter_crash.png differ diff --git a/examples/text/resources/fonts/jupiter_crash.rbmf b/examples/text/resources/fonts/jupiter_crash.rbmf deleted file mode 100644 index d797e0d65..000000000 Binary files a/examples/text/resources/fonts/jupiter_crash.rbmf and /dev/null differ diff --git a/examples/text/resources/fonts/mecha.png b/examples/text/resources/fonts/mecha.png new file mode 100644 index 000000000..8022d18c4 Binary files /dev/null and b/examples/text/resources/fonts/mecha.png differ diff --git a/examples/text/resources/fonts/mecha.rbmf b/examples/text/resources/fonts/mecha.rbmf deleted file mode 100644 index 0266a0654..000000000 Binary files a/examples/text/resources/fonts/mecha.rbmf and /dev/null differ diff --git a/examples/text/resources/fonts/pixantiqua.png b/examples/text/resources/fonts/pixantiqua.png new file mode 100644 index 000000000..ce422e7e7 Binary files /dev/null and b/examples/text/resources/fonts/pixantiqua.png differ diff --git a/examples/text/resources/fonts/pixantiqua.rbmf b/examples/text/resources/fonts/pixantiqua.rbmf deleted file mode 100644 index 04ef0e25e..000000000 Binary files a/examples/text/resources/fonts/pixantiqua.rbmf and /dev/null differ diff --git a/examples/text/resources/fonts/pixelplay.png b/examples/text/resources/fonts/pixelplay.png new file mode 100644 index 000000000..bf8f8818f Binary files /dev/null and b/examples/text/resources/fonts/pixelplay.png differ diff --git a/examples/text/resources/fonts/pixelplay.rbmf b/examples/text/resources/fonts/pixelplay.rbmf deleted file mode 100644 index 31d14038d..000000000 Binary files a/examples/text/resources/fonts/pixelplay.rbmf and /dev/null differ diff --git a/examples/text/resources/fonts/romulus.png b/examples/text/resources/fonts/romulus.png new file mode 100644 index 000000000..46ccc3273 Binary files /dev/null and b/examples/text/resources/fonts/romulus.png differ diff --git a/examples/text/resources/fonts/romulus.rbmf b/examples/text/resources/fonts/romulus.rbmf deleted file mode 100644 index be9da01a3..000000000 Binary files a/examples/text/resources/fonts/romulus.rbmf and /dev/null differ diff --git a/examples/text/resources/fonts/setback.png b/examples/text/resources/fonts/setback.png new file mode 100644 index 000000000..086f3e27b Binary files /dev/null and b/examples/text/resources/fonts/setback.png differ diff --git a/examples/text/resources/fonts/setback.rbmf b/examples/text/resources/fonts/setback.rbmf deleted file mode 100644 index 09572215c..000000000 Binary files a/examples/text/resources/fonts/setback.rbmf and /dev/null differ diff --git a/examples/text/resources/fonts/pixantiqua.fnt b/examples/text/resources/pixantiqua.fnt similarity index 100% rename from examples/text/resources/fonts/pixantiqua.fnt rename to examples/text/resources/pixantiqua.fnt diff --git a/examples/text/text_rbmf_fonts.c b/examples/text/text_raylib_fonts.c similarity index 68% rename from examples/text/text_rbmf_fonts.c rename to examples/text/text_raylib_fonts.c index f4778b451..6d8ef2b62 100644 --- a/examples/text/text_rbmf_fonts.c +++ b/examples/text/text_raylib_fonts.c @@ -1,19 +1,21 @@ /******************************************************************************************* * -* raylib [text] example - raylib bitmap font (rbmf) loading and usage +* raylib [text] example - raylib font loading and usage * * NOTE: raylib is distributed with some free to use fonts (even for commercial pourposes!) * To view details and credits for those fonts, check raylib license file * -* This example has been created using raylib 1.3 (www.raylib.com) +* This example has been created using raylib 1.7 (www.raylib.com) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * -* Copyright (c) 2015 Ramon Santamaria (@raysan5) +* Copyright (c) 2017 Ramon Santamaria (@raysan5) * ********************************************************************************************/ #include "raylib.h" +#define MAX_FONTS 8 + int main() { // Initialization @@ -21,21 +23,21 @@ int main() int screenWidth = 800; int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [text] example - rBMF fonts"); + InitWindow(screenWidth, screenHeight, "raylib [text] example - raylib fonts"); // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) - SpriteFont fonts[8]; + SpriteFont fonts[MAX_FONTS]; - fonts[0] = LoadSpriteFont("resources/fonts/alagard.rbmf"); // rBMF font loading - fonts[1] = LoadSpriteFont("resources/fonts/pixelplay.rbmf"); // rBMF font loading - fonts[2] = LoadSpriteFont("resources/fonts/mecha.rbmf"); // rBMF font loading - fonts[3] = LoadSpriteFont("resources/fonts/setback.rbmf"); // rBMF font loading - fonts[4] = LoadSpriteFont("resources/fonts/romulus.rbmf"); // rBMF font loading - fonts[5] = LoadSpriteFont("resources/fonts/pixantiqua.rbmf"); // rBMF font loading - fonts[6] = LoadSpriteFont("resources/fonts/alpha_beta.rbmf"); // rBMF font loading - fonts[7] = LoadSpriteFont("resources/fonts/jupiter_crash.rbmf"); // rBMF font loading + fonts[0] = LoadSpriteFont("resources/fonts/alagard.png"); + fonts[1] = LoadSpriteFont("resources/fonts/pixelplay.png"); + fonts[2] = LoadSpriteFont("resources/fonts/mecha.png"); + fonts[3] = LoadSpriteFont("resources/fonts/setback.png"); + fonts[4] = LoadSpriteFont("resources/fonts/romulus.png"); + fonts[5] = LoadSpriteFont("resources/fonts/pixantiqua.png"); + fonts[6] = LoadSpriteFont("resources/fonts/alpha_beta.png"); + fonts[7] = LoadSpriteFont("resources/fonts/jupiter_crash.png"); - const char *messages[8] = { "ALAGARD FONT designed by Hewett Tsoi", + const char *messages[MAX_FONTS] = { "ALAGARD FONT designed by Hewett Tsoi", "PIXELPLAY FONT designed by Aleksander Shevchuk", "MECHA FONT designed by Captain Falcon", "SETBACK FONT designed by Brian Kent (AEnigma)", @@ -44,17 +46,22 @@ int main() "ALPHA_BETA FONT designed by Brian Kent (AEnigma)", "JUPITER_CRASH FONT designed by Brian Kent (AEnigma)" }; - const int spacings[8] = { 2, 4, 8, 4, 3, 4, 4, 1 }; + const int spacings[MAX_FONTS] = { 2, 4, 8, 4, 3, 4, 4, 1 }; - Vector2 positions[8]; + Vector2 positions[MAX_FONTS]; - for (int i = 0; i < 8; i++) + for (int i = 0; i < MAX_FONTS; i++) { positions[i].x = screenWidth/2 - MeasureTextEx(fonts[i], messages[i], fonts[i].baseSize*2, spacings[i]).x/2; - positions[i].y = 60 + fonts[i].baseSize + 50*i; + positions[i].y = 60 + fonts[i].baseSize + 45*i; } - Color colors[8] = { MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, LIME, GOLD }; + // Small Y position corrections + positions[3].y += 8; + positions[4].y += 2; + positions[7].y -= 8; + + Color colors[MAX_FONTS] = { MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, LIME, GOLD, RED }; //-------------------------------------------------------------------------------------- // Main game loop @@ -74,7 +81,7 @@ int main() DrawText("free fonts included with raylib", 250, 20, 20, DARKGRAY); DrawLine(220, 50, 590, 50, DARKGRAY); - for (int i = 0; i < 8; i++) + for (int i = 0; i < MAX_FONTS; i++) { DrawTextEx(fonts[i], messages[i], positions[i], fonts[i].baseSize*2, spacings[i], colors[i]); } @@ -87,7 +94,7 @@ int main() //-------------------------------------------------------------------------------------- // SpriteFonts unloading - for (int i = 0; i < 8; i++) UnloadSpriteFont(fonts[i]); + for (int i = 0; i < MAX_FONTS; i++) UnloadSpriteFont(fonts[i]); CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- diff --git a/examples/text/text_raylib_fonts.png b/examples/text/text_raylib_fonts.png new file mode 100644 index 000000000..8f428a678 Binary files /dev/null and b/examples/text/text_raylib_fonts.png differ diff --git a/examples/text/text_rbmf_fonts.png b/examples/text/text_rbmf_fonts.png deleted file mode 100644 index c047c5037..000000000 Binary files a/examples/text/text_rbmf_fonts.png and /dev/null differ diff --git a/examples/others/particles_trail_blending.c b/examples/textures/textures_particles_blending.c similarity index 96% rename from examples/others/particles_trail_blending.c rename to examples/textures/textures_particles_blending.c index 0b47c790d..842ac77de 100644 --- a/examples/others/particles_trail_blending.c +++ b/examples/textures/textures_particles_blending.c @@ -1,11 +1,11 @@ /******************************************************************************************* * -* raylib example - particles trail blending +* raylib example - particles blending * -* This example has been created using raylib 1.3 (www.raylib.com) +* This example has been created using raylib 1.7 (www.raylib.com) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * -* Copyright (c) 2015 Ramon Santamaria (@raysan5) +* Copyright (c) 2017 Ramon Santamaria (@raysan5) * ********************************************************************************************/ @@ -30,7 +30,7 @@ int main() int screenWidth = 800; int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [textures] example - particles trail blending"); + InitWindow(screenWidth, screenHeight, "raylib [textures] example - particles blending"); // Particles pool, reuse them! Particle mouseTail[MAX_PARTICLES]; diff --git a/examples/textures/textures_particles_blending.png b/examples/textures/textures_particles_blending.png new file mode 100644 index 000000000..f90a87fd2 Binary files /dev/null and b/examples/textures/textures_particles_blending.png differ