diff options
| author | jussi | 2023-04-06 12:31:37 +0300 |
|---|---|---|
| committer | jussi | 2023-04-06 12:31:37 +0300 |
| commit | 2526c9732e7ea35bc9ed3e43a4db77b7e6364c5a (patch) | |
| tree | 825775577403d9341045571adb266173513c4bbd /examples/image_draw | |
| parent | 198a74c0aa27389c062c47bc29187c58a9d6c4a1 (diff) | |
| download | reilua-enhanced-2526c9732e7ea35bc9ed3e43a4db77b7e6364c5a.tar.gz reilua-enhanced-2526c9732e7ea35bc9ed3e43a4db77b7e6364c5a.tar.bz2 reilua-enhanced-2526c9732e7ea35bc9ed3e43a4db77b7e6364c5a.zip | |
All global variables and functions are not in global RL table. doc_parser creates also ReiLua_API.lua.
Diffstat (limited to 'examples/image_draw')
| -rw-r--r-- | examples/image_draw/main.lua | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/examples/image_draw/main.lua b/examples/image_draw/main.lua index 2a78a13..8c1ea82 100644 --- a/examples/image_draw/main.lua +++ b/examples/image_draw/main.lua @@ -5,40 +5,40 @@ local catImage = -1 local catCopy = -1 local textImage = -1 -function init() - local mPos = RL_GetMonitorPosition( monitor ) - local mSize = RL_GetMonitorSize( monitor ) - local winSize = RL_GetScreenSize() +function RL.init() + local mPos = RL.GetMonitorPosition( monitor ) + local mSize = RL.GetMonitorSize( monitor ) + local winSize = RL.GetScreenSize() - RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) - RL_SetWindowState( FLAG_VSYNC_HINT ) - 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 ) + RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE ) + RL.SetWindowState( RL.FLAG_VSYNC_HINT ) + 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], RL.WHITE ) -- Test changing working directory. - RL_ChangeDirectory( RL_GetBasePath().."../resources" ) - catImage = RL_LoadImage( RL_GetWorkingDirectory().."/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 ) + RL.ChangeDirectory( RL.GetBasePath().."../resources" ) + catImage = RL.LoadImage( RL.GetWorkingDirectory().."/images/cat.png" ) + RL.ImageClearBackground( image, { 150, 60, 100 } ) + RL.ImageDrawPixel( image, { 32, 32 }, RL.WHITE ) + RL.ImageDrawLine( image, { 32, 45 }, { 100, 60 }, RL.GREEN ) + RL.ImageDrawCircle( image, { 64, 32 }, 16, RL.BLUE ) + RL.ImageDrawRectangle( image, { 120, 64, 32, 64 }, RL.BLUE ) + RL.ImageDrawRectangleLines( image, { 160, 64, 32, 64 }, 2.0, RL.BLUE ) + RL.ImageDraw( image, catImage, { 143, 25, 230, 250 }, { 200, 200, 230, 250 }, RL.WHITE ) + RL.ImageDrawTextEx( image, 0, "Hello", { 300, 32 }, 48.0, 1.0, RL.WHITE ) local src = { 80, 70, 96, 96 } - catCopy = RL_ImageFromImage( catImage, src ) + catCopy = RL.ImageFromImage( catImage, src ) - RL_ImageDraw( image, catCopy, src, { 600, 200, src[3], src[4] }, WHITE ) + RL.ImageDraw( image, catCopy, src, { 600, 200, src[3], src[4] }, RL.WHITE ) - textImage = RL_ImageText( 0, "Cat", 10, 4, WHITE ) - local imageSize = RL_GetImageSize( textImage ) - RL_ImageDraw( image, textImage, { 0, 0, imageSize[1], imageSize[2] }, { 250, 40, imageSize[1], imageSize[2] }, WHITE ) - - texture = RL_LoadTextureFromImage( image ) + textImage = RL.ImageText( 0, "Cat", 10, 4, RL.WHITE ) + local imageSize = RL.GetImageSize( textImage ) + RL.ImageDraw( image, textImage, { 0, 0, imageSize[1], imageSize[2] }, { 250, 40, imageSize[1], imageSize[2] }, RL.WHITE ) + + texture = RL.LoadTextureFromImage( image ) end -function draw() - RL_ClearBackground( { 100, 150, 100 } ) - RL_DrawTexture( texture, { 0, 0 }, WHITE ) +function RL.draw() + RL.ClearBackground( { 100, 150, 100 } ) + RL.DrawTexture( texture, { 0, 0 }, RL.WHITE ) end |
