Graphics Reference
In-Depth Information
struct UWB _ IWindowHandler {
A: Working with Graphics and GUI API
virtual bool IsGraphicsDeviceValid() = 0;
virtual bool InitializeHandler(HWND hAttachedWindow)=0;
virtual void ShutDownHandler()=0;
.. B: View component functionality
Source file.
uwbgl _ IWindowHandler.h file
in the Common Files/Win-
dowHandler subfolder of the
UWBGL _ D3D _ Lib1 project.
// Support drawing
virtual void BeginDraw()=0;
virtual void EndDrawAndShow()=0;
virtual void DrawGraphics()=0;
.. C: Controller component functionality
virtual void OnMouseButton( bool down, unsigned int nFlags, int hwX, int hwY)=0;
virtual void OnMouseMove( unsigned int nFlags, int hwX, int hwY)=0;
};
Listing 5.5. The UWB _ IWindowHandler class (Tutorial 5.1).
The files in the Header Files and the D3D Files folders are specific to the D3D
library. The files in the Common Files folder are shared between OGL and D3D
graphics libraries. There are four files in the Common Files folder.
uwbgl _ Common.h . This header file defines general constants (e.g., pi),
macros (e.g. degree-to-radian conversion), and compilation parameters. We
will not change this file.
UWB _ IWindowHandler .
The I in front of the
IWindowHandler signifies
this is an interface ,orapure
virtual class. Once again, for
readability we will refer to this
class as IWindowHandler .
uwbgl _ IWindowHandler.h (in CommonFiles/WindowHandler subfolder).
This file defines the UWB _ IWindowHandler class, a pure abstract descrip-
tion encapsulating the view/controller pair functionality of the MVC frame-
work. This is the class illustrated in Figure 5.4. Listing 5.5 shows the pure
virtual functions defined in the IWindowHandler class.
We can identify
three major categories of functionality:
- (A) Graphics and GUI API. As illustrated in Figure 5.4, this class is
responsible for establishing the connection between graphics and GUI
APIs. These functions are for proper initialization and shut down of
these two APIs.
- (B) View component. These are graphics API functionality, for draw-
ing and for transformation.
Search WWH ::




Custom Search