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
|
Application Program Structure
An RTPEG-32 program's main function should perform the following steps:
- If RTKernel-32 is used, RTKernelInit() should be called first.
- A screen device driver (a PegScreen object) must be created.
- Objects PegMessageQueue and PegPresentationManager must be created. This is done by calling function PegInitialize().
- If mouse support is desired, the RTTarget-32 mouse driver must be initialized.
- All initial UI objects such as windows and control must be added to the PegPresentationManager. This will typically be done by function PegAppInitialize().
- Multithreaded applications can create additional threads at this point.
- The RTPEG-32 message loop is executed by calling PegExecute. Function PegExecute will not return before the application has terminated.
Example:
int main(void)
{
PegScreen * pScreen = CreatePegScreen_VESA_8();
PegPresentationManager * pPresent =
PegInitialize(pScreen, sizeof(class PegScreen));
RTInitMouse(-1, 12, 0, 5, 5); // this is for a PS2 mouse
RTSetMousePos(pScreen->GetXRes() / 2, pScreen->GetYRes() / 2);
PegAppInitialize(pPresent);
PegExecute(pPresent);
RTMouseDone();
return 0;
}
void PegAppInitialize(PegPresentationManager * pPresentation)
{
PegRect Rect;
Rect.Set(0, 0, 399, 319);
RobotFrame * pFrame = new RobotFrame(Rect);
pPresentation->Center(pFrame);
pPresentation->Add(pFrame);
}
Programming with RTPEG-32
Rules Of Memory Ownership
|