本文整理汇总了C++中iRect函数的典型用法代码示例。如果您正苦于以下问题:C++ iRect函数的具体用法?C++ iRect怎么用?C++ iRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了iRect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: iView
iSpellListView::iSpellListView(iViewMgr* pViewMgr, IViewCmdHandler* pCmdHandler, const iRect& rect, uint32 uid, iHero* pOwner, bool bShowFavorites)
: iView(pViewMgr, rect, GENERIC_VIEWPORT, uid, Visible|Enabled)
, m_pCmdHandler(pCmdHandler)
, m_pOwner(pOwner)
, m_typeMask(0), m_curSel(MSP_INVALID)
{
sint32 bcnt = SSM_COUNT;
if (!bShowFavorites) bcnt--;
sint32 btnW = iMAX<sint32>(rect.w/2,140) / bcnt;
sint32 sbW = btnW*bcnt - 16;
iPHScrollBar* pScrollBar = new iPHScrollBar(m_pMgr, this, iRect(sbW+1, 0, 15, rect.h-16), uid+1);
AddChild(pScrollBar);
m_pSpellListBox = new iSpellListBox(m_pMgr, this, iRect(0, 0, sbW, rect.h-16), uid, m_pOwner);
AddChild(m_pSpellListBox);
m_pSpellListBox->SetScrollBar(pScrollBar);
AddChild(m_pSchoolSwitch = new iBarTabSwitch(pViewMgr, this, iRect(0, rect.h-15, btnW * bcnt, 15), bcnt, uid + 10));
for (uint32 xx=0; xx<bcnt; ++xx) m_pSchoolSwitch->SetTabIcon(SCHOOL_SWITCH_ICONS[xx]);
if (m_pOwner) {
if (m_pOwner->GetSpellSetMode() == SSM_FAVORITES && !bShowFavorites) m_pSchoolSwitch->SetCurrentTab(SSM_ALL);
else m_pSchoolSwitch->SetCurrentTab(m_pOwner->GetSpellSetMode());
}
iRect rrc(rect.size());
rrc.DeflateRect(sbW + 16 + 5, 0, 0, 0);
AddChild(m_pSpellButton = new iSpellBtn(m_pMgr, this, iRect(rrc.x + (rrc.w/2 - 30), 30, 61,36), uid + 20));
}
示例2: ClientRect
void iDlg_HallOfFame::OnCreateDlg()
{
iRect clRect = ClientRect();
// Buttons
AddChild(new iTextButton(m_pMgr, this, iRect(clRect.x + clRect.w/2-55, clRect.y2()-DEF_BTN_HEIGHT, 50, DEF_BTN_HEIGHT), TRID_OK, DRC_OK));
AddChild(new iTextButton(m_pMgr, this, iRect(clRect.x + clRect.w/2+5, clRect.y2()-DEF_BTN_HEIGHT, 50, DEF_BTN_HEIGHT), TRID_RESET, 1000));
}
示例3: iView
/*
* Hero Child
*/
iHeroChild::iHeroChild(iViewMgr* pViewMgr, IViewCmdHandler* pCmdHandler, iSimpleArray<iArtDragDropItem*>& competitors, const iPoint& pos)
: iView(pViewMgr, iRect(pos.x, pos.y, 320, 109), GENERIC_VIEWPORT, 200, Enabled | Visible), m_pHero(NULL), m_pFriend(NULL)
{
AddChild(m_pPortrait = new iHeroBigPortBtn(pViewMgr, this, iRect(3,20,48,48), 201));
AddChild(m_pArtBackPackCtrl = new iArtBackPackCtrl(competitors, pViewMgr, this, iPoint(55,20+18), iSize(32,30), 7, iArtBackPackCtrl::Horizontal, 120));
AddChild(m_pSplitBtn = new iCheckButton(pViewMgr, this, iRect(m_Rect.w-23,m_Rect.h-38,20,36), PDGG_BTN_SPLIT, 140));
AddChild(m_pArmyList = new iArmyListEx(pViewMgr,this,iPoint(3,53+18), m_pSplitBtn, iSize(41,36),110));
}
示例4: View
IRCLobbyView::IRCLobbyView()
: View()
{
lobby_connection=0;
change_name=0;
skipChatLines=0;
lobby_view_height=184;
total_displayed_servers=0;
setSearchName("IRCLobbyView");
setTitle("Lobby");
setSubTitle("");
setAllowResize(false);
setAllowMove(false);
setVisible(false);
topViewableItem=0;
moveTo(iXY(bodyTextRect.max.x-440, bodyTextRect.min.y + 170));
iXY area_size = iXY(440, lobby_view_height);
resizeClientArea(area_size);
int chat_y=lobby_view_height-(Surface::getFontHeight()*2);
addButtonCenterText(iXY(getClientRect().getSizeX()-80, chat_y), 80, "Refresh", "", buttonRefresh);
szChat.init(" ", 255,39);
cInputField* input = addInputField(iXY(4, chat_y), &szChat, "", true);
input->setReturnAction(chatReturnPressed);
server_list_end_y=(Surface::getFontHeight()*6);
chat_list_end_y=getClientRect().getSizeY()-(Surface::getFontHeight()*2);
server_list_end_x=(getClientRect().getSizeX()-12);
iXY size(12, 12);
iXY pos(getClientRect().getSizeX() - size.x, 0);
serverUpButton.setLabel("-");
serverUpButton.setBounds(iRect(pos, pos + size));
add(&serverUpButton);
pos.y= server_list_end_y-size.y;
serverDownButton.setLabel("+");
serverDownButton.setBounds(iRect(pos, pos + size));
add(&serverDownButton);
pos.y+=size.y;
chatUpButton.setLabel("-");
chatUpButton.setBounds(iRect(pos, pos + size));
add(&chatUpButton);
pos.y = chat_list_end_y-size.y;
chatDownButton.setLabel("+");
chatDownButton.setBounds(iRect(pos, pos + size));
add(&chatDownButton);
// XXX ugly ugly ugly
if(!lobby_view)
lobby_view = this;
}
示例5: iRect
// getClientRect
//---------------------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------------------
iRect View::getClientRect() const
{
if (getBordered()) {
return iRect( borderSize,
borderSize + moveAreaHeight,
getSizeX() - borderSize,
getSizeY() - borderSize);
}
return iRect(0, 0, getSizeX(), getSizeY());
} // end View::getClientRect
示例6: ClientRect
void iDlg_TownList::OnCreateDlg()
{
iRect clRect = ClientRect();
AddChild(m_pTownList = new iTownListBox(m_pMgr, this, iRect(clRect.x+5, clRect.y+20, clRect.w-25-1, 130), 101, m_pOwner));
AddChild(m_pScrollBar = new iPHScrollBar(m_pMgr, this, iRect(clRect.x+clRect.w-20,clRect.y+20,15,130), 102));
m_pTownList->SetScrollBar(m_pScrollBar);
sint32 npos = clRect.x + (clRect.w/2-65);
AddChild(m_pbtnOk = new iTextButton(m_pMgr,this,iRect(npos,clRect.y2()-DEF_BTN_HEIGHT,60,DEF_BTN_HEIGHT),m_okBtnText, DRC_OK, Visible));
AddChild(new iTextButton(m_pMgr,this,iRect(npos+70,clRect.y2()-DEF_BTN_HEIGHT,60,DEF_BTN_HEIGHT),TRID_CANCEL, DRC_CANCEL));
}
示例7: ClientRect
void iDlg_LeaveGuards::OnCreateDlg()
{
iRect clRect = ClientRect();
AddChild(m_pSplitBtn = new iCheckButton(m_pMgr, this, iRect(clRect.x+5+36*7,clRect.y+20,18,34*2+1), PDGG_BTN_SPLIT, 103));
AddChild(m_pCnstArmyList = new iArmyListEx(m_pMgr,this,iPoint(clRect.x+5,clRect.y+20),m_pSplitBtn, iSize(35,34),101));
m_pCnstArmyList->SetArmy(&m_pOwnCnst->Guard(), NULL, true);
AddChild(m_pHeroArmyList = new iArmyListEx(m_pMgr,this,iPoint(clRect.x+5,clRect.y+55),m_pSplitBtn, iSize(35,34),102));
m_pHeroArmyList->SetArmy(&m_pHero->Army(), m_pHero, false);
m_pCnstArmyList->AddCompetitor(m_pHeroArmyList);
m_pHeroArmyList->AddCompetitor(m_pCnstArmyList);
AddChild(new iTextButton(m_pMgr, this, iRect((clRect.x+clRect.w/2)-20, clRect.y2()-DEF_BTN_HEIGHT, 40, DEF_BTN_HEIGHT), TRID_OK, DRC_OK));
}
示例8: render
void
LoadingView::doDraw(Surface &viewArea, Surface &clientArea)
{
if (dirty)
render();
screen->fill(Color::black);
backgroundSurface.blt(clientArea, 0, 0);
clientArea.FillRoundRect(iRect(165, 40, 635, 225), 10, Color::black);
clientArea.RoundRect(iRect(165, 40, 635, 225), 10, Color::yellow);
surface.blt(clientArea, 172, 45);
View::doDraw(viewArea, clientArea);
}
示例9: ClientRect
void iDlg_BattleLog::OnCreateDlg()
{
iRect clRect = ClientRect();
AddChild(m_pLogList = new iTextListBox(m_pMgr, this, iRect(clRect.x+5,clRect.y+20,clRect.w-26,135), 101, m_log));
AddChild(m_pScrollBar = new iPHScrollBar(m_pMgr, this, iRect(clRect.x+clRect.w-20,clRect.y+20,15,135), 102));
m_pLogList->SetScrollBar(m_pScrollBar);
if (m_pLogList->LBItemsCount() > m_pLogList->PageSize()) {
// scroll list down
sint32 npos = m_pLogList->LBItemsCount() - m_pLogList->PageSize();
m_pScrollBar->SetCurPos(npos);
m_pLogList->SetCurPos(npos);
}
AddChild(new iTextButton(m_pMgr,this,iRect(clRect.x+(clRect.w/2-20),clRect.y2()-DEF_BTN_HEIGHT,40,DEF_BTN_HEIGHT),TRID_OK, DRC_OK));
}
示例10: OnCreateDlg
void OnCreateDlg()
{
iRect clRect = ClientRect();
AddChild(new iPHLabel(m_pMgr, iRect(clRect.x,clRect.y,clRect.w,15), gTextMgr[TRID_HARDWARE_KEYS_SETTINGS], AlignCenter, dlgfc_hdr));
sint32 xpos = clRect.x + 10;
sint32 ypos = clRect.y + 20;
for (uint16 nn=0; nn<BAT_COUNT; ++nn) {
AddChild(new iPHLabel(m_pMgr, iRect(xpos,ypos,80,DEF_BTN_HEIGHT), gTextMgr[TRID_HKEY_ACT_HELPMODE + nn], AlignRight, dlgfc_topic));
AddChild(m_keyBtn[nn] = new iTextButton(m_pMgr, this, iRect(xpos+85, ypos, 70, DEF_BTN_HEIGHT), TRID_HKEY_NAME_ENTER + gSettings.ActionKey((ButtonActionType)nn), 100+nn));
ypos += DEF_BTN_HEIGHT + 3;
}
AddChild(new iTextButton(m_pMgr,this,iRect(clRect.x+(clRect.w/2-20),clRect.y2()-DEF_BTN_HEIGHT,40,DEF_BTN_HEIGHT),TRID_OK, DRC_OK));
}
示例11: iView
/*
* Castle Toolbar
*/
iCastleToolBar::iCastleToolBar(iViewMgr* pViewMgr, IViewCmdHandler* pCmdHandler, const iRect& rect)
: iView(pViewMgr,rect,GENERIC_VIEWPORT,VPUID_CTLVIEWTOOLBAR,Visible|Enabled), m_pCastle(NULL)
{
// Button with Popup
AddChild(m_pCastleGlyphBtn = new iCastleGlyphBtn(pViewMgr, pCmdHandler, iRect(0,1,32,20), 150));
// Tab switch
m_pTabSwitch = new iBarTabSwitch(pViewMgr, pCmdHandler, iRect(33,1,CVT_COUNT*32,20), CVT_COUNT, 103);
for (uint32 xx=0; xx<CVT_COUNT; ++xx) m_pTabSwitch->SetTabIcon(CVT_ICONS[xx]);
m_pTabSwitch->SetCurrentTab(CVT_CONSTRUCT);
AddChild(m_pTabSwitch);
// Close button
AddChild(new iIconButton(pViewMgr, pCmdHandler, iRect(rect.w-30,1,30,20),PDGG_BTN_CLOSE,VPUID_BTN_CLOSECITY));
}
示例12: rc
void iDlg_CreatInfo::DoCompose(const iRect& clRect)
{
iRect rc(clRect);
// title
gTextComposer.TextOut(dlgfc_hdr, gApp.Surface(),rc.point(),gTextMgr[m_cGroup.Type()*3+TRID_CREATURE_PEASANT_F2], iRect(rc.x,rc.y,rc.w,15),AlignCenter);
rc.y+=15;
// icon
BlitIcon(gApp.Surface(),PDGG_MINIMON+m_cGroup.Type(),iRect(rc.x,rc.y,rc.w,45));
rc.y+=45;
// Perks
if (CREAT_DESC[m_cGroup.Type()].perks != CPERK_NONE) rc.y+=15;
// props
iRect trc(rc.x,rc.y,90,12);
iTextComposer::FontConfig fc(iTextComposer::FS_SMALL, RGB16(192,192,255));
gTextComposer.TextOut(fc, gApp.Surface(),trc.point(),iStringT(gTextMgr[TRID_SKILL_ATTACK])+_T(" :"),trc,AlignTopRight); trc.y+=10;
gTextComposer.TextOut(fc, gApp.Surface(),trc.point(),iStringT(gTextMgr[TRID_SKILL_DEFENCE])+_T(" :"),trc,AlignTopRight); trc.y+=10;
gTextComposer.TextOut(fc, gApp.Surface(),trc.point(),iStringT(gTextMgr[TRID_SKILL_SHOTS])+_T(" :"),trc,AlignTopRight); trc.y+=10;
gTextComposer.TextOut(fc, gApp.Surface(),trc.point(),iStringT(gTextMgr[TRID_SKILL_DAMAGE])+_T(" :"),trc,AlignTopRight); trc.y+=10;
gTextComposer.TextOut(fc, gApp.Surface(),trc.point(),iStringT(gTextMgr[TRID_SKILL_HEALTH])+_T(" :"),trc,AlignTopRight); trc.y+=10;
gTextComposer.TextOut(fc, gApp.Surface(),trc.point(),iStringT(gTextMgr[TRID_SKILL_SPEED])+_T(" :"),trc,AlignTopRight); trc.y+=10;
gTextComposer.TextOut(fc, gApp.Surface(),trc.point(),iStringT(gTextMgr[TRID_SKILL_MORALE])+_T(" :"),trc,AlignTopRight); trc.y+=10;
gTextComposer.TextOut(fc, gApp.Surface(),trc.point(),iStringT(gTextMgr[TRID_SKILL_LUCK])+_T(" :"),trc,AlignTopRight); trc.y+=10;
trc = iRect(rc.x+95,rc.y,rc.w-105,12);
iTextComposer::FontConfig tfc(iTextComposer::FS_SMALL, RGB16(255,220,192));
iStringT tout;
tout.Setf(_T("%d (%d)"),CREAT_DESC[m_cGroup.Type()].attack, CREAT_DESC[m_cGroup.Type()].attack+m_furtSkills.Value(FSK_ATTACK));
gTextComposer.TextOut(tfc, gApp.Surface(),trc.point(),tout,trc,AlignTopLeft); trc.y+=10;
tout.Setf(_T("%d (%d)"),CREAT_DESC[m_cGroup.Type()].defence, CREAT_DESC[m_cGroup.Type()].defence+m_furtSkills.Value(FSK_DEFENCE));
gTextComposer.TextOut(tfc, gApp.Surface(),trc.point(),tout,trc,AlignTopLeft); trc.y+=10;
if (CREAT_DESC[m_cGroup.Type()].shots) tout.Setf(_T("%d"),CREAT_DESC[m_cGroup.Type()].shots);
else tout.Setf(_T("-"));
gTextComposer.TextOut(tfc, gApp.Surface(),trc.point(),tout,trc,AlignTopLeft); trc.y+=10;
tout.Setf(_T("%d - %d"),CREAT_DESC[m_cGroup.Type()].damage_min,CREAT_DESC[m_cGroup.Type()].damage_max);
gTextComposer.TextOut(tfc, gApp.Surface(),trc.point(),tout,trc,AlignTopLeft); trc.y+=10;
tout.Setf(_T("%d (%d)"),CREAT_DESC[m_cGroup.Type()].hits, CREAT_DESC[m_cGroup.Type()].hits+m_furtSkills.Value(FSK_HITS));
gTextComposer.TextOut(tfc, gApp.Surface(),trc.point(),tout,trc,AlignTopLeft); trc.y+=10;
tout.Setf(_T("%d (%d)"),CREAT_DESC[m_cGroup.Type()].speed, CREAT_DESC[m_cGroup.Type()].speed+m_furtSkills.Value(FSK_SPEED));
gTextComposer.TextOut(tfc, gApp.Surface(),trc.point(),tout,trc,AlignTopLeft); trc.y+=10;
sint32 morale = (CREAT_DESC[m_cGroup.Type()].perks&CPERK_UNDEAD)?0:(m_furtSkills.Value(FSK_MORALE)+m_moraleMod);
gTextComposer.TextOut(tfc, gApp.Surface(),trc.point(),FormatNumber(morale,true),trc,AlignTopLeft); trc.y+=10;
gTextComposer.TextOut(tfc, gApp.Surface(),trc.point(),FormatNumber(m_furtSkills.Value(FSK_LUCK),true),trc,AlignTopLeft); trc.y+=10;
}
示例13: doDraw
// doDraw
//---------------------------------------------------------------------------
void MiniMapView::doDraw(Surface &viewArea, Surface &clientArea)
{
// border
viewArea.drawRect(iRect(0,0,viewArea.getWidth(), viewArea.getHeight()),Color::gray);
// GameTemplateView::doDraw(viewArea, clientArea);
} // end doDraw
示例14: ComposeLBItem
void ComposeLBItem(uint32 iIdx, bool bSel, const iRect& irc)
{
iTextComposer::FontConfig fc(dlgfc_plain);
iRect rc=irc;
if (bSel) {
gGfxMgr.BlitTile(PDGG_CTILE, gApp.Surface(),rc);
ButtonFrame(gApp.Surface(),rc,0);
}
rc.DeflateRect(2);
iCastle* pCastle = *(m_pOwner->CastleFirst()+iIdx);
// Glyph
gApp.Surface().FillRect(iRect(rc.x,rc.y,34,22),cColor_Black);
SpriteId sid = PDGG_CTL_SICONS + (pCastle->Proto()->Size()-1)*CTLT_COUNT + pCastle->Proto()->Type();
gGfxMgr.Blit(sid,gApp.Surface(), iPoint(rc.x+1,rc.y+1));
// Name
rc.DeflateRect(36,0,0,0);
rc.h = 10;
gTextComposer.TextOut(dlgfc_topic,gApp.Surface(),rc,pCastle->Name(),rc,AlignTop);
rc.y+=10;
State state = GetItemState(iIdx);
if (state == Occupied) {
iTextComposer::FontConfig fc(iTextComposer::FS_SMALL,RGB16(255,128,128));
gTextComposer.TextOut(fc,gApp.Surface(),rc,pCastle->Visitor()->Name(),rc,AlignTop);
} else if (state == Normal) {
iTextComposer::FontConfig fc(iTextComposer::FS_SMALL,RGB16(128,255,128));
gTextComposer.TextOut(fc,gApp.Surface(),rc,gTextMgr[TRID_UNOCCUPIED],rc,AlignTop);
} else {
check(0);
}
}
示例15: AddFrame
void Sprite::LoadFromText(const char *text)
{
TextParser parser;
parser.Parse(text);
TextParser::NODE *node = NULL;
if ((node = parser.GetNode("FILETYPE")) && node->values[0] == "SPRITE")
{
if ((node = parser.GetNode("RESOURCE")))
{
_texture = static_cast<Texture*>(LE_ResourceManager.GetResourceWithRegister(node->values[0].GetCharPtr())->data);
}
if ((node = parser.GetNode("FRAMES")))
{
for (size_t i = 0; i<node->children.count(); i++)
{
TextParser::NODE *child = node->children[i];
if (child)
{
TextParser::NODE *node_rect = child->FindChild("RECT");
if (node_rect)
{
AddFrame(iRect(node_rect->values[0].ToInt(),
node_rect->values[1].ToInt(),
node_rect->values[2].ToInt(),
node_rect->values[3].ToInt()
));
}
}
}
}
}
}