On Time RTOS-32 Documentation
Welcome
RTTarget-32
RTKernel-32
RTFiles-32
RTIP-32
RTPEG-32
RTPEG-32 Programming Manual
Introduction
Overview
Programming with RTPEG-32
Application Program Structure
Rules Of Memory Ownership
Creating PegThings
Deleting/Removing PegThings
Obtaining a Pointer to PegPresentationManager
Finding an Object's Parent
Finding an Object's Children
Status Flags
Style Flags
Determining the Position of an Object
Using Object Types
Using Object IDs
Messages
Overriding the Message() Method
Drawing to the Screen
Overriding the Draw() Method
Drawing to Memory
Using PegTimer
Viewports
Fonts
Scrolling
Screen Drivers
Demo Programs
Utility Programs
RTPEG-32 Reference Manual
RTUSB-32
|
Determining the Position of an Object
One 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
}
Programming with RTPEG-32
Style Flags
Using Object Types
|