/// Funktion lädt die rassenspezifischen Grafiken.
void CShipDesignMenuView::LoadRaceGraphics()
{
	CBotEDoc* pDoc = resources::pDoc;
	ASSERT(pDoc);

	CMajor* pMajor = m_pPlayersRace;
	ASSERT(pMajor);

	CreateButtons();

	CString sPrefix = pMajor->GetPrefix();
	bg_designmenu	= pDoc->GetGraphicPool()->GetGDIGraphic("Backgrounds\\" + sPrefix + "designmenu.boj");
}
Ejemplo n.º 2
0
void CStartMenuView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();

	// TODO: Fügen Sie hier Ihren spezialisierten Code ein, und/oder rufen Sie die Basisklasse auf.
	CBotEDoc* pDoc = resources::pDoc;
	AssertBotE(pDoc);

	m_pBkgndImg = pDoc->GetGraphicPool()->GetGDIGraphic("Events\\Startmenu.boj");
	AssertBotE(m_pBkgndImg);

	m_pChooseRaceView = dynamic_cast<CChooseRaceView*>(resources::pMainFrame->GetView(RUNTIME_CLASS(CChooseRaceView)));
	AssertBotE(m_pChooseRaceView);

	m_pNewGameView = dynamic_cast<CNewGameView*>(resources::pMainFrame->GetView(RUNTIME_CLASS(CNewGameView)));
	AssertBotE(m_pNewGameView);

	// Immer im Vollbild anzeigen
	resources::pMainFrame->FullScreenMainView(true);

	// Menü zu Beginn nicht anzeigen
	GetTopLevelFrame()->SetMenuBarState(AFX_MBS_HIDDEN);

	m_TotalSize = CSize(1280, 1024);

	CRect clientRect;
	GetDesktopWindow()->GetClientRect(clientRect);

	double nButtonSizeX = 300.0;
	double nButtonSizeY = 40.0;

	double nXPos = clientRect.Width() / 2.0 - nButtonSizeX / 2.0;
	double nYPos = clientRect.Height() / 2.0 - 150.0;

	double nGab = 10.0;

	// Structure containing Style
	tButtonStyle tStyle;
	//////////////////////////////////////////////////////////////////////////

	// Get default Style
	m_tButtonStyle.GetButtonStyle(&tStyle);
	// Change Radius of Button
	tStyle.m_dRadius = 1.0;

	// Change Color Schema of Button
	tStyle.m_tColorFace.m_tEnabled		= RGB(100, 100, 100);
	tStyle.m_tColorBorder.m_tEnabled	= RGB(220, 220, 220);

	tStyle.m_tColorFace.m_tClicked		= RGB(75, 75, 75);
	tStyle.m_tColorBorder.m_tClicked	= RGB(25, 25, 25);

	tStyle.m_tColorFace.m_tPressed		= RGB(75, 75, 75);
	tStyle.m_tColorBorder.m_tPressed	= RGB(25, 25, 25);

	tStyle.m_tColorFace.m_tHot			= RGB(0x80, 0x80, 0xFF);
	tStyle.m_tColorBorder.m_tHot		= RGB(0x40, 0x40, 0xFF);

	// Set Style again
	m_tButtonStyle.SetButtonStyle(&tStyle);

	// Create a push button.
	m_btNewGame.Create(_T(CLoc::GetString("NEWGAME")), WS_CHILD|BS_PUSHBUTTON|WS_DISABLED, CRect(nXPos, nYPos, nXPos + nButtonSizeX, nYPos + nButtonSizeY), this, NEWGAME);
	m_btMultiplayer.Create(_T(CLoc::GetString("MULTIPLAYER")), WS_CHILD|BS_PUSHBUTTON|WS_DISABLED, CRect(nXPos, nYPos + (nGab + nButtonSizeY) * 1, nXPos + nButtonSizeX, nYPos + (nGab + nButtonSizeY) * 1 + nButtonSizeY), this, MULTIPLAYER);
	m_btLoadGame.Create(_T(CLoc::GetString("LOADGAME")), WS_CHILD|BS_PUSHBUTTON|WS_DISABLED, CRect(nXPos, nYPos + (nGab + nButtonSizeY) * 2, nXPos + nButtonSizeX, nYPos + (nGab + nButtonSizeY) * 2 + nButtonSizeY), this, LOADGAME);
	m_btTutorial.Create(_T(CLoc::GetString("TUTORIAL")), WS_CHILD|BS_PUSHBUTTON|WS_DISABLED, CRect(nXPos, nYPos + (nGab + nButtonSizeY) * 3, nXPos + nButtonSizeX, nYPos + (nGab + nButtonSizeY) * 3 + nButtonSizeY), this, TUTORIAL);
	m_btOptions.Create(_T(CLoc::GetString("SETTINGS")), WS_CHILD|BS_PUSHBUTTON|WS_DISABLED, CRect(nXPos, nYPos + (nGab + nButtonSizeY) * 4, nXPos + nButtonSizeX, nYPos + (nGab + nButtonSizeY) * 4 + nButtonSizeY), this, OPTIONS);
	m_btExit.Create(_T(CLoc::GetString("LEAVE")), WS_CHILD|BS_PUSHBUTTON|WS_DISABLED, CRect(nXPos, nYPos + (nGab + nButtonSizeY) * 5, nXPos + nButtonSizeX, nYPos + (nGab + nButtonSizeY) * 5 + nButtonSizeY), this, EXITGAME);

	m_btMPServer.Create(_T(CLoc::GetString("CREATEGAME")), WS_CHILD|BS_PUSHBUTTON|WS_DISABLED, CRect(nXPos, nYPos + (nGab + nButtonSizeY) * 1, nXPos + nButtonSizeX, nYPos + (nGab + nButtonSizeY) * 1 + nButtonSizeY), this, MP_CREATE);
	m_btMPClient.Create(_T(CLoc::GetString("JOINGAME")), WS_CHILD|BS_PUSHBUTTON|WS_DISABLED, CRect(nXPos, nYPos + (nGab + nButtonSizeY) * 2, nXPos + nButtonSizeX, nYPos + (nGab + nButtonSizeY) * 2 + nButtonSizeY), this, MP_JOIN);

	// Buttonstyle zuweisen
	for (int i = NEWGAME; i <= TUTORIAL; i++)
	{
		CRoundButton2* pBtn = dynamic_cast<CRoundButton2*>(GetDlgItem(i));
		if (!pBtn)
			continue;

		SetButtonStyle(pBtn);
	}

	// Für Tooltips registrieren
	CString sTooltip = CHTMLStringBuilder::GetHTMLColor(CLoc::GetString("NEWGAMETT"), _T("silver"));
	resources::pMainFrame->AddToTooltip(GetDlgItem(NEWGAME), sTooltip);
	sTooltip = CHTMLStringBuilder::GetHTMLColor(CLoc::GetString("MULTIPLAYERTT"), _T("silver"));
	resources::pMainFrame->AddToTooltip(GetDlgItem(MULTIPLAYER), sTooltip);
	sTooltip = CHTMLStringBuilder::GetHTMLColor(CLoc::GetString("LOADGAMETT"), _T("silver"));
	resources::pMainFrame->AddToTooltip(GetDlgItem(LOADGAME), sTooltip);
	sTooltip = CHTMLStringBuilder::GetHTMLColor(CLoc::GetString("SETTINGSTT"), _T("silver"));
	resources::pMainFrame->AddToTooltip(GetDlgItem(OPTIONS), sTooltip);
	sTooltip = CHTMLStringBuilder::GetHTMLColor(CLoc::GetString("LEAVETT"), _T("silver"));
	resources::pMainFrame->AddToTooltip(GetDlgItem(EXITGAME), sTooltip);
	sTooltip = CHTMLStringBuilder::GetHTMLColor(CLoc::GetString("TUTORIALTT"), _T("silver"));
	resources::pMainFrame->AddToTooltip(GetDlgItem(TUTORIAL), sTooltip);

	sTooltip = CHTMLStringBuilder::GetHTMLColor(CLoc::GetString("CREATEGAMETT"), _T("silver"));
	resources::pMainFrame->AddToTooltip(GetDlgItem(MP_CREATE), sTooltip);
	sTooltip = CHTMLStringBuilder::GetHTMLColor(CLoc::GetString("JOINGAMETT"), _T("silver"));
	resources::pMainFrame->AddToTooltip(GetDlgItem(MP_JOIN), sTooltip);

	this->SetTimer(1,1000,NULL);
}
Ejemplo n.º 3
0
void CIntelBottomView::OnDraw(CDC* dc)
{
	CBotEDoc* pDoc = resources::pDoc;
	AssertBotE(pDoc);

	if (!pDoc->m_bDataReceived)
		return;

	CMajor* pMajor = m_pPlayersRace;
	AssertBotE(pMajor);
	if (!pMajor)
		return;
	// TODO: add draw code here

	// Doublebuffering wird initialisiert
	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);

	CString fontName = "";
	Gdiplus::REAL fontSize = 0.0;
	StringFormat fontFormat;
	SolidBrush fontBrush(static_cast<Gdiplus::ARGB>(Color::White));

	Color color;
	color.SetFromCOLORREF(pMajor->GetDesign()->m_clrGalaxySectorText);

	fontBrush.SetColor(color);
	Bitmap* graphic = pDoc->GetGraphicPool()->GetGDIGraphic("Backgrounds\\" + pMajor->GetPrefix() + "diplomacyV3.boj");

	// Grafik zeichnen
	if (graphic)
	{
		g.DrawImage(graphic, 0, 0, 1075, 249);
		graphic = NULL;
	}

	// Nur in bestimmten Submenüs werden in der View3 Berichte angezeigt
	BYTE curIntelSubMenu = resources::pMainFrame->GetSubMenu(RUNTIME_CLASS(CIntelMenuView));
	if (curIntelSubMenu == 4 || curIntelSubMenu == 5)
	{
		CRect r;
		r.SetRect(0,0,m_TotalSize.cx,m_TotalSize.cy);
		short n = pMajor->GetEmpire()->GetIntelligence()->GetIntelReports()->GetActiveReport();
		if (n != -1)
		{
			CFontLoader::CreateGDIFont(pMajor, 4, fontName, fontSize);
			fontFormat.SetAlignment(StringAlignmentNear);
			fontFormat.SetLineAlignment(StringAlignmentNear);
			fontFormat.SetFormatFlags(StringFormatFlagsNoWrap);
			CIntelObject* report = pMajor->GetEmpire()->GetIntelligence()->GetIntelReports()->GetReport(n);
			CString s;
			if (report->GetIsSpy())
				s = CLoc::GetString("SPY");
			else
				s = CLoc::GetString("SABOTAGE");
			g.DrawString(CComBSTR(s), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(40, 40, r.right-100, r.bottom-20), &fontFormat, &fontBrush);

			CFontLoader::CreateGDIFont(pMajor, 2, fontName, fontSize);
			fontBrush.SetColor(Color(200,200,250));
			fontFormat.SetFormatFlags(!StringFormatFlagsNoWrap);
			if (report->GetOwner() == pMajor->GetRaceID())
				s = *report->GetOwnerDesc();
			else
				s = *report->GetEnemyDesc();
			g.DrawString(CComBSTR(s), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(40, 100, r.right-250, r.bottom-20), &fontFormat, &fontBrush);
		}
	}
	g.ReleaseHDC(pDC->GetSafeHdc());
}
Ejemplo n.º 4
0
void CResearchBottomView::OnDraw(CDC* dc)
{
	CBotEDoc* pDoc = resources::pDoc;
	AssertBotE(pDoc);

	if (!pDoc->m_bDataReceived)
		return;

	CMajor* pMajor = m_pPlayersRace;
	AssertBotE(pMajor);
	if (!pMajor)
		return;
	// TODO: add draw code here

	// Doublebuffering wird initialisiert
	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);

	CString fontName = "";
	Gdiplus::REAL fontSize = 0.0;
	StringFormat fontFormat;
	SolidBrush fontBrush(static_cast<Gdiplus::ARGB>(Color::White));
	CRect rect;
	rect.SetRect(0,0,m_TotalSize.cx,m_TotalSize.cy);

	CString sPrefix = pMajor->GetPrefix();
	Color color;
	color.SetFromCOLORREF(pMajor->GetDesign()->m_clrGalaxySectorText);
	fontBrush.SetColor(color);
	Bitmap* graphic = pDoc->GetGraphicPool()->GetGDIGraphic("Backgrounds\\" + sPrefix + "researchV3.boj");

	// gibt es keine Spezialforschung zur Auswahl, so wird auf Standardanzeige umgestellt
	if (m_nCurrentTech == 6 && pMajor->GetEmpire()->GetResearch()->GetUniqueReady() == TRUE)
		m_nCurrentTech = 0;

	// Grafik zeichnen
	if (graphic)
	{
		g.DrawImage(graphic, 0, 0, 1075, 249);
		graphic = NULL;
	}
	switch(m_nCurrentTech)
	{
	case 0:	graphic = pDoc->GetGraphicPool()->GetGDIGraphic("Research\\biotech.bop"); break;
	case 1:	graphic = pDoc->GetGraphicPool()->GetGDIGraphic("Research\\energytech.bop"); break;
	case 2:	graphic = pDoc->GetGraphicPool()->GetGDIGraphic("Research\\computertech.bop"); break;
	case 3:	graphic = pDoc->GetGraphicPool()->GetGDIGraphic("Research\\propulsiontech.bop"); break;
	case 4:	graphic = pDoc->GetGraphicPool()->GetGDIGraphic("Research\\constructiontech.bop"); break;
	case 5:	graphic = pDoc->GetGraphicPool()->GetGDIGraphic("Research\\weapontech.bop"); break;
	case 6:	graphic = pDoc->GetGraphicPool()->GetGDIGraphic("Research\\specialtech.bop"); break;
	}
	if (graphic)
	{
		g.DrawImage(graphic, 790, 25, 240, 200);
		graphic = NULL;
	}
	// Name und Beschreibung der Forschung anzeigen
	CFontLoader::CreateGDIFont(pMajor, 4, fontName, fontSize);
	fontFormat.SetAlignment(StringAlignmentNear);
	fontFormat.SetLineAlignment(StringAlignmentNear);
	fontFormat.SetFormatFlags(StringFormatFlagsNoWrap);

	CString s;
	if (m_nCurrentTech != 6)
		s = pMajor->GetEmpire()->GetResearch()->GetResearchInfo()->GetTechName(m_nCurrentTech);
	else
		s = pMajor->GetEmpire()->GetResearch()->GetResearchInfo()->GetCurrentResearchComplex()->GetComplexName();
	g.DrawString(CComBSTR(s), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(40, 30, rect.right-325, rect.bottom), &fontFormat, &fontBrush);

	CFontLoader::CreateGDIFont(pMajor, 2, fontName, fontSize);
	fontBrush.SetColor(Color(200,200,250));
	fontFormat.SetFormatFlags(!StringFormatFlagsNoWrap);
	if (m_nCurrentTech != 6)
		s = pMajor->GetEmpire()->GetResearch()->GetResearchInfo()->GetTechDescription(m_nCurrentTech);
	else
		s = pMajor->GetEmpire()->GetResearch()->GetResearchInfo()->GetCurrentResearchComplex()->GetComplexDescription();
	g.DrawString(CComBSTR(s), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(40, 100, rect.right-325, rect.bottom), &fontFormat, &fontBrush);

	g.ReleaseHDC(pDC->GetSafeHdc());
}
Ejemplo n.º 5
0
void CDiplomacyBottomView::OnDraw(CDC* dc)
{
    CBotEDoc* pDoc = resources::pDoc;
    AssertBotE(pDoc);

    if (!pDoc->m_bDataReceived)
        return;

    CMajor* pMajor = m_pPlayersRace;
    AssertBotE(pMajor);
    if (!pMajor)
        return;
    // TODO: add draw code here

    // Doublebuffering wird initialisiert
    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);

    CString fontName = "";
    Gdiplus::REAL fontSize = 0.0;
    StringFormat fontFormat;
    SolidBrush fontBrush(static_cast<Gdiplus::ARGB>(Color::White));

    // Soll was über die Diplomatie angezeigt werden
    CRect rect;
    rect.SetRect(0,0,m_TotalSize.cx,m_TotalSize.cy);

    CString sPrefix = pMajor->GetPrefix();
    Color color;
    color.SetFromCOLORREF(pMajor->GetDesign()->m_clrGalaxySectorText);
    fontBrush.SetColor(color);
    Bitmap* graphic = pDoc->GetGraphicPool()->GetGDIGraphic("Backgrounds\\" + sPrefix + "diplomacyV3.boj");

    // Grafik zeichnen
    if (graphic)
    {
        g.DrawImage(graphic, 0, 0, 1075, 249);
        graphic = NULL;
    }

    CFontLoader::CreateGDIFont(pMajor, 4, fontName, fontSize);
    fontFormat.SetAlignment(StringAlignmentNear);
    fontFormat.SetLineAlignment(StringAlignmentNear);
    fontFormat.SetFormatFlags(StringFormatFlagsNoWrap);
    g.DrawString(CComBSTR(m_strHeadLine), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(40, 30, rect.right, rect.bottom), &fontFormat, &fontBrush);

    if (m_strText.IsEmpty())
        g.DrawString(CComBSTR(CLoc::GetString("NO_DIPLOMATIC_NEWS")), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(40, 30, rect.right, rect.bottom), &fontFormat, &fontBrush);
    m_strHeadLine = "";

    CFontLoader::CreateGDIFont(pMajor, 2, fontName, fontSize);
    fontBrush.SetColor(Color(200,200,250));
    fontFormat.SetFormatFlags(!StringFormatFlagsNoWrap);
    g.DrawString(CComBSTR(m_strText), -1, &Gdiplus::Font(CComBSTR(fontName), fontSize), RectF(40, 100, rect.right-250, rect.bottom), &fontFormat, &fontBrush);

    g.ReleaseHDC(pDC->GetSafeHdc());
}
void CNewGameView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();

	// TODO: Fügen Sie hier Ihren spezialisierten Code ein, und/oder rufen Sie die Basisklasse auf.
	CBotEDoc* pDoc = resources::pDoc;
	ASSERT(pDoc);

	m_pBkgndImg = pDoc->GetGraphicPool()->GetGDIGraphic("Events\\Startmenu.boj");
	m_TotalSize = CSize(1280, 1024);

	CRect clientRect;
	GetDesktopWindow()->GetClientRect(clientRect);

	//double nButtonSizeX = 300.0;
	//double nButtonSizeY = 40.0;

	//double nXPos = clientRect.Width() / 2.0 - nButtonSizeX / 2.0;
	double nYPos = clientRect.Height() / 2.0 - 175.0;

	//double nGab = 10.0;

	// Structure containing Style
	tButtonStyle tStyle;
	//////////////////////////////////////////////////////////////////////////

	// Get default Style
	m_tButtonStyle.GetButtonStyle(&tStyle);
	// Change Radius of Button
	tStyle.m_dRadius = 1.0;

	// Change Color Schema of Button
	tStyle.m_tColorFace.m_tEnabled		= RGB(100, 100, 100);
	tStyle.m_tColorBorder.m_tEnabled	= RGB(220, 220, 220);

	tStyle.m_tColorFace.m_tClicked		= RGB(75, 75, 75);
	tStyle.m_tColorBorder.m_tClicked	= RGB(25, 25, 25);

	tStyle.m_tColorFace.m_tPressed		= RGB(75, 75, 75);
	tStyle.m_tColorBorder.m_tPressed	= RGB(25, 25, 25);

	tStyle.m_tColorFace.m_tHot			= RGB(0x80, 0x80, 0xFF);
	tStyle.m_tColorBorder.m_tHot		= RGB(0x40, 0x40, 0xFF);

	// Set Style again
	m_tButtonStyle.SetButtonStyle(&tStyle);

	// auflösungsabhängige Font erstellen
	CFont fnt;
	fnt.CreateFont(17, 0, 0, 0, FW_BLACK, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS,
		CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, DEFAULT_PITCH, "Calibri");

	// Set control positions
	m_username.SetWindowPos(NULL, clientRect.Width() / 2.0 - 100, nYPos, 200, 25, SWP_FRAMECHANGED);
	m_username.SetFont(&fnt);

	// Controls nur für Server
	m_description.SetWindowPos(NULL, clientRect.Width() / 2.0 - 100, nYPos + 35, 200, 25, SWP_FRAMECHANGED);
	m_description.SetFont(&fnt);

	m_serverPort.SetWindowPos(NULL, clientRect.Width() / 2.0 - 100, nYPos + 70, 200, 25, SWP_FRAMECHANGED);
	m_serverPort.SetFont(&fnt);

	m_btPublish.SetWindowPos(NULL, clientRect.Width() / 2.0 - 100, nYPos + 105, 14, 14, SWP_FRAMECHANGED);
	m_btPublish.SetFont(&fnt);

	// Controls nur für Clients
	m_hostIP.SetWindowPos(NULL, clientRect.Width() / 2.0 - 100, nYPos + 35, 200, 25, SWP_FRAMECHANGED);
	m_hostIP.SetFont(&fnt);

	m_btSearchServers.SetWindowPos(NULL, clientRect.Width() / 2.0 + 110, nYPos + 35, 175, 25, SWP_FRAMECHANGED);
	SetButtonStyle(&m_btSearchServers);
	m_btSearchServers.SetWindowText(CLoc::GetString("SEARCHLANSERVER"));

	m_hostPort.SetWindowPos(NULL, clientRect.Width() / 2.0 - 100, nYPos + 70, 200, 25, SWP_FRAMECHANGED);
	m_hostPort.SetFont(&fnt);

	// Create push buttons
	m_btBack.Create(_T(CLoc::GetString("BTN_BACK")), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, CRect(), this, BTN_BACK);
	m_btBack.SetWindowPos(NULL, clientRect.Width() / 2.0 - 160, nYPos + 175, 150, 30, SWP_FRAMECHANGED);
	SetButtonStyle(&m_btBack);

	m_btNext.Create(_T(CLoc::GetString("BTN_FURTHER")), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, CRect(), this, BTN_NEXT);
	m_btNext.SetWindowPos(NULL, clientRect.Width() / 2.0 + 10, nYPos + 175, 150, 30, SWP_FRAMECHANGED);
	SetButtonStyle(&m_btNext);

	// Handle auf Font freigeben
	fnt.Detach();

	// Anfangswerte setzen
	m_btPublish.SetCheck(TRUE);

	CString userName = "";
	CIniLoader::GetInstance()->ReadValue("General", "USERNAME", userName);
	if (!userName.IsEmpty())
		SetDlgItemText(IDC_USERNAME, userName);
	else
	{
		TCHAR userName[UNLEN + 1];
		DWORD nLen = UNLEN + 1;
		VERIFY(GetUserName(userName, &nLen));
		SetDlgItemText(IDC_USERNAME, userName);
	}
	GetDlgItemText(IDC_USERNAME, userName);
	CIniLoader::GetInstance()->WriteValue("General", "USERNAME", userName);

	m_hostIP.SetAddress(INADDR_LOOPBACK);
	m_hostPort.SetWindowText("7777");
	m_serverPort.SetWindowText("7777");
	CString strDesc;
	strDesc.Format("%ss BotE-Server", userName);
	m_description.SetWindowText(strDesc);

	SetMode(MODE_SERVER);

	EnableNextButton();

	// TEST-OPTION (only for Debug)
