// Build the menu void CMenuMouse::Build() { // Make sure to call the base class CMenuBase::Build(); CreateTitle("interface\\mainmenus\\options.pcx", IDS_MENU_TITLE_OPTIONS, m_pMainMenus->GetTitlePos()); SetOptionPos(m_pMainMenus->GetOptionsPos()); SetItemSpacing(5); SetScrollWrap(DFALSE); // Load the mouse settings LoadMouseSettings(); // Add the controls CLTGUISliderCtrl *pCtrl=AddSliderOption(IDS_MENU_MOUSE_SENSITIVITY, m_pMainMenus->GetSmallFont(), 100, m_pMainMenus->GetSurfaceSliderBar(), m_pMainMenus->GetSurfaceSliderTab(), &m_nMouseSensitivity); pCtrl->SetSliderRange(100, 1500); pCtrl->SetSliderIncrement(20); m_pInputRateCtrl=AddSliderOption(IDS_MENU_MOUSE_INPUTRATE, m_pMainMenus->GetSmallFont(), 100, m_pMainMenus->GetSurfaceSliderBar(), m_pMainMenus->GetSurfaceSliderTab(), &m_nInputRate); m_pInputRateCtrl->SetSliderIncrement(2); m_pInputRateCtrl->SetSliderRange(0, 40); AddOnOffOption(IDS_MENU_MOUSE_INVERT_YAXIS, m_pMainMenus->GetSmallFont(), 100, &m_bInvertYAxis); AddOnOffOption(IDS_MENU_MOUSE_MOUSELOOK, m_pMainMenus->GetSmallFont(), 100, &m_bMouseLook); AddOnOffOption(IDS_MENU_MOUSE_LOOKSPRING, m_pMainMenus->GetSmallFont(), 100, &m_bLookSpring); AddOnOffOption(IDS_MENU_MOUSE_USEWHEEL, m_pMainMenus->GetSmallFont(), 100, &m_bUseWheel); UpdateData(DFALSE); SetInputRateText(); }
// Build the axis menus void CMenuJoystick::BuildAxisMenus() { // Add the menu options AddOnOffOption(IDS_MENU_JOYSTICK_USE, m_pMainMenus->GetSmallFont(), 100, &m_bUseJoystick); CLTGUITextItemCtrl *pTitleCtrl=DNULL; // Turn menu options pTitleCtrl=AddTextItemOption(IDS_MENU_JOYSTICK_TURNLEFTRIGHTAXIS, 0, m_pMainMenus->GetSmallFont()); pTitleCtrl->SetColor(SETRGB(220,190,170), SETRGB(125,30,0), SETRGB(0,255,255)); if (pTitleCtrl) pTitleCtrl->Enable(DFALSE); m_pAxisTurn->Build(m_pClientDE, this); // Look menu options pTitleCtrl=AddTextItemOption(IDS_MENU_JOYSTICK_LOOKUPDOWNAXIS, 0, m_pMainMenus->GetSmallFont()); pTitleCtrl->SetColor(SETRGB(220,190,170), SETRGB(125,30,0), SETRGB(0,255,255)); if (pTitleCtrl) pTitleCtrl->Enable(DFALSE); m_pAxisLook->Build(m_pClientDE, this); // Move menu options pTitleCtrl=AddTextItemOption(IDS_MENU_JOYSTICK_MOVEFORWARDBACKWARDAXIS, 0, m_pMainMenus->GetSmallFont()); pTitleCtrl->SetColor(SETRGB(220,190,170), SETRGB(125,30,0), SETRGB(0,255,255)); if (pTitleCtrl) pTitleCtrl->Enable(DFALSE); m_pAxisMove->Build(m_pClientDE, this); // Strafe menu options pTitleCtrl=AddTextItemOption(IDS_MENU_JOYSTICK_STRAFELEFTRIGHTAXIS, 0, m_pMainMenus->GetSmallFont()); pTitleCtrl->SetColor(SETRGB(220,190,170), SETRGB(125,30,0), SETRGB(0,255,255)); if (pTitleCtrl) pTitleCtrl->Enable(DFALSE); m_pAxisStrafe->Build(m_pClientDE, this); m_pUsePovHat = AddOnOffOption(IDS_MENU_JOYSTICK_HATONOFF, m_pMainMenus->GetSmallFont(), 100, &m_bUsePovHat); }
// Wrapper for adding a control with a string ID instead of an HSTRING CLTGUIOnOffCtrl *CMenuBase::AddOnOffOption(int messageCode, CLTGUIFont *pFont, int nRightColumnOffset, DBOOL *pbValue) { // Load the string HSTRING hString=DNULL; if (messageCode) { hString=m_pClientDE->FormatString(messageCode); } // Create the control CLTGUIOnOffCtrl *pCtrl=AddOnOffOption(hString, pFont, nRightColumnOffset, pbValue); // Free the string if (hString) { m_pClientDE->FreeString(hString); } return pCtrl; }