|
||
Putting It All Together |
||||||||||||||||||||||
Overview
The essence of SilverEngine usage is to render SilverScreen screens into Windows windows. In order to do this, the sdc_open function is used to make a connection between SilverScreen and Windows. It is important to remember that the application is responsible for maintaining device display; SilverEngine should be used to generate bitmaps for display refresh.
|
||||||||||||||||||||||
Making the Connection
sdc_open has as its parameter a pointer to a SDCInitStruct, which contains as its members a window handle (HWND) and two associated device context handles (HDCs). The first HDC is referred to as the draw context, and represents the actual display surface, usually a window on the screen. The second HDC is referred to as the refresh context, and represents a backing bitmap for the first device context. The intent is that you get SilverScreen to render to your refresh DC, and then you update the display (draw DC) from the refresh DC. By doing so, any type of SilverScreen display, whether wireframe, hidden-line, or other hidden-surface rendering, may be refreshed correctly onto the display DC.
|
||||||||||||||||||||||
Managing the Connection
sdc_open returns an handle of type SDC which may be used to refer to the connection you’ve made in subsequent calls to sdc_goto or sdc_close. sdc_goto is particularly useful for ensuring that the proper SDC is active when repainting a particular screen. Typically, before you repaint or render the contents of a screen, you would perform the following sequence:
|
||||||||||||||||||||||
A Note on Screens
Screen size is a very important concept to keep straight in SilverEngine, as it is used in calculating viewing parameters and also in display refresh. Screen size is currently maintained as a single set of variables in SilverEngine – all screens are assumed to be the same size. Since the developer is in control of the windows that are mapped to SilverEngine screens, it is up to the developer to ensure that SilverEngine remains informed as to the proper screen size. This is done by using the function screen_resize. screen_resize sets the global screen size maintained by SilverEngine. screen_resize should be called before causing a screen or window to be repainted, especially in cases where the screen’s window may have been resized since the previous repaint, or when switching between different sized windows in your application. |
||||||||||||||||||||||
Closing the Connection
When you are finished using a particular SilverEngine connection, as would be the case when you are closing its associated window or view, then you should close it by using the sdc_close function. |
||||||||||||||||||||||