本文整理汇总了C++中CLabel::SetTextAlign方法的典型用法代码示例。如果您正苦于以下问题:C++ CLabel::SetTextAlign方法的具体用法?C++ CLabel::SetTextAlign怎么用?C++ CLabel::SetTextAlign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLabel
的用法示例。
在下文中一共展示了CLabel::SetTextAlign方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateInterface
void CScreenSetupSound::CreateInterface()
{
CWindow* pw;
CLabel* pl;
CSlider* psl;
CButton* pb;
Math::Point pos, ddim;
std::string name;
CScreenSetup::CreateInterface();
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
pos.x = ox+sx*3;
pos.y = 0.55f;
ddim.x = dim.x*4.0f;
ddim.y = 18.0f/480.0f;
psl = pw->CreateSlider(pos, ddim, 0, EVENT_INTERFACE_VOLSOUND);
psl->SetState(STATE_SHADOW);
psl->SetLimit(0.0f, MAXVOLUME);
psl->SetArrowStep(1.0f);
pos.y += ddim.y;
GetResource(RES_EVENT, EVENT_INTERFACE_VOLSOUND, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
pos.x = ox+sx*3;
pos.y = 0.40f;
ddim.x = dim.x*4.0f;
ddim.y = 18.0f/480.0f;
psl = pw->CreateSlider(pos, ddim, 0, EVENT_INTERFACE_VOLMUSIC);
psl->SetState(STATE_SHADOW);
psl->SetLimit(0.0f, MAXVOLUME);
psl->SetArrowStep(1.0f);
pos.y += ddim.y;
GetResource(RES_EVENT, EVENT_INTERFACE_VOLMUSIC, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
ddim.x = dim.x*3;
ddim.y = dim.y*1;
pos.x = ox+sx*10;
pos.y = oy+sy*2;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_SILENT);
pb->SetState(STATE_SHADOW);
pos.x += ddim.x;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NOISY);
pb->SetState(STATE_SHADOW);
UpdateSetupButtons();
}
示例2: CreateInterface
void CScreenSetupGame::CreateInterface()
{
CWindow* pw;
CLabel* pl;
CCheck* pc;
CSlider* psl;
CList* pli;
Math::Point pos, ddim;
std::string name;
CScreenSetup::CreateInterface();
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
ddim.x = dim.x*6;
ddim.y = dim.y*0.5f;
pos.x = ox+sx*3;
pos.y = 0.65f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_MOVIES);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SCROLL);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_INVERTX);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_INVERTY);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_EFFECT);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_BLOOD);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_AUTOSAVE_ENABLE);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pos.y -= ddim.y;
ddim.x = dim.x*2.5f;
psl = pw->CreateSlider(pos, ddim, -1, EVENT_INTERFACE_AUTOSAVE_INTERVAL);
psl->SetState(STATE_SHADOW);
psl->SetLimit(1.0f, 30.0f);
psl->SetArrowStep(1.0f);
pos.y += ddim.y/2;
GetResource(RES_EVENT, EVENT_INTERFACE_AUTOSAVE_INTERVAL, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
pos.y -= ddim.y/2;
pos.x = ox+sx*3+dim.x*4.0f;
psl = pw->CreateSlider(pos, ddim, -1, EVENT_INTERFACE_AUTOSAVE_SLOTS);
psl->SetState(STATE_SHADOW);
psl->SetLimit(1.0f, 10.0f);
psl->SetArrowStep(1.0f);
pos.y += ddim.y/2;
GetResource(RES_EVENT, EVENT_INTERFACE_AUTOSAVE_SLOTS, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
pos.y -= ddim.y/2;
ddim.x = dim.x*6;
ddim.y = dim.y*0.5f;
pos.x = ox+sx*10;
pos.y = 0.65f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_TOOLTIP);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_GLINT);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_RAIN);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_BGPAUSE);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_EDITMODE);
pc->SetState(STATE_SHADOW);
if ( m_simulationSetup )
{
pc->SetState(STATE_DEAD);
}
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_EDITVALUE);
pc->SetState(STATE_SHADOW);
ddim.y = dim.y*3.0f;
pos.y -= ddim.y;
pli = pw->CreateList(pos, ddim, 0, EVENT_INTERFACE_LANGUAGE);
pli->SetState(STATE_SHADOW);
// TODO: Add something like GetSupportedLanguages() and GetLanguageFriendlyName() for this
pli->SetItemName(1+LANGUAGE_ENV, "[System default]");
pli->SetItemName(1+LANGUAGE_ENGLISH, "English");
pli->SetItemName(1+LANGUAGE_FRENCH, "French");
pli->SetItemName(1+LANGUAGE_GERMAN, "German");
pli->SetItemName(1+LANGUAGE_POLISH, "Polish");
//.........这里部分代码省略.........
示例3: CreateInterface
void CScreenPlayerSelect::CreateInterface()
{
CWindow* pw;
CEdit* pe;
CLabel* pl;
CButton* pb;
CList* pli;
CGroup* pg;
Math::Point pos, ddim;
std::string name;
pos.x = 0.10f;
pos.y = 0.10f;
ddim.x = 0.80f;
ddim.y = 0.80f;
pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5);
GetResource(RES_TEXT, RT_TITLE_NAME, name);
pw->SetName(name);
pos.x = 0.10f;
pos.y = 0.40f;
ddim.x = 0.50f;
ddim.y = 0.50f;
pw->CreateGroup(pos, ddim, 5, EVENT_INTERFACE_GLINTl); // orange corner
pos.x = 0.40f;
pos.y = 0.10f;
ddim.x = 0.50f;
ddim.y = 0.50f;
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
pos.x = 60.0f/640.0f;
pos.y = 313.0f/480.0f;
ddim.x = 120.0f/640.0f;
ddim.y = 32.0f/480.0f;
GetResource(RES_EVENT, EVENT_INTERFACE_NLABEL, name);
pl = pw->CreateLabel(pos, ddim, -1, EVENT_INTERFACE_NLABEL, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_RIGHT);
pos.x = 200.0f/640.0f;
pos.y = 320.0f/480.0f;
ddim.x = 160.0f/640.0f;
ddim.y = 32.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 7, EVENT_LABEL1);
pg->SetState(STATE_SHADOW);
pos.x = 207.0f/640.0f;
pos.y = 328.0f/480.0f;
ddim.x = 144.0f/640.0f;
ddim.y = 18.0f/480.0f;
pe = pw->CreateEdit(pos, ddim, 0, EVENT_INTERFACE_NEDIT);
pe->SetMaxChar(15);
if(m_main->GetPlayerProfile() != nullptr)
{
name = m_main->GetPlayerProfile()->GetName();
}
else
{
name = CPlayerProfile::GetLastName();
}
pe->SetText(name.c_str());
pe->SetCursor(name.length(), 0);
m_interface->SetFocus(pe);
pos.x = 380.0f/640.0f;
pos.y = 320.0f/480.0f;
ddim.x =100.0f/640.0f;
ddim.y = 32.0f/480.0f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NOK);
pb->SetState(STATE_SHADOW);
pos.x = 380.0f/640.0f;
pos.y = 250.0f/480.0f;
ddim.x =100.0f/640.0f;
ddim.y = 52.0f/480.0f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PERSO);
pb->SetState(STATE_SHADOW);
pos.x = 200.0f/640.0f;
pos.y = 150.0f/480.0f;
ddim.x = 160.0f/640.0f;
ddim.y = 160.0f/480.0f;
pli = pw->CreateList(pos, ddim, 0, EVENT_INTERFACE_NLIST);
pli->SetState(STATE_SHADOW);
pos.x = 200.0f/640.0f;
pos.y = 100.0f/480.0f;
ddim.x = 160.0f/640.0f;
ddim.y = 32.0f/480.0f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NDELETE);
pb->SetState(STATE_SHADOW);
SetBackground("textures/interface/interface.png");
CreateVersionDisplay();
ReadNameList();
UpdateNameList();
UpdateNameControl();
}
示例4: CreateInterface
void CScreenApperance::CreateInterface()
{
CWindow* pw;
CLabel* pl;
CButton* pb;
CColor* pco;
CSlider* psl;
Math::Point pos, ddim;
std::string name;
pos.x = 0.10f;
pos.y = 0.10f;
ddim.x = 0.80f;
ddim.y = 0.80f;
pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5);
GetResource(RES_TEXT, RT_TITLE_PERSO, name);
pw->SetName(name);
pos.x = 0.10f;
pos.y = 0.40f;
ddim.x = 0.50f;
ddim.y = 0.50f;
pw->CreateGroup(pos, ddim, 5, EVENT_INTERFACE_GLINTl); // orange corner
pos.x = 0.40f;
pos.y = 0.10f;
ddim.x = 0.50f;
ddim.y = 0.50f;
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
pos.x = 95.0f/640.0f;
pos.y = 108.0f/480.0f;
ddim.x = 220.0f/640.0f;
ddim.y = 274.0f/480.0f;
pw->CreateGroup(pos, ddim, 17, EVENT_NULL); // frame
pos.x = 100.0f/640.0f;
pos.y = 364.0f/480.0f;
ddim.x = 210.0f/640.0f;
ddim.y = 14.0f/480.0f;
pw->CreateGroup(pos, ddim, 3, EVENT_NULL); // transparent -> gray
pos.x = 120.0f/640.0f;
pos.y = 364.0f/480.0f;
ddim.x = 80.0f/640.0f;
ddim.y = 28.0f/480.0f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PHEAD);
pb->SetState(STATE_SHADOW);
pb->SetState(STATE_CARD);
pos.x = 210.0f/640.0f;
pos.y = 364.0f/480.0f;
ddim.x = 80.0f/640.0f;
ddim.y = 28.0f/480.0f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PBODY);
pb->SetState(STATE_SHADOW);
pb->SetState(STATE_CARD);
pos.x = 100.0f/640.0f;
pos.y = 354.0f/480.0f;
ddim.x = 210.0f/640.0f;
ddim.y = 10.0f/480.0f;
pw->CreateGroup(pos, ddim, 1, EVENT_INTERFACE_GLINTb); // orange bar
pos.x = 100.0f/640.0f;
pos.y = 154.0f/480.0f;
ddim.x = 210.0f/640.0f;
ddim.y = 200.0f/480.0f;
pw->CreateGroup(pos, ddim, 2, EVENT_INTERFACE_GLINTu); // orange -> transparent
// Face
pos.x = 340.0f/640.0f;
pos.y = 356.0f/480.0f;
ddim.x = 200.0f/640.0f;
ddim.y = 16.0f/480.0f;
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL11, "");
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
pos.x = 340.0f/640.0f;
pos.y = 312.0f/480.0f;
ddim.x = 44.0f/640.0f;
ddim.y = 44.0f/480.0f;
pb = pw->CreateButton(pos, ddim, 43, EVENT_INTERFACE_PFACE1);
pb->SetState(STATE_SHADOW);
pos.x += 50.0f/640.0f;
pb = pw->CreateButton(pos, ddim, 46, EVENT_INTERFACE_PFACE4);
pb->SetState(STATE_SHADOW);
pos.x += 50.0f/640.0f;
pb = pw->CreateButton(pos, ddim, 45, EVENT_INTERFACE_PFACE3);
pb->SetState(STATE_SHADOW);
pos.x += 50.0f/640.0f;
pb = pw->CreateButton(pos, ddim, 44, EVENT_INTERFACE_PFACE2);
pb->SetState(STATE_SHADOW);
// Glasses
pos.x = 340.0f/640.0f;
pos.y = 270.0f/480.0f;
ddim.x = 200.0f/640.0f;
ddim.y = 16.0f/480.0f;
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL12, "");
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
//.........这里部分代码省略.........
示例5: CreateInterface
void CScreenLevelList::CreateInterface()
{
CWindow* pw;
CEdit* pe;
CLabel* pl;
CButton* pb;
CCheck* pc;
CList* pli;
Math::Point pos, ddim;
int res;
std::string name;
if ( m_category == LevelCategory::FreeGame )
{
m_accessChap = m_main->GetPlayerProfile()->GetChapPassed(LevelCategory::Missions);
}
pos.x = 0.10f;
pos.y = 0.10f;
ddim.x = 0.80f;
ddim.y = 0.80f;
pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5);
pw->SetClosable(true);
if ( m_category == LevelCategory::Exercises ) res = RT_TITLE_TRAINER;
if ( m_category == LevelCategory::Challenges ) res = RT_TITLE_DEFI;
if ( m_category == LevelCategory::Missions ) res = RT_TITLE_MISSION;
if ( m_category == LevelCategory::FreeGame ) res = RT_TITLE_FREE;
if ( m_category == LevelCategory::CodeBattles ) res = RT_TITLE_CODE_BATTLES;
if ( m_category == LevelCategory::CustomLevels ) res = RT_TITLE_USER;
GetResource(RES_TEXT, res, name);
pw->SetName(name);
pos.x = 0.10f;
pos.y = 0.40f;
ddim.x = 0.50f;
ddim.y = 0.50f;
pw->CreateGroup(pos, ddim, 5, EVENT_INTERFACE_GLINTl); // orange corner
pos.x = 0.40f;
pos.y = 0.10f;
ddim.x = 0.50f;
ddim.y = 0.50f;
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
// Displays a list of chapters:
pos.x = ox+sx*3;
pos.y = oy+sy*10.5f;
ddim.x = dim.x*7.5f;
ddim.y = dim.y*0.6f;
res = RT_PLAY_CHAP_CHAPTERS;
if ( m_category == LevelCategory::Missions ) res = RT_PLAY_CHAP_PLANETS;
if ( m_category == LevelCategory::FreeGame ) res = RT_PLAY_CHAP_PLANETS;
if ( m_category == LevelCategory::CustomLevels ) res = RT_PLAY_CHAP_USERLVL;
GetResource(RES_TEXT, res, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL11, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
pos.y = oy+sy*6.7f;
ddim.y = dim.y*4.5f;
ddim.x = dim.x*6.5f;
pli = pw->CreateList(pos, ddim, 0, EVENT_INTERFACE_CHAP);
pli->SetState(STATE_SHADOW);
m_chap[m_category] = m_main->GetPlayerProfile()->GetSelectedChap(m_category)-1;
UpdateSceneChap(m_chap[m_category]);
if ( m_category != LevelCategory::FreeGame &&
m_category != LevelCategory::CodeBattles &&
m_category != LevelCategory::CustomLevels ) // Don't show completion marks in free game, code battles and userlevels
{
pli->SetState(STATE_EXTEND);
}
// Displays a list of missions:
pos.x = ox+sx*9.5f;
pos.y = oy+sy*10.5f;
ddim.x = dim.x*7.5f;
ddim.y = dim.y*0.6f;
res = RT_PLAY_LIST_LEVELS;
if ( m_category == LevelCategory::Exercises ) res = RT_PLAY_LIST_EXERCISES;
if ( m_category == LevelCategory::Challenges ) res = RT_PLAY_LIST_CHALLENGES;
if ( m_category == LevelCategory::Missions ) res = RT_PLAY_LIST_MISSIONS;
if ( m_category == LevelCategory::FreeGame ) res = RT_PLAY_LIST_FREEGAME;
GetResource(RES_TEXT, res, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL12, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
pos.y = oy+sy*6.7f;
ddim.y = dim.y*4.5f;
ddim.x = dim.x*6.5f;
pli = pw->CreateList(pos, ddim, 0, EVENT_INTERFACE_LIST);
pli->SetState(STATE_SHADOW);
m_sel[m_category] = m_main->GetPlayerProfile()->GetSelectedRank(m_category)-1;
UpdateSceneList(m_chap[m_category], m_sel[m_category]);
if ( m_category != LevelCategory::FreeGame &&
m_category != LevelCategory::CodeBattles &&
m_category != LevelCategory::CustomLevels ) // Don't show completion marks in free game, code battles and userlevels
{
pli->SetState(STATE_EXTEND);
}
pos = pli->GetPos();
ddim = pli->GetDim();
//.........这里部分代码省略.........