![]() |
Collision Math Toy
Ian Parberry's "Introduction to Game Physics"
|
The dialog box class. More...
#include <DialogBox.h>
Public Member Functions | |
void | Initialize (CObjectManager *) |
Initialize the dialog box class. More... | |
void | Update () |
Update the dialog box at 1-second intervals. More... | |
void | UpdateLaunchCount () |
Update the launch count. More... | |
Static Public Member Functions | |
static BOOL CALLBACK | DlgProc (HWND, UINT, WPARAM, LPARAM) |
Dialog box procedure. More... | |
Static Private Member Functions | |
static int | GetEditBox (int) |
Get number from an edit box. More... | |
static void | SetEditBox (int, int) |
Set an edit box. More... | |
static void | InitEditBoxes (HWND) |
Initialize edit boxes. More... | |
static void | SetCheckbox (HWND, int, bool) |
Set check box. More... | |
static void | InitCheckBoxes (HWND) |
Initialize check boxes. More... | |
static void | InitRadioButtons (HWND) |
Initialize radio buttons. More... | |
static void | InitSpinControls (HWND) |
Initialize all spin controls. More... | |
static void | InitSpinControl (HWND, int, int, int) |
Init a spin control. More... | |
static LRESULT | GetSliderValue (HWND, int, LPARAM) |
Get value from slider. More... | |
Static Private Attributes | |
static CObjectManager * | m_pObjectManager = nullptr |
Pointer to the object manager. | |
Additional Inherited Members | |
![]() | |
static CRenderer * | m_pRenderer = nullptr |
Pointer to the renderer. | |
static CObjectManager * | m_pObjectManager = nullptr |
Pointer to the object manager. | |
static LParticleEngine2D * | m_pFrontParticleEngine = nullptr |
Pointer to front particle engine. | |
static LParticleEngine2D * | m_pBackParticleEngine = nullptr |
Pointer to front particle engine. | |
static bool | m_bShowTrack = false |
Show trail of breadcrumbs. | |
static bool | m_bShowReticles = false |
Show reticle at hit point. | |
static bool | m_bShowImpacts = false |
Draw dots at collision points. | |
static bool | m_bShowArrows = false |
Draw arrows for velocity vectors. | |
static bool | m_bShowTangents = false |
Draw arrows for tangents. | |
static bool | m_bShowSectors = false |
Draw arc sentinels and normals. | |
static bool | m_bShowAABBs = false |
Draw shape AABBs. | |
static bool | m_bShowLights = false |
Light up shapes on collision. | |
static bool | m_bRotate = false |
Rotate kinematic shapes. | |
static bool | m_bLaunch = false |
Launch a ball. | |
static bool | m_bMute = false |
Mute the sound. | |
static float | m_fNextBallScale = 0.5f |
Scale factor for ball size. | |
static int | m_nMIterationsInit = 4 |
Initial number of motion iterations. | |
static int | m_nCIterationsInit = 6 |
Initial number of collision iterations. | |
static int | m_nMIterations = CCommon::m_nMIterationsInit |
Current number of motion iterations. | |
static int | m_nCIterations = CCommon::m_nCIterationsInit |
Current number of collision iterations. | |
static bool | m_bUseQuadTree = false |
Whether to use a quadtree. | |
static HWND | m_hDlg = nullptr |
Control dialog box handle. | |
static float | m_fLoad = 0.0f |
Processor load. | |
static float | m_fLaunchSpeed = 1000.0f |
Speed at which the next ball will be launched. | |
static int | m_nDesiredLaunchCnt = 1 |
Number of balls to launch at next multilaunch. | |
static int | m_nLaunched = 0 |
Number of balls launched in current multilaunch. | |
static bool | m_bMultiLaunch = false |
Whether launching multiple balls. | |
static int | m_nBallsLaunched = 0 |
Number of balls in play. | |
static float | m_fFrequency = 60.0f*m_nMIterations |
Frequency, number of physics iterations per second. | |
This class encapsulates all of the nasty, ugly, crufty Windows API code needed for the care and feeding of a dialog box. Don't bother to look at it unless you are really motivated to learn how it works. Unfortunately, Windows message passing needs a C-style message handler, which we have to fake in C++ by making it a static function (CDialogBox::DlgProc
). That means that we have to make all of the functions it calls and member variables that they collectively access static too. That means that we have to make a static version of theobject manager pointer m_pObjectManager
inherited from CCommon
. Awkward.
|
static |
The Dialog Procedure processes messages from the controls on the dialog box, including radio buttons, check buttons, and edit boxes. This one's a monster, boys and girls, over 170 lines of straight-line code.
hDlg | Handle to the dialog box. |
iMsg | WM code for the message. |
wParam | Wparam. |
lParam | lParam. |
if
|
staticprivate |
Get integer value from an edit box, if something goes wrong then zero is returned, for better or for worse.
item | Id of an edit box. |
|
staticprivate |
If the LPARAM
value matches the handles of a slider, then get the slider's value.
hDlg | Handle to the dialog box. |
slider | Slider index. |
lParam | LPARAM value from message. |
|
staticprivate |
Set check boxes to initial values.
hDlg | Handle to the dialog box. |
|
staticprivate |
Set edit boxes to initial values.
hDlg | Handle to the dialog box. |
void CDialogBox::Initialize | ( | CObjectManager * | p | ) |
Initialize the dialog box.
p | Pointer to the object manager. |
|
staticprivate |
Set radio buttons to initial values.
hDlg | Handle to the dialog box. |
|
staticprivate |
Set the range for a spin control.
hDlg | Handle to the dialog box. |
n | Spin control. |
lo | Bottom of range. |
hi | Top of range. |
|
staticprivate |
Set the range of all spin controls.
hDlg | Handle to the dialog box. |
|
staticprivate |
Set the checkbox state, checked or unchecked.
hDlg | Handle to the dialog box. |
n | Check box. |
b | true to check the checkbox. |
|
staticprivate |
Set an edit box to a comma-separated integer value.
item | Id of an edit box. |
n | Number to put into the edit box. |
void CDialogBox::Update | ( | ) |
Update the edit boxes contained in the dialog box with interesting values only after a second has elapsed. Intended to be called from CGame
's ProcessFrame
function.
void CDialogBox::UpdateLaunchCount | ( | ) |
Immediately set the launch count edit box without waiting for the next update cycle.