Describes everything about the startup of the Renderer and the Resources. Setups the display mode and controls display mode shifts and loss of window focus. Some functionality is in the main Source1.cpp, however most logic is in this interface.
Startup Interface | Describes everything about the startup of the Renderer and the Resources. |
startup.cpp | |
Enumerations | |
MODE_TYP | Specifies what mode the program is running in |
STATE_TYP | Describes the current running mode. |
Macros | |
RGB10BIT_STRING | Used to force the compiler to write out the words RGB10BIT |
Types | |
SETTINGS | Alias for SETTINGS_TYP |
SETTINGS_PTR | Alias for a pointer to SETTINGS_TYP |
SETTINGS_TYP | This structure is more or less obsolete. |
Variables | |
Width | UINT The width of the display surface |
Height | UINT The height of the display surface |
IsWindowed | UINT Specifies whether the program is windowed or not |
IsActive | UINT Specifies wether the program is still active or not |
BackBufferFormat | UINT Specifies the exact type of the back buffer for D3D objects to know |
IsLogWindow | UINT Specifies wether a log window exists or not |
IsDebugWindow | UINT Specifies wether a debug control panel window exists or not |
dwD3DInitMode | DWORD Some options for the D3DInterface to use. |
VSync | UINT Determines wether VSync should be attempted or not |
bpp | UINT The Bits per Pixel of the display |
hz | UINT The Hertz the screen updates at. |
Mode | MODE_TYP The rendering mode requested |
hwndMain | HWND The main window |
CStartup | Interface to control and query the running state of the program. |
Constructors | |
CStartup | Simply increases the internal reference count |
~CStartup | Simply decreases the internal reference count |
Functions | |
ShowStartupDialog | Show the main startup dialog and save the results into the class. |
InitDevices | Initializes devices for the desired running mode. |
Shutdown | Shutdown all the interfaces. |
TestState | Tests the state of the devices for any changes. |
ProcessState | Processes the current state of the interface. |
TriggerTestState | If possible, puts the interface into STATE_TEST. |
DisplayModeShift | Puts the startup into a state to change the display mode from Fullscreen or Windowed. |
ResizeWindow | Resizes the back buffer to match a resized window. |
Access Functions | |
getState | Retrieves the state of the interface |
getMode | The current MODE_TYP |
getWidth | The current width of the window or back buffer |
getHeight | The current height of the window or back buffer |
getFSWidth | The stored fullscreen width of the backbuffer |
getFSHeight | The stored fullscreen height of the backbuffer |
getBpp | The bits per pixel for the current display mode. |
getHz | The current HZ the monitor is sync at. |
getBackBufferFormat | Specifies the exact type of the pixel format of the back buffer. |
getVSync | True if the display refresh rate is in sync with the monitor. |
Describes the current running mode. This is used in a finite state routine in the main program to keep the running mode valid and respond to changing in the environment.
Alias for SETTINGS_TYP
Alias for a pointer to SETTINGS_TYP
typedef struct SETTINGS_TYP
This structure is more or less obsolete. It has not been removed out of the initial startup procedures. All of the functions have been moved into CStartup. CStartup uses this structure to setup defaults.
Variables | |
Width | UINT The width of the display surface |
Height | UINT The height of the display surface |
IsWindowed | UINT Specifies whether the program is windowed or not |
IsActive | UINT Specifies wether the program is still active or not |
BackBufferFormat | UINT Specifies the exact type of the back buffer for D3D objects to know |
IsLogWindow | UINT Specifies wether a log window exists or not |
IsDebugWindow | UINT Specifies wether a debug control panel window exists or not |
dwD3DInitMode | DWORD Some options for the D3DInterface to use. |
VSync | UINT Determines wether VSync should be attempted or not |
bpp | UINT The Bits per Pixel of the display |
hz | UINT The Hertz the screen updates at. |
Mode | MODE_TYP The rendering mode requested |
hwndMain | HWND The main window |
DWORD dwD3DInitMode
DWORD Some options for the D3DInterface to use.
MODE_TYP Mode
MODE_TYP The rendering mode requested
class CStartup
Interface to control and query the running state of the program. Contains all information from the options dialog and allows the display to respond to windows environment changes.
The follow code controls the state. This should be in your main program. STATE_TYP StartupState; switch( StartupState = Startup.getState() ) { case STATE_RUN: break; case STATE_WAIT: case STATE_TEST: // Validate the running state if( ( StartupState = Startup.TestState() ) != STATE_RUN ) { if(bMainGate) LOG_INFO("Closing main gate because of state change"); bMainGate=false; } else { if(!bMainGate) LOG_INFO("Opening main gate because of successful state change"); bMainGate=true; } break; case STATE_ERROR: case STATE_SHUTDOWN: break; default: // Let startup process the problem if( ( StartupState = Startup.ProcessState() ) == STATE_RUN ) { if(!bMainGate) LOG_INFO("Opening main gate because of successful state change"); bMainGate=true; } break; }
Constructors | |
CStartup | Simply increases the internal reference count |
~CStartup | Simply decreases the internal reference count |
Functions | |
ShowStartupDialog | Show the main startup dialog and save the results into the class. |
InitDevices | Initializes devices for the desired running mode. |
Shutdown | Shutdown all the interfaces. |
TestState | Tests the state of the devices for any changes. |
ProcessState | Processes the current state of the interface. |
TriggerTestState | If possible, puts the interface into STATE_TEST. |
DisplayModeShift | Puts the startup into a state to change the display mode from Fullscreen or Windowed. |
ResizeWindow | Resizes the back buffer to match a resized window. |
Access Functions | |
getState | Retrieves the state of the interface |
getMode | The current MODE_TYP |
getWidth | The current width of the window or back buffer |
getHeight | The current height of the window or back buffer |
getFSWidth | The stored fullscreen width of the backbuffer |
getFSHeight | The stored fullscreen height of the backbuffer |
getBpp | The bits per pixel for the current display mode. |
getHz | The current HZ the monitor is sync at. |
getBackBufferFormat | Specifies the exact type of the pixel format of the back buffer. |
getVSync | True if the display refresh rate is in sync with the monitor. |
int InitDevices()
Initializes devices for the desired running mode. Handles the initalization of both the Renderer and the Resource Interfaces. It will catch exceptions thrown by the D3DInterface, DDrawInterface and the GDIInterface.
False if successful. Error code otherwise.
static void Shutdown()
Shutdown all the interfaces. Calls D3DInterface::ShutdownDevice, DDrawInterface::ShutdownInterface, GDIInterface::Shutdown, RSRC::Shutdown, and <RNDR::Shutdown>. Puts the class into mode STATE_SHUTDOWN.
STATE_TYP TestState()
Tests the state of the devices for any changes. If the STATE_TYP of the class is smaller than STATE_TEST it simply returns the state for later processing. Otherwise it changes the STATE_TYP to STATE_DISPLAY_REINIT_PENDING.
STATE_TYP Is the current state of the Startup Interface.
STATE_TYP ProcessState()
Processes the current state of the interface. It will run any required procedures to put the state back into STATE_RUN. However it may place the mode into a different mode, even STATE_ERROR depending on the needs.
STATE_TYP with the current mode after processing.
static STATE_TYP TriggerTestState()
If possible, puts the interface into STATE_TEST. If the STATE_TYP is already in a state below STATE_TEST, then it simple returns it.
STATE_TYP with the current mode after atempting to set STATE_TEST.
STATE_TYP DisplayModeShift( HWND LogWindow )
Puts the startup into a state to change the display mode from Fullscreen or Windowed. Also handles hiding and showing the log window if one exists.
LogWindow | The log window that should be hidden or shown, depending on options |
STATE_TYP of the current state of the startup interface.
static STATE_TYP ResizeWindow( int width, int height )
Resizes the back buffer to match a resized window. Puts the interface into a STATE_DISPLAY_REINIT_RESIZE.
width | The new width of the window |
height | The new height of the window |
STATE_TYP of the current state of the interface.
static STATE_TYP getState()
Retrieves the state of the interface
STATE_TYP with current state of the interface
UINT getBpp() const // Stores the bits per pixel
The bits per pixel for the current display mode. Could be 15,16,32, or RGB10BIT.
UINT with the bpp of the pixel format
This structure is more or less obsolete.
typedef struct SETTINGS_TYP
UINT The width of the display surface
UINT Width
UINT The height of the display surface
UINT Height
UINT Specifies whether the program is windowed or not
UINT IsWindowed
UINT Specifies wether the program is still active or not
UINT IsActive
UINT Specifies the exact type of the back buffer for D3D objects to know
UINT BackBufferFormat
UINT Specifies wether a log window exists or not
UINT IsLogWindow
UINT Specifies wether a debug control panel window exists or not
UINT IsDebugWindow
DWORD Some options for the D3DInterface to use.
DWORD dwD3DInitMode
This is the main interface into Direct3D.
class D3DInterface
UINT Determines wether VSync should be attempted or not
UINT VSync
UINT The Bits per Pixel of the display
UINT bpp
UINT The Hertz the screen updates at.
UINT hz
MODE_TYP The rendering mode requested
MODE_TYP Mode
HWND The main window
HWND hwndMain
Interface to control and query the running state of the program.
class CStartup
Simply increases the internal reference count
CStartup()
Simply decreases the internal reference count
~CStartup()
Show the main startup dialog and save the results into the class.
int ShowStartupDialog( HINSTANCE hinstance )
Initializes devices for the desired running mode.
int InitDevices()
Shutdown all the interfaces.
static void Shutdown()
Tests the state of the devices for any changes.
STATE_TYP TestState()
Processes the current state of the interface.
STATE_TYP ProcessState()
If possible, puts the interface into STATE_TEST.
static STATE_TYP TriggerTestState()
Puts the startup into a state to change the display mode from Fullscreen or Windowed.
STATE_TYP DisplayModeShift( HWND LogWindow )
Resizes the back buffer to match a resized window.
static STATE_TYP ResizeWindow( int width, int height )
Retrieves the state of the interface
static STATE_TYP getState()
The current MODE_TYP
MODE_TYP getMode() const
The current width of the window or back buffer
UINT getWidth() const
The current height of the window or back buffer
UINT getHeight() const
The stored fullscreen width of the backbuffer
UINT getFSWidth() const
The stored fullscreen height of the backbuffer
UINT getFSHeight() const
The bits per pixel for the current display mode.
UINT getBpp() const // Stores the bits per pixel
The current HZ the monitor is sync at.
UINT getHz() const // The hz the screen updates at
Specifies the exact type of the pixel format of the back buffer.
UINT getBackBufferFormat() const // Specifies the exact type of the back buffer
True if the display refresh rate is in sync with the monitor.
UINT getVSync() const // May not even be an option, but will include anyway
Controls DirectDraw and provides a common interface to all of its functions.
class DDrawInterface
Provides an interface to startup and shutdown the GDI+ Interface
class GDIInterface
Shutsdown all the D3D Interfaces.
static void ShutdownDevice()
Shutdown the interface.
static void ShutdownInterface()
Shutsdown GDI+.
static void Shutdown()
Shuts down the resource interface
void Shutdown()