Beginners_-_Enum.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "raylib.h"
  2. // Here are the enums.
  3. enum flag{UP,DOWN,LEFT,RIGHT};
  4. enum flag2{UP2=5,DOWN2,LEFT2,RIGHT2};
  5. int main(void)
  6. {
  7. // Initialization
  8. //--------------------------------------------------------------------------------------
  9. const int screenWidth = 800;
  10. const int screenHeight = 450;
  11. InitWindow(screenWidth, screenHeight, "raylib example.");
  12. SetTargetFPS(60); // Set our game to run at 60 frames-per-second
  13. //--------------------------------------------------------------------------------------
  14. // Main game loop
  15. while (!WindowShouldClose()) // Detect window close button or ESC key
  16. {
  17. // Update
  18. //----------------------------------------------------------------------------------
  19. //----------------------------------------------------------------------------------
  20. // Draw
  21. //----------------------------------------------------------------------------------
  22. BeginDrawing();
  23. ClearBackground(RAYWHITE);
  24. DrawText(FormatText("UP %i",UP) ,0,0,20,GRAY);
  25. DrawText(FormatText("DOWN %i",DOWN) ,0,20,20,GRAY);
  26. DrawText(FormatText("LEFT %i",LEFT) ,0,40,20,GRAY);
  27. DrawText(FormatText("UP2 %i",UP2) ,0,80,20,GRAY);
  28. DrawText(FormatText("DOWN2 %i",DOWN2) ,0,100,20,GRAY);
  29. DrawText(FormatText("LEFT2 %i",LEFT2) ,0,120,20,GRAY);
  30. EndDrawing();
  31. //----------------------------------------------------------------------------------
  32. }
  33. // De-Initialization
  34. //--------------------------------------------------------------------------------------
  35. CloseWindow(); // Close window and OpenGL context
  36. //--------------------------------------------------------------------------------------
  37. return 0;
  38. }