// Build the screen LTBOOL CScreenAudio::Build() { CreateTitle(IDS_TITLE_SOUND); kGap = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_AUDIO,"ColumnWidth"); kWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_AUDIO,"SliderWidth"); uint32 dwAdvancedOptions = g_pInterfaceMgr->GetAdvancedOptions(); m_bMusicEnabled = (dwAdvancedOptions & AO_MUSIC); //background frame LTRect frameRect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_AUDIO,"FrameRect"); LTIntPt pos(frameRect.left,frameRect.top); int nHt = frameRect.bottom - frameRect.top; int nWd = frameRect.right - frameRect.left; char szFrame[128]; g_pLayoutMgr->GetScreenCustomString(SCREEN_ID_AUDIO,"FrameTexture",szFrame,sizeof(szFrame)); HTEXTURE hFrame = g_pInterfaceResMgr->GetTexture(szFrame); CLTGUIFrame *pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame,nWd,nHt+8,LTTRUE); pFrame->SetBasePos(pos); pFrame->SetBorder(2,m_SelectedColor); AddControl(pFrame); m_pSoundVolumeCtrl=AddSlider(IDS_SOUND_FXVOL, IDS_HELP_SOUNDVOL, kGap, kWidth, -1, &m_nSoundVolume); m_pSoundVolumeCtrl->Enable( (dwAdvancedOptions & AO_SOUND) ); m_pSoundVolumeCtrl->SetSliderRange(SOUND_MIN_VOL, SOUND_MAX_VOL); m_pSoundVolumeCtrl->SetSliderIncrement(SOUND_SLIDER_INC); m_pSpeechVolumeCtrl=AddSlider(IDS_SPEECH_FXVOL, IDS_HELP_SPEECHVOL, kGap, kWidth, -1, &m_nSpeechVolume); m_pSpeechVolumeCtrl->Enable( (dwAdvancedOptions & AO_SOUND) ); m_pSpeechVolumeCtrl->SetSliderRange(SPEECH_MIN_VOL, SPEECH_MAX_VOL); m_pSpeechVolumeCtrl->SetSliderIncrement(SPEECH_SLIDER_INC); m_pSoundQualityCtrl=AddToggle(IDS_SOUND_QUALITY, IDS_HELP_SOUNDQUAL, kGap, &m_bSoundQuality); m_pSoundQualityCtrl->SetOnString(LoadTempString(IDS_SOUND_HIGH)); m_pSoundQualityCtrl->SetOffString(LoadTempString(IDS_SOUND_LOW)); m_pSoundQualityCtrl->Enable( (dwAdvancedOptions & AO_SOUND) ); m_pMusicVolumeCtrl = AddSlider(IDS_SOUND_MUSICVOL, IDS_HELP_MUSICVOL, kGap, kWidth, -1, &m_nMusicVolume); m_pMusicVolumeCtrl->Enable( (dwAdvancedOptions & AO_MUSIC) ); m_pMusicVolumeCtrl->SetSliderRange(MUSIC_MIN_VOL, MUSIC_MAX_VOL); m_pMusicVolumeCtrl->SetSliderIncrement(MUSIC_SLIDER_INC); m_pMusicQualityCtrl=AddToggle(IDS_MUSIC_QUALITY, IDS_HELP_MUSIC_QUALITY, kGap, &m_bMusicQuality); m_pMusicQualityCtrl->SetOnString(LoadTempString(IDS_SOUND_HIGH)); m_pMusicQualityCtrl->SetOffString(LoadTempString(IDS_SOUND_LOW)); m_pMusicQualityCtrl->Enable( (dwAdvancedOptions & AO_MUSIC) ); // Make sure to call the base class if (! CBaseScreen::Build()) return LTFALSE; UseBack(LTTRUE,LTTRUE); return LTTRUE; }
// Build the screen LTBOOL CScreenGame::Build() { CreateTitle(IDS_TITLE_GAME_OPTIONS); kGap = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_GAME,"ColumnWidth"); kWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_GAME,"SliderWidth"); //background frame LTRect frameRect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_GAME,"FrameRect"); LTIntPt pos(frameRect.left,frameRect.top); int nHt = frameRect.bottom - frameRect.top; int nWd = frameRect.right - frameRect.left; char szFrame[128]; g_pLayoutMgr->GetScreenCustomString(SCREEN_ID_GAME,"FrameTexture",szFrame,sizeof(szFrame)); HTEXTURE hFrame = g_pInterfaceResMgr->GetTexture(szFrame); CLTGUIFrame *pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame,nWd,nHt+8,LTTRUE); pFrame->SetBasePos(pos); pFrame->SetBorder(2,m_SelectedColor); AddControl(pFrame); //crosshair menu AddTextItem(IDS_CONTROLS_CROSSHAIR, CMD_CROSSHAIR, IDS_HELP_CROSSHAIRMENU); CLTGUICycleCtrl* pCycle = AddCycle(IDS_DISPLAY_SUBTITLES,IDS_HELP_SUBTITLES,kGap,&m_nSubtitles); char szTmp[64]; FormatString(IDS_OFF,szTmp,sizeof(szTmp)); pCycle->AddString(szTmp); FormatString(IDS_ON,szTmp,sizeof(szTmp)); pCycle->AddString(szTmp); CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile(); if (pProfile && !g_pVersionMgr->IsLowViolence()) { CLTGUIToggle *pGore = AddToggle(IDS_DISPLAY_GORE,IDS_HELP_GORE,kGap,&m_bGore); } char szYes[16]; char szNo[16]; FormatString(IDS_YES,szYes,sizeof(szYes)); FormatString(IDS_NO,szNo,sizeof(szNo)); //always run CLTGUIToggle* pToggle = AddToggle(IDS_ADVCONTROLS_RUNLOCK, IDS_HELP_RUNLOCK, kGap, &m_bAlwaysRun ); pToggle->SetOnString(szYes); pToggle->SetOffString(szNo); // Add the Difficulty option m_pDifficultyCtrl = AddCycle(IDS_DIFFICULTY,IDS_HELP_DIFFICULTY,kGap,&m_nDifficulty); FormatString(IDS_NEW_EASY,szTmp,sizeof(szTmp)); m_pDifficultyCtrl->AddString(szTmp); FormatString(IDS_NEW_MEDIUM,szTmp,sizeof(szTmp)); m_pDifficultyCtrl->AddString(szTmp); FormatString(IDS_NEW_HARD,szTmp,sizeof(szTmp)); m_pDifficultyCtrl->AddString(szTmp); FormatString(IDS_NEW_INSANE,szTmp,sizeof(szTmp)); m_pDifficultyCtrl->AddString(szTmp); /* pCycle = AddCycle(IDS_HUDLAYOUT,IDS_HELP_HUDLAYOUT,kGap,&m_nLayout); for (int hl = 0; hl < g_pLayoutMgr->GetNumHUDLayouts(); hl++) { char szTmpBuffer[128]; FormatString(g_pLayoutMgr->GetLayoutName(hl),szTmpBuffer,sizeof(szTmpBuffer)); pCycle->AddString(szTmpBuffer); } */ CLTGUISlider *pSlider=AddSlider(IDS_HEADBOB, IDS_HELP_HEADBOB, kGap, kWidth, -1, &m_nHeadBob); pSlider->SetSliderRange(0, 10); pSlider->SetSliderIncrement(1); pSlider=AddSlider(IDS_WEAPONSWAY, IDS_HELP_WEAPONSWAY, kGap, kWidth, -1, &m_nWeaponSway); pSlider->SetSliderRange(0, 10); pSlider->SetSliderIncrement(1); pSlider=AddSlider(IDS_PICKUP_MSG_DUR, IDS_HELP_PICKUP_MSG_DUR, kGap, kWidth, -1, &m_nMsgDur); pSlider->SetSliderRange(1, 10); pSlider->SetSliderIncrement(1); pToggle = AddToggle(IDS_AUTOSWITCH_WEAPONS, IDS_HELP_AUTOSWITCH_WEAPONS, kGap, &m_bAutoWeaponSwitch ); pToggle->SetOnString(szYes); pToggle->SetOffString(szNo); pToggle = AddToggle(IDS_LOAD_TIPS, IDS_HELP_LOAD_TIPS, kGap, &m_bLoadScreenTips ); pToggle->SetOnString(LoadTempString(IDS_ON)); pToggle->SetOffString(LoadTempString(IDS_OFF)); pToggle = AddToggle(IDS_CONTOUR, IDS_HELP_CONTOUR, kGap, &m_bVehicleContour ); pToggle->SetOnString(LoadTempString(IDS_ON)); pToggle->SetOffString(LoadTempString(IDS_OFF)); // Make sure to call the base class if (! CBaseScreen::Build()) return LTFALSE; UseBack(LTTRUE,LTTRUE); return LTTRUE; }
// Build the screen LTBOOL CScreenCrosshair::Build() { CreateTitle(IDS_TITLE_CROSSHAIR); kGap = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_CROSSHAIR,"ColumnWidth"); kWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_CROSSHAIR,"SliderWidth"); char szYes[16]; char szNo[16]; FormatString(IDS_YES,szYes,sizeof(szYes)); FormatString(IDS_NO,szNo,sizeof(szNo)); //background frame LTRect frameRect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_CROSSHAIR,"FrameRect"); LTIntPt pos(frameRect.left,frameRect.top); int nHt = frameRect.bottom - frameRect.top; int nWd = frameRect.right - frameRect.left; char szFrame[128]; g_pLayoutMgr->GetScreenCustomString(SCREEN_ID_CROSSHAIR,"FrameTexture",szFrame,sizeof(szFrame)); HTEXTURE hFrame = g_pInterfaceResMgr->GetTexture(szFrame); CLTGUIFrame *pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame,nWd,nHt+8,LTTRUE); pFrame->SetBasePos(pos); pFrame->SetBorder(2,m_SelectedColor); AddControl(pFrame); CLTGUISlider *pSlider = AddSlider(IDS_CH_R, IDS_HELP_CH_R, kGap, kWidth, -1, &m_nColorR); pSlider->SetSliderRange(15,255); pSlider->SetSliderIncrement(16); pSlider = AddSlider(IDS_CH_G, IDS_HELP_CH_G, kGap, kWidth, -1, &m_nColorG); pSlider->SetSliderRange(15,255); pSlider->SetSliderIncrement(16); pSlider = AddSlider(IDS_CH_B, IDS_HELP_CH_B, kGap, kWidth, -1, &m_nColorB); pSlider->SetSliderRange(15,255); pSlider->SetSliderIncrement(16); CLTGUIToggle* pToggle = AddToggle(IDS_CH_DYNAMIC, IDS_HELP_CH_DYNAMIC, kGap, &m_bDynamic ); m_pStyle = AddCycle(IDS_CH_STYLE,IDS_HELP_CH_STYLE,kGap,&m_nStyle); char szTmp[kMaxStringBuffer]; uint8 style = 0; char *szTag = "HUDCrosshair"; char szAtt[32]; sprintf(szAtt,"Crosshair%d",style); while (g_pLayoutMgr->HasValue(szTag,szAtt)) { g_pLayoutMgr->GetString(szTag,szAtt,szTmp,sizeof(szTmp)); strcat(szTmp,"_A.dtx"); m_styles.push_back(szTmp); sprintf(szTmp,"%d",style); // m_pStyle->AddString(szTmp); m_pStyle->AddString(" "); style++; sprintf(szAtt,"Crosshair%d",style); } g_pDrawPrim->SetRGBA(&m_Poly,argbWhite); // Make sure to call the base class if (! CBaseScreen::Build()) return LTFALSE; UseBack(LTTRUE,LTTRUE); return LTTRUE; }
// Build the screen LTBOOL CScreenDisplay::Build() { CreateTitle(IDS_TITLE_DISPLAYOPTIONS); kGap = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_DISPLAY,"ColumnWidth"); kWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_DISPLAY,"SliderWidth"); //background frame LTRect frameRect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_DISPLAY,"FrameRect"); LTIntPt pos(frameRect.left,frameRect.top); int nHt = frameRect.bottom - frameRect.top; int nWd = frameRect.right - frameRect.left; char szFrame[128]; g_pLayoutMgr->GetScreenCustomString(SCREEN_ID_DISPLAY,"FrameTexture",szFrame,sizeof(szFrame)); HTEXTURE hFrame = g_pInterfaceResMgr->GetTexture(szFrame); CLTGUIFrame *pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame,nWd,nHt+8,LTTRUE); pFrame->SetBasePos(pos); pFrame->SetBorder(2,m_SelectedColor); AddControl(pFrame); // Build the array of renderers GetRendererData(); // Add the "resolution" control m_pResolutionCtrl = AddCycle(IDS_DISPLAY_RESOLUTION,IDS_HELP_RESOLUTION,kGap); // Setup the resolution control based on the current renderer SetupResolutionCtrl(); m_pHardwareCursor = AddToggle(IDS_HARDWARE_CURSOR,IDS_HELP_HARDWARE_CURSOR,kGap,&m_bHardwareCursor); AddToggle(IDS_VSYNC,IDS_HELP_VSYNC,kGap,&m_bVSync); m_pGamma = AddSlider(IDS_GAMMA,IDS_HELP_GAMMA,kGap,kWidth,-1,&m_nGamma); m_pGamma->SetSliderRange(0,kNumSteps); m_pGamma->SetSliderIncrement(1); int nBaseGamma = ConvertToSlider(1.0f); float xoffset = (m_pGamma->CalculateSliderOffset(nBaseGamma) / m_pGamma->GetScale()); uint16 nHeight = m_pGamma->GetBarHeight(); float yoffset = ((( (float)m_pGamma->GetBaseHeight()) - (float)nHeight)) / 2.0f; pos = m_pGamma->GetBasePos(); pos.x += (int)(xoffset - 1.0f); pos.y += (int)(yoffset + 0.5f); CLTGUIFrame *pBar = debug_new(CLTGUIFrame); pBar->Create(0xBF000000,3,nHeight+1); pBar->SetBasePos(pos); pBar->SetScale(g_pInterfaceResMgr->GetXRatio()); AddControl(pBar); // Make sure to call the base class if (!CBaseScreen::Build()) return LTFALSE; UseBack(LTTRUE,LTTRUE); return LTTRUE; }
// Build the screen bool CScreenAudio::Build() { CreateTitle("IDS_TITLE_SOUND"); kGap = g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenColumnWidths,0); kWidth = g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenColumnWidths,1); uint32 dwAdvancedOptions = g_pInterfaceMgr->GetAdvancedOptions(); SoundCapabilities SoundCaps; g_pLTClient->SoundMgr()->GetSoundCapabilities(&SoundCaps); //background frame CLTGUICtrl_create cs; cs.rnBaseRect = g_pLayoutDB->GetRect(m_hLayout,LDB_ScreenFrameRect,0); TextureReference hFrame(g_pLayoutDB->GetString(m_hLayout,LDB_ScreenFrameTexture)); CLTGUIFrame *pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame,cs); AddControl(pFrame); cs.rnBaseRect = g_pLayoutDB->GetRect(m_hLayout,LDB_ScreenFrameRect,1); hFrame.Load(g_pLayoutDB->GetString(m_hLayout,LDB_ScreenAddTex,0)); pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame,cs,true); AddControl(pFrame); m_DefaultPos = m_ScreenRect.m_vMin; CLTGUISlider_create scs; scs.rnBaseRect.m_vMin.Init(); scs.rnBaseRect.m_vMax = LTVector2n(kGap+kWidth,g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); scs.nBarOffset = kGap; scs.szHelpID = "IDS_HELP_SOUNDVOL"; scs.pnValue = &m_nSoundVolume; scs.nMin = 0; scs.nMax = 100; scs.nIncrement = 5; m_pSoundVolumeCtrl= AddSlider("IDS_SOUND_FXVOL", scs ); m_pSoundVolumeCtrl->Enable( !!(dwAdvancedOptions & AO_SOUND) ); scs.szHelpID = "IDS_HELP_SPEECHVOL"; scs.pnValue = &m_nSpeechVolume; m_pSpeechVolumeCtrl= AddSlider("IDS_SPEECH_FXVOL", scs ); m_pSpeechVolumeCtrl->Enable( !!(dwAdvancedOptions & AO_SOUND) ); scs.szHelpID = "IDS_HELP_MUSICVOL"; scs.pnValue = &m_nMusicVolume; m_pMusicVolumeCtrl= AddSlider("IDS_SOUND_MUSICVOL", scs ); m_pMusicVolumeCtrl->Enable( !!(dwAdvancedOptions & AO_SOUND) ); CLTGUIToggle_create tcs; tcs.rnBaseRect.m_vMin.Init(); tcs.rnBaseRect.m_vMax = LTVector2n(m_ScreenRect.GetWidth(),g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); tcs.szHelpID = "IDS_HELP_SOUND_USE_HW"; tcs.pbValue = &m_bHWSoundsEnable; tcs.nHeaderWidth = kGap; // Enable HW Sounds m_pHWSoundsEnableCtrl= AddToggle("IDS_SOUND_USE_HW", tcs ); m_pHWSoundsEnableCtrl->Enable( !!(dwAdvancedOptions & AO_SOUND) && SoundCaps.bSupportsHWSounds); // Use EAX tcs.szHelpID = "IDS_HELP_SOUND_USE_EAX"; tcs.pbValue = &m_bEAXEnable; m_pEAXEnableCtrl= AddToggle("IDS_SOUND_USE_EAX", tcs ); m_pEAXEnableCtrl->Enable( !!(dwAdvancedOptions & AO_SOUND) && SoundCaps.bSupportsEAX); // Use EAX 4.0, if available tcs.szHelpID = "IDS_HELP_SOUND_USE_EAX4"; tcs.pbValue = &m_bEAX4Enable; m_pEAX4EnableCtrl= AddToggle("IDS_SOUND_USE_EAX4", tcs ); m_pEAX4EnableCtrl->Enable( !!(dwAdvancedOptions & AO_SOUND) && SoundCaps.bSupportsEAX4); // Make sure to call the base class if (! CBaseScreen::Build()) return false; UseBack(true,true); return true; }
// Build the screen bool CScreenGame::Build() { CreateTitle("IDS_TITLE_GAME_OPTIONS"); kGap = g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenColumnWidths,0); kWidth = g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenColumnWidths,1); kTextWidth = g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenColumnWidths,2); //background frame CLTGUICtrl_create cs; cs.rnBaseRect = g_pLayoutDB->GetRect(m_hLayout,LDB_ScreenFrameRect); TextureReference hFrame(g_pLayoutDB->GetString(m_hLayout,LDB_ScreenFrameTexture)); CLTGUIFrame *pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame,cs); AddControl(pFrame); m_DefaultPos = m_ScreenRect.m_vMin; //crosshair menu cs.rnBaseRect.m_vMin.Init(); cs.rnBaseRect.m_vMax = LTVector2n(m_ScreenRect.GetWidth(),g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); cs.nCommandID = CMD_CROSSHAIR; cs.szHelpID = "IDS_HELP_CROSSHAIRMENU"; AddTextItem("IDS_CONTROLS_CROSSHAIR", cs); CLTGUIToggle_create tcs; tcs.nHeaderWidth = kGap; CLTGUIToggle *pToggle = NULL; #if !defined(_DEMO) || defined(_SPDEMO) tcs.rnBaseRect.m_vMin.Init(); tcs.rnBaseRect.m_vMax = LTVector2n(m_ScreenRect.GetWidth(),g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); tcs.szHelpID = "IDS_HELP_SUBTITLES"; tcs.pbValue = &m_bSubtitles; pToggle = AddToggle("IDS_DISPLAY_SUBTITLES", tcs); pToggle->SetOnString(LoadString("IDS_ON")); pToggle->SetOffString(LoadString("IDS_OFF")); #endif const wchar_t* szYes = LoadString( "IDS_YES" ); const wchar_t* szNo = LoadString( "IDS_NO" ); tcs.rnBaseRect.m_vMin.Init(); tcs.rnBaseRect.m_vMax = LTVector2n(m_ScreenRect.GetWidth(),g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile(); if (pProfile && !g_pVersionMgr->IsLowViolence()) { tcs.szHelpID = "IDS_HELP_GORE"; tcs.pbValue = &m_bGore; tcs.nHeaderWidth = kGap; CLTGUIToggle *pGore = AddToggle("IDS_DISPLAY_GORE",tcs); pGore->SetOnString(szYes); pGore->SetOffString(szNo); } //always run tcs.szHelpID = "IDS_HELP_RUNLOCK"; tcs.pbValue = &m_bAlwaysRun; tcs.nHeaderWidth = kGap; pToggle = AddToggle("IDS_ADVCONTROLS_RUNLOCK",tcs); pToggle->SetOnString(szYes); pToggle->SetOffString(szNo); tcs.szHelpID = "ScreenOptions_CrouchToggle_Help"; tcs.pbValue = &m_bCrouchToggle; tcs.nHeaderWidth = kGap; pToggle = AddToggle("ScreenOptions_CrouchToggle",tcs); pToggle->SetOnString(szYes); pToggle->SetOffString(szNo); #if !defined(_DEMO) || defined(_SPDEMO) // Add the Difficulty option CLTGUICycleCtrl_create ccs; ccs.szHelpID = "IDS_HELP_DIFFICULTY"; ccs.pnValue = &m_nDifficulty; ccs.nHeaderWidth = kGap; ccs.rnBaseRect.m_vMin.Init(); ccs.rnBaseRect.m_vMax = LTVector2n(m_ScreenRect.GetWidth(),g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); m_pDifficultyCtrl = AddCycle("IDS_DIFFICULTY",ccs); m_pDifficultyCtrl->AddString(LoadString("IDS_NEW_EASY")); m_pDifficultyCtrl->AddString(LoadString("IDS_NEW_MEDIUM")); m_pDifficultyCtrl->AddString(LoadString("IDS_NEW_HARD")); m_pDifficultyCtrl->AddString(LoadString("IDS_NEW_INSANE")); #endif CLTGUISlider_create scs; scs.rnBaseRect.m_vMin.Init(); scs.rnBaseRect.m_vMax = LTVector2n(kGap+kWidth,g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); scs.nBarOffset = kGap; scs.szHelpID = "IDS_HELP_PICKUP_MSG_DUR"; scs.pnValue = &m_nMsgDur; scs.nMin = 1; scs.nMax = 10; scs.nIncrement = 1; CLTGUISlider* pSlider = AddSlider("IDS_PICKUP_MSG_DUR", scs ); scs.rnBaseRect.m_vMin.Init(); scs.rnBaseRect.m_vMax = LTVector2n(kGap+kWidth,g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); scs.nBarOffset = kGap; scs.szHelpID = "IDS_HELP_HEADBOB"; scs.pnValue = &m_nHeadBob; scs.nMin = 1; scs.nMax = 10; scs.nIncrement = 1; pSlider = AddSlider("IDS_HEADBOB", scs ); #if defined(_MPDEMO) tcs.szHelpID = "IDS_HELP_AUTOSWITCH_WEAPONS"; tcs.pbValue = &m_bMPAutoWeaponSwitch; tcs.nHeaderWidth = kGap; pToggle = AddToggle("IDS_AUTOSWITCH_WEAPONS",tcs); pToggle->SetOnString(szYes); pToggle->SetOffString(szNo); #elif defined(_SPDEMO) tcs.szHelpID = "IDS_HELP_AUTOSWITCH_WEAPONS"; tcs.pbValue = &m_bSPAutoWeaponSwitch; tcs.nHeaderWidth = kGap; pToggle = AddToggle("IDS_AUTOSWITCH_WEAPONS",tcs); pToggle->SetOnString(szYes); pToggle->SetOffString(szNo); #else ccs.szHelpID = "IDS_HELP_AUTOSWITCH_WEAPONS"; ccs.pnValue = &m_nAutoWeaponSwitch; CLTGUICycleCtrl *pCycle = AddCycle("IDS_AUTOSWITCH_WEAPONS", ccs); pCycle->AddString(LoadString("IDS_NEVER")); pCycle->AddString(LoadString("IDS_SP_ONLY")); pCycle->AddString(LoadString("IDS_MP_ONLY")); pCycle->AddString(LoadString("IDS_ALWAYS")); #endif //slowmo overlay tcs.szHelpID = "Screen_Options_SlowMoFX_Help"; tcs.pbValue = &m_bSlowMoFX; tcs.nHeaderWidth = kGap; pToggle = AddToggle("Screen_Options_SlowMoFX",tcs); pToggle->SetOnString(szYes); pToggle->SetOffString(szNo); scs.rnBaseRect.m_vMin.Init(); scs.rnBaseRect.m_vMax = LTVector2n(kGap+kWidth,g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); scs.nBarOffset = kGap; scs.szHelpID = "IDS_HELP_HUD_FADE_TIME"; scs.pnValue = &m_nHUDFade; scs.nMin = kMinFade; scs.nMax = kMaxFade; scs.nIncrement = 3; scs.pnTextCallback = HUDSliderTextCallback; scs.nDisplayWidth = kTextWidth; pSlider = AddSlider("IDS_HUD_FADE_TIME", scs ); // Make sure to call the base class if (! CBaseScreen::Build()) return false; UseBack(true,true); return true; }
// Build the screen bool CScreenHostLevels::Build() { LTRect2n rcAvailRect = g_pLayoutDB->GetListRect(m_hLayout,0); LTRect2n rcSelRect = g_pLayoutDB->GetListRect(m_hLayout,1); uint32 nOffset = g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize) + 4; LTVector2n addPos = rcAvailRect.GetTopLeft(); addPos.y -= nOffset; LTVector2n removePos = rcSelRect.GetTopLeft(); removePos.y -= nOffset; LTVector2n commandPos = rcAvailRect.GetTopRight(); commandPos.x += nOffset; commandPos.x += g_pLayoutDB->GetScrollBarSize(); int32 nCommandWidth = rcSelRect.Left() - commandPos.x; nListFontSize = g_pLayoutDB->GetListSize(m_hLayout,0); CreateTitle("IDS_TITLE_HOST_MISSIONS"); //background frame CLTGUICtrl_create frameCs; TextureReference hFrame(g_pLayoutDB->GetString(m_hLayout,LDB_ScreenFrameTexture)); frameCs.rnBaseRect = g_pLayoutDB->GetRect(m_hLayout,LDB_ScreenFrameRect); CLTGUIFrame *pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame, frameCs); AddControl(pFrame); CLTGUICtrl_create cs; cs.rnBaseRect.m_vMin.Init(); cs.rnBaseRect.m_vMax = LTVector2n(nCommandWidth,g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); cs.nCommandID = CMD_ADD_LEVEL; cs.szHelpID = "IDS_HELP_ADD_MISSION"; m_pAdd = AddTextItem("IDS_HOST_ADD_MISSION", cs, true); m_pAdd->SetBasePos(addPos); m_DefaultPos = commandPos; cs.nCommandID = CMD_ADD_ALL; cs.szHelpID = "IDS_HELP_ADD_ALL_LEVELS"; m_pAddAll = AddTextItem("IDS_HOST_ADD_ALL_LEVELS", cs); cs.nCommandID = CMD_REMOVE_ALL; cs.szHelpID = "IDS_HELP_REM_ALL_LEVELS"; m_pRemoveAll = AddTextItem("IDS_HOST_REMOVE_ALL_LEVELS", cs); cs.nCommandID = CMD_REMOVE_LEVEL; cs.szHelpID = "IDS_HELP_REM_MISSION"; m_pRemove = AddTextItem("IDS_HOST_REMOVE_MISSION", cs, true); m_pRemove->SetBasePos(removePos); { CLTGUIScrollBar_create csb; csb.rnBaseRect = g_pLayoutDB->GetListRect(m_hLayout,0); csb.rnBaseRect.Right() += g_pLayoutDB->GetScrollBarSize(); csb.rnBaseRect.Left() = csb.rnBaseRect.Right() - g_pLayoutDB->GetScrollBarSize(); m_pAvailMissionsScrollBar = CreateScrollBar( csb ); if( m_pAvailMissionsScrollBar ) { m_pAvailMissionsScrollBar->SetFrameWidth( 1 ); m_pAvailMissionsScrollBar->Enable( true ); m_pAvailMissionsScrollBar->Show( true ); } } { CLTGUIScrollBar_create csb; csb.rnBaseRect = g_pLayoutDB->GetListRect(m_hLayout,1); csb.rnBaseRect.Right() += g_pLayoutDB->GetScrollBarSize(); csb.rnBaseRect.Left() = csb.rnBaseRect.Right() - g_pLayoutDB->GetScrollBarSize(); m_pSelMissionsScrollBar = CreateScrollBar( csb ); if( m_pSelMissionsScrollBar ) { m_pSelMissionsScrollBar->SetFrameWidth( 1 ); m_pSelMissionsScrollBar->Enable( true ); m_pSelMissionsScrollBar->Show( true ); } } // int32 nListHeight = rcAvailRect.GetHeight(); nAvailWidth = rcAvailRect.GetWidth(); CLTGUIListCtrlEx_create listCs; listCs.rnBaseRect = rcAvailRect; listCs.nTextIdent = g_pLayoutDB->GetListIndent(m_hLayout,0).x; listCs.pScrollBar = m_pAvailMissionsScrollBar; m_pAvailMissions = AddListEx(listCs); m_pAvailMissions->SetFrameWidth( 1 ); m_pAvailMissions->SetIndent(g_pLayoutDB->GetListIndent(m_hLayout,0)); hFrame.Load(g_pLayoutDB->GetListFrameTexture(m_hLayout,0,0)); TextureReference hSelFrame(g_pLayoutDB->GetListFrameTexture(m_hLayout,0,1)); m_pAvailMissions->SetFrame(hFrame,hSelFrame,g_pLayoutDB->GetListFrameExpand(m_hLayout,0)); if( m_pAvailMissionsScrollBar ) AddControl( m_pAvailMissionsScrollBar ); nSelWidth = rcSelRect.GetWidth(); listCs.rnBaseRect = rcSelRect; listCs.pScrollBar = m_pSelMissionsScrollBar; m_pSelMissions = AddListEx(listCs); m_pSelMissions->SetFrameWidth( 1 ); m_pSelMissions->SetIndent(g_pLayoutDB->GetListIndent(m_hLayout,1)); hFrame.Load(g_pLayoutDB->GetListFrameTexture(m_hLayout,1,0)); hSelFrame.Load(g_pLayoutDB->GetListFrameTexture(m_hLayout,1,1)); m_pSelMissions->SetFrame(hFrame,hSelFrame,g_pLayoutDB->GetListFrameExpand(m_hLayout,1)); if( m_pSelMissionsScrollBar ) AddControl( m_pSelMissionsScrollBar ); // Make sure to call the base class if (!CBaseScreen::Build()) return false; UseBack(true,true); return true; }
// Build the screen bool CScreenDisplay::Build() { CreateTitle("IDS_TITLE_DISPLAYOPTIONS"); kGap = g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenColumnWidths,0); kWidth = g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenColumnWidths,1); kTotalWidth = kGap + kWidth; m_nWarningColor = g_pLayoutDB->GetInt32(m_hLayout, LDB_ScreenAddColor, 0); //background frame CLTGUICtrl_create frameCs; TextureReference hFrame(g_pLayoutDB->GetString(m_hLayout,LDB_ScreenFrameTexture)); frameCs.rnBaseRect = g_pLayoutDB->GetRect(m_hLayout,LDB_ScreenFrameRect,0); CLTGUIFrame *pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame, frameCs); AddControl(pFrame); // Build the array of renderers GetRendererData( m_rendererData ); // Add the "resolution" control CLTGUICycleCtrl_create ccs; ccs.nHeaderWidth = kGap; ccs.rnBaseRect.m_vMin = m_ScreenRect.m_vMin; ccs.rnBaseRect.m_vMax = m_ScreenRect.m_vMin + LTVector2n(kTotalWidth,g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); ccs.szHelpID = "IDS_HELP_RESOLUTION"; ccs.pCommandHandler = this; ccs.nCommandID = CMD_DISPLAY_CYCLE; m_pResolutionCtrl = AddCycle("IDS_DISPLAY_RESOLUTION",ccs); // Setup the resolution control based on the current renderer SetupResolutionCtrl(); CLTGUIToggle_create tcs; tcs.rnBaseRect.m_vMin.Init(); tcs.rnBaseRect.m_vMax = LTVector2n(kGap+kWidth,g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); tcs.szHelpID = "IDS_HELP_VSYNC"; tcs.pbValue = &m_bVSync; tcs.nHeaderWidth = kGap; AddToggle("IDS_VSYNC",tcs); tcs.szHelpID = "ScreenDisplay_RestartRender_Help"; tcs.pbValue = &m_bRestartRenderBetweenMaps; tcs.nHeaderWidth = kGap; AddToggle("ScreenDisplay_RestartRender",tcs); tcs.szHelpID = "ScreenDisplay_TextScaling_Help"; tcs.pbValue = &m_bUseTextScaling; tcs.nHeaderWidth = kGap; CLTGUIToggle* pTog = AddToggle("ScreenDisplay_TextScaling",tcs); pTog->SetOnString(LoadString("ScreenDisplay_TextScaling_Large")); pTog->SetOffString(LoadString("ScreenDisplay_TextScaling_Small")); CLTGUISlider_create scs; scs.rnBaseRect.m_vMin.Init(); scs.rnBaseRect.m_vMax = LTVector2n(kGap+kWidth,g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenFontSize)); scs.nBarOffset = kGap; scs.szHelpID = "IDS_HELP_GAMMA"; scs.pnValue = &m_nGamma; scs.nMin = 0; scs.nMax = kNumSteps; scs.nIncrement = 1; m_pGamma= AddSlider("IDS_GAMMA", scs ); int nBaseGamma = ConvertToSlider(kDefaultGamma); float xoffset = (m_pGamma->CalculateSliderOffset(nBaseGamma) / m_pGamma->GetScale().x); uint16 nHeight = m_pGamma->GetBarHeight(); float yoffset = ((( (float)m_pGamma->GetBaseHeight()) - (float)nHeight)) / 2.0f; LTVector2n pos = m_pGamma->GetBasePos(); pos.x += int(xoffset - 1.0f); pos.y += int(yoffset - 0.5f); CLTGUIFrame *pBar = debug_new(CLTGUIFrame); CLTGUICtrl_create cs; cs.rnBaseRect.m_vMin.Init(); cs.rnBaseRect.m_vMax = LTVector2n(3,nHeight+2); pBar->Create(0xBF000000,cs); pBar->SetBasePos(pos); pBar->SetScale(g_pInterfaceResMgr->GetScreenScale()); AddControl(pBar); CLTGUICtrl_create imageCs; hFrame.Load(g_pLayoutDB->GetString(m_hLayout,LDB_ScreenAddTex)); imageCs.rnBaseRect = g_pLayoutDB->GetRect(m_hLayout,LDB_ScreenFrameRect,1); pFrame = debug_new(CLTGUIFrame); pFrame->Create(hFrame, imageCs, true); AddControl(pFrame); uint32 nFontHeight = g_pLayoutDB->GetInt32(m_hLayout,LDB_ScreenAdditionalInt,0); cs.rnBaseRect = g_pLayoutDB->GetRect(m_hLayout,LDB_ScreenFrameRect,2); m_pWarning = AddTextItem("ScreenDisplay_ResolutionWarning",cs,true,NULL,nFontHeight); m_pWarning->SetWordWrap(true); m_pWarning->Show(false); // Make sure to call the base class if (!CBaseScreen::Build()) return false; UseBack(true,true); return true; }