summaryrefslogtreecommitdiff
path: root/examples/resources
diff options
context:
space:
mode:
authorjussi2022-12-08 18:24:41 +0200
committerjussi2022-12-08 18:24:41 +0200
commit973d902a16b35258629d2a0b228ad9c3f49b6198 (patch)
tree7ee30310c5c2356cbaf31f9f2d23d21b89770f51 /examples/resources
parent79fbb36d2a4d73001c446f75b3b87dc84f1605b6 (diff)
downloadreilua-enhanced-973d902a16b35258629d2a0b228ad9c3f49b6198.tar.gz
reilua-enhanced-973d902a16b35258629d2a0b228ad9c3f49b6198.tar.bz2
reilua-enhanced-973d902a16b35258629d2a0b228ad9c3f49b6198.zip
ReiLuaGui File explorer.
Diffstat (limited to 'examples/resources')
-rw-r--r--examples/resources/images/LICENCE5
-rw-r--r--examples/resources/images/files.pngbin0 -> 7500 bytes
-rw-r--r--examples/resources/images/open-folder.pngbin0 -> 6243 bytes
-rw-r--r--examples/resources/images/previous-button.pngbin0 -> 6820 bytes
-rw-r--r--examples/resources/lib/gui.lua23
-rw-r--r--examples/resources/lib/utillib.lua4
6 files changed, 30 insertions, 2 deletions
diff --git a/examples/resources/images/LICENCE b/examples/resources/images/LICENCE
index bfe263f..3cf6909 100644
--- a/examples/resources/images/LICENCE
+++ b/examples/resources/images/LICENCE
@@ -9,4 +9,7 @@ ui_bgr.png Jussi Viitala CC0
check-mark.png Delapouite Creative Commons 3.0 https://game-icons.net Resized
circle.png Delapouite Creative Commons 3.0 https://game-icons.net Resized
plain-circle.png Delapouite Creative Commons 3.0 https://game-icons.net Resized
-cancel.png Sbed Creative Commons 3.0 https://game-icons.net Resized \ No newline at end of file
+previous-button.png Delapouite Creative Commons 3.0 https://game-icons.net Resized
+open-folder.png Delapouite Creative Commons 3.0 https://game-icons.net Resized
+files.png Delapouite Creative Commons 3.0 https://game-icons.net Resized
+cancel.png Sbed Creative Commons 3.0 https://game-icons.net Resized
diff --git a/examples/resources/images/files.png b/examples/resources/images/files.png
new file mode 100644
index 0000000..503e0d9
--- /dev/null
+++ b/examples/resources/images/files.png
Binary files differ
diff --git a/examples/resources/images/open-folder.png b/examples/resources/images/open-folder.png
new file mode 100644
index 0000000..8a14119
--- /dev/null
+++ b/examples/resources/images/open-folder.png
Binary files differ
diff --git a/examples/resources/images/previous-button.png b/examples/resources/images/previous-button.png
new file mode 100644
index 0000000..fa4ba7e
--- /dev/null
+++ b/examples/resources/images/previous-button.png
Binary files differ
diff --git a/examples/resources/lib/gui.lua b/examples/resources/lib/gui.lua
index c7609c1..4e4ee7e 100644
--- a/examples/resources/lib/gui.lua
+++ b/examples/resources/lib/gui.lua
@@ -226,7 +226,7 @@ Text.__index = Text
function Text:new( set )
local object = setmetatable( {}, Text )
- object.bounds = Rect:new( 0, 0, 0, 0 )
+ object.bounds = setProperty( set, "bounds", Rect:new( 0, 0, 0, 0 ) )
object.HAling = setProperty( set, "HAling", Gui.ALING.LEFT )
object.VAling = setProperty( set, "VAling", Gui.ALING.BOTTOM )
@@ -557,6 +557,8 @@ function Container:new( set )
object.showScrollbar = setProperty( set, "showScrollbar", false )
object.scrollbarWidth = setProperty( set, "scrollbarWidth", Gui.scrollbarWidth )
object.scrollAmount = setProperty( set, "scrollAmount", Gui.scrollAmount ) -- When using mouse scroll.
+ object.color = setProperty( set, "color", Color:new( WHITE ) )
+ object.drawBounds = setProperty( set, "drawBounds", false )
object.drawScrollRect = setProperty( set, "drawScrollRect", false )
-- For grid container. Do not set both.
object.columns = setProperty( set, "columns", nil )
@@ -661,6 +663,12 @@ function Container:updateScrollbar()
self._VScrollbar.items[1].bounds.width = self.scrollbarWidth
self._VScrollbar.items[1].bounds.height = self.bounds.height / self._scrollRect.height * self.bounds.height
self._VScrollbar.items[1].bounds.y = self._scrollRect.y / self._scrollRect.height * self.bounds.height
+
+ self._VScrollbar.visible = self.visible
+ self._VScrollbar.disabled = self.disabled
+ else
+ self._VScrollbar.visible = false
+ self._VScrollbar.disabled = true
end
if self.bounds.width < self._scrollRect.width then
@@ -672,6 +680,12 @@ function Container:updateScrollbar()
self._HScrollbar.items[1].bounds.width = self.bounds.width / self._scrollRect.width * self.bounds.width
self._HScrollbar.items[1].bounds.height = self.scrollbarWidth
self._HScrollbar.items[1].bounds.x = self._scrollRect.x / self._scrollRect.width * self.bounds.width
+
+ self._HScrollbar.visible = self.visible
+ self._HScrollbar.disabled = self.disabled
+ else
+ self._HScrollbar.visible = false
+ self._HScrollbar.disabled = true
end
end
@@ -727,6 +741,9 @@ function Container:update()
cell._visibilityBounds = self._visibilityBounds
end
+ cell.visible = self.visible
+ cell.disabled = self.disabled
+
if self.type == Gui.CONTAINER.VERTICAL then
if self.HAling == Gui.ALING.CENTER then
pos.x = self.bounds.x + self.bounds.width / 2 - cell.bounds.width / 2
@@ -838,6 +855,10 @@ function Container:set2Back()
end
function Container:draw()
+ if self.drawBounds then
+ RL_DrawRectangle( self.bounds, self.color )
+ end
+
if self.drawScrollRect then
RL_DrawRectangleLines( {
self.bounds.x - self._scrollRect.x,
diff --git a/examples/resources/lib/utillib.lua b/examples/resources/lib/utillib.lua
index d6e5019..7fb7405 100644
--- a/examples/resources/lib/utillib.lua
+++ b/examples/resources/lib/utillib.lua
@@ -152,6 +152,10 @@ function utillib.toBoolean( v )
return false
end
+function utillib.boo2Number( bool )
+ return bool and 1 or 0
+end
+
-- Print table content.
function utillib.printt( t )
print( tostring(t).." = {" )