Diablo, I think I found the main cause of the poor speed I (and others) have experienced with HighGui.
The culprit is in hi_TGadget.IsIn().
I made some very limited changes, but with a major impact on the speed : for a test in windowed mode with 5 rows of 25 textboxes, my FPS has gone from 1 FPS (!) to 60.
Needless to say, that makes a huge difference regarding the usefulness of the lib.
Just replace the implementation of IsIn with the following code:
I'll let you do your own checks of the validity of my correction (admitedly I wrote it quickly and haven't tested it extensively, but I'm rather confident).
If it could end up in the next release, that would be great.
Now that I can actually use the lib, thanks one more time for writing it.
The culprit is in hi_TGadget.IsIn().
I made some very limited changes, but with a major impact on the speed : for a test in windowed mode with 5 rows of 25 textboxes, my FPS has gone from 1 FPS (!) to 60.
Needless to say, that makes a huge difference regarding the usefulness of the lib.
Just replace the implementation of IsIn with the following code:
Method PointInView_%(x%, y%, recursive%=True) If Not visible Or Not hi_TRect.PointInRect(x, y, Self.x, Self.y, Self.w, Self.h) Then Return False Else If parent <> Null Then ' Check that the point is not hidden by a sibbling gadget with a higher z order If parent.childList <> Null Then For Local gadget:hi_TGadget = EachIn parent.childList If gadget.z > Self.z And gadget.visible And .. hi_TRect.PointInRect(x, y, gadget.x, gadget.y, gadget.w, gadget.h) Then Return False EndIf Next EndIf If recursive Then Return parent.PointInView_(x, y, recursive) EndIf Else Return True EndIf EndIf End Method Method FindTopMostAncestor:hi_TGadget(includingSelf%=False) If parent = Null Then If includingSelf Then Return Self Else Return Null EndIf Else Local res:hi_TGadget = Self While res.parent <> Null res = res.parent Wend Return res EndIf End Method Rem bbdoc: Check if a point is in the gadget endrem Method IsIn%(x%, y%) 'If Not visible Then Return False If disabled Then Return False ' Check that the point is in view, without taking into account unrelated gadgets ' (but taking into acoount siblings and parents) If Not PointInView_(x, y, True) Then Return False EndIf ' Now check unrelated gadgets Local topMostGadget:hi_TGadget = FindTopMostAncestor(True) For Local gadget:hi_TGadget = EachIn list If gadget <> Self And gadget.parent = Null And gadget.z > topMostGadget.z Then 'If gadget.IsIn(x, y) Then If hi_TRect.PointInRect(x, y, gadget.x, gadget.y, gadget.w, gadget.h) Return False EndIf EndIf Next Return True End Method
I'll let you do your own checks of the validity of my correction (admitedly I wrote it quickly and haven't tested it extensively, but I'm rather confident).
If it could end up in the next release, that would be great.
Now that I can actually use the lib, thanks one more time for writing it.