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.

96 lines
4.1 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. SetTargetFPS(60);
  20. //--------------------------------------------------------------------------------------
  21. // Main game loop
  22. while (!WindowShouldClose()) // Detect window close button or ESC key
  23. {
  24. // Update
  25. //----------------------------------------------------------------------------------
  26. // TODO: Update your variables here
  27. //----------------------------------------------------------------------------------
  28. // Draw
  29. //----------------------------------------------------------------------------------
  30. BeginDrawing();
  31. ClearBackground(RAYWHITE);
  32. DrawText("raylib color palette", 28, 42, 20, BLACK);
  33. DrawRectangle(26, 80, 100, 100, DARKGRAY);
  34. DrawRectangle(26, 188, 100, 100, GRAY);
  35. DrawRectangle(26, 296, 100, 100, LIGHTGRAY);
  36. DrawRectangle(134, 80, 100, 100, MAROON);
  37. DrawRectangle(134, 188, 100, 100, RED);
  38. DrawRectangle(134, 296, 100, 100, PINK);
  39. DrawRectangle(242, 80, 100, 100, ORANGE);
  40. DrawRectangle(242, 188, 100, 100, GOLD);
  41. DrawRectangle(242, 296, 100, 100, YELLOW);
  42. DrawRectangle(350, 80, 100, 100, DARKGREEN);
  43. DrawRectangle(350, 188, 100, 100, LIME);
  44. DrawRectangle(350, 296, 100, 100, GREEN);
  45. DrawRectangle(458, 80, 100, 100, DARKBLUE);
  46. DrawRectangle(458, 188, 100, 100, BLUE);
  47. DrawRectangle(458, 296, 100, 100, SKYBLUE);
  48. DrawRectangle(566, 80, 100, 100, DARKPURPLE);
  49. DrawRectangle(566, 188, 100, 100, VIOLET);
  50. DrawRectangle(566, 296, 100, 100, PURPLE);
  51. DrawRectangle(674, 80, 100, 100, DARKBROWN);
  52. DrawRectangle(674, 188, 100, 100, BROWN);
  53. DrawRectangle(674, 296, 100, 100, BEIGE);
  54. DrawText("DARKGRAY", 65, 166, 10, BLACK);
  55. DrawText("GRAY", 93, 274, 10, BLACK);
  56. DrawText("LIGHTGRAY", 61, 382, 10, BLACK);
  57. DrawText("MAROON", 186, 166, 10, BLACK);
  58. DrawText("RED", 208, 274, 10, BLACK);
  59. DrawText("PINK", 204, 382, 10, BLACK);
  60. DrawText("ORANGE", 295, 166, 10, BLACK);
  61. DrawText("GOLD", 310, 274, 10, BLACK);
  62. DrawText("YELLOW", 300, 382, 10, BLACK);
  63. DrawText("DARKGREEN", 382, 166, 10, BLACK);
  64. DrawText("LIME", 420, 274, 10, BLACK);
  65. DrawText("GREEN", 410, 382, 10, BLACK);
  66. DrawText("DARKBLUE", 498, 166, 10, BLACK);
  67. DrawText("BLUE", 526, 274, 10, BLACK);
  68. DrawText("SKYBLUE", 505, 382, 10, BLACK);
  69. DrawText("DARKPURPLE", 592, 166, 10, BLACK);
  70. DrawText("VIOLET", 621, 274, 10, BLACK);
  71. DrawText("PURPLE", 620, 382, 10, BLACK);
  72. DrawText("DARKBROWN", 705, 166, 10, BLACK);
  73. DrawText("BROWN", 733, 274, 10, BLACK);
  74. DrawText("BEIGE", 737, 382, 10, BLACK);
  75. EndDrawing();
  76. //----------------------------------------------------------------------------------
  77. }
  78. // De-Initialization
  79. //--------------------------------------------------------------------------------------
  80. CloseWindow(); // Close window and OpenGL context
  81. //--------------------------------------------------------------------------------------
  82. return 0;
  83. }