test jpeg image loading
This commit is contained in:
parent
7b246103d8
commit
8666f0cff8
4 changed files with 33 additions and 2 deletions
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
|
@ -84,7 +84,7 @@ jobs:
|
||||||
cd raylib-c
|
cd raylib-c
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DINCLUDE_EVERYTHING=on -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
|
cmake -DINCLUDE_EVERYTHING=on -DSUPPORT_FILEFORMAT_JPG -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
|
||||||
make -j2
|
make -j2
|
||||||
sudo make install
|
sudo make install
|
||||||
- name: Build raylib-python-cffi
|
- name: Build raylib-python-cffi
|
||||||
|
@ -131,7 +131,7 @@ jobs:
|
||||||
cd raylib-c
|
cd raylib-c
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DINCLUDE_EVERYTHING=on -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
|
cmake -DINCLUDE_EVERYTHING=on -DSUPPORT_FILEFORMAT_JPG -DWITH_PIC=on -DCMAKE_BUILD_TYPE=Release ..
|
||||||
msbuild raylib.sln /target:raylib /property:Configuration=Release
|
msbuild raylib.sln /target:raylib /property:Configuration=Release
|
||||||
copy raylib\Release\raylib.lib ..\..
|
copy raylib\Release\raylib.lib ..\..
|
||||||
cd ..\..
|
cd ..\..
|
||||||
|
|
31
examples/textures/image_loading.py
Normal file
31
examples/textures/image_loading.py
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
from raylib import *
|
||||||
|
|
||||||
|
screenWidth = 800
|
||||||
|
screenHeight = 450
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, b"raylib [textures] example - image loading")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
image = LoadImage(b"resources/raylib_logo.jpg")
|
||||||
|
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()
|
BIN
examples/textures/resources/raylib_logo.jpg
Normal file
BIN
examples/textures/resources/raylib_logo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
BIN
examples/textures/resources/raylib_logo.png
Normal file
BIN
examples/textures/resources/raylib_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
Reference in a new issue