// Automatisch bis zu einer gewissen Runde durchzuklicken falls per Startparamter aktiviert
// Eventscreen gleich wieder schließen
if (const CCommandLineParameters* const clp = resources::pClp)
{
    int nAutoTurns = clp->GetAutoTurns();
		CBotEDoc* pDoc = resources::pDoc;
	ASSERT(pDoc);
	if (!pDoc)
		return;
    //if (!pDoc->m_bRoundEndPressed && pDoc->GetCurrentRound() < nAutoTurns)
    //{
	using namespace network;

	// Wechsel zur nächsten Seite nur möglich, wenn der Server läuft
	//if (!m_bIsServer)
	//	return;


	StartServer(m_btPublish.GetCheck() == BST_CHECKED);
	client.RequestRace((network::RACE)(clp->GetAutoTurns()));

	//m_bStopDrawing = true;

	//SetCursor(::LoadCursor(NULL, IDC_WAIT));

	// evtl. laufende Veröffentlichung des Spiels stoppen
	//serverPublisher.StopPublishing();

	// die nicht ausgewählten Völker vom Server spielen lassen
	/*for (int i = 0; i < RACE_COUNT; i++)
	{
		RACE race = (RACE)(RACE_FIRST + i);
		if (!server.IsPlayedByClient(race))
			server.SetPlayByServer(race,TRUE,FALSE);
	}*/

	// Spiel starten; veranlasst die Clients, auf die nächste Seite zu wechseln
	pDoc->PrepareData();
	server.BeginGame(pDoc);

	SetCursor(::LoadCursor(NULL, IDC_ARROW));
}
}
/////////////////////////////////////////////////////////////////////////////////////////
// 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);
}