Collision Math Toy
Game Physics with Bespoke Code
Loading...
Searching...
No Matches
CDialogBox Class Reference

The dialog box class. More...

#include <DialogBox.h>

Inheritance diagram for CDialogBox:
Collaboration diagram for CDialogBox:

Public Member Functions

 CDialogBox ()
 Constructor.
 
void Update ()
 Update the dialog box at 1-second intervals.
 
void UpdateLaunchCount ()
 Update the launch count.
 

Static Public Member Functions

static BOOL CALLBACK DlgProc (HWND, UINT, WPARAM, LPARAM)
 Dialog box procedure.
 

Static Private Member Functions

static int GetEditBox (int)
 Get number from an edit box.
 
static void SetEditBox (int, int)
 Set an edit box.
 
static void InitEditBoxes (HWND)
 Initialize edit boxes.
 
static void SetCheckbox (HWND, int, bool)
 Set check box.
 
static void InitCheckBoxes (HWND)
 Initialize check boxes.
 
static void InitRadioButtons (HWND)
 Initialize radio buttons.
 
static void InitSpinControls (HWND)
 Initialize all spin controls.
 
static void InitSpinControl (HWND, int, int, int)
 Init a spin control.
 
static LRESULT GetSliderValue (HWND, int, LPARAM)
 Get value from slider.
 

Additional Inherited Members

- Static Protected Attributes inherited from CCommon
static Sage::CSpriteRenderer * m_pRenderer = nullptr
 Pointer to the renderer.
 
static CObjectManagerm_pObjectManager = nullptr
 Pointer to the object manager.
 
static Sage::CParticleEngine2D * m_pFrontParticleEngine = nullptr
 Ptr to front particle engine.

 
static Sage::CParticleEngine2D * m_pBackParticleEngine = nullptr
 Ptr to back 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ CDialogBox()

CDialogBox::CDialogBox ( )

Create and initialize the dialog box.

Here is the call graph for this function:

Member Function Documentation

◆ DlgProc()

BOOL CALLBACK CDialogBox::DlgProc ( HWND hDlg,
UINT iMsg,
WPARAM wParam,
LPARAM lParam )
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 with over 170 lines of straight-line code.

Parameters
hDlgHandle to the dialog box.
iMsgWM code for the message.
wParamWparam.
lParamlParam.
Returns
TRUE if the user quits.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEditBox()

int CDialogBox::GetEditBox ( int item)
staticprivate

Get integer value from an edit box, if something goes wrong then zero is returned, for better or for worse.

Parameters
itemId of an edit box.
Returns
Value from that edit box, 0 if there was an error.
Here is the caller graph for this function:

◆ GetSliderValue()

LRESULT CDialogBox::GetSliderValue ( HWND hDlg,
int slider,
LPARAM lParam )
staticprivate

If the LPARAM value matches the handles of a slider, then get the slider's value.

Parameters
hDlgHandle to the dialog box.
sliderSlider index.
lParamLPARAM value from message.
Returns
Value of slider if it matches the LPARAM, 0 otherwise.
Here is the caller graph for this function:

◆ InitCheckBoxes()

void CDialogBox::InitCheckBoxes ( HWND hDlg)
staticprivate

Set check boxes to initial values.

Parameters
hDlgHandle to the dialog box.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitEditBoxes()

void CDialogBox::InitEditBoxes ( HWND hDlg)
staticprivate

Set edit boxes to initial values.

Parameters
hDlgHandle to the dialog box.
Here is the caller graph for this function:

◆ InitRadioButtons()

void CDialogBox::InitRadioButtons ( HWND hDlg)
staticprivate

Set radio buttons to initial values.

Parameters
hDlgHandle to the dialog box.
Here is the caller graph for this function:

◆ InitSpinControl()

void CDialogBox::InitSpinControl ( HWND hDlg,
int n,
int lo,
int hi )
staticprivate

Set the range for a spin control.

Parameters
hDlgHandle to the dialog box.
nSpin control.
loBottom of range.
hiTop of range.
Here is the caller graph for this function:

◆ InitSpinControls()

void CDialogBox::InitSpinControls ( HWND hDlg)
staticprivate

Set the range of all spin controls.

Parameters
hDlgHandle to the dialog box.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetCheckbox()

void CDialogBox::SetCheckbox ( HWND hDlg,
int n,
bool b )
staticprivate

Set the checkbox state, checked or unchecked.

Parameters
hDlgHandle to the dialog box.
nCheck box.
btrue to check the checkbox.
Here is the caller graph for this function:

◆ SetEditBox()

void CDialogBox::SetEditBox ( int item,
int n )
staticprivate

Set an edit box to a comma-separated integer value.

Parameters
itemId of an edit box.
nNumber to put into the edit box.
Here is the caller graph for this function:

◆ Update()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateLaunchCount()

void CDialogBox::UpdateLaunchCount ( )

Immediately set the launch count edit box without waiting for the next update cycle.

Here is the call graph for this function:
Here is the caller graph for this function: