Esempio n. 1
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;

}
Esempio n. 2
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;

}