diff --git a/examples/Makefile b/examples/Makefile index 12d798b50680..834007c269d0 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -330,25 +330,26 @@ endif ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW)) # -Os # size optimization # -O2 # optimization level 2, if used, also set --memory-init-file 0 - # -sUSE_GLFW=3 # Use glfw3 library (context/input management) - # -sALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL! - # -sTOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB) - # -sUSE_PTHREADS=1 # multithreading support - # -sWASM=0 # disable Web Assembly, emitted by default - # -sASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS - # -sFORCE_FILESYSTEM=1 # force filesystem to load/save files data - # -sASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off) - # -sGL_ENABLE_GET_PROC_ADDRESS # enable using the *glGetProcAddress() family of functions, required for extensions loading + # -sUSE_GLFW=3 # Use glfw3 library (context/input management) + # -sALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL! + # -sTOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB) + # -sUSE_PTHREADS=1 # multithreading support + # -sWASM=0 # disable Web Assembly, emitted by default + # -sASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS + # -sFORCE_FILESYSTEM=1 # force filesystem to load/save files data + # -sASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off) + # -sMINIFY_HTML=0 # minify generated html from shell.html # --profiling # include information for code profiling # --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # --preload-file resources # specify a resources folder for data compilation # --source-map-base # allow debugging in browser with source map - + # --shell-file shell.html # define a custom shell .html and output extension + LDFLAGS += -sTOTAL_MEMORY=$(BUILD_WEB_HEAP_SIZE) -sFORCE_FILESYSTEM=1 -sMINIFY_HTML=0 + + # Using GLFW3 library (instead of RGFW) ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) LDFLAGS += -sUSE_GLFW=3 endif - - LDFLAGS += -sTOTAL_MEMORY=$(BUILD_WEB_HEAP_SIZE) -sFORCE_FILESYSTEM=1 # Build using asyncify ifeq ($(BUILD_WEB_ASYNCIFY),TRUE) @@ -512,7 +513,6 @@ CORE = \ core/core_custom_logging \ core/core_drop_files \ core/core_input_gamepad \ - core/core_input_gamepad_info \ core/core_input_gestures \ core/core_input_gestures_web \ core/core_input_keys \ @@ -547,10 +547,11 @@ SHAPES = \ shapes/shapes_lines_bezier \ shapes/shapes_logo_raylib \ shapes/shapes_logo_raylib_anim \ + shapes/shapes_rectangle_advanced \ shapes/shapes_rectangle_scaling \ shapes/shapes_splines_drawing \ - shapes/shapes_top_down_lights \ - shapes/shapes_rectangle_advanced + shapes/shapes_top_down_lights + TEXTURES = \ textures/textures_background_scrolling \ @@ -603,6 +604,7 @@ MODELS = \ models/models_draw_cube_texture \ models/models_first_person_maze \ models/models_geometric_shapes \ + models/models_gpu_skinning \ models/models_heightmap \ models/models_loading \ models/models_loading_gltf \ @@ -614,9 +616,9 @@ MODELS = \ models/models_point_rendering \ models/models_rlgl_solar_system \ models/models_skybox \ + models/models_tesseract_view \ models/models_waving_cubes \ - models/models_yaw_pitch_roll \ - models/models_gpu_skinning + models/models_yaw_pitch_roll SHADERS = \ shaders/shaders_basic_lighting \ diff --git a/examples/Makefile.Web b/examples/Makefile.Web index 90345f97d802..3757e4a3d9e6 100644 --- a/examples/Makefile.Web +++ b/examples/Makefile.Web @@ -266,26 +266,27 @@ endif ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW)) # -Os # size optimization # -O2 # optimization level 2, if used, also set --memory-init-file 0 - # -sUSE_GLFW=3 # Use glfw3 library (context/input management) - # -sALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL! - # -sTOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB) - # -sUSE_PTHREADS=1 # multithreading support - # -sWASM=0 # disable Web Assembly, emitted by default - # -sASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS - # -sFORCE_FILESYSTEM=1 # force filesystem to load/save files data - # -sASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off) - # -sGL_ENABLE_GET_PROC_ADDRESS # enable using the *glGetProcAddress() family of functions, required for extensions loading + # -sUSE_GLFW=3 # Use glfw3 library (context/input management) + # -sALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL! + # -sTOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB) + # -sUSE_PTHREADS=1 # multithreading support + # -sWASM=0 # disable Web Assembly, emitted by default + # -sASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS + # -sFORCE_FILESYSTEM=1 # force filesystem to load/save files data + # -sASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off) + # -sMINIFY_HTML=0 # minify generated html from shell.html # --profiling # include information for code profiling # --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # --preload-file resources # specify a resources folder for data compilation # --source-map-base # allow debugging in browser with source map - + # --shell-file shell.html # define a custom shell .html and output extension + LDFLAGS += -sTOTAL_MEMORY=$(BUILD_WEB_HEAP_SIZE) -sFORCE_FILESYSTEM=1 -sEXPORTED_RUNTIME_METHODS=ccall -sMINIFY_HTML=0 + + # Using GLFW3 library (instead of RGFW) ifeq ($(PLATFORM),PLATFORM_WEB) LDFLAGS += -sUSE_GLFW=3 endif - LDFLAGS += -sEXPORTED_RUNTIME_METHODS=ccall - # Build using asyncify ifeq ($(BUILD_WEB_ASYNCIFY),TRUE) LDFLAGS += -sASYNCIFY @@ -393,7 +394,6 @@ CORE = \ core/core_custom_logging \ core/core_drop_files \ core/core_input_gamepad \ - core/core_input_gamepad_info \ core/core_input_gestures \ core/core_input_gestures_web \ core/core_input_keys \ @@ -428,10 +428,10 @@ SHAPES = \ shapes/shapes_lines_bezier \ shapes/shapes_logo_raylib \ shapes/shapes_logo_raylib_anim \ + shapes/shapes_rectangle_advanced \ shapes/shapes_rectangle_scaling \ shapes/shapes_splines_drawing \ - shapes/shapes_top_down_lights \ - shapes/shapes_rectangle_advanced + shapes/shapes_top_down_lights TEXTURES = \ textures/textures_background_scrolling \ @@ -477,7 +477,6 @@ TEXT = \ MODELS = \ models/models_animation \ - models/models_gpu_skinning \ models/models_billboard \ models/models_bone_socket \ models/models_box_collisions \ @@ -485,6 +484,7 @@ MODELS = \ models/models_draw_cube_texture \ models/models_first_person_maze \ models/models_geometric_shapes \ + models/models_gpu_skinning \ models/models_heightmap \ models/models_loading \ models/models_loading_gltf \ @@ -496,6 +496,7 @@ MODELS = \ models/models_point_rendering \ models/models_rlgl_solar_system \ models/models_skybox \ + models/models_tesseract_view \ models/models_waving_cubes \ models/models_yaw_pitch_roll @@ -524,8 +525,8 @@ SHADERS = \ shaders/shaders_texture_outline \ shaders/shaders_texture_tiling \ shaders/shaders_texture_waves \ - shaders/shaders_write_depth \ - shaders/shaders_vertex_displacement + shaders/shaders_vertex_displacement \ + shaders/shaders_write_depth AUDIO = \ audio/audio_mixed_processor \ @@ -613,9 +614,6 @@ core/core_input_gamepad: core/core_input_gamepad.c --preload-file core/resources/ps3.png@resources/ps3.png \ --preload-file core/resources/xbox.png@resources/xbox.png -core/core_input_gamepad_info: core/core_input_gamepad_info.c - $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) - core/core_input_gestures: core/core_input_gestures.c $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) @@ -637,7 +635,7 @@ core/core_input_multitouch: core/core_input_multitouch.c core/core_input_virtual_controls: core/core_input_virtual_controls.c $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -# NOTE: To use multi-threading raylib must be compiled with multi-theading support (-s USE_PTHREADS=1) +# NOTE: To use multi-threading raylib must be compiled with multi-theading support (-sUSE_PTHREADS=1) # WARNING: For security reasons multi-threading is not supported on browsers, it requires cross-origin isolation (Oct.2021) # WARNING: It requires raylib to be compiled using -pthread, so atomic operations and thread-local data (if any) # in its source were transformed to non-atomic operations and non-thread-local data @@ -998,6 +996,9 @@ models/models_skybox: models/models_skybox.c --preload-file models/resources/shaders/glsl100/cubemap.vs@resources/shaders/glsl100/cubemap.vs \ --preload-file models/resources/shaders/glsl100/cubemap.fs@resources/shaders/glsl100/cubemap.fs +models/models_tesseract_view: models/models_tesseract_view.c + $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) + models/models_waving_cubes: models/models_waving_cubes.c $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) diff --git a/examples/core/core_2d_camera_mouse_zoom.png b/examples/core/core_2d_camera_mouse_zoom.png index b920d5c7bd47..1c8ab1f2dd75 100644 Binary files a/examples/core/core_2d_camera_mouse_zoom.png and b/examples/core/core_2d_camera_mouse_zoom.png differ diff --git a/examples/core/core_basic_screen_manager.c b/examples/core/core_basic_screen_manager.c index 728ef1257f13..df38a06231d0 100644 --- a/examples/core/core_basic_screen_manager.c +++ b/examples/core/core_basic_screen_manager.c @@ -46,7 +46,7 @@ int main(void) { // Update //---------------------------------------------------------------------------------- - switch(currentScreen) + switch (currentScreen) { case LOGO: { diff --git a/examples/core/core_input_gamepad_info.c b/examples/core/core_input_gamepad_info.c deleted file mode 100644 index 0962946810ee..000000000000 --- a/examples/core/core_input_gamepad_info.c +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************************* -* -* raylib [core] example - Gamepad information -* -* NOTE: This example requires a Gamepad connected to the system -* Check raylib.h for buttons configuration -* -* Example originally created with raylib 4.6, last time updated with raylib 4.6 -* -* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, -* BSD-like license that allows static linking with closed source software -* -* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5) -* -********************************************************************************************/ - -#include "raylib.h" - -//------------------------------------------------------------------------------------ -// Program main entry point -//------------------------------------------------------------------------------------ -int main(void) -{ - // Initialization - //-------------------------------------------------------------------------------------- - const int screenWidth = 800; - const int screenHeight = 450; - - SetConfigFlags(FLAG_MSAA_4X_HINT); // Set MSAA 4X hint before windows creation - - InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad information"); - - SetTargetFPS(60); // Set our game to run at 60 frames-per-second - //-------------------------------------------------------------------------------------- - - // Main game loop - while (!WindowShouldClose()) // Detect window close button or ESC key - { - // Update - //---------------------------------------------------------------------------------- - // TODO: Update your variables here - //---------------------------------------------------------------------------------- - - // Draw - //---------------------------------------------------------------------------------- - BeginDrawing(); - - ClearBackground(RAYWHITE); - - for (int i = 0, y = 5; i < 4; i++) // MAX_GAMEPADS = 4 - { - if (IsGamepadAvailable(i)) - { - DrawText(TextFormat("Gamepad name: %s", GetGamepadName(i)), 10, y, 10, BLACK); - y += 11; - DrawText(TextFormat("\tAxis count: %d", GetGamepadAxisCount(i)), 10, y, 10, BLACK); - y += 11; - - for (int axis = 0; axis < GetGamepadAxisCount(i); axis++) - { - DrawText(TextFormat("\tAxis %d = %f", axis, GetGamepadAxisMovement(i, axis)), 10, y, 10, BLACK); - y += 11; - } - - for (int button = 0; button < 32; button++) - { - DrawText(TextFormat("\tButton %d = %d", button, IsGamepadButtonDown(i, button)), 10, y, 10, BLACK); - y += 11; - } - } - } - - DrawFPS(GetScreenWidth() - 100, 100); - - EndDrawing(); - //---------------------------------------------------------------------------------- - } - - // De-Initialization - //-------------------------------------------------------------------------------------- - CloseWindow(); // Close window and OpenGL context - //-------------------------------------------------------------------------------------- -} diff --git a/examples/core/core_input_multitouch.c b/examples/core/core_input_multitouch.c index 73b363576bcf..093b6f386514 100644 --- a/examples/core/core_input_multitouch.c +++ b/examples/core/core_input_multitouch.c @@ -42,7 +42,7 @@ int main(void) // Get the touch point count ( how many fingers are touching the screen ) int tCount = GetTouchPointCount(); // Clamp touch points available ( set the maximum touch points allowed ) - if(tCount > MAX_TOUCH_POINTS) tCount = MAX_TOUCH_POINTS; + if (tCount > MAX_TOUCH_POINTS) tCount = MAX_TOUCH_POINTS; // Get touch points positions for (int i = 0; i < tCount; ++i) touchPositions[i] = GetTouchPosition(i); //---------------------------------------------------------------------------------- diff --git a/examples/core/core_input_virtual_controls.c b/examples/core/core_input_virtual_controls.c index 76eeafee48a5..799c927c006d 100644 --- a/examples/core/core_input_virtual_controls.c +++ b/examples/core/core_input_virtual_controls.c @@ -115,26 +115,10 @@ int main(void) // Move player according to pressed button switch (pressedButton) { - case BUTTON_UP: - { - playerPosition.y -= playerSpeed*GetFrameTime(); - break; - } - case BUTTON_LEFT: - { - playerPosition.x -= playerSpeed*GetFrameTime(); - break; - } - case BUTTON_RIGHT: - { - playerPosition.x += playerSpeed*GetFrameTime(); - break; - } - case BUTTON_DOWN: - { - playerPosition.y += playerSpeed*GetFrameTime(); - break; - } + case BUTTON_UP: playerPosition.y -= playerSpeed*GetFrameTime(); break; + case BUTTON_LEFT: playerPosition.x -= playerSpeed*GetFrameTime(); break; + case BUTTON_RIGHT: playerPosition.x += playerSpeed*GetFrameTime(); break; + case BUTTON_DOWN: playerPosition.y += playerSpeed*GetFrameTime(); break; default: break; }; diff --git a/examples/core/core_random_sequence.c b/examples/core/core_random_sequence.c index 2f7c3be95832..2cb067db4dee 100644 --- a/examples/core/core_random_sequence.c +++ b/examples/core/core_random_sequence.c @@ -18,159 +18,168 @@ #include // Required for: malloc() and free() -typedef struct ColorRect{ - Color c; - Rectangle r; +typedef struct ColorRect { + Color c; + Rectangle r; } ColorRect; +//------------------------------------------------------------------------------------ +// Module functions declaration +//------------------------------------------------------------------------------------ static Color GenerateRandomColor(); -static ColorRect* GenerateRandomColorRectSequence(float rectCount, float rectWidth, float screenWidth, float screenHeight); -static void ShuffleColorRectSequence(ColorRect* rectangles, int rectCount); -static void DrawTextCenterKeyHelp(const char* key, const char* text, int posX, int posY, int fontSize, Color color); +static ColorRect *GenerateRandomColorRectSequence(float rectCount, float rectWidth, float screenWidth, float screenHeight); +static void ShuffleColorRectSequence(ColorRect *rectangles, int rectCount); +static void DrawTextCenterKeyHelp(const char *key, const char *text, int posX, int posY, int fontSize, Color color); //------------------------------------------------------------------------------------ // Program main entry point //------------------------------------------------------------------------------------ -int main(void) { - // Initialization - //-------------------------------------------------------------------------------------- - const int screenWidth = 800; - const int screenHeight = 450; - - InitWindow(screenWidth, screenHeight, "raylib [core] example - Generates a random sequence"); - - int rectCount = 20; - float rectSize = (float)screenWidth/rectCount; - ColorRect* rectangles = GenerateRandomColorRectSequence((float)rectCount, rectSize, (float)screenWidth, 0.75f * screenHeight); - - SetTargetFPS(60); - //-------------------------------------------------------------------------------------- - - // Main game loop - while (!WindowShouldClose()) // Detect window close button or ESC key - { - // Update - //---------------------------------------------------------------------------------- - - if(IsKeyPressed(KEY_SPACE)) - { - ShuffleColorRectSequence(rectangles, rectCount); - } +int main(void) +{ + // Initialization + //-------------------------------------------------------------------------------------- + const int screenWidth = 800; + const int screenHeight = 450; - if(IsKeyPressed(KEY_UP)) - { - rectCount++; - rectSize = (float)screenWidth/rectCount; - free(rectangles); - rectangles = GenerateRandomColorRectSequence((float)rectCount, rectSize, (float)screenWidth, 0.75f * screenHeight); - } + InitWindow(screenWidth, screenHeight, "raylib [core] example - Generates a random sequence"); - if(IsKeyPressed(KEY_DOWN)) - { - if(rectCount >= 4){ - rectCount--; - rectSize = (float)screenWidth/rectCount; - free(rectangles); - rectangles = GenerateRandomColorRectSequence((float)rectCount, rectSize, (float)screenWidth, 0.75f * screenHeight); - } - } + int rectCount = 20; + float rectSize = (float)screenWidth/rectCount; + ColorRect *rectangles = GenerateRandomColorRectSequence((float)rectCount, rectSize, (float)screenWidth, 0.75f*screenHeight); - // Draw - //---------------------------------------------------------------------------------- - BeginDrawing(); + SetTargetFPS(60); + //-------------------------------------------------------------------------------------- - ClearBackground(RAYWHITE); - - int fontSize = 20; - for(int x=0;x= 4) + { + rectCount--; + rectSize = (float)screenWidth/rectCount; + free(rectangles); + rectangles = GenerateRandomColorRectSequence((float)rectCount, rectSize, (float)screenWidth, 0.75f*screenHeight); + } + } + //---------------------------------------------------------------------------------- + + // Draw + //---------------------------------------------------------------------------------- + BeginDrawing(); + + ClearBackground(RAYWHITE); + + int fontSize = 20; + for (int i = 0; i < rectCount; i++) + { + DrawRectangleRec(rectangles[i].r, rectangles[i].c); + DrawTextCenterKeyHelp("SPACE", "to shuffle the sequence.", 10, screenHeight - 96, fontSize, BLACK); + DrawTextCenterKeyHelp("UP", "to add a rectangle and generate a new sequence.", 10, screenHeight - 64, fontSize, BLACK); + DrawTextCenterKeyHelp("DOWN", "to remove a rectangle and generate a new sequence.", 10, screenHeight - 32, fontSize, BLACK); + } + + const char *rectCountText = TextFormat("%d rectangles", rectCount); + int rectCountTextSize = MeasureText(rectCountText, fontSize); + DrawText(rectCountText, screenWidth - rectCountTextSize - 10, 10, fontSize, BLACK); + + DrawFPS(10, 10); + + EndDrawing(); + //---------------------------------------------------------------------------------- } - const char* rectCountText = TextFormat("%d rectangles", rectCount); - int rectCountTextSize = MeasureText(rectCountText, fontSize); - DrawText(rectCountText, screenWidth - rectCountTextSize - 10, 10, fontSize, BLACK); - - DrawFPS(10, 10); - - EndDrawing(); - //---------------------------------------------------------------------------------- - } + // De-Initialization + //-------------------------------------------------------------------------------------- + free(rectangles); + CloseWindow(); // Close window and OpenGL context + //-------------------------------------------------------------------------------------- - // De-Initialization - //-------------------------------------------------------------------------------------- - - free(rectangles); - CloseWindow(); // Close window and OpenGL context - //-------------------------------------------------------------------------------------- - - return 0; + return 0; } +//------------------------------------------------------------------------------------ +// Module functions definition +//------------------------------------------------------------------------------------ static Color GenerateRandomColor() { - return CLITERAL(Color){ - GetRandomValue(0, 255), - GetRandomValue(0, 255), - GetRandomValue(0, 255), - 255, - }; -} + Color color = { + GetRandomValue(0, 255), + GetRandomValue(0, 255), + GetRandomValue(0, 255), + 255 + }; -static ColorRect* GenerateRandomColorRectSequence(float rectCount, float rectWidth, float screenWidth, float screenHeight){ - int *seq = LoadRandomSequence((unsigned int)rectCount, 0, (unsigned int)rectCount-1); - ColorRect* rectangles = (ColorRect *)malloc((int)rectCount*sizeof(ColorRect)); + return color; +} - float rectSeqWidth = rectCount * rectWidth; - float startX = (screenWidth - rectSeqWidth) * 0.5f; +static ColorRect *GenerateRandomColorRectSequence(float rectCount, float rectWidth, float screenWidth, float screenHeight) +{ + ColorRect *rectangles = (ColorRect *)malloc((int)rectCount*sizeof(ColorRect)); + int *seq = LoadRandomSequence((unsigned int)rectCount, 0, (unsigned int)rectCount - 1); + float rectSeqWidth = rectCount*rectWidth; + float startX = (screenWidth - rectSeqWidth)*0.5f; - for(int x=0;xc = r2->c; - r1->r.height = r2->r.height; - r1->r.y = r2->r.y; - r2->c = tmp.c; - r2->r.height = tmp.r.height; - r2->r.y = tmp.r.y; - - } - UnloadRandomSequence(seq); + int *seq = LoadRandomSequence(rectCount, 0, rectCount - 1); + + for (int i1 = 0; i1 < rectCount; i1++) + { + ColorRect *r1 = &rectangles[i1]; + ColorRect *r2 = &rectangles[seq[i1]]; + + // Swap only the color and height + ColorRect tmp = *r1; + r1->c = r2->c; + r1->r.height = r2->r.height; + r1->r.y = r2->r.y; + r2->c = tmp.c; + r2->r.height = tmp.r.height; + r2->r.y = tmp.r.y; + } + + UnloadRandomSequence(seq); } -static void DrawTextCenterKeyHelp(const char* key, const char* text, int posX, int posY, int fontSize, Color color) +static void DrawTextCenterKeyHelp(const char *key, const char *text, int posX, int posY, int fontSize, Color color) { - int spaceSize = MeasureText(" ", fontSize); - int pressSize = MeasureText("Press", fontSize); - int keySize = MeasureText(key, fontSize); - int textSize = MeasureText(text, fontSize); - int totalSize = pressSize + 2 * spaceSize + keySize + 2 * spaceSize + textSize; - int textSizeCurrent = 0; - - DrawText("Press", posX, posY, fontSize, color); - textSizeCurrent += pressSize + 2 * spaceSize; - DrawText(key, posX + textSizeCurrent, posY, fontSize, RED); - DrawRectangle(posX + textSizeCurrent, posY + fontSize, keySize, 3, RED); - textSizeCurrent += keySize + 2 * spaceSize; - DrawText(text, posX + textSizeCurrent, posY, fontSize, color); + int spaceSize = MeasureText(" ", fontSize); + int pressSize = MeasureText("Press", fontSize); + int keySize = MeasureText(key, fontSize); + int textSize = MeasureText(text, fontSize); + int textSizeCurrent = 0; + + DrawText("Press", posX, posY, fontSize, color); + textSizeCurrent += pressSize + 2*spaceSize; + DrawText(key, posX + textSizeCurrent, posY, fontSize, RED); + DrawRectangle(posX + textSizeCurrent, posY + fontSize, keySize, 3, RED); + textSizeCurrent += keySize + 2*spaceSize; + DrawText(text, posX + textSizeCurrent, posY, fontSize, color); } \ No newline at end of file diff --git a/examples/models/models_gpu_skinning.png b/examples/models/models_gpu_skinning.png new file mode 100644 index 000000000000..8003c16effa5 Binary files /dev/null and b/examples/models/models_gpu_skinning.png differ diff --git a/examples/models/models_mesh_generation.c b/examples/models/models_mesh_generation.c index 59aebe7c9051..03dc2b067b99 100644 --- a/examples/models/models_mesh_generation.c +++ b/examples/models/models_mesh_generation.c @@ -112,7 +112,7 @@ int main(void) DrawRectangleLines(30, 400, 310, 30, Fade(DARKBLUE, 0.5f)); DrawText("MOUSE LEFT BUTTON to CYCLE PROCEDURAL MODELS", 40, 410, 10, BLUE); - switch(currentModel) + switch (currentModel) { case 0: DrawText("PLANE", 680, 10, 20, DARKBLUE); break; case 1: DrawText("CUBE", 680, 10, 20, DARKBLUE); break; diff --git a/examples/models/models_point_rendering.c b/examples/models/models_point_rendering.c index 68d498453e41..d33cbdda80d0 100644 --- a/examples/models/models_point_rendering.c +++ b/examples/models/models_point_rendering.c @@ -22,7 +22,7 @@ #define MIN_POINTS 1000 // 1 thousand // Generate mesh using points -Mesh GenMeshPoints(int numPoints); +static Mesh GenMeshPoints(int numPoints); //------------------------------------------------------------------------------------ // Program main entry point @@ -56,7 +56,7 @@ int main() //-------------------------------------------------------------------------------------- // Main game loop - while(!WindowShouldClose()) + while (!WindowShouldClose()) { // Update //---------------------------------------------------------------------------------- @@ -147,7 +147,7 @@ int main() } // Generate a spherical point cloud -Mesh GenMeshPoints(int numPoints) +static Mesh GenMeshPoints(int numPoints) { Mesh mesh = { .triangleCount = 1, @@ -159,9 +159,9 @@ Mesh GenMeshPoints(int numPoints) // https://en.wikipedia.org/wiki/Spherical_coordinate_system for (int i = 0; i < numPoints; i++) { - float theta = PI*rand()/RAND_MAX; - float phi = 2.0f*PI*rand()/RAND_MAX; - float r = 10.0f*rand()/RAND_MAX; + float theta = ((float)PI*rand())/RAND_MAX; + float phi = (2.0f*PI*rand())/RAND_MAX; + float r = (10.0f*rand())/RAND_MAX; mesh.vertices[i*3 + 0] = r*sin(theta)*cos(phi); mesh.vertices[i*3 + 1] = r*sin(theta)*sin(phi); diff --git a/examples/models/models_tesseract_view.c b/examples/models/models_tesseract_view.c new file mode 100644 index 000000000000..495e9af9c976 --- /dev/null +++ b/examples/models/models_tesseract_view.c @@ -0,0 +1,124 @@ +/******************************************************************************************* +* +* raylib [models] example - Tesseract view +* +* NOTE: This example only works on platforms that support drag & drop (Windows, Linux, OSX, Html5?) +* +* Example originally created with raylib 5.6-dev, last time updated with raylib 5.6-dev +* +* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, +* BSD-like license that allows static linking with closed source software +* +* Copyright (c) 2024-2025 raylib contributor (?) & Ramon Santamaria (@raysan5) +* +********************************************************************************************/ + +#include "raylib.h" + +#include "raymath.h" + +//------------------------------------------------------------------------------------ +// Program main entry point +//------------------------------------------------------------------------------------ +int main(void) +{ + // Initialization + //-------------------------------------------------------------------------------------- + const int screenWidth = 800; + const int screenHeight = 450; + + InitWindow(screenWidth, screenHeight, "raylib [models] example - tesseract view"); + + // Define the camera to look into our 3d world + Camera camera = { 0 }; + camera.position = (Vector3){ 4.0f, 4.0f, 4.0f }; // Camera position + camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point + camera.up = (Vector3){ 0.0f, 0.0f, 1.0f }; // Camera up vector (rotation towards target) + camera.fovy = 50.0f; // Camera field-of-view Y + camera.projection = CAMERA_PERSPECTIVE; // Camera mode type + + // Find the coordinates by setting XYZW to +-1 + Vector4 tesseract[16] = { + { 1, 1, 1, 1 }, { 1, 1, 1, -1 }, + { 1, 1, -1, 1 }, { 1, 1, -1, -1 }, + { 1, -1, 1, 1 }, { 1, -1, 1, -1 }, + { 1, -1, -1, 1 }, { 1, -1, -1, -1 }, + { -1, 1, 1, 1 }, { -1, 1, 1, -1 }, + { -1, 1, -1, 1 }, { -1, 1, -1, -1 }, + { -1, -1, 1, 1 }, { -1, -1, 1, -1 }, + { -1, -1, -1, 1 }, { -1, -1, -1, -1 }, + }; + + float rotation = 0.0f; + Vector3 transformed[16] = { 0 }; + float wValues[16] = { 0 }; + + SetTargetFPS(60); // Set our game to run at 60 frames-per-second + //-------------------------------------------------------------------------------------- + + // Main game loop + while (!WindowShouldClose()) // Detect window close button or ESC key + { + // Update + //---------------------------------------------------------------------------------- + rotation = DEG2RAD*45.0f*GetTime(); + + for (int i = 0; i < 16; i++) + { + Vector4 p = tesseract[i]; + + // Rotate the XW part of the vector + Vector2 rotXW = Vector2Rotate((Vector2){ p.x, p.w }, rotation); + p.x = rotXW.x; + p.w = rotXW.y; + + // Projection from XYZW to XYZ from perspective point (0, 0, 0, 3) + // NOTE: Trace a ray from (0, 0, 0, 3) > p and continue until W = 0 + float c = 3.0f/(3.0f - p.w); + p.x = c * p.x; + p.y = c * p.y; + p.z = c * p.z; + + // Split XYZ coordinate and W values later for drawing + transformed[i] = (Vector3){ p.x, p.y, p.z }; + wValues[i] = p.w; + } + //---------------------------------------------------------------------------------- + + // Draw + //---------------------------------------------------------------------------------- + BeginDrawing(); + + ClearBackground(RAYWHITE); + + BeginMode3D(camera); + for (int i = 0; i < 16; i++) + { + // Draw spheres to indicate the W value + DrawSphere(transformed[i], fabsf(wValues[i]*0.1f), RED); + + for (int j = 0; j < 16; j++) + { + // Two lines are connected if they differ by 1 coordinate + // This way we dont have to keep an edge list + Vector4 v1 = tesseract[i]; + Vector4 v2 = tesseract[j]; + int diff = (int)(v1.x == v2.x) + (int)(v1.y == v2.y) + (int)(v1.z == v2.z) + (int)(v1.w == v2.w); + + // Draw only differing by 1 coordinate and the lower index only (duplicate lines) + if (diff == 3 && i < j) DrawLine3D(transformed[i], transformed[j], MAROON); + } + } + EndMode3D(); + + EndDrawing(); + //---------------------------------------------------------------------------------- + } + + // De-Initialization + //-------------------------------------------------------------------------------------- + CloseWindow(); // Close window and OpenGL context + //-------------------------------------------------------------------------------------- + + return 0; +} \ No newline at end of file diff --git a/examples/models/models_tesseract_view.png b/examples/models/models_tesseract_view.png new file mode 100644 index 000000000000..664e560b2487 Binary files /dev/null and b/examples/models/models_tesseract_view.png differ diff --git a/examples/others/raymath_vector_angle.c b/examples/others/raymath_vector_angle.c index d0f81548ce23..5a69345b4fa9 100644 --- a/examples/others/raymath_vector_angle.c +++ b/examples/others/raymath_vector_angle.c @@ -51,7 +51,7 @@ int main(void) if (IsKeyPressed(KEY_SPACE)) angleMode = !angleMode; - if(angleMode == 0 && IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) v1 = GetMousePosition(); + if ((angleMode == 0) && IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) v1 = GetMousePosition(); if (angleMode == 0) { diff --git a/examples/shaders/resources/shaders/glsl100/depth.fs b/examples/shaders/resources/shaders/glsl100/depth.fs index 780992784755..001cca087be5 100644 --- a/examples/shaders/resources/shaders/glsl100/depth.fs +++ b/examples/shaders/resources/shaders/glsl100/depth.fs @@ -22,5 +22,5 @@ void main() float depth = (2.0*zNear)/(zFar + zNear - z*(zFar - zNear)); // Calculate final fragment color - gl_FragColor = vec4(depth, depth, depth, 1.0f); + gl_FragColor = vec4(depth, depth, depth, 1.0); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl100/julia_set.fs b/examples/shaders/resources/shaders/glsl100/julia_set.fs index 82d0a75abec7..9ee8c6f4da45 100644 --- a/examples/shaders/resources/shaders/glsl100/julia_set.fs +++ b/examples/shaders/resources/shaders/glsl100/julia_set.fs @@ -13,23 +13,20 @@ uniform float zoom; // Zoom of the scale. // NOTE: Maximum number of shader for-loop iterations depend on GPU, // for example, on RasperryPi for this examply only supports up to 60 const int maxIterations = 48; // Max iterations to do. -const float colorCycles = 1.0f; // Number of times the color palette repeats. +const float colorCycles = 1.0; // Number of times the color palette repeats. // Square a complex number vec2 ComplexSquare(vec2 z) { - return vec2( - z.x*z.x - z.y*z.y, - z.x*z.y*2.0f - ); + return vec2(z.x*z.x - z.y*z.y, z.x*z.y*2.0); } // Convert Hue Saturation Value (HSV) color into RGB vec3 Hsv2rgb(vec3 c) { - vec4 K = vec4(1.0f, 2.0f/3.0f, 1.0f/3.0f, 3.0f); - vec3 p = abs(fract(c.xxx + K.xyz)*6.0f - K.www); - return c.z*mix(K.xxx, clamp(p - K.xxx, 0.0f, 1.0f), c.y); + vec4 K = vec4(1.0, 2.0/3.0, 1.0/3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz)*6.0 - K.www); + return c.z*mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } void main() @@ -55,7 +52,7 @@ void main() // The pixel coordinates are scaled so they are on the mandelbrot scale // NOTE: fragTexCoord already comes as normalized screen coordinates but offset must be normalized before scaling and zoom - vec2 z = vec2((fragTexCoord.x - 0.5f)*2.5f, (fragTexCoord.y - 0.5f)*1.5f)/zoom; + vec2 z = vec2((fragTexCoord.x - 0.5)*2.5, (fragTexCoord.y - 0.5)*1.5)/zoom; z.x += offset.x; z.y += offset.y; @@ -63,7 +60,7 @@ void main() for (int iterations = 0; iterations < 60; iterations++) { z = ComplexSquare(z) + c; // Iterate function - if (dot(z, z) > 4.0f) break; + if (dot(z, z) > 4.0) break; iter = iterations; } @@ -74,12 +71,12 @@ void main() z = ComplexSquare(z) + c; // This last part smooths the color (again see link above). - float smoothVal = float(iter) + 1.0f - (log(log(length(z)))/log(2.0f)); + float smoothVal = float(iter) + 1.0 - (log(log(length(z)))/log(2.0)); // Normalize the value so it is between 0 and 1. float norm = smoothVal/float(maxIterations); // If in set, color black. 0.999 allows for some float accuracy error. - if (norm > 0.999f) gl_FragColor = vec4(0.0f, 0.0f, 0.0f, 1.0f); - else gl_FragColor = vec4(Hsv2rgb(vec3(norm*colorCycles, 1.0f, 1.0f)), 1.0f); + if (norm > 0.999) gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); + else gl_FragColor = vec4(Hsv2rgb(vec3(norm*colorCycles, 1.0, 1.0)), 1.0); } diff --git a/examples/shaders/resources/shaders/glsl100/tiling.fs b/examples/shaders/resources/shaders/glsl100/tiling.fs index 392786a83baa..0a3f07e3ab56 100644 --- a/examples/shaders/resources/shaders/glsl100/tiling.fs +++ b/examples/shaders/resources/shaders/glsl100/tiling.fs @@ -7,15 +7,15 @@ varying vec2 fragTexCoord; varying vec4 fragColor; // Input uniform values -uniform sampler2D diffuseMap; -uniform vec4 tiling; +uniform sampler2D texture0; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables +uniform vec2 tiling; void main() { vec2 texCoord = fragTexCoord*tiling; - fragColor = texture2D(diffuseMap, texCoord); - - gl_FragColor = fragColor; + + gl_FragColor = texture2D(texture0, texCoord)*colDiffuse; } diff --git a/examples/shaders/resources/shaders/glsl120/shadowmap.fs b/examples/shaders/resources/shaders/glsl120/shadowmap.fs index f43e63823c52..84f31859199f 100644 --- a/examples/shaders/resources/shaders/glsl120/shadowmap.fs +++ b/examples/shaders/resources/shaders/glsl120/shadowmap.fs @@ -46,34 +46,34 @@ void main() vec4 finalColor = (texelColor*((colDiffuse + vec4(specular, 1.0))*vec4(lightDot, 1.0))); // Shadow calculations - vec4 fragPosLightSpace = lightVP * vec4(fragPosition, 1); + vec4 fragPosLightSpace = lightVP*vec4(fragPosition, 1); fragPosLightSpace.xyz /= fragPosLightSpace.w; // Perform the perspective division - fragPosLightSpace.xyz = (fragPosLightSpace.xyz + 1.0f) / 2.0f; // Transform from [-1, 1] range to [0, 1] range + fragPosLightSpace.xyz = (fragPosLightSpace.xyz + 1.0)/2.0; // Transform from [-1, 1] range to [0, 1] range vec2 sampleCoords = fragPosLightSpace.xy; float curDepth = fragPosLightSpace.z; + // Slope-scale depth bias: depth biasing reduces "shadow acne" artifacts, where dark stripes appear all over the scene. // The solution is adding a small bias to the depth // In this case, the bias is proportional to the slope of the surface, relative to the light - float bias = max(0.0008 * (1.0 - dot(normal, l)), 0.00008); + float bias = max(0.0008*(1.0 - dot(normal, l)), 0.00008); int shadowCounter = 0; const int numSamples = 9; + // PCF (percentage-closer filtering) algorithm: // Instead of testing if just one point is closer to the current point, // we test the surrounding points as well. // This blurs shadow edges, hiding aliasing artifacts. - vec2 texelSize = vec2(1.0f / float(shadowMapResolution)); + vec2 texelSize = vec2(1.0/float(shadowMapResolution)); for (int x = -1; x <= 1; x++) { for (int y = -1; y <= 1; y++) { - float sampleDepth = texture2D(shadowMap, sampleCoords + texelSize * vec2(x, y)).r; - if (curDepth - bias > sampleDepth) - { - shadowCounter++; - } + float sampleDepth = texture2D(shadowMap, sampleCoords + texelSize*vec2(x, y)).r; + if (curDepth - bias > sampleDepth) shadowCounter++; } } - finalColor = mix(finalColor, vec4(0, 0, 0, 1), float(shadowCounter) / float(numSamples)); + + finalColor = mix(finalColor, vec4(0, 0, 0, 1), float(shadowCounter)/float(numSamples)); // Add ambient lighting whether in shadow or not finalColor += texelColor*(ambient/10.0)*colDiffuse; diff --git a/examples/shaders/resources/shaders/glsl330/depth.fs b/examples/shaders/resources/shaders/glsl330/depth.fs index f7546bbb8edf..5c4a3de990ef 100644 --- a/examples/shaders/resources/shaders/glsl330/depth.fs +++ b/examples/shaders/resources/shaders/glsl330/depth.fs @@ -23,5 +23,5 @@ void main() float depth = (2.0*zNear)/(zFar + zNear - z*(zFar - zNear)); // Calculate final fragment color - finalColor = vec4(depth, depth, depth, 1.0f); + finalColor = vec4(depth, depth, depth, 1.0); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl330/julia_set.fs b/examples/shaders/resources/shaders/glsl330/julia_set.fs index 7a6f069c8bed..3a8e25deb536 100644 --- a/examples/shaders/resources/shaders/glsl330/julia_set.fs +++ b/examples/shaders/resources/shaders/glsl330/julia_set.fs @@ -12,23 +12,20 @@ uniform vec2 offset; // Offset of the scale. uniform float zoom; // Zoom of the scale. const int maxIterations = 255; // Max iterations to do. -const float colorCycles = 2.0f; // Number of times the color palette repeats. Can show higher detail for higher iteration numbers. +const float colorCycles = 2.0; // Number of times the color palette repeats. Can show higher detail for higher iteration numbers. // Square a complex number vec2 ComplexSquare(vec2 z) { - return vec2( - z.x*z.x - z.y*z.y, - z.x*z.y*2.0f - ); + return vec2(z.x*z.x - z.y*z.y, z.x*z.y*2.0); } // Convert Hue Saturation Value (HSV) color into RGB vec3 Hsv2rgb(vec3 c) { - vec4 K = vec4(1.0f, 2.0f/3.0f, 1.0f/3.0f, 3.0f); - vec3 p = abs(fract(c.xxx + K.xyz)*6.0f - K.www); - return c.z*mix(K.xxx, clamp(p - K.xxx, 0.0f, 1.0f), c.y); + vec4 K = vec4(1.0, 2.0/3.0, 1.0/3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz)*6.0 - K.www); + return c.z*mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } void main() @@ -54,7 +51,7 @@ void main() // The pixel coordinates are scaled so they are on the mandelbrot scale // NOTE: fragTexCoord already comes as normalized screen coordinates but offset must be normalized before scaling and zoom - vec2 z = vec2((fragTexCoord.x - 0.5f)*2.5f, (fragTexCoord.y - 0.5f)*1.5f)/zoom; + vec2 z = vec2((fragTexCoord.x - 0.5f)*2.5, (fragTexCoord.y - 0.5)*1.5)/zoom; z.x += offset.x; z.y += offset.y; @@ -63,7 +60,7 @@ void main() { z = ComplexSquare(z) + c; // Iterate function - if (dot(z, z) > 4.0f) break; + if (dot(z, z) > 4.0) break; } // Another few iterations decreases errors in the smoothing calculation. @@ -72,12 +69,12 @@ void main() z = ComplexSquare(z) + c; // This last part smooths the color (again see link above). - float smoothVal = float(iterations) + 1.0f - (log(log(length(z)))/log(2.0f)); + float smoothVal = float(iterations) + 1.0 - (log(log(length(z)))/log(2.0)); // Normalize the value so it is between 0 and 1. float norm = smoothVal/float(maxIterations); // If in set, color black. 0.999 allows for some float accuracy error. - if (norm > 0.999f) finalColor = vec4(0.0f, 0.0f, 0.0f, 1.0f); - else finalColor = vec4(Hsv2rgb(vec3(norm*colorCycles, 1.0f, 1.0f)), 1.0f); + if (norm > 0.999) finalColor = vec4(0.0, 0.0, 0.0, 1.0); + else finalColor = vec4(Hsv2rgb(vec3(norm*colorCycles, 1.0, 1.0)), 1.0); } diff --git a/examples/shaders/resources/shaders/glsl330/shadowmap.fs b/examples/shaders/resources/shaders/glsl330/shadowmap.fs index 506b51a8b677..d535de2bc565 100644 --- a/examples/shaders/resources/shaders/glsl330/shadowmap.fs +++ b/examples/shaders/resources/shaders/glsl330/shadowmap.fs @@ -51,32 +51,31 @@ void main() // Shadow calculations vec4 fragPosLightSpace = lightVP * vec4(fragPosition, 1); fragPosLightSpace.xyz /= fragPosLightSpace.w; // Perform the perspective division - fragPosLightSpace.xyz = (fragPosLightSpace.xyz + 1.0f) / 2.0f; // Transform from [-1, 1] range to [0, 1] range + fragPosLightSpace.xyz = (fragPosLightSpace.xyz + 1.0)/2.0; // Transform from [-1, 1] range to [0, 1] range vec2 sampleCoords = fragPosLightSpace.xy; float curDepth = fragPosLightSpace.z; + // Slope-scale depth bias: depth biasing reduces "shadow acne" artifacts, where dark stripes appear all over the scene. // The solution is adding a small bias to the depth // In this case, the bias is proportional to the slope of the surface, relative to the light - float bias = max(0.0002 * (1.0 - dot(normal, l)), 0.00002) + 0.00001; + float bias = max(0.0002*(1.0 - dot(normal, l)), 0.00002) + 0.00001; int shadowCounter = 0; const int numSamples = 9; + // PCF (percentage-closer filtering) algorithm: // Instead of testing if just one point is closer to the current point, // we test the surrounding points as well. // This blurs shadow edges, hiding aliasing artifacts. - vec2 texelSize = vec2(1.0f / float(shadowMapResolution)); + vec2 texelSize = vec2(1.0/float(shadowMapResolution)); for (int x = -1; x <= 1; x++) { for (int y = -1; y <= 1; y++) { - float sampleDepth = texture(shadowMap, sampleCoords + texelSize * vec2(x, y)).r; - if (curDepth - bias > sampleDepth) - { - shadowCounter++; - } + float sampleDepth = texture(shadowMap, sampleCoords + texelSize*vec2(x, y)).r; + if (curDepth - bias > sampleDepth) shadowCounter++; } } - finalColor = mix(finalColor, vec4(0, 0, 0, 1), float(shadowCounter) / float(numSamples)); + finalColor = mix(finalColor, vec4(0, 0, 0, 1), float(shadowCounter)/float(numSamples)); // Add ambient lighting whether in shadow or not finalColor += texelColor*(ambient/10.0)*colDiffuse; diff --git a/examples/shaders/resources/shaders/glsl330/tiling.fs b/examples/shaders/resources/shaders/glsl330/tiling.fs index 6e7f5243475f..86f054a8a5d2 100644 --- a/examples/shaders/resources/shaders/glsl330/tiling.fs +++ b/examples/shaders/resources/shaders/glsl330/tiling.fs @@ -1,14 +1,20 @@ #version 330 core -uniform sampler2D diffuseMap; -uniform vec2 tiling; - +// Input vertex attributes (from vertex shader) in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; -out vec4 fragColor; +uniform vec2 tiling; + +out vec4 finalColor; void main() { - vec2 texCoord = fragTexCoord * tiling; - fragColor = texture(diffuseMap, texCoord); + vec2 texCoord = fragTexCoord*tiling; + + finalColor = texture(texture0, texCoord)*colDiffuse; } diff --git a/examples/shaders/shaders_deferred_render.c b/examples/shaders/shaders_deferred_render.c index e5c549e5aea6..e03ad6009d42 100644 --- a/examples/shaders/shaders_deferred_render.c +++ b/examples/shaders/shaders_deferred_render.c @@ -273,7 +273,7 @@ int main(void) // that represent light positions in default forward rendering BeginMode3D(camera); rlEnableShader(rlGetShaderIdDefault()); - for(int i = 0; i < MAX_LIGHTS; i++) + for (int i = 0; i < MAX_LIGHTS; i++) { if (lights[i].enabled) DrawSphereEx(lights[i].position, 0.2f, 8, 8, lights[i].color); else DrawSphereWires(lights[i].position, 0.2f, 8, 8, ColorAlpha(lights[i].color, 0.3f)); diff --git a/examples/shapes/shapes_rectangle_advanced.c b/examples/shapes/shapes_rectangle_advanced.c index e885a10ee05a..6dd7d2e7e8df 100644 --- a/examples/shapes/shapes_rectangle_advanced.c +++ b/examples/shapes/shapes_rectangle_advanced.c @@ -1,10 +1,87 @@ +/******************************************************************************************* +* +* raylib [shapes] example - Rectangle advanced +* +* Example originally created with raylib 5.5, last time updated with raylib 5.5 +* +* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, +* BSD-like license that allows static linking with closed source software +* +* Copyright (c) 2024-2025 raylib contributors and Ramon Santamaria (@raysan5) +* +********************************************************************************************/ + #include "raylib.h" + #include "rlgl.h" + #include // Draw rectangle with rounded edges and horizontal gradient, with options to choose side of roundness -// Adapted from both `DrawRectangleRounded` and `DrawRectangleGradientH` -void DrawRectangleRoundedGradientH(Rectangle rec, float roundnessLeft, float roundnessRight, int segments, Color left, Color right) +static void DrawRectangleRoundedGradientH(Rectangle rec, float roundnessLeft, float roundnessRight, int segments, Color left, Color right); + +//------------------------------------------------------------------------------------ +// Program main entry point +//------------------------------------------------------------------------------------ +int main(void) +{ + // Initialization + //-------------------------------------------------------------------------------------- + const int screenWidth = 800; + const int screenHeight = 450; + + InitWindow(screenWidth, screenHeight, "raylib [shapes] example - rectangle avanced"); + + SetTargetFPS(60); // Set our game to run at 60 frames-per-second + //-------------------------------------------------------------------------------------- + + // Main game loop + while (!WindowShouldClose()) // Detect window close button or ESC key + { + // Update rectangle bounds + //---------------------------------------------------------------------------------- + float width = GetScreenWidth()/2.0f, height = GetScreenHeight()/6.0f; + Rectangle rec = { + GetScreenWidth() / 2.0f - width/2, + GetScreenHeight() / 2.0f - 5*(height/2), + width, height + }; + //-------------------------------------------------------------------------------------- + + // Draw + //---------------------------------------------------------------------------------- + BeginDrawing(); + ClearBackground(RAYWHITE); + + // Draw All Rectangles with different roundess for each side and different gradients + DrawRectangleRoundedGradientH(rec, 0.8f, 0.8f, 36, BLUE, RED); + + rec.y += rec.height + 1; + DrawRectangleRoundedGradientH(rec, 0.5f, 1.0f, 36, RED, PINK); + + rec.y += rec.height + 1; + DrawRectangleRoundedGradientH(rec, 1.0f, 0.5f, 36, RED, BLUE); + + rec.y += rec.height + 1; + DrawRectangleRoundedGradientH(rec, 0.0f, 1.0f, 36, BLUE, BLACK); + + rec.y += rec.height + 1; + DrawRectangleRoundedGradientH(rec, 1.0f, 0.0f, 36, BLUE, PINK); + EndDrawing(); + //-------------------------------------------------------------------------------------- + } + + // De-Initialization + //-------------------------------------------------------------------------------------- + CloseWindow(); // Close window and OpenGL context + //-------------------------------------------------------------------------------------- + + return 0; +} + +// Draw rectangle with rounded edges and horizontal gradient, with options to choose side of roundness +// NOTE: Adapted from both 'DrawRectangleRounded()' and 'DrawRectangleGradientH()' raylib [rshapes] implementations +static void DrawRectangleRoundedGradientH(Rectangle rec, float roundnessLeft, float roundnessRight, int segments, Color left, Color right) { // Neither side is rounded if ((roundnessLeft <= 0.0f && roundnessRight <= 0.0f) || (rec.width < 1) || (rec.height < 1 )) @@ -29,7 +106,7 @@ void DrawRectangleRoundedGradientH(Rectangle rec, float roundnessLeft, float rou float stepLength = 90.0f/(float)segments; /* - Diagram Copied here for reference, original at `DrawRectangleRounded` source code + Diagram Copied here for reference, original at 'DrawRectangleRounded()' source code P0____________________P1 /| |\ @@ -113,12 +190,9 @@ void DrawRectangleRoundedGradientH(Rectangle rec, float roundnessLeft, float rou } } - // - // Here we use the `Diagram` to guide ourselves to which point receives what color. - // + // Here we use the 'Diagram' to guide ourselves to which point receives what color // By choosing the color correctly associated with a pointe the gradient effect - // will naturally come from OpenGL interpolation. - // + // will naturally come from OpenGL interpolation // [2] Upper Rectangle rlColor4ub(left.r, left.g, left.b, left.a); @@ -187,27 +261,25 @@ void DrawRectangleRoundedGradientH(Rectangle rec, float roundnessLeft, float rou rlSetTexture(0); #else - // - // Here we use the `Diagram` to guide ourselves to which point receives what color. - // + // Here we use the 'Diagram' to guide ourselves to which point receives what color. // By choosing the color correctly associated with a pointe the gradient effect // will naturally come from OpenGL interpolation. // But this time instead of Quad, we think in triangles. - // rlBegin(RL_TRIANGLES); - // Draw all of the 4 corners: [1] Upper Left Corner, [3] Upper Right Corner, [5] Lower Right Corner, [7] Lower Left Corner for (int k = 0; k < 4; ++k) { - Color color; - float radius; + Color color = { 0 }; + float radius = 0.0f; if (k == 0) color = left, radius = radiusLeft; // [1] Upper Left Corner if (k == 1) color = right, radius = radiusRight; // [3] Upper Right Corner if (k == 2) color = right, radius = radiusRight; // [5] Lower Right Corner if (k == 3) color = left, radius = radiusLeft; // [7] Lower Left Corner + float angle = angles[k]; const Vector2 center = centers[k]; + for (int i = 0; i < segments; i++) { rlColor4ub(color.r, color.g, color.b, color.a); @@ -274,57 +346,3 @@ void DrawRectangleRoundedGradientH(Rectangle rec, float roundnessLeft, float rou rlEnd(); #endif } - -int main(int argc, char *argv[]) -{ - // Initialization - //-------------------------------------------------------------------------------------- - const int screenWidth = 800; - const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [shapes] example - rectangle avanced"); - SetTargetFPS(60); - //-------------------------------------------------------------------------------------- - - // Main game loop - while (!WindowShouldClose()) // Detect window close button or ESC key - { - // Update rectangle bounds - //---------------------------------------------------------------------------------- - float width = GetScreenWidth()/2.0f, height = GetScreenHeight()/6.0f; - Rectangle rec = { - GetScreenWidth() / 2.0f - width/2, - GetScreenHeight() / 2.0f - (5)*(height/2), - width, height - }; - //-------------------------------------------------------------------------------------- - - // Draw - //---------------------------------------------------------------------------------- - BeginDrawing(); - ClearBackground(RAYWHITE); - - // Draw All Rectangles with different roundess for each side and different gradients - DrawRectangleRoundedGradientH(rec, 0.8f, 0.8f, 36, BLUE, RED); - - rec.y += rec.height + 1; - DrawRectangleRoundedGradientH(rec, 0.5f, 1.0f, 36, RED, PINK); - - rec.y += rec.height + 1; - DrawRectangleRoundedGradientH(rec, 1.0f, 0.5f, 36, RED, BLUE); - - rec.y += rec.height + 1; - DrawRectangleRoundedGradientH(rec, 0.0f, 1.0f, 36, BLUE, BLACK); - - rec.y += rec.height + 1; - DrawRectangleRoundedGradientH(rec, 1.0f, 0.0f, 36, BLUE, PINK); - EndDrawing(); - //-------------------------------------------------------------------------------------- - } - - // De-Initialization - //-------------------------------------------------------------------------------------- - CloseWindow(); // Close window and OpenGL context - //-------------------------------------------------------------------------------------- - return 0; -} - diff --git a/examples/textures/textures_image_channel.c b/examples/textures/textures_image_channel.c index 39618c5f4698..9afcda6385c2 100644 --- a/examples/textures/textures_image_channel.c +++ b/examples/textures/textures_image_channel.c @@ -24,7 +24,6 @@ int main(void) { // Initialization //-------------------------------------------------------------------------------------- - const int screenWidth = 800; const int screenHeight = 450; @@ -60,8 +59,6 @@ int main(void) UnloadImage(imageBlue); UnloadImage(backgroundImage); - SetTargetFPS(60); // Set our game to run at 60 frames-per-second - Rectangle fudesumiRec = {0, 0, fudesumiImage.width, fudesumiImage.height}; Rectangle fudesumiPos = {50, 10, fudesumiImage.width*0.8f, fudesumiImage.height*0.8f}; @@ -70,11 +67,17 @@ int main(void) Rectangle bluePos = { 410, 230, fudesumiPos.width / 2, fudesumiPos.height / 2 }; Rectangle alphaPos = { 600, 230, fudesumiPos.width / 2, fudesumiPos.height / 2 }; + SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key { + // Draw + //---------------------------------------------------------------------------------- + // TODO... + //---------------------------------------------------------------------------------- + // Draw //---------------------------------------------------------------------------------- BeginDrawing(); diff --git a/examples/textures/textures_image_generation.c b/examples/textures/textures_image_generation.c index 97e43f007b47..47f9a9eb0fe9 100644 --- a/examples/textures/textures_image_generation.c +++ b/examples/textures/textures_image_generation.c @@ -88,7 +88,7 @@ int main(void) DrawRectangleLines(30, 400, 325, 30, Fade(WHITE, 0.5f)); DrawText("MOUSE LEFT BUTTON to CYCLE PROCEDURAL TEXTURES", 40, 410, 10, WHITE); - switch(currentTexture) + switch (currentTexture) { case 0: DrawText("VERTICAL GRADIENT", 560, 10, 20, RAYWHITE); break; case 1: DrawText("HORIZONTAL GRADIENT", 540, 10, 20, RAYWHITE); break; diff --git a/projects/4coder/Makefile b/projects/4coder/Makefile index 641731291a43..1b598eed5f20 100644 --- a/projects/4coder/Makefile +++ b/projects/4coder/Makefile @@ -219,21 +219,23 @@ endif ifeq ($(PLATFORM),PLATFORM_WEB) # -Os # size optimization # -O2 # optimization level 2, if used, also set --memory-init-file 0 - # -s USE_GLFW=3 # Use glfw3 library (context/input management) - # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL! - # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) - # -s USE_PTHREADS=1 # multithreading support - # -s WASM=0 # disable Web Assembly, emitted by default - # -s EMTERPRETIFY=1 # enable emscripten code interpreter (very slow) - # -s EMTERPRETIFY_ASYNC=1 # support synchronous loops by emterpreter - # -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data - # -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off) + # -sUSE_GLFW=3 # Use glfw3 library (context/input management) + # -sALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL! + # -sTOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB) + # -sUSE_PTHREADS=1 # multithreading support + # -sWASM=0 # disable Web Assembly, emitted by default + # -sASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS + # -sFORCE_FILESYSTEM=1 # force filesystem to load/save files data + # -sASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off) + # -sMINIFY_HTML=0 # minify generated html from shell.html # --profiling # include information for code profiling # --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # --preload-file resources # specify a resources folder for data compilation - CFLAGS += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=16777216 --preload-file resources + # --source-map-base # allow debugging in browser with source map + # --shell-file shell.html # define a custom shell .html and output extension + CFLAGS += -Os -sUSE_GLFW=3 -sTOTAL_MEMORY=16777216 --preload-file resources -sMINIFY_HTML=0 ifeq ($(BUILD_MODE), DEBUG) - CFLAGS += -s ASSERTIONS=1 --profiling + CFLAGS += -sASSERTIONS=1 --profiling endif # Define a custom shell .html and output extension diff --git a/projects/VS2022/examples/core_input_gamepad_info.vcxproj b/projects/VS2022/examples/core_input_gamepad_info.vcxproj deleted file mode 100644 index 7227ef2f45fa..000000000000 --- a/projects/VS2022/examples/core_input_gamepad_info.vcxproj +++ /dev/null @@ -1,390 +0,0 @@ - - - - - Debug.DLL - Win32 - - - Debug.DLL - x64 - - - Debug - Win32 - - - Debug - x64 - - - Release.DLL - Win32 - - - Release.DLL - x64 - - - Release - Win32 - - - Release - x64 - - - - {27AA7BDA-0C34-4733-9009-73D3E64234FB} - Win32Proj - core_input_gamepad_info - 10.0 - core_input_gamepad_info - - - - Application - true - $(DefaultPlatformToolset) - Unicode - - - Application - true - $(DefaultPlatformToolset) - Unicode - - - Application - true - $(DefaultPlatformToolset) - Unicode - - - Application - true - $(DefaultPlatformToolset) - Unicode - - - Application - false - $(DefaultPlatformToolset) - true - Unicode - - - Application - false - $(DefaultPlatformToolset) - true - Unicode - - - Application - false - $(DefaultPlatformToolset) - true - Unicode - - - Application - false - $(DefaultPlatformToolset) - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ - $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ - - - true - $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ - $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ - - - true - $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ - $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ - - - true - $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ - $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ - - - false - $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ - $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ - - - false - $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ - $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ - - - false - $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ - $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ - - - false - $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ - $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ - - - $(SolutionDir)..\..\examples\core - WindowsLocalDebugger - - - $(SolutionDir)..\..\examples\core - WindowsLocalDebugger - - - $(SolutionDir)..\..\examples\core - WindowsLocalDebugger - - - $(SolutionDir)..\..\examples\core - WindowsLocalDebugger - - - $(SolutionDir)..\..\examples\core - WindowsLocalDebugger - - - $(SolutionDir)..\..\examples\core - WindowsLocalDebugger - - - $(SolutionDir)..\..\examples\core - WindowsLocalDebugger - - - $(SolutionDir)..\..\examples\core - WindowsLocalDebugger - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) - CompileAsC - $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) - - - Console - true - $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ - raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) - CompileAsC - $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - - - Console - true - $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ - raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) - CompileAsC - $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) - - - Console - true - $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ - raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)" - Copy Debug DLL to output directory - - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) - CompileAsC - $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) - - - Console - true - $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ - raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)" - Copy Debug DLL to output directory - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP - $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) - CompileAsC - true - - - Console - true - true - true - raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP - $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) - CompileAsC - true - - - Console - true - true - true - raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP - $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) - CompileAsC - true - - - Console - true - true - true - raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ - - - xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)" - - - Copy Release DLL to output directory - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP - $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) - CompileAsC - true - - - Console - true - true - true - raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ - - - xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)" - - - Copy Release DLL to output directory - - - - - - - - - - - {e89d61ac-55de-4482-afd4-df7242ebc859} - - - - - - \ No newline at end of file diff --git a/projects/VS2022/raylib.sln b/projects/VS2022/raylib.sln index feb0f2c3559d..f4f0600e193f 100644 --- a/projects/VS2022/raylib.sln +++ b/projects/VS2022/raylib.sln @@ -279,8 +279,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_automation_events", "e EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "audio_mixed_processor", "examples\audio_mixed_processor.vcxproj", "{A4B0D971-3CD6-41C9-8AB2-055D25A33373}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_input_gamepad_info", "examples\core_input_gamepad_info.vcxproj", "{27AA7BDA-0C34-4733-9009-73D3E64234FB}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_input_mouse_wheel", "examples\core_input_mouse_wheel.vcxproj", "{15CDD310-6980-42A6-8082-3A6B7730D13F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_smooth_pixelperfect", "examples\core_smooth_pixelperfect.vcxproj", "{71DB4284-5B1C-4E86-9AF5-B91542D44A6F}" diff --git a/projects/VSCode/Makefile b/projects/VSCode/Makefile index 72b850d9b705..389a12cf972a 100644 --- a/projects/VSCode/Makefile +++ b/projects/VSCode/Makefile @@ -225,21 +225,23 @@ endif ifeq ($(PLATFORM),PLATFORM_WEB) # -Os # size optimization # -O2 # optimization level 2, if used, also set --memory-init-file 0 - # -s USE_GLFW=3 # Use glfw3 library (context/input management) - # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL! - # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) - # -s USE_PTHREADS=1 # multithreading support - # -s WASM=0 # disable Web Assembly, emitted by default - # -s EMTERPRETIFY=1 # enable emscripten code interpreter (very slow) - # -s EMTERPRETIFY_ASYNC=1 # support synchronous loops by emterpreter - # -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data - # -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off) + # -sUSE_GLFW=3 # Use glfw3 library (context/input management) + # -sALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL! + # -sTOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB) + # -sUSE_PTHREADS=1 # multithreading support + # -sWASM=0 # disable Web Assembly, emitted by default + # -sASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS + # -sFORCE_FILESYSTEM=1 # force filesystem to load/save files data + # -sASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off) + # -sMINIFY_HTML=0 # minify generated html from shell.html # --profiling # include information for code profiling # --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # --preload-file resources # specify a resources folder for data compilation - CFLAGS += -Os -s USE_GLFW=3 -s TOTAL_MEMORY=16777216 --preload-file resources + # --source-map-base # allow debugging in browser with source map + # --shell-file shell.html # define a custom shell .html and output extension + CFLAGS += -Os -sUSE_GLFW=3 -sTOTAL_MEMORY=16777216 --preload-file resources -sMINIFY_HTML=0 ifeq ($(BUILD_MODE), DEBUG) - CFLAGS += -s ASSERTIONS=1 --profiling + CFLAGS += -sASSERTIONS=1 --profiling endif # Define a custom shell .html and output extension diff --git a/src/Makefile b/src/Makefile index 37554b2a0a93..a626db52ed82 100644 --- a/src/Makefile +++ b/src/Makefile @@ -369,20 +369,23 @@ endif ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW)) # -Os # size optimization # -O2 # optimization level 2, if used, also set --memory-init-file 0 - # -sUSE_GLFW=3 # Use glfw3 library (context/input management) -> Only for linker! - # -sALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL! - # -sTOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) - # -sUSE_PTHREADS=1 # multithreading support - # -sFORCE_FILESYSTEM=1 # force filesystem to load/save files data - # -sASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off) - # -sGL_ENABLE_GET_PROC_ADDRESS # enable using the *glGetProcAddress() family of functions, required for extensions loading + # -sUSE_GLFW=3 # Use glfw3 library (context/input management) + # -sALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL! + # -sTOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB) + # -sUSE_PTHREADS=1 # multithreading support + # -sWASM=0 # disable Web Assembly, emitted by default + # -sASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS + # -sFORCE_FILESYSTEM=1 # force filesystem to load/save files data + # -sASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off) + # -sMINIFY_HTML=0 # minify generated html from shell.html # --profiling # include information for code profiling # --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # --preload-file resources # specify a resources folder for data compilation + # --source-map-base # allow debugging in browser with source map + # --shell-file shell.html # define a custom shell .html and output extension ifeq ($(RAYLIB_BUILD_MODE),DEBUG) CFLAGS += -sASSERTIONS=1 --profiling endif - #CFLAGS += -sGL_ENABLE_GET_PROC_ADDRESS endif ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) # Compiler flags for arquitecture diff --git a/src/minshell.html b/src/minshell.html index 4068ca36c750..ec71588419e3 100644 --- a/src/minshell.html +++ b/src/minshell.html @@ -34,12 +34,8 @@