本文整理汇总了C++中ui::CWindow::CreateButton方法的典型用法代码示例。如果您正苦于以下问题:C++ CWindow::CreateButton方法的具体用法?C++ CWindow::CreateButton怎么用?C++ CWindow::CreateButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ui::CWindow
的用法示例。
在下文中一共展示了CWindow::CreateButton方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateInterface
bool CAutoBase::CreateInterface(bool bSelect)
{
Ui::CWindow* pw;
Math::Point pos, dim, ddim;
float ox, oy, sx, sy;
float sleep, delay, magnetic, progress;
CAuto::CreateInterface(bSelect);
if ( !bSelect ) return true;
pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == nullptr ) return false;
dim.x = 33.0f/640.0f;
dim.y = 33.0f/480.0f;
ox = 3.0f/640.0f;
oy = 3.0f/480.0f;
sx = 33.0f/640.0f;
sy = 33.0f/480.0f;
ddim.x = dim.x*1.5f;
ddim.y = dim.y*1.5f;
//? pos.x = ox+sx*7.25f;
//? pos.y = oy+sy*0.25f;
//? pw->CreateButton(pos, ddim, 63, EVENT_OBJECT_BHELP);
pos.x = ox+sx*8.00f;
pos.y = oy+sy*0.25f;
pw->CreateButton(pos, ddim, 28, EVENT_OBJECT_BTAKEOFF);
if ( m_lightning->GetStatus(sleep, delay, magnetic, progress) )
{
pos.x = ox+sx*10.2f;
pos.y = oy+sy*0.5f;
ddim.x = dim.x*1.0f;
ddim.y = dim.y*1.0f;
pw->CreateButton(pos, ddim, 41, EVENT_OBJECT_LIMIT);
}
pos.x = ox+sx*0.0f;
pos.y = oy+sy*0;
ddim.x = 66.0f/640.0f;
ddim.y = 66.0f/480.0f;
pw->CreateGroup(pos, ddim, 100, EVENT_OBJECT_TYPE);
UpdateInterface();
return true;
}
示例2: CreateInterface
bool CAutoPowerCaptor::CreateInterface(bool bSelect)
{
Ui::CWindow* pw;
Math::Point pos, ddim;
float ox, oy, sx, sy;
CAuto::CreateInterface(bSelect);
if ( !bSelect ) return true;
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == nullptr ) return false;
ox = 3.0f/640.0f;
oy = 3.0f/480.0f;
sx = 33.0f/640.0f;
sy = 33.0f/480.0f;
pos.x = ox+sx*0.0f;
pos.y = oy+sy*0;
ddim.x = 66.0f/640.0f;
ddim.y = 66.0f/480.0f;
pw->CreateGroup(pos, ddim, 113, EVENT_OBJECT_TYPE);
pos.x = ox+sx*10.2f;
pos.y = oy+sy*0.5f;
ddim.x = 33.0f/640.0f;
ddim.y = 33.0f/480.0f;
pw->CreateButton(pos, ddim, 41, EVENT_OBJECT_LIMIT);
return true;
}
示例3: CreateInterface
bool CAutoDestroyer::CreateInterface(bool bSelect)
{
Ui::CWindow* pw;
Math::Point pos, ddim;
float ox, oy, sx, sy;
CObject* scrap;
CAuto::CreateInterface(bSelect);
if ( !bSelect ) return true;
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == nullptr ) return false;
ox = 3.0f/640.0f;
oy = 3.0f/480.0f;
sx = 33.0f/640.0f;
sy = 33.0f/480.0f;
pos.x = ox+sx*0.0f;
pos.y = oy+sy*0;
ddim.x = 66.0f/640.0f;
ddim.y = 66.0f/480.0f;
pw->CreateGroup(pos, ddim, 106, EVENT_OBJECT_TYPE);
pos.x = ox+sx*8.00f;
pos.y = oy+sy*0.25f;
ddim.x = (33.0f/640.0f)*1.5f;
ddim.y = (33.0f/480.0f)*1.5f;
pw->CreateButton(pos, ddim, 12, EVENT_OBJECT_BDESTROY);
scrap = SearchPlastic();
EnableInterface(pw, EVENT_OBJECT_BDESTROY, (scrap != 0));
return true;
}
示例4: CreateInterface
bool CAutoFactory::CreateInterface(bool bSelect)
{
Ui::CWindow* pw;
Math::Point pos, dim, ddim;
float ox, oy, sx, sy;
CAuto::CreateInterface(bSelect);
if ( !bSelect ) return true;
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == nullptr ) return false;
dim.x = 33.0f/640.0f;
dim.y = 33.0f/480.0f;
ox = 3.0f/640.0f;
oy = 3.0f/480.0f;
sx = 33.0f/640.0f;
sy = 33.0f/480.0f;
pos.x = 0.0f;
pos.y = oy+sy*2.6f;
ddim.x = 138.0f/640.0f;
ddim.y = 222.0f/480.0f;
pw->CreateGroup(pos, ddim, 6, EVENT_WINDOW3);
pos.x = ox+sx*0.0f;
pos.y = oy+sy*8.2f;
pw->CreateButton(pos, dim, 128+9, EVENT_OBJECT_FACTORYwa);
pos.x += dim.x;
pw->CreateButton(pos, dim, 128+10, EVENT_OBJECT_FACTORYta);
pos.x += dim.x;
pw->CreateButton(pos, dim, 128+11, EVENT_OBJECT_FACTORYfa);
pos.x += dim.x;
pw->CreateButton(pos, dim, 128+22, EVENT_OBJECT_FACTORYia);
pos.x = ox+sx*0.0f;
pos.y = oy+sy*7.1f;
pw->CreateButton(pos, dim, 128+12, EVENT_OBJECT_FACTORYws);
pos.x += dim.x;
pw->CreateButton(pos, dim, 128+13, EVENT_OBJECT_FACTORYts);
pos.x += dim.x;
pw->CreateButton(pos, dim, 128+14, EVENT_OBJECT_FACTORYfs);
pos.x += dim.x;
pw->CreateButton(pos, dim, 128+24, EVENT_OBJECT_FACTORYis);
pos.x = ox+sx*0.0f;
pos.y = oy+sy*6.0f;
pw->CreateButton(pos, dim, 128+15, EVENT_OBJECT_FACTORYwc);
pos.x += dim.x;
pw->CreateButton(pos, dim, 128+16, EVENT_OBJECT_FACTORYtc);
pos.x += dim.x;
pw->CreateButton(pos, dim, 128+17, EVENT_OBJECT_FACTORYfc);
pos.x += dim.x;
pw->CreateButton(pos, dim, 128+23, EVENT_OBJECT_FACTORYic);
pos.x = ox+sx*0.0f;
pos.y = oy+sy*4.9f;
pw->CreateButton(pos, dim, 128+25, EVENT_OBJECT_FACTORYwi);
pos.x += dim.x;
pw->CreateButton(pos, dim, 128+26, EVENT_OBJECT_FACTORYti);
pos.x += dim.x;
pw->CreateButton(pos, dim, 128+27, EVENT_OBJECT_FACTORYfi);
pos.x += dim.x;
pw->CreateButton(pos, dim, 128+28, EVENT_OBJECT_FACTORYii);
pos.x = ox+sx*0.0f;
pos.y = oy+sy*3.8f;
pw->CreateButton(pos, dim, 128+18, EVENT_OBJECT_FACTORYrt);
pos.x += dim.x;
pw->CreateButton(pos, dim, 128+19, EVENT_OBJECT_FACTORYrc);
pos.x += dim.x;
pw->CreateButton(pos, dim, 128+20, EVENT_OBJECT_FACTORYrr);
pos.x += dim.x;
pw->CreateButton(pos, dim, 128+29, EVENT_OBJECT_FACTORYrs);
pos.x = ox+sx*0.0f;
pos.y = oy+sy*2.7f;
pw->CreateButton(pos, dim, 128+21, EVENT_OBJECT_FACTORYsa);
pos.x = ox+sx*0.0f;
pos.y = oy+sy*0;
ddim.x = 66.0f/640.0f;
ddim.y = 66.0f/480.0f;
pw->CreateGroup(pos, ddim, 101, EVENT_OBJECT_TYPE);
UpdateInterface();
return true;
}
示例5: DisplayText
void CDisplayText::DisplayText(const char *text, Math::Vector goal, float height,
float dist, float time, TextType type)
{
CObject* toto;
CMotion* motion;
Ui::CWindow* pw;
Ui::CButton* button;
Ui::CGroup* group;
Ui::CLabel* label;
Math::Point pos, ppos, dim;
Sound sound;
float hLine, hBox;
int nLine, icon, i;
if ( !m_bEnable ) return;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 )
{
pos.x = 0.0f;
pos.y = 0.0f;
dim.x = 0.0f;
dim.y = 0.0f;
pw = m_interface->CreateWindows(pos, dim, 10, EVENT_WINDOW2);
}
hBox = 0.045f;
hLine = m_engine->GetText()->GetHeight(Gfx::FONT_COLOBOT, FONTSIZE);
nLine = 0;
for ( i=0 ; i<MAXDTLINE ; i++ )
{
group = static_cast<CGroup*>(pw->SearchControl(EventType(EVENT_DT_GROUP0+i)));
if ( group == 0 ) break;
nLine ++;
}
if ( nLine == MAXDTLINE )
{
ClearLastText();
nLine --;
}
pos.x = 0.10f;
pos.y = 0.92f-hBox-hBox*nLine;
dim.x = 0.80f;
dim.y = hBox;
icon = 1; // yellow
if ( type == TT_ERROR ) icon = 9; // red
if ( type == TT_WARNING ) icon = 10; // blue
if ( type == TT_INFO ) icon = 8; // green
if ( type == TT_MESSAGE ) icon = 11; // yellow
pw->CreateGroup(pos, dim, icon, EventType(EVENT_DT_GROUP0+nLine));
pw->SetTrashEvent(false);
ppos = pos;
ppos.y -= hLine/2.0f;
label = pw->CreateLabel(ppos, dim, -1, EventType(EVENT_DT_LABEL0+nLine), text);
if ( label != 0 )
{
label->SetFontSize(FONTSIZE);
}
dim.x = dim.y*0.75f;
pos.x -= dim.x;
button = pw->CreateButton(pos, dim, 14, EventType(EVENT_DT_VISIT0+nLine));
if ( goal.x == 0.0f &&
goal.y == 0.0f &&
goal.z == 0.0f )
{
button->ClearState(STATE_ENABLE);
}
m_bExist[nLine] = true;
m_visitGoal[nLine] = goal;
m_visitDist[nLine] = dist;
m_visitHeight[nLine] = height;
m_time[nLine] = time*m_delayFactor;
toto = SearchToto();
if ( toto != 0 )
{
motion = toto->GetMotion();
if ( motion != 0 )
{
if ( type == TT_ERROR )
{
motion->SetAction(MT_ERROR, 4.0f);
}
if ( type == TT_WARNING )
{
motion->SetAction(MT_WARNING, 4.0f);
}
if ( type == TT_INFO )
{
motion->SetAction(MT_INFO, 4.0f);
}
//.........这里部分代码省略.........
示例6: StartDisplayInfo
void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluce)
{
Gfx::Light light;
Math::Point pos, dim;
Ui::CWindow* pw;
Ui::CEdit* edit;
Ui::CButton* button;
Ui::CSlider* slider;
CMotionToto* toto;
m_index = index;
m_bSoluce = bSoluce;
m_bEditLock = m_main->GetEditLock();
if ( m_bEditLock ) // edition running program?
{
pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW3));
if ( pw != 0 )
{
pw->ClearState(STATE_ENABLE); // CStudio inactive
}
}
m_main->SetEditLock(true, false);
m_main->SetEditFull(false);
m_bInitPause = m_pause->GetPauseType();
m_pause->SetPause(PAUSE_SATCOM);
m_infoCamera = m_camera->GetType();
m_camera->SetType(Gfx::CAM_TYPE_INFO);
pos = m_infoActualPos = m_infoFinalPos;
dim = m_infoActualDim = m_infoFinalDim;
pw = m_interface->CreateWindows(pos, dim, 4, EVENT_WINDOW4);
if ( pw == 0 ) return;
//? pw->SetClosable(true);
//? GetResource(RES_TEXT, RT_DISINFO_TITLE, res);
//? pw->SetName(res);
//? pw->SetMinDim(Math::Point(0.56f, 0.40f));
//? pw->SetMaximized(m_bInfoMaximized);
//? pw->SetMinimized(m_bInfoMinimized);
//? m_main->SetEditFull(m_bInfoMaximized);
edit = pw->CreateEdit(pos, dim, 0, EVENT_EDIT1);
if ( edit == 0 ) return;
edit->SetState(STATE_SHADOW);
edit->SetMultiFont(true);
edit->SetMaxChar(10000);
edit->SetFontType(Gfx::FONT_COLOBOT);
edit->SetSoluceMode(bSoluce);
edit->ReadText(filename.c_str());
edit->HyperHome(filename.c_str());
edit->SetEditCap(false); // just to see!
edit->SetHighlightCap(false);
edit->SetFocus(true);
ViewDisplayInfo();
button = pw->CreateButton(pos, dim, 128+57, EVENT_SATCOM_HUSTON);
button->SetState(STATE_SHADOW);
button = pw->CreateButton(pos, dim, 128+58, EVENT_SATCOM_SAT);
button->SetState(STATE_SHADOW);
//? button = pw->CreateButton(pos, dim, 128+59, EVENT_SATCOM_OBJECT);
//? button->SetState(STATE_SHADOW);
button = pw->CreateButton(pos, dim, 53, EVENT_SATCOM_LOADING);
button->SetState(STATE_SHADOW);
button = pw->CreateButton(pos, dim, 128+60, EVENT_SATCOM_PROG);
button->SetState(STATE_SHADOW);
button = pw->CreateButton(pos, dim, 20, EVENT_SATCOM_SOLUCE);
button->SetState(STATE_SHADOW);
pw->CreateGroup(pos, dim, 18, EVENT_LABEL1); // arrow >
pw->CreateGroup(pos, dim, 19, EVENT_LABEL2); // symbol SatCom
button = pw->CreateButton(pos, dim, 55, EVENT_HYPER_PREV);
button->SetState(STATE_SHADOW);
button = pw->CreateButton(pos, dim, 48, EVENT_HYPER_NEXT);
button->SetState(STATE_SHADOW);
button = pw->CreateButton(pos, dim, 30, EVENT_HYPER_HOME);
button->SetState(STATE_SHADOW);
button = pw->CreateButton(pos, dim, 82, EVENT_HYPER_SIZE1);
button->SetState(STATE_SHADOW);
button = pw->CreateButton(pos, dim, 83, EVENT_HYPER_SIZE2);
button->SetState(STATE_SHADOW);
button = pw->CreateButton(pos, dim, 90, EVENT_HYPER_SIZE3);
button->SetState(STATE_SHADOW);
button = pw->CreateButton(pos, dim, 91, EVENT_HYPER_SIZE4);
button->SetState(STATE_SHADOW);
slider = pw->CreateSlider(pos, dim, 0, EVENT_STUDIO_SIZE);
slider->SetState(STATE_SHADOW);
slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f);
button = pw->CreateButton(pos, dim, 61, EVENT_HYPER_COPY);
button->SetState(STATE_SHADOW);
HyperUpdate();
button = pw->CreateButton(pos, dim, -1, EVENT_OBJECT_INFOOK);
button->SetState(STATE_SHADOW);
button->SetState(STATE_SIMPLY);
button->SetState(STATE_DEFAULT);
pw->CreateGroup(pos, dim, 21, EVENT_LABEL3); // symbol stand-by
//.........这里部分代码省略.........
示例7: CreateInterface
bool CAuto::CreateInterface(bool bSelect)
{
Ui::CWindow* pw;
Math::Point pos, dim, ddim;
float ox, oy, sx, sy;
pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw != nullptr )
{
pw->Flush(); // destroys the window buttons
m_interface->DeleteControl(EVENT_WINDOW0); // destroys the window
}
if ( !bSelect ) return true;
pos.x = 0.0f;
pos.y = 0.0f;
dim.x = 540.0f/640.0f;
//? dim.y = 70.0f/480.0f;
dim.y = 86.0f/480.0f;
m_interface->CreateWindows(pos, dim, 3, EVENT_WINDOW0);
pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false;
std::string name;
m_object->GetTooltipName(name);
pos.x = 0.0f;
pos.y = 64.0f/480.0f;
ddim.x = 540.0f/640.0f;
ddim.y = 16.0f/480.0f;
pw->CreateLabel(pos, ddim, 0, EVENT_LABEL0, name);
dim.x = 33.0f/640.0f;
dim.y = 33.0f/480.0f;
ox = 3.0f/640.0f;
oy = 3.0f/480.0f;
sx = 33.0f/640.0f;
sy = 33.0f/480.0f;
pos.x = ox+sx*7.0f;
pos.y = oy+sy*0.6f;
ddim.x = 160.0f/640.0f;
ddim.y = 26.0f/480.0f;
pw->CreateGauge(pos, ddim, 0, EVENT_OBJECT_GPROGRESS);
if ( m_type != OBJECT_BASE &&
m_type != OBJECT_SAFE &&
m_type != OBJECT_HUSTON )
{
pos.x = ox+sx*2.1f;
pos.y = oy+sy*0;
ddim.x = dim.x*0.6f;
ddim.y = dim.y*0.6f;
pw->CreateButton(pos, ddim, 12, EVENT_OBJECT_DELETE);
}
#if 0
pos.x = ox+sx*12.4f;
pos.y = oy+sy*1;
pw->CreateButton(pos, dim, 63, EVENT_OBJECT_BHELP);
pos.x = ox+sx*12.4f;
pos.y = oy+sy*0;
pw->CreateButton(pos, dim, 19, EVENT_OBJECT_HELP);
if ( m_main->GetSceneSoluce() )
{
pos.x = ox+sx*13.4f;
pos.y = oy+sy*1;
pw->CreateButton(pos, dim, 20, EVENT_OBJECT_SOLUCE);
}
pos.x = ox+sx*13.4f;
pos.y = oy+sy*0;
pw->CreateButton(pos, dim, 10, EVENT_OBJECT_DESELECT);
#else
pos.x = ox+sx*12.3f;
pos.y = oy+sy*-0.1f;
ddim.x = dim.x*1.0f;
ddim.y = dim.y*2.1f;
pw->CreateGroup(pos, ddim, 20, EVENT_NULL); // solid blue background
pos.x = ox+sx*12.3f;
pos.y = oy+sy*1;
pw->CreateGroup(pos, dim, 19, EVENT_NULL); // sign SatCom
pos.x = ox+sx*12.4f;
pos.y = oy+sy*0.5f;
ddim.x = dim.x*0.8f;
ddim.y = dim.y*0.5f;
pw->CreateButton(pos, ddim, 18, EVENT_OBJECT_BHELP);
pos.y = oy+sy*0.0f;
pw->CreateButton(pos, ddim, 19, EVENT_OBJECT_HELP);
pos.x = ox+sx*13.4f;
pos.y = oy+sy*0;
pw->CreateButton(pos, dim, 10, EVENT_OBJECT_DESELECT);
#endif
pos.x = ox+sx*14.9f;
//.........这里部分代码省略.........
示例8: CreateInterface
bool CAutoResearch::CreateInterface(bool bSelect)
{
Ui::CWindow* pw;
Math::Point pos, dim, ddim;
float ox, oy, sx, sy;
CAuto::CreateInterface(bSelect);
if ( !bSelect ) return true;
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == nullptr ) return false;
dim.x = 33.0f/640.0f;
dim.y = 33.0f/480.0f;
ox = 3.0f/640.0f;
oy = 3.0f/480.0f;
sx = 33.0f/640.0f;
sy = 33.0f/480.0f;
pos.x = ox+sx*7.0f;
pos.y = oy+sy*1.0f;
pw->CreateButton(pos, dim, 64+0, EVENT_OBJECT_RTANK);
pos.x = ox+sx*8.0f;
pos.y = oy+sy*1.0f;
pw->CreateButton(pos, dim, 64+1, EVENT_OBJECT_RFLY);
pos.x = ox+sx*9.0f;
pos.y = oy+sy*1.0f;
pw->CreateButton(pos, dim, 64+3, EVENT_OBJECT_RCANON);
pos.x = ox+sx*10.0f;
pos.y = oy+sy*1.0f;
pw->CreateButton(pos, dim, 64+4, EVENT_OBJECT_RTOWER);
pos.x = ox+sx*7.0f;
pos.y = oy+sy*0.0f;
pw->CreateButton(pos, dim, 64+7, EVENT_OBJECT_RATOMIC);
pos.x = ox+sx*8.0f;
pos.y = oy+sy*0.0f;
pw->CreateButton(pos, dim, 64+2, EVENT_OBJECT_RTHUMP);
pos.x = ox+sx*9.0f;
pos.y = oy+sy*0.0f;
pw->CreateButton(pos, dim, 64+6, EVENT_OBJECT_RSHIELD);
pos.x = ox+sx*10.0f;
pos.y = oy+sy*0.0f;
pw->CreateButton(pos, dim, 64+5, EVENT_OBJECT_RPHAZER);
pos.x = ox+sx*14.5f;
pos.y = oy+sy*0;
ddim.x = 14.0f/640.0f;
ddim.y = 66.0f/480.0f;
pw->CreateGauge(pos, ddim, 0, EVENT_OBJECT_GENERGY);
pos.x = ox+sx*0.0f;
pos.y = oy+sy*0;
ddim.x = 66.0f/640.0f;
ddim.y = 66.0f/480.0f;
pw->CreateGroup(pos, ddim, 102, EVENT_OBJECT_TYPE);
UpdateInterface();
return true;
}