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.

63 lines
2.6 KiB

  1. /*******************************************************************************************
  2. *
  3. * raylib [textures] example - DDS Texture loading and drawing (compressed and uncompressed)
  4. *
  5. * NOTE: This example requires raylib OpenGL 3.3+ or ES2 versions for compressed texture,
  6. * OpenGL 1.1 does not support compressed textures, only uncompressed version.
  7. *
  8. * This example has been created using raylib 1.2 (www.raylib.com)
  9. * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
  10. *
  11. * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
  12. *
  13. ********************************************************************************************/
  14. #include "raylib.h"
  15. int main()
  16. {
  17. // Initialization
  18. //--------------------------------------------------------------------------------------
  19. int screenWidth = 800;
  20. int screenHeight = 450;
  21. InitWindow(screenWidth, screenHeight, "raylib [textures] example - DDS texture loading and drawing");
  22. // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
  23. //Texture2D texture = LoadTexture("resources/raylib_logo.dds"); // Texture loading (compressed)
  24. Texture2D texture = LoadTexture("resources/raylib_logo_uncompressed.dds"); // Texture loading (uncompressed)
  25. SetTargetFPS(60); // Set our game to run at 60 frames-per-second
  26. //---------------------------------------------------------------------------------------
  27. // Main game loop
  28. while (!WindowShouldClose()) // Detect window close button or ESC key
  29. {
  30. // Update
  31. //----------------------------------------------------------------------------------
  32. // TODO: Update your variables here
  33. //----------------------------------------------------------------------------------
  34. // Draw
  35. //----------------------------------------------------------------------------------
  36. BeginDrawing();
  37. ClearBackground(RAYWHITE);
  38. DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE);
  39. DrawText("this may be a compressed texture!", 320, 370, 10, GRAY);
  40. EndDrawing();
  41. //----------------------------------------------------------------------------------
  42. }
  43. // De-Initialization
  44. //--------------------------------------------------------------------------------------
  45. UnloadTexture(texture); // Texture unloading
  46. CloseWindow(); // Close window and OpenGL context
  47. //--------------------------------------------------------------------------------------
  48. return 0;
  49. }