This repository has been archived on 2025-06-21. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
raylib-python-cffi/examples/textures/textures_image_loading.py
2024-02-21 12:21:32 +00:00

27 lines
595 B
Python

from raylib import *
screenWidth = 800
screenHeight = 450
InitWindow(screenWidth, screenHeight, b"raylib [textures] example - image loading")
image = LoadImage(b"resources/raylib_logo.png")
texture = LoadTextureFromImage(image)
UnloadImage(image)
while not WindowShouldClose():
BeginDrawing()
ClearBackground(RAYWHITE)
DrawTexture(texture, int(screenWidth/2 - texture.width/2), int(screenHeight/2 - texture.height/2), WHITE)
DrawText(b"this IS a texture loaded from an image!", 300, 370, 10, GRAY)
EndDrawing()
UnloadTexture(texture)
CloseWindow()