Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

63 строки
2.6 KiB

11 месяцев назад
5 лет назад
5 лет назад
9 лет назад
  1. /*******************************************************************************************
  2. *
  3. * raylib [textures] example - Texture loading and drawing
  4. *
  5. * Example originally created with raylib 1.0, last time updated with raylib 1.0
  6. *
  7. * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
  8. * BSD-like license that allows static linking with closed source software
  9. *
  10. * Copyright (c) 2014-2024 Ramon Santamaria (@raysan5)
  11. *
  12. ********************************************************************************************/
  13. #include "raylib.h"
  14. //------------------------------------------------------------------------------------
  15. // Program main entry point
  16. //------------------------------------------------------------------------------------
  17. int main(void)
  18. {
  19. // Initialization
  20. //--------------------------------------------------------------------------------------
  21. const int screenWidth = 800;
  22. const int screenHeight = 450;
  23. InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture loading and drawing");
  24. // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
  25. Texture2D texture = LoadTexture("resources/raylib_logo.png"); // Texture loading
  26. SetTargetFPS(60); // Set our game to run at 60 frames-per-second
  27. //---------------------------------------------------------------------------------------
  28. // Main game loop
  29. while (!WindowShouldClose()) // Detect window close button or ESC key
  30. {
  31. // Update
  32. //----------------------------------------------------------------------------------
  33. // TODO: Update your variables here
  34. //----------------------------------------------------------------------------------
  35. // Draw
  36. //----------------------------------------------------------------------------------
  37. BeginDrawing();
  38. ClearBackground(RAYWHITE);
  39. DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE);
  40. DrawText("this IS a texture!", 360, 370, 10, GRAY);
  41. EndDrawing();
  42. //----------------------------------------------------------------------------------
  43. }
  44. // De-Initialization
  45. //--------------------------------------------------------------------------------------
  46. UnloadTexture(texture); // Texture unloading
  47. CloseWindow(); // Close window and OpenGL context
  48. //--------------------------------------------------------------------------------------
  49. return 0;
  50. }