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.

88 lines
3.8 KiB

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