void Paint(Surface* pSurface) { if (m_pImageBkgnd) pSurface->BitBlt(WinPoint(0, 0), m_pImageBkgnd->GetSurface(), WinRect(m_ptImgOrigin.X(), m_ptImgOrigin.Y(), m_ptImgOrigin.X() + XSize(), m_ptImgOrigin.Y() + YSize())); // calc num Items to draw int iLastVisibleItem = LastVisibleItem(); int iLastItem = m_vItems.GetCount() - 1; if (iLastVisibleItem > iLastItem) iLastVisibleItem = iLastItem; // draw each Item WinRect rectPaint = WinRect(0, 0, m_nItemWidth, YSize()); WinRect rectItem = rectPaint; rectItem.bottom = rectItem.top; ZAssert(m_iTopItem >= 0); // count the number of slots for the first item which we are not drawing int nNumHiddenSlots = 0; if (m_vItems.GetCount() > 0) { while (m_iTopItem - nNumHiddenSlots > 0 && m_vItems[m_iTopItem - (nNumHiddenSlots + 1)] == m_vItems[m_iTopItem]) nNumHiddenSlots++; for (int iItem = m_iTopItem; iItem <= iLastVisibleItem; iItem += m_vItems[iItem]->GetItemHeight() - nNumHiddenSlots, nNumHiddenSlots = 0) { rectItem.top = rectItem.bottom; int nLinesLeft = (iLastVisibleItem - iItem) + 1; int nLines = m_vItems[iItem]->GetItemHeight() - nNumHiddenSlots; rectItem.bottom += m_nItemHeight * (nLines > nLinesLeft ? nLinesLeft : nLines); // draw highlight if selected bool bItemSel = (m_iSelItem == iItem); if (bItemSel && m_pImageBkgndSel) pSurface->BitBlt(rectItem.Min(), m_pImageBkgndSel->GetSurface(), rectItem); // draw item m_vItems[iItem]->DrawItem(pSurface, rectItem, bItemSel, nNumHiddenSlots); } } }
Result::Result(ProgramSystemMain *_sys,GameMain *gm) : SystemState(_sys,RESULT) { //どうでもよさそうなカウンタ FinishBegin_cnt = UINT_MAX; //配列初期化 player.clear(); for(unsigned int i=0;i<gm->player.size();i++){ player.push_back(Player()); //入力初期化 player[i].pushtime_left = 1; player[i].pushtime_middle = 0; player[i].pushtime_right = 0; player[i].pushtime_key.clear(); player[i].input = gm->player[i].input; player[i].pushtime_key[SDLK_RETURN] = 1; //状況初期化 player[i].isReady = false; } //順位集計 rank.clear(); for(unsigned int i=0;i<gm->player.size();i++){rank.push_back(i);} //hp多い順 > 倒した数多い順 > 倒された数少ない順 でランク配列をソート for(unsigned int j=0;j<gm->player.size();j++){ for(unsigned int i=j+1;i<gm->player.size();i++){ //HPが多いなら if(gm->player[rank[j]].base->hp < gm->player[rank[i]].base->hp) std::swap(rank[j],rank[i]); else if(gm->player[rank[j]].base->hp == gm->player[rank[i]].base->hp){ //倒した数が多いなら if(gm->player[rank[j]].killed_cnt < gm->player[rank[i]].killed_cnt) std::swap(rank[j],rank[i]); else if(gm->player[rank[j]].killed_cnt == gm->player[rank[i]].killed_cnt){ //倒された数が少ないなら if(gm->player[rank[j]].bekilled_cnt > gm->player[rank[j]].bekilled_cnt) std::swap(rank[j],rank[i]); } } } } //結果集計 for(unsigned int i=0;i<gm->player.size();i++){ player[i].name = gm->player[i].name; player[i].spendmoney = gm->player[i].spendmoney; player[i].killed = gm->player[i].killed_cnt; player[i].bekilled = gm->player[i].bekilled_cnt; player[i].typeofBase = gm->player[i].typeofBase; } for(unsigned int i=0;i<rank.size();i++){ player[rank[i]].rank=i+1; } //決定ボタンの位置 readybutton_rect = WinRect( 0,0, systemmain->screen->w, systemmain->screen->h); player_ctrl = gm->player_ctrl; }
//////////////////////////////////////////////////////////////////////////////////////////////////// // PaintAll() // Paint this panes surface, then paint any children. // Note: the function ::Paint(), is overloaded by any class derived from Pane. // Added: pass the clip rect round, as with the others, pass by copy, as this can then be modified // and passed to child panes. //////////////////////////////////////////////////////////////////////////////////////////////////// void Pane::PaintAll( Surface * psurface ) { // Clipping test - TBD: reinstate. /* if( ( rectClip.XMax() <= rectClip.XMin() ) || ( rectClip.YMax() <= rectClip.YMin() ) || ( rectClip.XMax() < 0 ) || ( rectClip.YMax() < 0 ) ) { return; }*/ if( !m_bHidden ) { Paint( psurface ); for(Pane* ppane = m_pchild; ppane != NULL; ppane = ppane->m_pnext) { WinRect rectClipOld = psurface->GetClipRect(); psurface->Offset(ppane->m_offset); psurface->SetClipRect(WinRect(WinPoint(0, 0), ppane->GetSize())); D3DVIEWPORT9 newViewport, oldViewport; CD3DDevice9::Get()->GetViewport( &oldViewport ); WinRect surfClip = psurface->GetClipRect(); WinPoint surfOffset = psurface->GetOffset(); newViewport.X = surfClip.XMin() + surfOffset.X(); newViewport.Y = surfClip.YMin() + surfOffset.Y(); newViewport.Width = surfClip.XMax() - surfClip.XMin(); newViewport.Height = surfClip.YMax() - surfClip.YMin(); newViewport.MinZ = oldViewport.MinZ; newViewport.MaxZ = oldViewport.MaxZ; newViewport.X = (int) newViewport.X < 0 ? 0 : newViewport.X; newViewport.Y = (int) newViewport.Y < 0 ? 0 : newViewport.Y; newViewport.Width = (int) newViewport.Width < 0 ? 0 : newViewport.Width; newViewport.Height = (int) newViewport.Height < 0 ? 0 : newViewport.Height; if( ( newViewport.Width > 0 ) && ( newViewport.Height > 0 ) ) { CD3DDevice9::Get()->SetViewport( &newViewport ); ppane->PaintAll( psurface ); } psurface->Offset(-ppane->m_offset); psurface->RestoreClipRect(rectClipOld); if( ( newViewport.Width > 0 ) && ( newViewport.Height > 0 ) ) { CD3DDevice9::Get()->SetViewport( &oldViewport ); } } m_bNeedPaint = false; m_bPaintAll = false; } }
WinRect OilRect::ToWin(View *pView) const { // Get pixel size for this view // NB. Previously this was done with 4 function calls! - Tim FIXED16 PixelWidth, PixelHeight; pView->GetPixelSize(&PixelWidth, &PixelHeight); // Do the conversion and return the results. return WinRect(INT32(MPtoPixel(lo.x, PixelWidth)), -INT32(MPtoPixel(hi.y, PixelHeight) ), INT32(MPtoPixel(hi.x, PixelWidth)), -INT32(MPtoPixel(lo.y, PixelHeight) )); }
void Paint(Surface* psurface) { if (m_value != 0) { psurface->BitBlt( WinPoint(0, 0), m_psurface, WinRect(0, 0, m_value, YSize()) ); } if (m_value < m_valueFlash) { psurface->FillRect( WinRect( m_value, 0, m_valueFlash, YSize() ), m_colorFlash ); } }
void Paint(ItemID pitemArg, Surface* psurface, bool bSelected, bool bFocus) { StringListItem* pitem = (StringListItem*)pitemArg; if (bSelected) { psurface->FillRect( WinRect(0, 0, GetXSize(), GetYSize()), m_colorSelected ); } psurface->DrawString(m_pfont, m_color, WinPoint(0, 0), pitem->GetString()); }
void Pane::PaintAll(Surface* psurface) { if (!m_bHidden) { Paint(psurface); for(Pane* ppane = m_pchild; ppane != NULL; ppane = ppane->m_pnext) { WinRect rectClipOld = psurface->GetClipRect(); psurface->Offset(ppane->m_offset); psurface->SetClipRect(WinRect(WinPoint(0, 0), ppane->GetSize())); ppane->PaintAll(psurface); psurface->Offset(-ppane->m_offset); psurface->RestoreClipRect(rectClipOld); } m_bNeedPaint = false; m_bPaintAll = false; } }
void Pane::InternalPaint(Surface* psurface) { if (m_bPaintAll) { TunnelPaint(psurface, true); } else if (m_bNeedPaint) { if (m_pchild != NULL) { for(Pane* ppane = m_pchild; ppane != NULL; ppane = ppane->m_pnext) { WinRect rectClipOld = psurface->GetClipRect(); psurface->Offset(ppane->m_offset); psurface->SetClipRect(WinRect(WinPoint(0, 0), ppane->GetSize())); ppane->InternalPaint(psurface); psurface->Offset(-ppane->m_offset); psurface->RestoreClipRect(rectClipOld); } } else { TunnelPaint(psurface, false); } m_bNeedPaint = false; } }
void Paint(ItemID pitemArg, Surface* psurface, bool bSelected, bool bFocus) { ImodelIGC* pDestination = (ImodelIGC*)pitemArg; IshipIGC* pship = NULL; IstationIGC* pstation = NULL; if (pDestination == NULL || trekClient.MyMission() == NULL) return; if (pDestination->GetObjectType() == OT_ship) { CastTo(pship, pDestination); } else { assert(pDestination->GetObjectType() == OT_station); CastTo(pstation, pDestination); } // draw the selection bar if (bSelected) { psurface->FillRect( WinRect(0, 0, GetXSize(), GetYSize()), Color::Red() ); } TRef<IEngineFont> pfont; // show the place we currently are in bold if (pship && pship == trekClient.GetShip()->GetParentShip() || pstation && pstation == trekClient.GetShip()->GetStation()) { pfont = TrekResources::SmallBoldFont(); } else { pfont = TrekResources::SmallFont(); } Color color; if (CanKeepCurrentShip(pDestination)) { color = Color::White(); } else { color = 0.75f * Color::White(); } // draw the name psurface->DrawString( pfont, color, WinPoint(0, 0), pship ? pship->GetName() : pstation->GetName() ); // draw the ship type (if any) if (pship) { psurface->DrawString( pfont, color, WinPoint(m_viColumns[0], 0), HullName(pDestination) ); } // draw the cluster psurface->DrawString( pfont, color, WinPoint(m_viColumns[1] + 2, 0), SectorName(pDestination) ); // draw the total number of turrets (if appropriate) if (pship && NumTurrets(pship)) { int nNumTurrets = NumTurrets(pship); if (nNumTurrets != 0) { psurface->DrawString( pfont, color, WinPoint(m_viColumns[2] + 2, 0), ZString((int)MannedTurrets(pship)) + ZString("/") + ZString(nNumTurrets) ); } } }