home | |||
links |
|
||
developer's mag main page article part 1 part 2 part 3 part 4 part 5 part 6 part 7 part 8 part 9 |
4 - The CWindow CallsThe img_ functions still refer to the display as a whole, meaning that drawing on specific windows can be a problem. Not only is clipping lacking (which would prevent us from writing off the edge of a window), but there is no knowledge of window border sizes, meaning we have to calculate the offset for our calls to account for our window frame.A much easier solution is in the CWindow class, which wraps the img_ calls and includes additional safety checks:
The SDK documentation goes into these in some detail, but a few things should be noted. These functions are overloaded in many cases, allowing you to use either a RECT structure or four individual values. As well, they have various default values, making the use of them less complicated than they may first appear. The RECT structure deserves additional mentioning, since it can lead to some confusion for Windows programmers. In Windows the RECT structure looks like this: struct RECT { LONG left; LONG top; LONG right; LONG bottom; };The ebm uses a slightly different format and different names to define the structure: struct RECT { S16 x; S16 y; U16 width; U16 height; };This is an important distinction for programmers 'crossing over' - other systems may actually outline the rectangle with two points (top/left and bottom/right), while the ebm uses a single point with height and width values. Many problems in moving to ebm graphics coding arise from this assumption; however the problem is often easy to spot since usually only the bottom and right sides are misaligned. Previous Section Next Section |
||
Copyright © 2001-2006 ebmDevMag.com - Legal Notice |