Advertisement
janducev

Untitled

Nov 25th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. /*******************************************************************************************
  2. *
  3. * raylib [core] example - Basic window
  4. *
  5. * Welcome to raylib!
  6. *
  7. * To test examples, just press F6 and execute raylib_compile_execute script
  8. * Note that compiled executable is placed in the same folder as .c file
  9. *
  10. * You can find all basic examples on C:\raylib\raylib\examples folder or
  11. * raylib official webpage: www.raylib.com
  12. *
  13. * Enjoy using raylib. :)
  14. *
  15. * This example has been created using raylib 1.0 (www.raylib.com)
  16. * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
  17. *
  18. * Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
  19. *
  20. ********************************************************************************************/
  21.  
  22. #include "raylib.h"
  23.  
  24. int main()
  25. {
  26. // Initialization
  27. //--------------------------------------------------------------------------------------
  28. int screenWidth = 800;
  29. int screenHeight = 450;
  30.  
  31. InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
  32.  
  33. int framesCounter = 0;
  34. SetTargetFPS(60);
  35. bool blink = false;
  36. //--------------------------------------------------------------------------------------
  37.  
  38. // Main game loop
  39. while (!WindowShouldClose()) // Detect window close button or ESC key
  40. {
  41. // Update
  42. //----------------------------------------------------------------------------------
  43. // TODO: Update your variables here
  44.  
  45. framesCounter++;
  46. if (framesCounter % 30 == 0)
  47. {
  48. framesCounter = 0;
  49. blink = !blink;
  50. }
  51. //----------------------------------------------------------------------------------
  52.  
  53. // Draw
  54. //----------------------------------------------------------------------------------
  55. BeginDrawing();
  56.  
  57. ClearBackground(RAYWHITE);
  58.  
  59. DrawText("GAME TITLE", screenWidth/2 - MeasureText("GAME TITLE", 60)/2, screenHeight/4, 60, LIME);
  60. if (blink) DrawText("Press Start", screenWidth/2 - MeasureText("Press Start", 30)/2, screenHeight - 100, 30, BLACK);
  61.  
  62.  
  63. EndDrawing();
  64. //----------------------------------------------------------------------------------
  65. }
  66.  
  67. // De-Initialization
  68. //--------------------------------------------------------------------------------------
  69. CloseWindow(); // Close window and OpenGL context
  70. //--------------------------------------------------------------------------------------
  71.  
  72. return 0;
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement