Home |
Obtaining a Pointer to PegPresentationManager Determining the Position of an Object |
Determining the Position of an ObjectOne of the most basic properties of all RTPEG-32 objects is the object's position on the screen. PegThing maintains this information, along with clipping and Z-ordering information to insure that objects are only allowed to draw to the areas of the screen that are owned by the object. An object's position is held in the PegThing public member variable mReal, which is a value of type PegRect. PegThing also maintains a separate but related member called mClient, which is an additional PegRect member that indicates the client rectangle of the object. For many objects, the client area and the real area are equal. For example, by using the mReal variables and the PegRect::Overlap function, we can easily determine if two objects overlap using the following code segment: PegThing * pThing1 = First(); PegThing * pThing2 = pThing1->Next(); if (pThing1->mReal.Overlap(pThing2->mReal)) { // objects overlap } else { // objects do not overlap }
|