core_basic_window.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*******************************************************************************************
  2. *
  3. * raylib [core] example - Basic window
  4. *
  5. * Example complexity rating: [★☆☆☆] 1/4
  6. *
  7. * Welcome to raylib!
  8. *
  9. * To test examples, just press F6 and execute 'raylib_compile_execute' script
  10. * Note that compiled executable is placed in the same folder as .c file
  11. *
  12. * To test the examples on Web, press F6 and execute 'raylib_compile_execute_web' script
  13. * Web version of the program is generated in the same folder as .c file
  14. *
  15. * You can find all basic examples on C:\raylib\raylib\examples folder or
  16. * raylib official webpage: www.raylib.com
  17. *
  18. * Enjoy using raylib. :)
  19. *
  20. * Example originally created with raylib 1.0, last time updated with raylib 1.0
  21. *
  22. * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
  23. * BSD-like license that allows static linking with closed source software
  24. *
  25. * Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
  26. *
  27. ********************************************************************************************/
  28. #include "raylib.h"
  29. //------------------------------------------------------------------------------------
  30. // Program main entry point
  31. //------------------------------------------------------------------------------------
  32. int main(void)
  33. {
  34. // Initialization
  35. //--------------------------------------------------------------------------------------
  36. const int screenWidth = 800;
  37. const int screenHeight = 450;
  38. InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
  39. SetTargetFPS(60); // Set our game to run at 60 frames-per-second
  40. //--------------------------------------------------------------------------------------
  41. // Main game loop
  42. while (!WindowShouldClose()) // Detect window close button or ESC key
  43. {
  44. // Update
  45. //----------------------------------------------------------------------------------
  46. // TODO: Update your variables here
  47. //----------------------------------------------------------------------------------
  48. // Draw
  49. //----------------------------------------------------------------------------------
  50. BeginDrawing();
  51. ClearBackground(RAYWHITE);
  52. DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
  53. EndDrawing();
  54. //----------------------------------------------------------------------------------
  55. }
  56. // De-Initialization
  57. //--------------------------------------------------------------------------------------
  58. CloseWindow(); // Close window and OpenGL context
  59. //--------------------------------------------------------------------------------------
  60. return 0;
  61. }