You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.2 KiB

преди 10 години
преди 10 години
преди 10 години
преди 10 години
преди 10 години
преди 10 години
преди 10 години
преди 9 години
преди 10 години
преди 10 години
преди 10 години
преди 10 години
  1. /*******************************************************************************************
  2. *
  3. * raylib [textures] example - Texture loading and drawing
  4. *
  5. * This example has been created using raylib 1.0 (www.raylib.com)
  6. * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
  7. *
  8. * Copyright (c) 2014 Ramon Santamaria (@raysan5)
  9. *
  10. ********************************************************************************************/
  11. #include "raylib.h"
  12. int main()
  13. {
  14. // Initialization
  15. //--------------------------------------------------------------------------------------
  16. int screenWidth = 800;
  17. int screenHeight = 450;
  18. InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture loading and drawing");
  19. // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
  20. Texture2D texture = LoadTexture("resources/raylib_logo.png"); // Texture loading
  21. //---------------------------------------------------------------------------------------
  22. // Main game loop
  23. while (!WindowShouldClose()) // Detect window close button or ESC key
  24. {
  25. // Update
  26. //----------------------------------------------------------------------------------
  27. // TODO: Update your variables here
  28. //----------------------------------------------------------------------------------
  29. // Draw
  30. //----------------------------------------------------------------------------------
  31. BeginDrawing();
  32. ClearBackground(RAYWHITE);
  33. DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE);
  34. DrawText("this IS a texture!", 360, 370, 10, GRAY);
  35. EndDrawing();
  36. //----------------------------------------------------------------------------------
  37. }
  38. // De-Initialization
  39. //--------------------------------------------------------------------------------------
  40. UnloadTexture(texture); // Texture unloading
  41. CloseWindow(); // Close window and OpenGL context
  42. //--------------------------------------------------------------------------------------
  43. return 0;
  44. }