本文整理汇总了C++中CButton::SetState方法的典型用法代码示例。如果您正苦于以下问题:C++ CButton::SetState方法的具体用法?C++ CButton::SetState怎么用?C++ CButton::SetState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CButton
的用法示例。
在下文中一共展示了CButton::SetState方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EnableControls
void CBidDialogSmall::EnableControls()
{
// enable all controls
for(int i=IDC_BID_LEVEL_1;i<=IDC_BID_LEVEL_7;i++)
{
CButton* pButton = (CButton*) GetDlgItem(i);
pButton->EnableWindow(TRUE);
pButton->SetState(FALSE);
}
for(i=IDC_SUIT_CLUBS;i<=IDC_SUIT_NOTRUMP;i++)
{
CButton* pButton = (CButton*) GetDlgItem(i);
pButton->EnableWindow(TRUE);
pButton->SetState(FALSE);
}
/*
// enable the level & suit buttons
int nLastBid = pDOC->GetLastValidBid();
if (nLastBid == BID_PASS)
{
}
//
int nLevel = BID_LEVEL(nLastBid);
int nSuit = BID_SUIT(nLastBid);
// enable all suits higher than the one bid
for(int i=0;i<nSuit;i++)
GetDlgItem(IDC_SUIT_CLUBS+i)->EnableWindow(TRUE);
*/
}
示例2: 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();
}
示例3: StartQuestion
void CMainDialog::StartQuestion(const std::string& text, bool warningYes, bool warningNo, bool fireParticles, DialogCallback yes, DialogCallback no)
{
CWindow* pw;
CButton* pb;
Math::Point pos, dim, ddim;
std::string name;
dim.x = 0.7f;
dim.y = 0.3f;
StartDialog(dim, fireParticles);
m_dialogType = DialogType::Question;
m_callbackYes = yes;
m_callbackNo = no;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW9));
if ( pw == nullptr ) return;
pos.x = 0.00f;
pos.y = 0.50f;
ddim.x = 1.00f;
ddim.y = 0.05f;
pw->CreateLabel(pos, ddim, -1, EVENT_DIALOG_LABEL, text);
pos.x = 0.50f-0.15f-0.02f;
pos.y = 0.50f-dim.y/2.0f+0.03f;
ddim.x = 0.15f;
ddim.y = 0.06f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_DIALOG_OK);
pb->SetState(STATE_SHADOW);
GetResource(RES_TEXT, RT_DIALOG_YES, name);
pb->SetName(name);
if (warningYes)
{
pb->SetState(STATE_WARNING);
}
pos.x = 0.50f+0.02f;
pos.y = 0.50f-dim.y/2.0f+0.03f;
ddim.x = 0.15f;
ddim.y = 0.06f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_DIALOG_CANCEL);
pb->SetState(STATE_SHADOW);
GetResource(RES_TEXT, RT_DIALOG_NO, name);
pb->SetName(name);
if (warningNo)
{
pb->SetState(STATE_WARNING);
}
}
示例4: StartInformation
void CMainDialog::StartInformation(const std::string& title, const std::string& text, const std::string& details, bool warning, bool fireParticles, DialogCallback ok)
{
CWindow* pw;
CButton* pb;
CLabel* pl;
Math::Point pos, dim, ddim;
std::string name;
dim.x = 0.7f;
dim.y = 0.3f;
StartDialog(dim, fireParticles);
m_dialogType = DialogType::Question;
m_callbackYes = ok;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW9));
if ( pw == nullptr ) return;
if(!title.empty())
pw->SetName(title);
pos.x = 0.00f;
pos.y = 0.50f;
ddim.x = 1.00f;
ddim.y = 0.05f;
pl = pw->CreateLabel(pos, ddim, -1, EVENT_DIALOG_LABEL, text);
pl->SetFontType(Gfx::FONT_COMMON_BOLD);
//TODO: Add \n support in CLabel
pos.y -= ddim.y;
pl = pw->CreateLabel(pos, ddim, -1, EVENT_DIALOG_LABEL1, details);
pl->SetFontSize(10.0f);
pos.x = 0.50f-0.075f;
pos.y = 0.50f-dim.y/2.0f+0.03f;
ddim.x = 0.15f;
ddim.y = 0.06f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_DIALOG_OK);
pb->SetState(STATE_SHADOW);
GetResource(RES_TEXT, RT_DIALOG_OK, name);
pb->SetName(name);
if (warning)
{
pb->SetState(STATE_WARNING);
}
}
示例5: EventProcess
bool CScreenLevelList::EventProcess(const Event &event)
{
CWindow* pw;
CList* pl;
CButton* pb;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return false;
if ( event.type == pw->GetEventTypeClose() ||
event.type == EVENT_INTERFACE_BACK ||
(event.type == EVENT_KEY_DOWN && event.GetData<KeyEventData>()->key == KEY(ESCAPE)) )
{
m_main->ChangePhase(PHASE_MAIN_MENU);
return false;
}
switch( event.type )
{
case EVENT_INTERFACE_CHAP:
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_CHAP));
if ( pl == nullptr ) break;
m_chap[m_category] = pl->GetSelect();
m_main->GetPlayerProfile()->SetSelectedChap(m_category, m_chap[m_category]+1);
UpdateSceneList(m_chap[m_category], m_sel[m_category]);
UpdateSceneResume(m_chap[m_category]+1, m_sel[m_category]+1);
break;
case EVENT_INTERFACE_LIST:
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_LIST));
if ( pl == nullptr ) break;
m_sel[m_category] = pl->GetSelect();
m_main->GetPlayerProfile()->SetSelectedRank(m_category, m_sel[m_category]+1);
UpdateSceneResume(m_chap[m_category]+1, m_sel[m_category]+1);
break;
case EVENT_INTERFACE_SOLUCE:
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_SOLUCE));
if ( pb == nullptr ) break;
m_sceneSoluce = !m_sceneSoluce;
pb->SetState(STATE_CHECK, m_sceneSoluce);
break;
case EVENT_INTERFACE_PLAY:
m_main->SetLevel(m_category, m_chap[m_category]+1, m_sel[m_category]+1);
m_main->ChangePhase(PHASE_SIMUL);
break;
case EVENT_INTERFACE_READ:
m_main->ChangePhase(PHASE_READ);
break;
default:
return true;
}
return false;
}
示例6: UpdateNameControl
void CScreenPlayerSelect::UpdateNameControl()
{
CWindow* pw;
CList* pl;
CButton* pb;
CEdit* pe;
std::string name;
int total, sel;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
if ( pl == nullptr ) return;
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
if ( pe == nullptr ) return;
total = pl->GetTotal();
sel = pl->GetSelect();
name = pe->GetText(100);
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_NDELETE));
if ( pb != nullptr )
{
pb->SetState(STATE_ENABLE, total>0 && sel!=-1);
}
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_NOK));
if ( pb != nullptr )
{
pb->SetState(STATE_ENABLE, !name.empty() || sel!=-1);
}
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_PERSO));
if ( pb != nullptr )
{
pb->SetState(STATE_ENABLE, !name.empty() || sel!=-1);
}
}
示例7: IOUpdateList
void CScreenIO::IOUpdateList(bool isWrite)
{
CWindow* pw;
CList* pl;
CButton* pb;
CImage* pi;
int sel, max;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_IOLIST));
if ( pl == nullptr ) return;
pi = static_cast<CImage*>(pw->SearchControl(EVENT_INTERFACE_IOIMAGE));
if ( pi == nullptr ) return;
sel = pl->GetSelect();
max = pl->GetTotal();
if (m_saveList.size() <= static_cast<unsigned int>(sel))
return;
std::string filename = m_saveList.at(sel) + "/screen.png";
if ( isWrite )
{
if ( sel < max-1 )
{
pi->SetFilenameImage(filename.c_str());
}
else
{
pi->SetFilenameImage("");
}
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_IODELETE));
if ( pb != nullptr )
{
pb->SetState(STATE_ENABLE, sel < max-1);
}
}
else
{
pi->SetFilenameImage(filename.c_str());
}
}
示例8: StartPauseMenu
void CMainDialog::StartPauseMenu()
{
CWindow* pw;
CButton* pb;
Math::Point pos, dim;
std::string name;
StartDialog(Math::Point(0.3f, 0.8f), true);
m_dialogType = DialogType::PauseMenu;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW9));
if ( pw == nullptr ) return;
pos.x = 0.35f;
pos.y = 0.60f;
dim.x = 0.30f;
dim.y = 0.30f;
pw->CreateGroup(pos, dim, 5, EVENT_INTERFACE_GLINTl); // orange corner
pos.x = 0.35f;
pos.y = 0.10f;
dim.x = 0.30f;
dim.y = 0.30f;
pw->CreateGroup(pos, dim, 4, EVENT_INTERFACE_GLINTr); // blue corner
pos.x = 0.40f;
dim.x = 0.20f;
dim.y = 32.0f/480.0f;
pos.y = 0.74f;
pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_CANCEL);
pb->SetState(STATE_SHADOW);
GetResource(RES_TEXT, RT_DIALOG_CONTINUE, name);
pb->SetName(name);
if ( (m_main->GetLevelCategory() == LevelCategory::Missions || // missions ?
m_main->GetLevelCategory() == LevelCategory::FreeGame || // free games?
m_main->GetLevelCategory() == LevelCategory::CustomLevels ) && // user ?
m_main->GetMissionType() != MISSION_CODE_BATTLE )
{
pos.y = 0.62f;
pb = pw->CreateButton(pos, dim, -1, EVENT_INTERFACE_WRITE);
pb->SetState(STATE_SHADOW);
if ( m_main->IOIsBusy() ) // current task?
{
pb->ClearState(STATE_ENABLE);
}
pos.y = 0.53f;
pb = pw->CreateButton(pos, dim, -1, EVENT_INTERFACE_READ);
pb->SetState(STATE_SHADOW);
if ( !m_main->GetPlayerProfile()->HasAnySavedScene() ) // no file to read?
{
pb->ClearState(STATE_ENABLE);
}
pb->SetState(STATE_WARNING);
}
pos.y = 0.39f;
pb = pw->CreateButton(pos, dim, -1, EVENT_INTERFACE_SETUP);
pb->SetState(STATE_SHADOW);
pos.y = 0.25f;
pb = pw->CreateButton(pos, dim, -1, EVENT_INTERFACE_AGAIN);
pb->SetState(STATE_SHADOW);
pb->SetState(STATE_WARNING);
pos.y = 0.16f;
pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_OK);
pb->SetState(STATE_SHADOW);
pb->SetState(STATE_WARNING);
GetResource(RES_TEXT, RT_DIALOG_ABORT, name);
pb->SetName(name);
}
示例9: 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();
}
示例10: CreateInterface
void CScreenQuit::CreateInterface()
{
CWindow* pw;
CEdit* pe;
CLabel* pl;
CButton* pb;
Math::Point pos, ddim;
std::string name;
pos.x = 0.0f;
pos.y = 0.0f;
ddim.x = 0.0f;
ddim.y = 0.0f;
pw = m_interface->CreateWindows(pos, ddim, -1, EVENT_WINDOW5);
pos.x = 80.0f/640.0f;
pos.y = 190.0f/480.0f;
ddim.x = 490.0f/640.0f;
ddim.y = 160.0f/480.0f;
pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1);
pe->SetGenericMode(true);
pe->SetEditCap(false);
pe->SetHighlightCap(false);
pe->SetFontType(Gfx::FONT_STUDIO);
pe->SetFontSize(Gfx::FONT_SIZE_SMALL);
pe->ReadText(std::string("help/") + m_app->GetLanguageChar() + std::string("/authors.txt"));
pos.x = 40.0f/640.0f;
pos.y = 83.0f/480.0f;
ddim.x = 246.0f/640.0f;
ddim.y = 16.0f/480.0f;
GetResource(RES_TEXT, RT_GENERIC_DEV1, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
pl->SetFontType(Gfx::FONT_STUDIO);
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
pos.y = 13.0f/480.0f;
GetResource(RES_TEXT, RT_GENERIC_DEV2, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, name);
pl->SetFontType(Gfx::FONT_STUDIO);
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
pos.x = 355.0f/640.0f;
pos.y = 83.0f/480.0f;
ddim.x = 246.0f/640.0f;
ddim.y = 16.0f/480.0f;
GetResource(RES_TEXT, RT_GENERIC_EDIT1, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL3, name);
pl->SetFontType(Gfx::FONT_STUDIO);
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
pos.y = 13.0f/480.0f;
GetResource(RES_TEXT, RT_GENERIC_EDIT2, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL4, name);
pl->SetFontType(Gfx::FONT_STUDIO);
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
pos.x = 306.0f/640.0f;
pos.y = 17.0f/480.0f;
ddim.x = 30.0f/640.0f;
ddim.y = 30.0f/480.0f;
pb = pw->CreateButton(pos, ddim, 49, EVENT_INTERFACE_ABORT);
pb->SetState(STATE_SHADOW);
SetBackground("textures/interface/generico.png");
}
示例11: 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);
//.........这里部分代码省略.........
示例12: UpdatePerso
void CScreenApperance::UpdatePerso()
{
CWindow* pw;
CLabel* pl;
CButton* pb;
CColor* pc;
CSlider* ps;
Gfx::Color color;
std::string name;
int i;
PlayerApperance& apperance = m_main->GetPlayerProfile()->GetApperance();
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_PHEAD));
if ( pb != nullptr )
{
pb->SetState(STATE_CHECK, m_apperanceTab==0);
}
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_PBODY));
if ( pb != nullptr )
{
pb->SetState(STATE_CHECK, m_apperanceTab==1);
}
pl = static_cast<CLabel*>(pw->SearchControl(EVENT_LABEL11));
if ( pl != nullptr )
{
if ( m_apperanceTab == 0 )
{
pl->SetState(STATE_VISIBLE);
GetResource(RES_TEXT, RT_PERSO_FACE, name);
pl->SetName(name);
}
else
{
pl->ClearState(STATE_VISIBLE);
}
}
pl = static_cast<CLabel*>(pw->SearchControl(EVENT_LABEL12));
if ( pl != nullptr )
{
if ( m_apperanceTab == 0 )
{
pl->SetState(STATE_VISIBLE);
GetResource(RES_TEXT, RT_PERSO_GLASSES, name);
pl->SetName(name);
}
else
{
pl->ClearState(STATE_VISIBLE);
}
}
pl = static_cast<CLabel*>(pw->SearchControl(EVENT_LABEL13));
if ( pl != nullptr )
{
if ( m_apperanceTab == 0 ) GetResource(RES_TEXT, RT_PERSO_HAIR, name);
else GetResource(RES_TEXT, RT_PERSO_BAND, name);
pl->SetName(name);
}
pl = static_cast<CLabel*>(pw->SearchControl(EVENT_LABEL14));
if ( pl != nullptr )
{
if ( m_apperanceTab == 0 )
{
pl->ClearState(STATE_VISIBLE);
}
else
{
pl->SetState(STATE_VISIBLE);
GetResource(RES_TEXT, RT_PERSO_COMBI, name);
pl->SetName(name);
}
}
for ( i=0 ; i<4 ; i++ )
{
pb = static_cast<CButton*>(pw->SearchControl(static_cast<EventType>(EVENT_INTERFACE_PFACE1+i)));
if ( pb == nullptr ) break;
pb->SetState(STATE_VISIBLE, m_apperanceTab==0);
pb->SetState(STATE_CHECK, i==apperance.face);
}
for ( i=0 ; i<10 ; i++ )
{
pb = static_cast<CButton*>(pw->SearchControl(static_cast<EventType>(EVENT_INTERFACE_PGLASS0+i)));
if ( pb == nullptr ) break;
pb->SetState(STATE_VISIBLE, m_apperanceTab==0);
pb->SetState(STATE_CHECK, i==apperance.glasses);
}
for ( i=0 ; i<3*3 ; i++ )
{
pc = static_cast<CColor*>(pw->SearchControl(static_cast<EventType>(EVENT_INTERFACE_PC0a+i)));
if ( pc == nullptr ) break;
//.........这里部分代码省略.........
示例13: 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();
//.........这里部分代码省略.........