Scripting, Code & Interaction: Difference between revisions

Jump to navigation Jump to search
Line 341: Line 341:
   GUI *GUIUnderMouse = GUI.GetAtScreenXY(mouse.x, mouse.y);
   GUI *GUIUnderMouse = GUI.GetAtScreenXY(mouse.x, mouse.y);


As implied by the name of the pointer, this pointer will point to the GUI that the mouse is over.  This brings to point an interesting question though.  What if there is no GUI under the mouse?  Well, in that case, GUIUnderMouse would be set to 'null', which means that it isn't pointing to anything.
As implied by the name of the pointer, this pointer will point to the GUI that the mouse is over.  This brings to point an interesting question though.  What if there is no GUI under the mouse?  Well, in that case, GUIUnderMouse would be set to ''null'', which means that it isn't pointing to anything.


If a pointer is null, then basically all you can do with the pointer is make it point to something (assign it a value as in the examples), and test it against other pointers (or variables) of the same type.  We've already seen how to assign a value to a pointer, so let's see how we can compare two pointers.  Let's take the following example:
If a pointer is null, then basically all you can do with the pointer is make it point to something (assign it a value as in the examples), and test it against other pointers (or variables) of the same type.  We've already seen how to assign a value to a pointer, so let's see how we can compare two pointers.  Let's take the following example:
Anonymous user

Navigation menu