diff options
Diffstat (limited to 'examples/resources')
| -rw-r--r-- | examples/resources/images/LICENCE | 5 | ||||
| -rw-r--r-- | examples/resources/images/files.png | bin | 0 -> 7500 bytes | |||
| -rw-r--r-- | examples/resources/images/open-folder.png | bin | 0 -> 6243 bytes | |||
| -rw-r--r-- | examples/resources/images/previous-button.png | bin | 0 -> 6820 bytes | |||
| -rw-r--r-- | examples/resources/lib/gui.lua | 23 | ||||
| -rw-r--r-- | examples/resources/lib/utillib.lua | 4 |
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 Binary files differnew file mode 100644 index 0000000..503e0d9 --- /dev/null +++ b/examples/resources/images/files.png diff --git a/examples/resources/images/open-folder.png b/examples/resources/images/open-folder.png Binary files differnew file mode 100644 index 0000000..8a14119 --- /dev/null +++ b/examples/resources/images/open-folder.png diff --git a/examples/resources/images/previous-button.png b/examples/resources/images/previous-button.png Binary files differnew file mode 100644 index 0000000..fa4ba7e --- /dev/null +++ b/examples/resources/images/previous-button.png 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).." = {" ) |
