Beginners_-_GetMonitorWidth_Height.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "raylib.h"
  2. int main(void)
  3. {
  4. // Initialization
  5. //--------------------------------------------------------------------------------------
  6. const int screenWidth = GetMonitorWidth(0);
  7. const int screenHeight = GetMonitorHeight(0);
  8. InitWindow(screenWidth, screenHeight, "raylib example.");
  9. SetTargetFPS(60); // Set our game to run at 60 frames-per-second
  10. //--------------------------------------------------------------------------------------
  11. // Main game loop
  12. while (!WindowShouldClose()) // Detect window close button or ESC key
  13. {
  14. // Update
  15. //----------------------------------------------------------------------------------
  16. //----------------------------------------------------------------------------------
  17. // Draw
  18. //----------------------------------------------------------------------------------
  19. BeginDrawing();
  20. ClearBackground(RAYWHITE);
  21. DrawText("Press Escape to end..",100,400,120,GRAY);
  22. EndDrawing();
  23. //----------------------------------------------------------------------------------
  24. }
  25. // De-Initialization
  26. //--------------------------------------------------------------------------------------
  27. CloseWindow(); // Close window and OpenGL context
  28. //--------------------------------------------------------------------------------------
  29. return 0;
  30. }