diff options
| author | jussi | 2022-02-18 18:27:10 +0200 |
|---|---|---|
| committer | jussi | 2022-02-18 18:27:10 +0200 |
| commit | 6e4fdd3b3ae4e4656e151f098c40cfe551a36e8c (patch) | |
| tree | 37e30d371ebd44dfc8bab0d33c26f0294bda5ae4 /examples/image_draw | |
| parent | 345cc1d5aa3b3c97e2cce453dc65a62c3e05427b (diff) | |
| download | reilua-enhanced-6e4fdd3b3ae4e4656e151f098c40cfe551a36e8c.tar.gz reilua-enhanced-6e4fdd3b3ae4e4656e151f098c40cfe551a36e8c.tar.bz2 reilua-enhanced-6e4fdd3b3ae4e4656e151f098c40cfe551a36e8c.zip | |
Added initial files.
Diffstat (limited to 'examples/image_draw')
| -rw-r--r-- | examples/image_draw/main.lua | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/image_draw/main.lua b/examples/image_draw/main.lua new file mode 100644 index 0000000..8855fce --- /dev/null +++ b/examples/image_draw/main.lua @@ -0,0 +1,30 @@ +local monitor = 0 +local texture = -1 +local image = -1 +local catImage = -1 + +function init() + local mPos = RL_GetMonitorPosition( monitor ) + local mSize = RL_GetMonitorSize( monitor ) + local winSize = RL_GetWindowSize() + + RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) + RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) + image = RL_GenImageColor( winSize[1], winSize[2], WHITE ) + catImage = RL_LoadImage( RL_GetBasePath().."../resources/images/cat.png" ) + RL_ImageClearBackground( image, { 150, 60, 100 } ) + RL_ImageDrawPixel( image, { 32, 32 }, WHITE ) + RL_ImageDrawLine( image, { 32, 45 }, { 100, 60 }, GREEN ) + RL_ImageDrawCircle( image, { 64, 32 }, 16, BLUE ) + RL_ImageDrawRectangle( image, { 120, 64, 32, 64 }, BLUE ) + RL_ImageDrawRectangleLines( image, { 160, 64, 32, 64 }, 2.0, BLUE ) + RL_ImageDraw( image, catImage, { 143, 25, 230, 250 }, { 200, 200, 230, 250 }, WHITE ) + RL_ImageDrawTextEx( image, 0, "Hello", { 300, 32 }, 48.0, 1.0, WHITE ) + + texture = RL_LoadTextureFromImage( image ) +end + +function draw() + RL_ClearBackground( { 100, 150, 100 } ) + RL_DrawTexture( texture, { 0, 0 }, WHITE ) +end |
