WidowPushed
Introduction
The WindowPushed property returns the IWindow that the Cursor was over when a push last occurred. This property will remain valid while the cursor is down, and will continue to remain valid the frame when the cursor is clicked (released). After the frame where a click has occurred, the property is returned to null until the next push. WindowPushed is often used to push+drag off of a UI element.
Code Example
The following code example shows how to create Circle and AxisAlignedRectangle instances by push+dragging off of two IWindows. These can be Glue entities implementing IWindow, Gum components, or hand-written IWindow-implementing objects. The following code assumes that the screen contains two IWindow-implementing objects:
RectangleButton
CircleButton
Note that this code creates circles and rectangles, but does not add them to any list. In a real game these shapes would need to be added to some list (probably a list created in Glue for the screen) so that they would get properly disposed when the screen is destroyed. This additional code has been omitted for this sample.
Last updated