Beginners_-_Using_Color.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #include "raylib.h"
  2. void floodit();
  3. int main(void)
  4. {
  5. // Initialization
  6. //--------------------------------------------------------------------------------------
  7. const int screenWidth = 800;
  8. const int screenHeight = 450;
  9. InitWindow(screenWidth, screenHeight, "Raylib examples.");
  10. SetTargetFPS(60); // Set our game to run at 60 frames-per-second
  11. //--------------------------------------------------------------------------------------
  12. // Main game loop
  13. while (!WindowShouldClose()) // Detect window close button or ESC key
  14. {
  15. // Update
  16. //----------------------------------------------------------------------------------
  17. //----------------------------------------------------------------------------------
  18. // Draw
  19. //----------------------------------------------------------------------------------
  20. BeginDrawing();
  21. ClearBackground(RAYWHITE);
  22. DrawText("Creating RGB colors.", 100, 180, 40, LIGHTGRAY);
  23. // (Color){Red[0..255],Green[0..255],Blue[0.255],Alpha[0.255(non transparent)]}
  24. DrawRectangle(100 +0 *1,100,64,32,(Color){255,0,0,255});
  25. DrawRectangle(100 +64 *2,100,64,32,(Color){0,255,0,255});
  26. DrawRectangle(100 +64 *4,100,64,32,(Color){0,0,255,255});
  27. EndDrawing();
  28. //----------------------------------------------------------------------------------
  29. }
  30. // De-Initialization
  31. //--------------------------------------------------------------------------------------
  32. CloseWindow(); // Close window and OpenGL context
  33. //--------------------------------------------------------------------------------------
  34. return 0;
  35. }