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.

48 lines
2.0 KiB

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