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)); }
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)); }
/* * 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)); }
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; }
// 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
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)); }
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)); }
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); }
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)); }
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)); }
/* * 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)); }
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; }
// 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
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); } }
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() )); } } } } } }
void WorldInputCmdProcessor::draw() { if (selection_box_active == true && box_press != box_release) { WorldViewInterface::getViewWindow(&world_win); iXY box1, box2; WorldViewInterface::worldXYtoClientXY(world_win, box_press, &box1); WorldViewInterface::worldXYtoClientXY(world_win, box_release, &box2); --box2.x; box2.y-=3; screen->drawRect(iRect(box1, box2), Color::white); } if (outpost_goal_selection != OBJECTIVE_NONE) { iXY mouse_pos; MouseInterface::getMousePosition( &mouse_pos.x, &mouse_pos.y ); WorldViewInterface::getViewWindow( &world_win ); iXY pos; WorldViewInterface::worldXYtoClientXY(world_win, output_pos_press,&pos); screen->drawLine(pos, mouse_pos, Color::blue); } }
/* * Castle view */ iCastleView::iCastleView() : iChildGameView(false, CV_OVERLAND), m_curTab(-1), m_pCastle(NULL) { AddChild(m_pChilds[0] = new iCnstTab(&gApp.ViewMgr(), this)); AddChild(m_pChilds[1] = new iRecrTab(&gApp.ViewMgr())); AddChild(m_pChilds[2] = new iMGuildTab(&gApp.ViewMgr())); AddChild(m_pChilds[3] = new iMarketTab(&gApp.ViewMgr())); AddChild(m_pChilds[4] = new iTavernTab(&gApp.ViewMgr())); AddChild(new iInfoBar(&gApp.ViewMgr(), this, iRect(0,0,m_Rect.w,15))); AddChild(new iCastleTitleBar(&gApp.ViewMgr(),this, iRect(0,15,m_Rect.w,22))); AddChild(m_pToolBar = new iCastleToolBar(&gApp.ViewMgr(),this, iRect(0,m_Rect.h-21,m_Rect.w,21))); SetCastle(gGame.Map().CurCastle()); ShowPage(CVT_CONSTRUCT); }
void VehicleSelectionView::drawBar(const Surface &dest, const iXY &pos, int length, float percent) { const PIX tickColor = Color::white; iXY size(int(float(length) * percent), CHAR_YPIX); dest.fillRect(iRect(pos.x, pos.y, pos.x + size.x, pos.y + size.y), Color::red); // Draw tick marks. //// Draw 3 major //int topY = pos.y + size.y / 2; //int bottomY = pos.y + size.y; // //dest.drawVLine(pos.x + 0, topY, bottomY, tickColor); //dest.drawVLine(pos.x + length / 2 - 1, topY, bottomY, tickColor); //dest.drawVLine(pos.x + length - 1, topY, bottomY, tickColor); // //// Draw 4 minor //int oneSixth = length / 6; //topY = pos.y + size.y - size.y / 4; //bottomY = pos.y + size.y; // //dest.drawVLine(pos.x + oneSixth - 1, topY, bottomY, tickColor); //dest.drawVLine(pos.x + oneSixth * 2 - 1, topY, bottomY, tickColor); //dest.drawVLine(pos.x + oneSixth * 4 - 1, topY, bottomY, tickColor); //dest.drawVLine(pos.x + oneSixth * 5 - 1, topY, bottomY, tickColor); }
void iDlg_TownList::DoCompose(const iRect& clRect) { iRect rc(clRect); // title gTextComposer.TextOut(dlgfc_hdr, gApp.Surface(),rc.point(), m_title, iRect(rc.x,rc.y,rc.w,15),AlignTop); rc.y+=15; }
// doDraw //--------------------------------------------------------------------------- void RankView::doDraw(Surface &viewArea, Surface &clientArea) { unsigned int flagHeight = ResourceManager::getFlag(0)->getHeight(); unsigned int newheight = HEADER_HEIGHT + (TABLE_BORDER * 2) + (ENTRY_HEIGHT * PlayerInterface::countPlayers()) + DEFAULT_MOVE_AREA_HEIGHT + (DEFAULT_BORDER_SIZE * 2); if ( newheight != (unsigned int)getSizeY() ) { resize(WINDOW_WIDTH, newheight); return; // this frame draws nothing } bltViewBackground(viewArea); clientArea.drawButtonBorder( iRect(0, TABLE_BORDER_START, clientArea.getWidth()-1, clientArea.getHeight()-1), Color::gray64, Color::white); clientArea.bltStringShadowed(0, 16, table_header, Color::red, Color::gray64); drawPlayerStats(clientArea, flagHeight); View::doDraw(viewArea, clientArea); } // end doDraw
void ConsoleInterface::initialize( long size ) { assert( size > 0 ); console_size = size; line_list.initialize( size ); line_index = console_size - 1; surface_size = iXY( 800, 600 ); bounds = iRect( 5, 5, 800 - 5, 600 - 5 ); max_char_per_line = (bounds.max.x - bounds.min.x) / 8; vertical_spacing = 2; line_offset.x = 0; line_offset.y = (14 + vertical_spacing); input_string_active = false; long line_loop; for ( line_loop = 0; line_loop < console_size; line_loop++ ) { line_list[ line_loop ].color = Color::white; line_list[ line_loop ].string[0] = 0; line_list[ line_loop ].life_timer.changePeriod( 30 ); line_list[ line_loop ].visible = false; } commandPos = 0; stdout_pipe = false; }
bool WorldInputCmdProcessor::selectBoundBoxUnits( void ) { bool select_success; long x,y; if ( box_press.x > box_release.x ) { x = box_press.x; box_press.x = box_release.x; box_release.x = x; } if ( box_press.y > box_release.y ) { y = box_press.y; box_press.y = box_release.y; box_release.y = y; } select_success = working_list.selectBounded( iRect( box_press, box_release ) ); if ( select_success == false ) { iXY box_size; box_size = box_release - box_press; if ( (box_size.x > 40) || (box_size.y > 40) ) select_success = true; return( select_success ); } else { current_selection_list_index = 0xFFFF; current_selection_list_bits=0; return( select_success ); } }
void MiniMapInterface::annotateUnits( Surface &map_surface ) { iXY world_loc, map_loc; unsigned char unit_dispostion; unsigned char threat_level; UnitInterface::startUnitPositionEnumeration( ); iRect unitRect; while( UnitInterface::unitPositionEnumeration( &world_loc, &unit_dispostion, &threat_level) ) { map_loc.x = int(float(world_loc.x) / scale_factor.x); map_loc.y = int(float(world_loc.y) / scale_factor.y); if (GameConfig::getMiniMapUnitSize() == _mini_map_unit_size_large) { unitRect = iRect(map_loc, map_loc + 1); } if ( unit_dispostion == _unit_player ) { if ( threat_level == _threat_level_under_attack ) { if ( radar_blink_flag == true ) { drawLargeUnitDot( map_surface, map_loc, Color::yellow ); } } else { if (GameConfig::getMiniMapUnitSize() == _mini_map_unit_size_small) { drawSmallUnitDot( map_surface, map_loc, player_unit_color ); } else if (GameConfig::getMiniMapUnitSize() == _mini_map_unit_size_large) { drawLargeUnitDot( map_surface, map_loc, player_unit_color ); } else { assert(false); } } } else if ( unit_dispostion == _unit_allied ) { if (GameConfig::getMiniMapUnitSize() == _mini_map_unit_size_small) { drawSmallUnitDot( map_surface, map_loc, allie_unit_color ); } else if (GameConfig::getMiniMapUnitSize() == _mini_map_unit_size_large) { drawLargeUnitDot( map_surface, map_loc, allie_unit_color ); } else { assert(false); } } else if( ( unit_dispostion == _unit_enemy ) && (show_enemy_radar_flag == true) ) { if (GameConfig::getMiniMapUnitSize() == _mini_map_unit_size_small) { drawSmallUnitDot( map_surface, map_loc, enemy_objective_color ); } else if (GameConfig::getMiniMapUnitSize() == _mini_map_unit_size_large) { drawLargeUnitDot( map_surface, map_loc, enemy_objective_color ); } else { assert(false); } } } }
// draw //--------------------------------------------------------------------------- void Choice::draw(Surface &dest) const { iRect r(rect); dest.RoundRect(iRect(r.getLocationX(), r.getLocationY(), r.getWidth() - 2, r.getHeight() - 2), 4, Color::gray96); dest.RoundRect(iRect(r.getLocationX()+1, r.getLocationY()+1, r.getWidth() - 1, r.getHeight() - 1), 4, componentActiveTextColor); dest.FillRoundRect(iRect(r.getLocationX()+1, r.getLocationY()+1, r.getWidth() - 2, r.getHeight() - 2), 4, componentBodyColor); const TextRenderer *t; int width = r.getWidth(); if ( !selecting ) { t = choice_renders[index]; t->draw(dest, r.getLocationX() + ((width - t->getWidth()) / 2), r.getLocationY(), componentActiveTextColor ); } else { r.setHeight( TextRenderingSystem::line_height() ); size_t count = choiceList.size(); for (size_t i = 0; i < count; i++) { t = choice_renders[i]; PIX color = componentActiveTextColor; if ( i == mouseover ) { // Higlight the selected item. dest.fillRect(r, componentActiveTextColor); color = Color::black; } t->draw(dest, r.getLocationX() + ((width - t->getWidth()) / 2), r.getLocationY(), color ); r.translate(iXY(0, TextRenderingSystem::line_height())); } } //isOpen = 0; } // end Choice::draw
void iDlg_CreatInfo::OnCreateDlg() { iRect clRect = ClientRect(); // Perks if (CREAT_DESC[m_cGroup.Type()].perks != CPERK_NONE) { AddChild(new iPerksBtn(m_pMgr, iRect(clRect.x, clRect.y + 60, clRect.w, 15), 500, m_cGroup.Type())); } // Buttons if (m_bCanDismiss) { AddChild(new iTextButton(m_pMgr, this, iRect(clRect.x+5, clRect.y2()-DEF_BTN_HEIGHT, 55, DEF_BTN_HEIGHT), TRID_CREAT_DISMISS, 100)); AddChild(new iTextButton(m_pMgr, this, iRect(clRect.x2()-45, clRect.y2()-DEF_BTN_HEIGHT, 40, DEF_BTN_HEIGHT), TRID_OK, DRC_OK)); } else { 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)); } }
// drawCheckBox //--------------------------------------------------------------------------- void CheckBox::drawCheckBox(const Surface &dest) { iRect bounds; getBounds(bounds); iRect r; r = iRect(bounds.min.x, bounds.min.y, bounds.max.x - 2, bounds.max.y - 2); dest.drawRect(r, Color::gray96); r = iRect(bounds.min.x + 1, bounds.min.y + 1, bounds.max.x - 1, bounds.max.y - 1); dest.drawRect(r, Color::white); r = iRect(bounds.min.x + 1, bounds.min.y + 1, bounds.max.x - 2, bounds.max.y - 2); dest.fillRect(r, Color::black); } // end CheckBox::drawCheckBox
// 移动对象 void XUI_Wnd::MoveWindow( int left, int top, int right, int bottom, bool notify ) { m_WindowPosition = iPoint( left, top ); m_WindowSize = iSize( abs(right - left), abs(bottom - top) ); if( notify ) { // 发送位置变更消息 OnMoveWindow( iRect( left, top, right, bottom ) ); } }
bool iPopupMenu::InitPopupMenu(iPopupNotifySubscriber *pwns, const iStringT &capt, const iSize &elsiz) { m_Caption = capt; m_ElementSize = elsiz; if (!CreatePopupWindow(pwns,iRect(0,0,elsiz.w,elsiz.h))) return false; AddMessageSubscriber(this); return true; }
void iScenPropsDlg::OnCreateDlg() { iRect clRect = ClientRect(); sint32 yp = clRect.y; AddChild(new iPHLabel(m_pMgr, iRect(clRect.x, yp, clRect.w, 15), m_scProps.m_Name, AlignTop, dlgfc_hdr) ); yp += 20; AddChild(m_pDfcLabel = new iPHLabel(m_pMgr, iRect(clRect.x, yp, clRect.w, 15), GetDfcString(m_scProps.m_Difficulty), AlignTop, dlgfc_topic) ); yp += 15; AddChild(m_difLevel = new iDifLvlTab(m_pMgr, this, iRect(clRect.x+(clRect.w/2-95),yp,190,38), 301, m_bReadOnly?(Visible):(Visible|Enabled))); if (m_scProps.m_Difficulty == DFC_UNDEFINED) m_scProps.m_Difficulty = DFC_NORMAL; m_difLevel->SetCurrentTab(m_scProps.m_Difficulty); m_pDfcLabel->SetText(GetDfcString(m_scProps.m_Difficulty)); yp += 45; uint32 cnt = m_scProps.TotalPlayers(); sint32 btnsw = cnt * 34 + (cnt-1)*3; sint32 sy = yp; sint32 sx = clRect.x + (clRect.w/2 - btnsw/2); for (uint32 xx=0; xx<cnt; ++xx) { iNationBtn* pNatBtn = new iNationBtn(m_pMgr, iRect(sx,sy,34,22), m_scProps.m_Players[xx].m_Id, m_scProps.m_Players[xx].m_Nation, 150+xx, m_scProps.m_Players[xx].m_Nation != CTLT_RANDOM); AddChild(pNatBtn); m_btnNations.Add(pNatBtn); PLAYER_TYPE tp; switch(m_scProps.m_Players[xx].m_TypeMask) { case PTM_HUMAN_ONLY: tp = PT_HUMAN; break; case PTM_COMPUTER_ONLY: tp = PT_COMPUTER; break; default: tp = xx == 0 ? PT_HUMAN : PT_COMPUTER; break; } iPlayerBtn* pPlBtn = new iPlayerBtn(m_pMgr, this, iRect(sx,sy+25,34,34), m_scProps.m_Players[xx].m_Id, m_bReadOnly ? m_scProps.m_Players[xx].m_Type : tp, 200+xx, (!m_bReadOnly && (m_scProps.m_Players[xx].m_TypeMask == PTM_HUMAN_OR_COMPUTER))?(Visible|Enabled):(Visible)); AddChild(pPlBtn); m_btnPlayers.Add(pPlBtn); sx += 37; } // Buttons sint32 npos = clRect.x + (clRect.w/2-80); AddChild(m_pOkBtn = new iTextButton(m_pMgr,this,iRect(npos,clRect.y2()-DEF_BTN_HEIGHT,50,DEF_BTN_HEIGHT),TRID_OK, DRC_OK,iButton::Visible)); AddChild(new iTextButton(m_pMgr,this,iRect(npos+55,clRect.y2()-DEF_BTN_HEIGHT,50,DEF_BTN_HEIGHT),TRID_INFO, 401)); AddChild(new iTextButton(m_pMgr,this,iRect(npos+110,clRect.y2()-DEF_BTN_HEIGHT,50,DEF_BTN_HEIGHT),TRID_CANCEL, DRC_CANCEL)); UpdateControls(); }
// doDraw //--------------------------------------------------------------------------- void RankView::doDraw(const Surface &viewArea, const Surface &clientArea) { bltViewBackground(viewArea); clientArea.drawButtonBorder(iRect(0, 26, getClientRect().getSize().x - 1, getClientRect().getSize().y - 1), Color::gray64, Color::white); drawPlayerStats(clientArea); View::doDraw(viewArea, clientArea); } // end doDraw