diff options
| author | jussi | 2022-12-08 18:24:41 +0200 |
|---|---|---|
| committer | jussi | 2022-12-08 18:24:41 +0200 |
| commit | 973d902a16b35258629d2a0b228ad9c3f49b6198 (patch) | |
| tree | 7ee30310c5c2356cbaf31f9f2d23d21b89770f51 /examples/resources/lib | |
| parent | 79fbb36d2a4d73001c446f75b3b87dc84f1605b6 (diff) | |
| download | reilua-enhanced-973d902a16b35258629d2a0b228ad9c3f49b6198.tar.gz reilua-enhanced-973d902a16b35258629d2a0b228ad9c3f49b6198.tar.bz2 reilua-enhanced-973d902a16b35258629d2a0b228ad9c3f49b6198.zip | |
ReiLuaGui File explorer.
Diffstat (limited to 'examples/resources/lib')
| -rw-r--r-- | examples/resources/lib/gui.lua | 23 | ||||
| -rw-r--r-- | examples/resources/lib/utillib.lua | 4 |
2 files changed, 26 insertions, 1 deletions
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).." = {" ) |
