From 70b40f67824b3d612235c382aa83821c054fa51e Mon Sep 17 00:00:00 2001 From: jussi Date: Wed, 17 Apr 2024 00:35:58 +0300 Subject: Object libraries like Vector2 optimizations. --- examples/raygui_extensions/tree_view.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'examples/raygui_extensions/tree_view.lua') diff --git a/examples/raygui_extensions/tree_view.lua b/examples/raygui_extensions/tree_view.lua index ac73d4a..055694d 100644 --- a/examples/raygui_extensions/tree_view.lua +++ b/examples/raygui_extensions/tree_view.lua @@ -20,8 +20,8 @@ function TreeView:new( bounds, text, callbacks, styles, tooltip ) object.bounds = bounds:clone() object.text = text - object.scroll = Vec2:new() - object.view = Rect:new() + object.scroll = Vec2:new( 0, 0 ) + object.view = Rect:new( 0, 0, 0, 0 ) object.callbacks = callbacks -- select, grab, drag. object.styles = styles object.tooltip = tooltip @@ -269,7 +269,7 @@ function TreeView:itemSelect( item ) end function TreeView:update() - local mousePos = Vec2:new( RL.GetMousePosition() ) + local mousePos = Vec2:newT( RL.GetMousePosition() ) local guiMousePos = mousePos + self.gui.mouseOffset local mouseInView = self.view:checkCollisionPoint( mousePos ) @@ -336,8 +336,8 @@ end function TreeView:draw() local oldScroll = self.scroll:clone() local _, scroll, view = RL.GuiScrollPanel( self.bounds, self.text, self.content, self.scroll, self.view ) - self.view:set( view ) - self.scroll:set( scroll ) + self.view:setT( view ) + self.scroll:setT( scroll ) if self.scroll ~= oldScroll or self._forceCheckScroll then if not self._forceCheckScroll then @@ -386,7 +386,7 @@ function TreeView:setSize( size ) self.defaultControlSize = Vec2:new( self.content.width, self.defaultControlHeight ) local _, _, view = RL.GuiScrollPanel( self.bounds, self.text, self.content, self.scroll, self.view ) - self.view = Rect:new( view ) + self.view = Rect:newT( view ) self.gui.view = Rect:new( 0, 0, self.view.width, self.view.height ) self.framebufferSize = Vec2:new( self.bounds.width, self.bounds.height - self.gui.RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT ) -- cgit v1.2.3