Пример #1
0
void CMTimeMachine::AddCycle(const wchar_t* b, const wchar_t* e, const wchar_t* s, int lastmonth, CMTIMEUNIT si)
{
	CMTime beg(b),end(e),start(s);
   int begweek = beg.WeekDay();

	if (CMTime::GetResolution(e)==CM_YEAR) {
		end = CMTime(end.Year(),lastmonth);
		end = end.AtEnd(CM_MONTH);
   	if (incunits==CM_YEAR)
      	end = end.AtBeginning(CM_MONTH);
      else
	      end = end.AtBeginning(incunits,begweek);
   }
	else {
		end = end.AtEnd(CMTime::GetResolution(e));
	   end = end.AtBeginning(incunits,begweek);
   }

	if (CMTime::GetResolution(b)==CM_YEAR) {
   	if (incunits==CM_YEAR)
      	beg = CMTime(beg.Year(),lastmonth).AtBeginning(CM_MONTH);
      else {
			beg = CMTime(lastmonth<12 ? beg.Year()-1 : beg.Year(),lastmonth%12+1);
		   beg = beg.AtBeginning(incunits,begweek);
      }
   }
   else {
		beg = beg.AtBeginning(CMTime::GetResolution(b));
	   beg = beg.AtBeginning(incunits,begweek);
   }

	if (s!=0) {
		if (CMTime::GetResolution(s)==CM_YEAR) {
   		if (incunits==CM_YEAR)
      		start = CMTime(start.Year(),lastmonth).AtBeginning(CM_MONTH);
	      else {
				start = CMTime(lastmonth<12 ? start.Year()-1 : start.Year(),lastmonth%12+1);
			   start = start.AtBeginning(incunits,begweek);
	      }
   	}
	   else {
			start = start.AtBeginning(CMTime::GetResolution(s));
	   	start = start.AtBeginning(incunits,begweek);
	   }
   }
   else
   	start = beg;

   AddCycle(beg,end,start,si);
}
Пример #2
0
// 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;
}
Пример #3
0
// Build the screen
LTBOOL CScreenPlayerSkills::Build()
{
	g_pSkillsScreen = this;

	CreateTitle(IDS_TITLE_SKILLS);

	int kColumn = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_PLAYER_SKILLS,"ColumnWidth");
	int kSlider = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_PLAYER_SKILLS,"SliderWidth");


	s_nMaxPool = g_pSkillsButeMgr->GetMultiplayerPool();

	LTIntPt pos = m_nextPos;
	AddTextItem(IDS_SKILL_PTS,LTNULL,LTNULL,pos,LTTRUE);
	pos.x += kColumn;

	m_pPool = AddTextItem("999",LTNULL,LTNULL,pos,LTTRUE);

	pos.y += (m_pPool->GetBaseHeight() + 16);

	for (uint8 i = 0; i < kNumSkills; i++)
	{
		pos.x = GetPageLeft();
		eSkill skl = (eSkill)i;
		if (g_pSkillsButeMgr->IsAvailable(skl) )
		{
			m_pSkill[i] = AddSlider(GetSkillNameId(skl),GetSkillDescriptionId(skl),kColumn,kSlider,-1,&m_nLevels[i], pos);
			m_pSkill[i]->SetSliderIncrement(1);
			m_pSkill[i]->SetSliderRange(0,kNumSkillLevels-1);
			m_pSkill[i]->SetRangeCallback(SliderCallBack);
			m_pSkill[i]->SetParam1(i);

			pos.x += (kColumn + kSlider + 5);

			m_pLabel[i] = AddCycle(" ",NULL,20,&s_nLevels[i],pos,LTTRUE);
			for (int j = 0; j < kNumSkillLevels; j++)
			{
				eSkillLevel nxt = (eSkillLevel)(j+1);
				char szTemp[32];
				

				if ( nxt < kNumSkillLevels)
				{
					uint32 nCost = g_pSkillsButeMgr->GetCostToUpgrade(skl,nxt);
					sprintf(szTemp,"%s (%d)",GetSkillLevelName((eSkillLevel)j),nCost);

				}
				else
				{
					SAFE_STRCPY(szTemp,GetSkillLevelName((eSkillLevel)j));
				}
				m_pLabel[i]->AddString(szTemp);
				
			}


			pos.y += m_pSkill[i]->GetBaseHeight();

			kNumAvailSkills++;
		
		}
	}

	pos.x = GetPageLeft();
	pos.y += 8;

	AddTextItem(IDS_RESET_SKILLS,CMD_SKILLS,IDS_HELP_RESET_SKILLS,pos);

 	// Make sure to call the base class
	return CBaseScreen::Build();
}
Пример #4
0
// 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;
}
Пример #5
0
// 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;

}
Пример #6
0
// 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;
}
Пример #7
0
// 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;

}