Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 3.4

COLUMN

Control Panel Library

Architecture

Issue: 3.4 (March/April 2005)
Author: Joe Nastasi
Author Bio: Joe Nastasi is the president of Pyramid Design, a software development firm and the developers of A-OK! Spacecraft Simulation System and FTP Suite.
Article Description: No description available.
Article Length (in bytes): 5,332
Starting Page Number: 38
Article Number: 3417
Related Link(s): None

Excerpt of article text...

In keeping with the theme of "a picture is worth a thousand words," I offer Figure 1, which illustrates how the control panel library treats a typical gauge (an altimeter in this case) internally. The panel background image is the furthest from the camera with a Z position of -4. Note that the actual values in the Z axis might vary depending on how many layers you have in your instruments. For example, if this were a 3 needle gauge, we'd need to make the panel's Z position -5 instead. The altimeter background image is next with a Z position of -3. The black background is part of the masking scheme and will be transparent when displayed. We'll discuss masking in a later issue.

Figure 1: Panel Elements

The next two images are the 100 and 1000 foot needles, occupying Z positions of -2 and -1, respectively. Finally, a center cap occupies Z position 0. The X and Y position of the altimeter elements determines the position of the instrument relative to the center of the control panel background. All elements have the same X and Y position values so that they remain centered when displayed.

Once the images are loaded as Object3Ds, the two needles can be rotated around the Z axis to simulate movement. In switches and indicators the situation is similar, except we simply replace one Object3D with another as the switch or indicator changes state. In this case, all the Object3Ds that represent a state are located at the same Z position; we simply toggle the Visible property as needed.

Panel Class

...End of Excerpt. Please purchase the magazine to read the full article.