summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorjussi2022-11-27 14:08:58 +0200
committerjussi2022-11-27 14:08:58 +0200
commitdeda5fb9170295133444809618835e8b9aa61512 (patch)
treeb00b07e245e2b9899f2c0059706b1f112e6b8c3a /examples
parentc327a1ed55fafc212bf0e3bd5067ab246f1f041c (diff)
downloadreilua-enhanced-deda5fb9170295133444809618835e8b9aa61512.tar.gz
reilua-enhanced-deda5fb9170295133444809618835e8b9aa61512.tar.bz2
reilua-enhanced-deda5fb9170295133444809618835e8b9aa61512.zip
Exit function and N-Patch fix.
Diffstat (limited to 'examples')
-rw-r--r--examples/n-patches/main.lua25
-rw-r--r--examples/resources/images/n-patch.pngbin0 -> 6021 bytes
2 files changed, 25 insertions, 0 deletions
diff --git a/examples/n-patches/main.lua b/examples/n-patches/main.lua
new file mode 100644
index 0000000..045bb84
--- /dev/null
+++ b/examples/n-patches/main.lua
@@ -0,0 +1,25 @@
+local dstRec = { 160.0, 160.0, 8.0, 8.0 };
+local origin = { 0.0, 0.0 }
+
+-- local ninePatchInfo = { { 0.0, 0.0, 24.0, 24.0 }, 8, 8, 8, 8, NPATCH_NINE_PATCH }
+local ninePatchInfo = { source = { 0, 0, 24.0, 24.0 }, left = 8, top = 8, right = 8, bottom = 8, layout = NPATCH_NINE_PATCH }
+
+local nPatchTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/n-patch.png" )
+
+function init()
+ RL_SetWindowTitle( "N-Patches" )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
+end
+
+function process( delta )
+ local mousePosition = RL_GetMousePosition();
+
+ -- Resize the n-patch based on mouse position
+ dstRec[3] = mousePosition[1] - dstRec[1];
+ dstRec[4] = mousePosition[2] - dstRec[2];
+end
+
+function draw()
+ RL_ClearBackground( RAYWHITE )
+ RL_DrawTextureNPatch( nPatchTexture, ninePatchInfo, dstRec, origin, 0.0, WHITE )
+end
diff --git a/examples/resources/images/n-patch.png b/examples/resources/images/n-patch.png
new file mode 100644
index 0000000..c6e738b
--- /dev/null
+++ b/examples/resources/images/n-patch.png
Binary files differ