void DrawItemShape::OnPaint( Graphics &g ) { if(isChangeRegion()) { ResetRegion(); } auto region = getRegion(); SolidBrush brush(DrawTools::ColorNormal); if (m_isFillPath) { if (StateNormal == m_state) { g.FillRegion(&brush, region.get()); } else if (StateHovered == m_state) { g.FillRegion(&SolidBrush(DrawTools::ColorHovered), region.get()); } else if (StateDisable == m_state) { g.FillRegion(&SolidBrush(DrawTools::ColorDisable), region.get()); } else if (StateDown == m_state) { g.FillRegion(&SolidBrush(DrawTools::ColorDown), region.get()); } else if (StateError == m_state) { g.FillRegion(&SolidBrush(DrawTools::ColorError), region.get()); } else { g.FillRegion(&SolidBrush(m_fillColor), region.get()); } } if (m_isDrawPath) { GraphicsPath path; path.StartFigure(); for(auto itter = m_lines.begin();itter != m_lines.end() ; itter++ ) { (*itter)->getPath(path); } path.CloseFigure(); g.DrawPath(&Pen(m_drawColor),&path); } }
void DrawItemManagement::OnPaint(Graphics& g) { //»±³¾°É« g.FillRectangle(&SolidBrush(m_backgroundColor),getDrawRectF()); m_strategy->OnPaint(g,m_allDrawItemList); }
void CElcNonWndButton::Draw(PVOID pvGraphics) { if (!pvGraphics) return; Rect rect(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height()); // draw background image if (m_background.background.pImage) { thePainter.DrawImage(pvGraphics, &m_background.background, &rect, m_state, 1, NULL); } // draw icon if (m_icon.pImage) { thePainter.DrawImage(pvGraphics, &m_icon, &rect, m_state, 1, NULL); } if (!m_strText.IsEmpty()) { LOGFONT lf = {0}; m_ftText.GetLogFont(&lf); FontFamily family(lf.lfFaceName); Font ftText(&family, 9); StringFormat stringfmt; stringfmt.SetAlignment(StringAlignmentCenter); stringfmt.SetLineAlignment(StringAlignmentCenter); stringfmt.SetHotkeyPrefix(HotkeyPrefixHide); Color crText; crText.SetFromCOLORREF(m_background.crTextNormal); RectF rcText; rcText.X = (REAL)m_rect.left; rcText.Y = (REAL)m_rect.top + 4; rcText.Width = (REAL)m_rect.Width(); rcText.Height = (REAL)m_rect.Height(); ((Graphics *)pvGraphics)->DrawString(m_strText, -1, &ftText, rcText, &stringfmt, &SolidBrush(crText)); } }
SettingPanel& SettingPanel::operator<<(const ReaderSetting& s) { auto& node(dynWgts.WidgetNode); DeclDynWidgetNode(DropDownList, ddlFont) DeclDynWidgetNode(CheckButton, cbSmoothScroll) yunseq( lblAreaUp.ForeColor = s.FontColor, lblAreaUp.Background = SolidBrush(s.UpColor), lblAreaUp.Font = s.Font, lblAreaDown.ForeColor = s.FontColor, lblAreaDown.Background = SolidBrush(s.DownColor), lblAreaDown.Font = s.Font, ddlFont.Text = s.Font.GetFamilyName(), scroll_duration = s.ScrollDuration, smooth_scroll_duration = s.SmoothScrollDuration ), cbSmoothScroll.Tick(s.SmoothScroll); UpdateInfo(); return *this; }
ProgressBar::ProgressBar(const Rect& r, ValueType m) : Control(r, NoBackgroundTag()), GMRange<float>(m == 0 ? 1 : m, 0) { auto& pal(FetchGUIState().Colors); BorderStyle style; style.ActiveColor = pal[Styles::InactiveBorder]; yunseq( Background = SolidBrush(pal[Styles::Track]), ForeColor = pal[Styles::HotTracking], FetchEvent<Paint>(*this).Add(BorderBrush(style), BoundaryPriority) ); }
ProgressBar::ProgressBar(const Rect& r, ValueType m) : Control(r), GMRange<float>(m == 0 ? 1 : m, 0) { const auto invalidator([this]{ Invalidate(*this); }); auto& pal(FetchGUIState().Colors); BorderStyle style; style.ActiveColor = pal[Styles::InactiveBorder]; yunseq( Background = SolidBrush(pal[Styles::Track]), ForeColor = pal[Styles::HotTracking], FetchEvent<Paint>(*this).Add(BorderBrush(style), BoundaryPriority), FetchEvent<GotFocus>(*this) += invalidator, FetchEvent<LostFocus>(*this) += invalidator ); }
void CStartMenuView::OnDraw(CDC* dc) { // TODO: Fügen Sie hier Ihren spezialisierten Code ein, und/oder rufen Sie die Basisklasse auf. AssertBotE((CBotEDoc*)GetDocument()); CMyMemDC pDC(dc); CRect client; GetClientRect(&client); // Graphicsobjekt, in welches gezeichnet wird anlegen Graphics g(pDC->GetSafeHdc()); g.Clear(static_cast<Gdiplus::ARGB>(Color::Black)); g.SetSmoothingMode(SmoothingModeHighSpeed); g.SetInterpolationMode(InterpolationModeLowQuality); g.SetPixelOffsetMode(PixelOffsetModeHighSpeed); g.SetCompositingQuality(CompositingQualityHighSpeed); g.ScaleTransform((REAL)client.Width() / (REAL)m_TotalSize.cx, (REAL)client.Height() / (REAL)m_TotalSize.cy); // zum Start nur einen schwarzen Hintergrund mit Welcome Nachricht anzeigen if (m_nLogoTimer < 2) { Gdiplus::Font font(L"Calibri", 25, FontStyleBold); StringFormat format; format.SetAlignment(StringAlignmentCenter); format.SetLineAlignment(StringAlignmentCenter); CString s= CLoc::GetString("PRESENTEDBY")+"\n\n"+CLoc::GetString("PRESENTED"); g.DrawString(CComBSTR(s), -1, &font, RectF(0, 0, m_TotalSize.cx, m_TotalSize.cy), &format, &SolidBrush(static_cast<Gdiplus::ARGB>(Color::WhiteSmoke))); g.ReleaseHDC(pDC->GetSafeHdc()); // nichts weiter Zeichnen return; } // Hintergrundbild anzeigen g.DrawImage(m_pBkgndImg, 0, 0, m_TotalSize.cx, m_TotalSize.cy); Gdiplus::Font font(L"Calibri", 10, FontStyleBold); StringFormat format; format.SetAlignment(StringAlignmentFar); format.SetLineAlignment(StringAlignmentFar); CString sVersion = "Birth of the Empires Alpha7 V"; sVersion += CString(VERSION_INFORMATION.c_str()); sVersion += "\n© by Sir Pustekuchen 2014"; g.DrawString(CComBSTR(sVersion), -1, &font, RectF(0, 0, m_TotalSize.cx, m_TotalSize.cy), &format, &SolidBrush(static_cast<Gdiplus::ARGB>(Color::WhiteSmoke))); // Hintergrundbild langsam einblenden if (m_nTimeCounter < 255) { Color clr(255 - m_nTimeCounter, 0, 0, 0); g.FillRectangle(&Gdiplus::SolidBrush(clr), RectF(0, 0, m_TotalSize.cx, m_TotalSize.cy)); Gdiplus::Font font(L"Calibri", 25, FontStyleBold); StringFormat format; format.SetAlignment(StringAlignmentCenter); format.SetLineAlignment(StringAlignmentCenter); Color clr2(max(0, 255 - m_nTimeCounter * 1.2), 245,245,245); CString s= CLoc::GetString("PRESENTEDBY")+"\n\n"+CLoc::GetString("PRESENTED"); g.DrawString(CComBSTR(s), -1, &font, RectF(0, 0, m_TotalSize.cx, m_TotalSize.cy), &format, &SolidBrush(clr2)); } g.ReleaseHDC(pDC->GetSafeHdc()); }
this->tamanio = TAMANIO; } Simbolo::~Simbolo() {} int Simbolo::getSigno() { return signo; } void Simbolo::setSigno(int signo) { this->signo = signo; } void Simbolo::mostrarSimbolo(Graphics^ lienzo) { Font^ fuente = gcnew Font("Times New Roman", tamanio * 2); SolidBrush^ pincel = gcnew SolidBrush(Color::Blue); lienzo->DrawString(signo.ToString(), fuente, pincel, origen.x, origen.y); } /*-----------------------------------*/ /*-----------------------------------*/ Circulo::Circulo(TPunto centro, int radio) { this->centro = centro; this->diametro = 2 * radio; this->origen.x = centro.x - radio; this->origen.y = centro.y - radio; } Circulo::~Circulo()
} int Taxi::getTimeStop(void) { return TimeStop; } bool Taxi::getIsStop(void) { return isStop; } // //set // void Taxi::setTimeStop(int ts) { (ts >= 0) ? TimeStop = ts : TimeStop = 0; } void Taxi::setIsStop(bool is) { isStop = is; } // //interface // void Taxi::draw(Graphics^ g,bool cmd) { (cmd)? g->FillRectangle(gcnew SolidBrush(Color::Yellow),getX(),getY(),getLength(),30): g->FillRectangle(gcnew SolidBrush(Color::White),getX(),getY(),getLength(),30); } Taxi::~Taxi(void) { }
// from Comp 220. #include "HCEditorForm.h" #include "DisplayManager.h" #include "MyForm.h" #include "findForm.h" namespace Program5 { HCEditorForm::HCEditorForm(MyForm^ form): d(*new Document), form(form) { d.load("kjv.txt"); dispMan = new DisplayManager(d); loaded = false; fontName = gcnew String("Courier New"); blackBrush = gcnew SolidBrush(Color::Black); blackPen = gcnew Pen(Color::Black); backPen = gcnew Pen(form->BackColor); form->Font = gcnew Font(fontName,12); dx = pixelsPerCharX; dy = pixelsPerCharY; } HCEditorForm::~HCEditorForm() { delete &d; } void HCEditorForm::onLoad(Object^ sender, EventArgs^ e) { loaded = true; cursorColor = Color::Black; }
void CSkinButton2::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { UINT lState = lpDrawItemStruct->itemState; CRect rect; GetClientRect(rect); CMemDC pDC( CDC::FromHandle(lpDrawItemStruct->hDC), rect); Gdiplus::Graphics graphics(pDC->m_hDC); // get background CBitmap bmp, *pOldBitmap; if (m_dcBk.m_hDC == NULL) { CRect rect1; CClientDC clDC(GetParent()); GetWindowRect(rect1); GetParent()->ScreenToClient(rect1); m_dcBk.CreateCompatibleDC(&clDC); bmp.CreateCompatibleBitmap(&clDC, rect.Width(), rect.Height()); pOldBitmap = m_dcBk.SelectObject(&bmp); m_dcBk.BitBlt(0, 0, rect.Width(), rect.Height(), &clDC, rect1.left, rect1.top, SRCCOPY); bmp.DeleteObject(); } // paint backGround pDC->BitBlt(0, 0, rect.Width(), rect.Height(), &m_dcBk, 0, 0, SRCCOPY); if( m_bDisable ) { DrawImage(graphics); } else { if (lState & ODS_DISABLED) { DrawImage(graphics, DRAW_GRAY); } else { if (m_bSelected ) { DrawFrame(graphics,rect ); DrawImage(graphics, DRAW_LIGHT); } else { if (lState & ODS_SELECTED) { DrawFrame(graphics,rect ); if( m_enmuDrawType != NO_FRAME_SELECT ) { DrawImage(graphics, DRAW_LIGHT); } } else if (m_bMouseOnButton) { DrawFrame(graphics,rect ); if( m_enmuDrawType != NO_FRAME_SELECT ) { DrawImage(graphics,DRAW_LIGHT); } } else if (lState & ODS_FOCUS) { if( m_enmuDrawType == NO_FRAME_SELECT ) { DrawFrame(graphics,rect ); } if( m_enmuDrawType != NO_FRAME_SELECT ) { DrawImage(graphics); } } else { if( m_enmuDrawType == NO_FRAME_SELECT ) { DrawFrame(graphics,rect ); } if( m_enmuDrawType != NO_FRAME_SELECT ) { DrawImage(graphics); } } } //graphics } } if( m_strText.GetLength() > 0 && m_pPngImage == NULL ) { Gdiplus::Bitmap bmpText( rect.Width(), rect.Height(), &graphics ); Graphics* Ptext=Graphics::FromImage(&bmpText); // Ptext->SetTextRenderingHint(Gdiplus::TextRenderingHintAntiAlias); //Matrix mx(0.25f,0,0,0.25f,1,1); //Ptext->SetTransform(&mx); Gdiplus::RectF rc( rect.left, rect.top, rect.Width(), rect.Height() ); WCHAR wFile[1024]; #ifndef UNICODE MultiByteToWideChar(CP_ACP, 0, LPCTSTR(m_strText), -1, wFile, 1024 ); #else lstrcpy(wFile, szFile); #endif StringFormat format; format.SetAlignment( StringAlignmentCenter ); Gdiplus::RectF rectText, rectBack; rectText.X = rc.X; rectText.Y = rc.Y+ ( rc.Height-m_nWidth)/2; rectText.Width = rc.Width; rectText.Height = m_nWidth + rc.Height/2; rectBack.X = rc.X+2; rectBack.Y = rc.Y+1+ ( rc.Height-m_nWidth)/2; rectBack.Width = rc.Width-2; rectBack.Height = m_nWidth + rc.Height/2-1; Ptext->DrawString( wFile,-1 ,mp_font,rectBack,&format,&SolidBrush(Color(100,0,0,0)) ); //graphics.SetInterpolationMode( Gdiplus::InterpolationModeHighQualityBicubic); //graphics.SetTextRenderingHint( Gdiplus::TextRenderingHintAntiAlias); graphics.DrawImage(&bmpText,rc,0,0,bmpText.GetWidth(),bmpText.GetHeight(),UnitPixel); graphics.DrawString(wFile,-1,mp_font,rectText,&format,&SolidBrush(Color(255,255,255,255))); } }
HBrush Widget::MakeBlankBrush() { return SolidBrush(ColorSpace::White); }
///////////////////////////////////////////////////////////////////////////////////////// // Hier die Funktion zum Zeichnen des Schiffsdesignmenüs ///////////////////////////////////////////////////////////////////////////////////////// void CShipDesignMenuView::DrawShipDesignMenue(Graphics* g) { CBotEDoc* pDoc = resources::pDoc; ASSERT(pDoc); CMajor* pMajor = m_pPlayersRace; ASSERT(pDoc); if (!pMajor) return; CString fontName = ""; Gdiplus::REAL fontSize = 0.0; // Rassenspezifische Schriftart auswählen CFontLoader::CreateGDIFont(pMajor, 2, fontName, fontSize); // Schriftfarbe wählen Gdiplus::Color normalColor; CFontLoader::GetGDIFontColor(pMajor, 3, normalColor); StringFormat fontFormat; fontFormat.SetAlignment(StringAlignmentNear); fontFormat.SetLineAlignment(StringAlignmentCenter); fontFormat.SetFormatFlags(StringFormatFlagsNoWrap); Color penColor; penColor.SetFromCOLORREF(pMajor->GetDesign()->m_clrListMarkPenColor); Color markColor; markColor.SetFromCOLORREF(pMajor->GetDesign()->m_clrListMarkTextColor); if (bg_designmenu) g->DrawImage(bg_designmenu, 0, 0, 1075, 750); SolidBrush fontBrush(normalColor); // Links im Bild die veränderbaren Schiffklassen zeichnen (bis jetzt darf man keine Stationen verändern, // weil deren Baukosten allein von den Industriekosten berechnet werden. Diese aber nicht steigen wenn // man die Hülle oder Schilde verbessert. Somit könnte man bessere Stationen für den gleichen Preis bauen. // Schiffsinfoarray durchgehen und nach zum Imperium gehörende baubare Schiffe suchen short j = 0; short counter = m_iClickedOnShip - 23 + m_iOldClickedOnShip; short oldClickedShip = m_iClickedOnShip; BYTE researchLevels[6] = { pMajor->GetEmpire()->GetResearch()->GetBioTech(), pMajor->GetEmpire()->GetResearch()->GetEnergyTech(), pMajor->GetEmpire()->GetResearch()->GetCompTech(), pMajor->GetEmpire()->GetResearch()->GetPropulsionTech(), pMajor->GetEmpire()->GetResearch()->GetConstructionTech(), pMajor->GetEmpire()->GetResearch()->GetWeaponTech() }; m_pShownShip = NULL; m_nSizeOfShipDesignList = 0; // Es gehen nur 21 Einträge auf die Seite, deshalb muss abgebrochen werden for (int i = 0; i < pDoc->m_ShipInfoArray.GetSize(); i++) if (pDoc->m_ShipInfoArray.GetAt(i).GetRace() == pMajor->GetRaceShipNumber()) if (!pDoc->m_ShipInfoArray.GetAt(i).IsStation()) if (pDoc->m_ShipInfoArray.GetAt(i).IsThisShipBuildableNow(researchLevels)) { // wurde dieses Schiff durch kein anderes jetzt baubares Schiff schon obsolet? BOOLEAN foundObsolet = FALSE; for (int m = 0; m < pDoc->m_ShipInfoArray.GetSize(); m++) if (pDoc->m_ShipInfoArray.GetAt(m).GetRace() == pMajor->GetRaceShipNumber()) if (pDoc->m_ShipInfoArray.GetAt(m).GetObsoleteShipClass() == pDoc->m_ShipInfoArray.GetAt(i).GetShipClass()) if (pDoc->m_ShipInfoArray.GetAt(m).IsThisShipBuildableNow(researchLevels)) { foundObsolet = TRUE; break; } if (foundObsolet) continue; m_nSizeOfShipDesignList++; if (counter > 0) { m_iClickedOnShip--; counter--; continue; } if (j < 24) { fontBrush.SetColor(normalColor); // Wenn wir ein Schiff gefunden haben, dann zeichnen wir dieses in die Liste (max. 21) // Wenn wir das Schiff markiert haben, dann die Markierung zeichnen, haben wir kein spezielles Schiff // angeklickt, so wird das 1. Schiff in der Liste markiert if (j == m_iClickedOnShip || m_iClickedOnShip == -1) { fontBrush.SetColor(markColor); // Wenn wir nix angeklickt haben und nur das erste Schiff markiert war, dann automatisch m_iClickedOnShip = j; if (oldClickedShip == -1) oldClickedShip = j; m_pShownShip = &pDoc->m_ShipInfoArray.GetAt(i); // Markierung worauf wir geklickt haben g->FillRectangle(&SolidBrush(Color(50,200,200,200)), RectF(15,120+j*25,183,25)); g->DrawLine(&Gdiplus::Pen(penColor), 15, 120+j*25, 198, 120+j*25); g->DrawLine(&Gdiplus::Pen(penColor), 15, 145+j*25, 198, 145+j*25); // Infos in unteren Schiffsdesignansicht aktualisieren if (CShipDesignBottomView* pView = dynamic_cast<CShipDesignBottomView*>(resources::pMainFrame->GetView(RUNTIME_CLASS(CShipDesignBottomView)))) { if (pView->GetCurrentShipInfo() != i) { pView->SetCurrentShipInfo(i); pView->Invalidate(FALSE); } } } CString s = pDoc->m_ShipInfoArray.GetAt(i).GetShipClass(); g->DrawString(CComBSTR(s), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(25, 120 + j * 25, 175, 25), &fontFormat, &fontBrush); j++; } } m_iClickedOnShip = oldClickedShip; // Hier jetzt Informationen zum angeklickten Schiff anzeigen if (m_pShownShip) { // Bild des Schiffes zeichnen CString s; s.Format("Ships\\%s.bop",m_pShownShip->GetShipClass()); Bitmap* graphic = pDoc->GetGraphicPool()->GetGDIGraphic(s); if (graphic == NULL) graphic = pDoc->GetGraphicPool()->GetGDIGraphic("Ships\\ImageMissing.bop"); if (graphic) { g->DrawImage(graphic, 388, 90, 200, 150); graphic = NULL; } // allgemeine Schiffsinformationen anzeigen m_pShownShip->DrawShipInformation(g, CRect(220,250,740,440), &Gdiplus::Font(CComBSTR(fontName), fontSize), normalColor, markColor, pMajor->GetEmpire()->GetResearch()); // Baukosten des Schiffes anzeigen fontBrush.SetColor(markColor); fontFormat.SetAlignment(StringAlignmentCenter); fontFormat.SetLineAlignment(StringAlignmentNear); g->DrawString(CComBSTR(CLoc::GetString("BUILDCOSTS")), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(190,440,580,25), &fontFormat, &fontBrush); fontBrush.SetColor(normalColor); s.Format("%s: %d %s: %d %s: %d",CLoc::GetString("INDUSTRY"),m_pShownShip->GetNeededIndustry(), CLoc::GetString("TITAN"),m_pShownShip->GetNeededTitan(), CLoc::GetString("DEUTERIUM"),m_pShownShip->GetNeededDeuterium()); g->DrawString(CComBSTR(s), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(190,465,580,25), &fontFormat, &fontBrush); s.Format("%s: %d %s: %d %s: %d %s: %d",CLoc::GetString("DURANIUM"),m_pShownShip->GetNeededDuranium(), CLoc::GetString("CRYSTAL"),m_pShownShip->GetNeededCrystal(), CLoc::GetString("IRIDIUM"),m_pShownShip->GetNeededIridium(), CLoc::GetString("DERITIUM"),m_pShownShip->GetNeededDeritium()); g->DrawString(CComBSTR(s), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(190,490,580,25), &fontFormat, &fontBrush); // Die Buttons zur Eigenschaftsänderung in der Rechten Seite der Ansicht anzeigen // zuerst überprüfen wir die Beamwaffen, wir können den Typ der Beamwaffe verändern, wenn wir mindst. ein anderes // Schiff des Imperiums finden, welches DIESE Beamwaffe mit einem höheren Typ oder einem niedrigeren Typ besitzt graphic = pDoc->GetGraphicPool()->GetGDIGraphic("Other\\" + pMajor->GetPrefix() + "button_small.bop"); Color btnColor; CFontLoader::GetGDIFontColor(pMajor, 1, btnColor); SolidBrush btnBrush(btnColor); fontFormat.SetAlignment(StringAlignmentCenter); fontFormat.SetLineAlignment(StringAlignmentCenter); // Nach Beamwaffen suchen if (m_pShownShip->GetBeamWeapons()->GetSize() > m_iBeamWeaponNumber) { // gibt es schon von dieser Beamwaffe hier auf dem Schiff einen höheren Typ? USHORT maxTyp = pMajor->GetWeaponObserver()->GetMaxBeamType(m_pShownShip->GetBeamWeapons()->GetAt(m_iBeamWeaponNumber).GetBeamName()); if (maxTyp > m_pShownShip->GetBeamWeapons()->GetAt(m_iBeamWeaponNumber).GetBeamType()) { // Dann können wir den Typ unserer Beamwaffe(n) verbessern if (graphic) g->DrawImage(graphic, 930, 120, 120, 30); g->DrawString(CComBSTR(CLoc::GetString("BTN_STRONGER")), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(930,120,120,30), &fontFormat, &btnBrush); m_bFoundBetterBeam = TRUE; } // Wenn wir einen größeren Typ als Typ 1 haben, dann können wir diesen verringern if (m_pShownShip->GetBeamWeapons()->GetAt(m_iBeamWeaponNumber).GetBeamType() > 1) { // Dann können wir den Typ unserer Beamwaffe(n) verkleinern if (graphic) g->DrawImage(graphic, 800, 120, 120, 30); g->DrawString(CComBSTR(CLoc::GetString("BTN_WEAKER")), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(800,120,120,30), &fontFormat, &btnBrush); m_bFoundWorseBeam = TRUE; } // Typ und Name der Beamwaffe zeichnen fontBrush.SetColor(normalColor); s.Format("%s %d %s",CLoc::GetString("TYPE"),m_pShownShip->GetBeamWeapons()->GetAt(m_iBeamWeaponNumber).GetBeamType(),m_pShownShip->GetBeamWeapons()->GetAt(m_iBeamWeaponNumber).GetBeamName()); fontFormat.SetTrimming(StringTrimmingEllipsisCharacter); g->DrawString(CComBSTR(s), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(845,80,160,25), &fontFormat, &fontBrush); fontFormat.SetTrimming(StringTrimmingNone); } // Nach anderer Torpedowaffe suchen if (m_pShownShip->GetTorpedoWeapons()->GetSize() > m_iTorpedoWeaponNumber) { // den aktuellen Torpedotyp holen BYTE currentTorpType = m_pShownShip->GetTorpedoWeapons()->GetAt(m_iTorpedoWeaponNumber).GetTorpedoType(); // Torpedoname zeichnen fontBrush.SetColor(normalColor); s.Format("%s (%d°)",m_pShownShip->GetTorpedoWeapons()->GetAt(m_iTorpedoWeaponNumber).GetTupeName(), m_pShownShip->GetTorpedoWeapons()->GetAt(m_iTorpedoWeaponNumber).GetFirearc()->GetAngle()); g->DrawString(CComBSTR(s), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(775,170,300,25), &fontFormat, &fontBrush); s.Format("%s (%d)", CTorpedoInfo::GetName(currentTorpType), CTorpedoInfo::GetPower(currentTorpType)); g->DrawString(CComBSTR(s), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(775,195,300,25), &fontFormat, &fontBrush); if (graphic) g->DrawImage(graphic, 800, 230, 120, 30); g->DrawString(CComBSTR(CLoc::GetString("BTN_LAUNCHER")), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(800,230,120,30), &fontFormat, &btnBrush); if (graphic) g->DrawImage(graphic, 930, 230, 120, 30); g->DrawString(CComBSTR(CLoc::GetString("BTN_TORPEDO")), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(930,230,120,30), &fontFormat, &btnBrush); } // hier Möglichkeit anderes Hüllenmaterial anzubringen eingebaut CString material; switch (m_pShownShip->GetHull()->GetHullMaterial()) { case TITAN: material = CLoc::GetString("TITAN");; break; case DURANIUM: material = CLoc::GetString("DURANIUM");; break; case IRIDIUM: material = CLoc::GetString("IRIDIUM");; break; default: material = ""; } BOOLEAN bDoubleHull = m_pShownShip->GetHull()->GetDoubleHull(); if (bDoubleHull == TRUE) s.Format("%s%s",material, CLoc::GetString("DOUBLE_HULL_ARMOUR")); else s.Format("%s%s",material, CLoc::GetString("HULL_ARMOR")); g->DrawString(CComBSTR(s), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(775,380,300,30), &fontFormat, &fontBrush); // Hier kann man den Schildtyp ändern // zuerst Anzeige der jetzt aktuellen Schilde. Beim Romulaner eine schwarze Schriftart wählen. Wenn dies // später auch bei der Föd heller unterlegt ist kann auch dort eine schwarze Schriftfarbe gewählt werden. s.Format("%s %d %s",CLoc::GetString("TYPE"),m_pShownShip->GetShield()->GetShieldType(),CLoc::GetString("SHIELDS")); g->DrawString(CComBSTR(s), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(775,490,300,30), &fontFormat, &fontBrush); // Ab jetzt die Buttons zum Ändern der jeweiligen Komponenten if (graphic) g->DrawImage(graphic, 800, 420, 120, 30); g->DrawString(CComBSTR(CLoc::GetString("BTN_MATERIAL")), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(800,420,120,30), &fontFormat, &btnBrush); // wenn eine Doppelhülle draus gemacht werden soll dann darf die Manövrierbarkeit nicht schon "keine" oder nur 1 sein // wenn eine Einzelhülle draus gemacht werden soll, dann darf die Manövrierbarkeit nicht schon phänomenal sein if ((bDoubleHull == FALSE && m_pShownShip->GetManeuverability() > 1) || (bDoubleHull == TRUE && m_pShownShip->GetManeuverability() < 9)) { if (graphic) g->DrawImage(graphic, 930, 420, 120, 30); g->DrawString(CComBSTR(CLoc::GetString("BTN_HULLTYPE")), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(930,420,120,30), &fontFormat, &btnBrush); } // Schildtyp schwächer Button einblenden if (m_pShownShip->GetShield()->GetShieldType() > 0) { if (graphic) g->DrawImage(graphic, 800, 540, 120, 30); g->DrawString(CComBSTR(CLoc::GetString("BTN_WEAKER")), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(800,540,120,30), &fontFormat, &btnBrush); } // Schildtyp stärker Button einblenden if (m_pShownShip->GetShield()->GetShieldType() < pMajor->GetWeaponObserver()->GetMaxShieldType()) { if (graphic) g->DrawImage(graphic, 930, 540, 120, 30); g->DrawString(CComBSTR(CLoc::GetString("BTN_STRONGER")), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(930,540,120,30), &fontFormat, &btnBrush); } } // Wenn das Schiff in irgendeinem unserer Systeme gebaut wird, dann großen Text ausgeben, in welchem System das Schiff // gerade gebaut wird CString systemName = CheckIfShipIsBuilding(m_pShownShip); if (!systemName.IsEmpty()) { COverlayBanner *banner = new COverlayBanner(CPoint(200,300), CSize(580, 200), CLoc::GetString("NO_CHANGE_POSSIBLE", FALSE, systemName), RGB(220,0,0)); banner->Draw(g, &Gdiplus::Font(CComBSTR(fontName), fontSize)); delete banner; } // draw Button DisplayAllShips Bitmap* btnDisplayAllShips = pDoc->GetGraphicPool()->GetGDIGraphic("Other\\" + pMajor->GetPrefix() + "button_small.bop");//All-Button zeichnen if(btnDisplayAllShips) g->DrawImage(btnDisplayAllShips,40,750,80,30); CString s; //AfxMessageBox("m_bDisplayAllShips"); if (m_bDisplayAllShips) s=CLoc::GetString("BTN_ALL"); else s=CLoc::GetString("BTN_CURRENTS"); g->DrawString(CComBSTR(s), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(40,750,80,30), &fontFormat, &fontBrush); // "Schiffsdesign" in der Mitte zeichnen // Rassenspezifische Schriftart auswählen CFontLoader::CreateGDIFont(pMajor, 5, fontName, fontSize); // Schriftfarbe wählen CFontLoader::GetGDIFontColor(pMajor, 3, normalColor); fontBrush.SetColor(normalColor); g->DrawString(CComBSTR(CLoc::GetString("SHIPDESIGN")), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(188,10,600,50), &fontFormat, &fontBrush); }
void SquareView::OnPaint( PaintEventArgs* e ) { Control::OnPaint(e); e->Graphics.FillEllipse(SolidBrush(Color::Grey), 0, 0, Width, Height); }
#include "StdAfx.h" #include "GameObject.h" GameObject::GameObject(RectangleF startRect, PointF startVel, Graphics^ startCanvas) { rect = startRect; vel = startVel; pen = gcnew Pen(Color::White, 2); brush = gcnew SolidBrush(Color::White); canvas = startCanvas; visible = true; } void GameObject::update() { } void GameObject::render() { canvas->FillRectangle(brush, rect); } void GameObject::shoot() { } bool GameObject::collision(GameObject^ go) {
Control::Control(const Rect& r) : Control(r, NoBackgroundTag()) { Background = SolidBrush(ColorSpace::White); }