You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
4.0 KiB

  1. /*******************************************************************************************
  2. *
  3. * raylib [shapes] example - Draw raylib custom color palette
  4. *
  5. * This example has been created using raylib 1.0 (www.raylib.com)
  6. * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
  7. *
  8. * Copyright (c) 2014 Ramon Santamaria (@raysan5)
  9. *
  10. ********************************************************************************************/
  11. #include "raylib.h"
  12. int main()
  13. {
  14. // Initialization
  15. //--------------------------------------------------------------------------------------
  16. int screenWidth = 800;
  17. int screenHeight = 450;
  18. InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib color palette");
  19. //--------------------------------------------------------------------------------------
  20. // Main game loop
  21. while (!WindowShouldClose()) // Detect window close button or ESC key
  22. {
  23. // Update
  24. //----------------------------------------------------------------------------------
  25. // TODO: Update your variables here
  26. //----------------------------------------------------------------------------------
  27. // Draw
  28. //----------------------------------------------------------------------------------
  29. BeginDrawing();
  30. ClearBackground(RAYWHITE);
  31. DrawText("raylib color palette", 28, 42, 20, BLACK);
  32. DrawRectangle(26, 80, 100, 100, DARKGRAY);
  33. DrawRectangle(26, 188, 100, 100, GRAY);
  34. DrawRectangle(26, 296, 100, 100, LIGHTGRAY);
  35. DrawRectangle(134, 80, 100, 100, MAROON);
  36. DrawRectangle(134, 188, 100, 100, RED);
  37. DrawRectangle(134, 296, 100, 100, PINK);
  38. DrawRectangle(242, 80, 100, 100, ORANGE);
  39. DrawRectangle(242, 188, 100, 100, GOLD);
  40. DrawRectangle(242, 296, 100, 100, YELLOW);
  41. DrawRectangle(350, 80, 100, 100, DARKGREEN);
  42. DrawRectangle(350, 188, 100, 100, LIME);
  43. DrawRectangle(350, 296, 100, 100, GREEN);
  44. DrawRectangle(458, 80, 100, 100, DARKBLUE);
  45. DrawRectangle(458, 188, 100, 100, BLUE);
  46. DrawRectangle(458, 296, 100, 100, SKYBLUE);
  47. DrawRectangle(566, 80, 100, 100, DARKPURPLE);
  48. DrawRectangle(566, 188, 100, 100, VIOLET);
  49. DrawRectangle(566, 296, 100, 100, PURPLE);
  50. DrawRectangle(674, 80, 100, 100, DARKBROWN);
  51. DrawRectangle(674, 188, 100, 100, BROWN);
  52. DrawRectangle(674, 296, 100, 100, BEIGE);
  53. DrawText("DARKGRAY", 65, 166, 10, BLACK);
  54. DrawText("GRAY", 93, 274, 10, BLACK);
  55. DrawText("LIGHTGRAY", 61, 382, 10, BLACK);
  56. DrawText("MAROON", 186, 166, 10, BLACK);
  57. DrawText("RED", 208, 274, 10, BLACK);
  58. DrawText("PINK", 204, 382, 10, BLACK);
  59. DrawText("ORANGE", 295, 166, 10, BLACK);
  60. DrawText("GOLD", 310, 274, 10, BLACK);
  61. DrawText("YELLOW", 300, 382, 10, BLACK);
  62. DrawText("DARKGREEN", 382, 166, 10, BLACK);
  63. DrawText("LIME", 420, 274, 10, BLACK);
  64. DrawText("GREEN", 410, 382, 10, BLACK);
  65. DrawText("DARKBLUE", 498, 166, 10, BLACK);
  66. DrawText("BLUE", 526, 274, 10, BLACK);
  67. DrawText("SKYBLUE", 505, 382, 10, BLACK);
  68. DrawText("DARKPURPLE", 592, 166, 10, BLACK);
  69. DrawText("VIOLET", 621, 274, 10, BLACK);
  70. DrawText("PURPLE", 620, 382, 10, BLACK);
  71. DrawText("DARKBROWN", 705, 166, 10, BLACK);
  72. DrawText("BROWN", 733, 274, 10, BLACK);
  73. DrawText("BEIGE", 737, 382, 10, BLACK);
  74. EndDrawing();
  75. //----------------------------------------------------------------------------------
  76. }
  77. // De-Initialization
  78. //--------------------------------------------------------------------------------------
  79. CloseWindow(); // Close window and OpenGL context
  80. //--------------------------------------------------------------------------------------
  81. return 0;
  82. }