diff options
Diffstat (limited to 'examples/web/shapes/shapes_draw_circle_sector.c')
| -rw-r--r-- | examples/web/shapes/shapes_draw_circle_sector.c | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/examples/web/shapes/shapes_draw_circle_sector.c b/examples/web/shapes/shapes_draw_circle_sector.c deleted file mode 100644 index a6826a8..0000000 --- a/examples/web/shapes/shapes_draw_circle_sector.c +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************************* -* -* raylib [shapes] example - draw circle sector (with gui options) -* -* This example has been created using raylib 2.6 (www.raylib.com) -* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) -* -* Example contributed by Vlad Adrian (@demizdor) and reviewed by Ramon Santamaria (@raysan5) -* -* Copyright (c) 2018-2020 Vlad Adrian (@demizdor) and Ramon Santamaria (@raysan5) -* -********************************************************************************************/ - -#include <raylib.h> - -#define RAYGUI_IMPLEMENTATION -#define RAYGUI_SUPPORT_ICONS -#include "raygui.h" // Required for GUI controls - -#if defined(PLATFORM_WEB) - #include <emscripten/emscripten.h> -#endif - -//---------------------------------------------------------------------------------- -// Global Variables Definition -//---------------------------------------------------------------------------------- -const int screenWidth = 800; -const int screenHeight = 450; - -// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) - -Vector2 center = { 0 }; - -float outerRadius = 180.f; -int startAngle = 0; -int endAngle = 180; -int segments = 0; - -//---------------------------------------------------------------------------------- -// Module Functions Declaration -//---------------------------------------------------------------------------------- -void UpdateDrawFrame(void); // Update and Draw one frame - -//---------------------------------------------------------------------------------- -// Program Main Entry Point -//---------------------------------------------------------------------------------- -int main(void) -{ - // Initialization - //-------------------------------------------------------------------------------------- - const int screenWidth = 800; - const int screenHeight = 450; - - InitWindow(screenWidth, screenHeight, "raylib [shapes] example - draw circle sector"); - - center = (Vector2){ (GetScreenWidth() - 300)/2, GetScreenHeight()/2 }; - -#if defined(PLATFORM_WEB) - emscripten_set_main_loop(UpdateDrawFrame, 60, 1); -#else - SetTargetFPS(60); // Set our game to run at 60 frames-per-second - //-------------------------------------------------------------------------------------- - - // Main game loop - while (!WindowShouldClose()) // Detect window close button or ESC key - { - UpdateDrawFrame(); - } -#endif - - // De-Initialization - //-------------------------------------------------------------------------------------- - CloseWindow(); // Close window and OpenGL context - //-------------------------------------------------------------------------------------- - - return 0; -} - -//---------------------------------------------------------------------------------- -// Module Functions Definition -//---------------------------------------------------------------------------------- -void UpdateDrawFrame(void) -{ - // Update - //---------------------------------------------------------------------------------- - // NOTE: All variables update happens inside GUI control functions - //---------------------------------------------------------------------------------- - - // Draw - //---------------------------------------------------------------------------------- - BeginDrawing(); - - ClearBackground(RAYWHITE); - - DrawLine(500, 0, 500, GetScreenHeight(), Fade(LIGHTGRAY, 0.6f)); - DrawRectangle(500, 0, GetScreenWidth() - 500, GetScreenHeight(), Fade(LIGHTGRAY, 0.3f)); - - DrawCircleSector(center, outerRadius, startAngle, endAngle, segments, Fade(MAROON, 0.3)); - DrawCircleSectorLines(center, outerRadius, startAngle, endAngle, segments, Fade(MAROON, 0.6)); - - // Draw GUI controls - //------------------------------------------------------------------------------ - startAngle = GuiSliderBar((Rectangle){ 600, 40, 120, 20}, "StartAngle", TextFormat("%2i deg.", startAngle), startAngle, 0, 720); - endAngle = GuiSliderBar((Rectangle){ 600, 70, 120, 20}, "EndAngle", TextFormat("%2i deg.", endAngle), endAngle, 0, 720); - - outerRadius = GuiSliderBar((Rectangle){ 600, 140, 120, 20}, "Radius", TextFormat("%2.2f", outerRadius), outerRadius, 0, 200); - segments = GuiSliderBar((Rectangle){ 600, 170, 120, 20}, "Segments", TextFormat("%2i", segments), segments, 0, 20); - //------------------------------------------------------------------------------ - - DrawText(TextFormat("MODE: %s", (segments >= 4)? "MANUAL" : "AUTO"), 600, 200, 10, (segments >= 4)? MAROON : DARKGRAY); - - DrawFPS(10, 10); - - EndDrawing(); - //---------------------------------------------------------------------------------- -} |
