[Gcblue-commits] gcb_wx/src/sim Game.cpp,1.52.2.2,1.52.2.3 tcCreditView.cpp,1.6.2.3,1.6.2.4 tcMapVie
Status: Alpha
Brought to you by:
ddcforge
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32097/src/sim Modified Files: Tag: v0_5_0 Game.cpp tcCreditView.cpp tcMapView.cpp tcObjectControl.cpp tcStartView.cpp Log Message: Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.52.2.2 retrieving revision 1.52.2.3 diff -C2 -d -r1.52.2.2 -r1.52.2.3 *** Game.cpp 25 Jan 2004 17:36:28 -0000 1.52.2.2 --- Game.cpp 17 Feb 2004 14:27:02 -0000 1.52.2.3 *************** *** 126,132 **** directorTime = 0; ! mnBriefingWidth = 350; ! mnLeftMargin = 200; ! mnBottomMargin = 200; std::cout << "Game constructor success" << std::endl; --- 126,130 ---- directorTime = 0; ! InitializeScreenSizeParams(size); std::cout << "Game constructor success" << std::endl; *************** *** 280,287 **** { int margin = (meScreenMode == TACTICALBRIEF) ? mnBriefingWidth : mnLeftMargin; ! r.x = margin; r.y = 0; ! r.width = mnWidth-margin; ! r.height = mnHeight-mnBottomMargin; } else // size3D = MODE3D_FULL --- 278,285 ---- { int margin = (meScreenMode == TACTICALBRIEF) ? mnBriefingWidth : mnLeftMargin; ! r.x = margin + 1; r.y = 0; ! r.width = mnWidth-margin - 1; ! r.height = mnHeight-mnBottomMargin - 1; } else // size3D = MODE3D_FULL *************** *** 403,408 **** void tcGame::Initialize3DViewer() { ! smallViewerPosition = wxPoint(mnWidth - 380, 0); ! smallViewerSize = wxSize(380, 200); viewer = new tc3DViewer(this, smallViewerPosition, smallViewerSize); --- 401,414 ---- void tcGame::Initialize3DViewer() { ! if (mnWidth > 1000) ! { ! smallViewerPosition = wxPoint(mnWidth - 380, 0); ! smallViewerSize = wxSize(380, 200); ! } ! else // support for 800 x 600 ! { ! smallViewerPosition = wxPoint(mnWidth - 285, 0); ! smallViewerSize = wxSize(285, 150); ! } viewer = new tc3DViewer(this, smallViewerPosition, smallViewerSize); *************** *** 607,616 **** } void tcGame::InitializeTacticalMap() { ! mrectMap.left = 200; mrectMap.top = 0; mrectMap.right = mnWidth; //GetSystemMetrics(SM_CXFULLSCREEN); ! mrectMap.bottom = mnHeight - 200; //GetSystemMetrics(SM_CYFULLSCREEN); tacticalMap = new tcTacticalMapView(this, wxPoint(mrectMap.left,mrectMap.top), wxSize(mrectMap.right-mrectMap.left, mrectMap.bottom-mrectMap.top)); tacticalMapSize = TM_LARGE; --- 613,655 ---- } + /** + * Called at startup to initialize parameters that are sensitive + * to screen size e.g. window sizes and placements. + * @param screenSize wxSize object for screen size + */ + void tcGame::InitializeScreenSizeParams(const wxSize& screenSize) + { + fprintf(stdout, "screen size: %d x %d\n", + screenSize.GetWidth(), screenSize.GetHeight()); + if (screenSize.GetWidth() >= 1280) + { + mnBriefingWidth = 350; + mnLeftMargin = 200; + mnLeftMargin2 = 200; + mnBottomMargin = 200; + } + else if (screenSize.GetWidth() >= 1024) + { + mnBriefingWidth = 320; + mnLeftMargin = 200; + mnLeftMargin2 = 160; + mnBottomMargin = 200; + } + else + { + mnBriefingWidth = 300; + mnLeftMargin = 160; + mnLeftMargin2 = 160; + mnBottomMargin = 200; + } + } + + void tcGame::InitializeTacticalMap() { ! mrectMap.left = mnLeftMargin; mrectMap.top = 0; mrectMap.right = mnWidth; //GetSystemMetrics(SM_CXFULLSCREEN); ! mrectMap.bottom = mnHeight - mnBottomMargin; //GetSystemMetrics(SM_CYFULLSCREEN); tacticalMap = new tcTacticalMapView(this, wxPoint(mrectMap.left,mrectMap.top), wxSize(mrectMap.right-mrectMap.left, mrectMap.bottom-mrectMap.top)); tacticalMapSize = TM_LARGE; *************** *** 642,650 **** /* ** Info console init * **/ mrectLowerLeft.left = 0; ! mrectLowerLeft.top = mnHeight-200; ! mrectLowerLeft.right = 200; mrectLowerLeft.bottom = mnHeight; ! infoConsole = new tcSoundConsole(this, wxPoint(mrectLowerLeft.left,mrectLowerLeft.top), wxSize(200,200)); if (!infoConsole) --- 681,690 ---- /* ** Info console init * **/ mrectLowerLeft.left = 0; ! mrectLowerLeft.top = mnHeight-mnBottomMargin; ! mrectLowerLeft.right = mnLeftMargin; mrectLowerLeft.bottom = mnHeight; ! infoConsole = new tcSoundConsole(this, ! wxPoint(mrectLowerLeft.left,mrectLowerLeft.top), wxSize(mnLeftMargin,mnBottomMargin)); if (!infoConsole) *************** *** 663,669 **** infoConsole->AttachSound(&mcSound); infoConsole->SetEffect(-1); //SEFFECT_MUTEDBEEP); // no sound ! infoConsole->InitGdi(10.0f,0xFF64FF64); ! infoConsole->SetLineSpacing(10); ! infoConsole->SetWrap(28); infoConsole->SetActive(false); infoConsole->SetSkipCount(mcOptions.renderSkipCount); --- 703,718 ---- infoConsole->AttachSound(&mcSound); infoConsole->SetEffect(-1); //SEFFECT_MUTEDBEEP); // no sound ! if (mnWidth > 1000) ! { ! infoConsole->InitGdi(10.0f,0xFF64FF64); ! infoConsole->SetLineSpacing(10); ! infoConsole->SetWrap(28); ! } ! else // 800 x 600 support ! { ! infoConsole->InitGdi(8.0f,0xFF64FF64); ! infoConsole->SetLineSpacing(9); ! infoConsole->SetWrap(26); ! } infoConsole->SetActive(false); infoConsole->SetSkipCount(mcOptions.renderSkipCount); *************** *** 672,676 **** /* ** hookInfo init * **/ hookInfo = new tcHookInfo(this, wxPoint(mrectLowerLeft.right,mrectLowerLeft.top), ! wxSize(200,200)); if (!hookInfo) --- 721,725 ---- /* ** hookInfo init * **/ hookInfo = new tcHookInfo(this, wxPoint(mrectLowerLeft.right,mrectLowerLeft.top), ! wxSize(mnLeftMargin2,mnBottomMargin)); if (!hookInfo) *************** *** 695,699 **** // objectControl init ! objectControl = new tcObjectControl(this, wxPoint(mrectLowerLeft.right+200,mrectLowerLeft.top), wxSize(mnWidth-400,200)); if (!objectControl) --- 744,750 ---- // objectControl init ! objectControl = new tcObjectControl(this, ! wxPoint(mrectLowerLeft.right+mnLeftMargin2,mrectLowerLeft.top), ! wxSize(mnWidth-mnLeftMargin-mnLeftMargin2,mnBottomMargin)); if (!objectControl) *************** *** 721,726 **** mrectOOB.left = 0; mrectOOB.top = 0; ! mrectOOB.right = 200; ! mrectOOB.bottom = mnHeight-200; oobView = new tcOOBView(this, wxPoint(mrectOOB.left,mrectOOB.top), wxSize(mrectOOB.right-mrectOOB.left, mrectOOB.bottom-mrectOOB.top)); --- 772,777 ---- mrectOOB.left = 0; mrectOOB.top = 0; ! mrectOOB.right = mnLeftMargin; ! mrectOOB.bottom = mnHeight-mnBottomMargin; oobView = new tcOOBView(this, wxPoint(mrectOOB.left,mrectOOB.top), wxSize(mrectOOB.right-mrectOOB.left, mrectOOB.bottom-mrectOOB.top)); *************** *** 993,996 **** --- 1044,1048 ---- { static teScreenMode lastMode = NONE; + static int skipCount = 0; tcTime::Update(); *************** *** 1001,1009 **** { case START: ! optionsView->SetActive(false); ! startView->SetActive(true); ! creditView->SetActive(false); ! scenarioSelectView->SetActive(false); ! startView->Draw(); break; case CREDIT: --- 1053,1064 ---- { case START: ! if ((mcOptions.graphicsDetail == 2)||(skipCount++ % 2 == 0)) ! { ! optionsView->SetActive(false); ! startView->SetActive(true); ! creditView->SetActive(false); ! scenarioSelectView->SetActive(false); ! startView->Draw(); ! } break; case CREDIT: *************** *** 1012,1035 **** creditView->Rewind(); } ! ! optionsView->SetActive(false); ! startView->SetActive(false); ! creditView->SetActive(true); ! scenarioSelectView->SetActive(false); ! creditView->Draw(); break; case OPTIONS: ! optionsView->SetActive(true); ! startView->SetActive(false); ! creditView->SetActive(false); ! scenarioSelectView->SetActive(false); ! optionsView->Draw(); break; case SCENARIOSELECT: ! scenarioSelectView->SetActive(true); ! optionsView->SetActive(false); ! startView->SetActive(false); ! creditView->SetActive(false); ! scenarioSelectView->Draw(); break; } --- 1067,1098 ---- creditView->Rewind(); } ! if ((mcOptions.graphicsDetail == 2)||(skipCount++ % 2 == 0)) ! { ! optionsView->SetActive(false); ! startView->SetActive(false); ! creditView->SetActive(true); ! scenarioSelectView->SetActive(false); ! creditView->Draw(); ! } break; case OPTIONS: ! if ((mcOptions.graphicsDetail == 2)||(skipCount++ % 2 == 0)) ! { ! optionsView->SetActive(true); ! startView->SetActive(false); ! creditView->SetActive(false); ! scenarioSelectView->SetActive(false); ! optionsView->Draw(); ! } break; case SCENARIOSELECT: ! if ((mcOptions.graphicsDetail == 2)||(skipCount++ % 2 == 0)) ! { ! scenarioSelectView->SetActive(true); ! optionsView->SetActive(false); ! startView->SetActive(false); ! creditView->SetActive(false); ! scenarioSelectView->Draw(); ! } break; } *************** *** 1077,1080 **** --- 1140,1145 ---- void tcGame::UpdateForScreenMode() { + static int skipCount = 0; + bool drawEdgeWindows = (size3D != MODE3D_FULL) || (!mb3DActive); bool drawTacticalMap = (size3D == MODE3D_SMALL) || (!mb3DActive); *************** *** 1092,1099 **** --- 1157,1167 ---- viewer->SetActive(mb3DActive); + if ((mcOptions.graphicsDetail < 2)&&(skipCount++ % 2 != 0)) return; if (drawTacticalMap) { tacticalMap->Draw(); } + if (popupControl->mbActive) popupControl->Draw(); + if (drawEdgeWindows) { *************** *** 1103,1107 **** objectControl->Draw(); } ! if (popupControl->mbActive) popupControl->Draw(); } else if (meScreenMode == TACTICALBRIEF) --- 1171,1175 ---- objectControl->Draw(); } ! if ((mcOptions.graphicsDetail < 2)&&(skipCount % 4 != 0)) return; } else if (meScreenMode == TACTICALBRIEF) *************** *** 1118,1121 **** --- 1186,1190 ---- viewer->SetActive(mb3DActive); + if ((mcOptions.graphicsDetail < 2)&&(skipCount++ % 2 != 0)) return; if (drawTacticalMap) { *************** *** 1309,1313 **** if (directorTime >= 0.1f) { ! mpGraphicsEngine->RenderAll(); if (mcOptions.debugLevel > 1) --- 1378,1389 ---- if (directorTime >= 0.1f) { ! ! if ((size3D != MODE3D_FULL) || (!mb3DActive)) ! { ! if ((mcOptions.graphicsDetail != 0) || (snFrameCount % 2 == 0)) ! { ! mpGraphicsEngine->RenderAll(); ! } ! } if (mcOptions.debugLevel > 1) *************** *** 1317,1320 **** --- 1393,1397 ---- viewer->Frame(); + } Index: tcCreditView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCreditView.cpp,v retrieving revision 1.6.2.3 retrieving revision 1.6.2.4 diff -C2 -d -r1.6.2.3 -r1.6.2.4 *** tcCreditView.cpp 25 Jan 2004 17:36:29 -0000 1.6.2.3 --- tcCreditView.cpp 17 Feb 2004 14:27:03 -0000 1.6.2.4 *************** *** 38,301 **** void tcCreditView::AddCredit(tcString& s, float afTrailSpace, int effect) { ! if (mnCredits >= MAX_CREDITS) {return;} ! maCredit[mnCredits].mfTrailSpace = afTrailSpace; ! maCredit[mnCredits].mnEffect = effect; ! maCredit[mnCredits++].mzCaption = s; } /*******************************************************************************/ bool tcCreditView::Init() { ! tcString s; ! s = "------- C R E D I T S -------"; ! AddCredit(s, 40.0f, 1); ! s = "Dewitt \"Cole\" Colclough"; ! AddCredit(s, 25.0f, 1); ! s = "Project manager and lead developer\n"; ! AddCredit(s, 80.0f, 0); ! s = "Marcelo C\341ceres (op4_delta)"; ! AddCredit(s, 25.0f, 1); ! s = "3D art"; ! AddCredit(s, 60.0f, 0); ! s = "Marco Belli"; ! AddCredit(s, 25.0f, 1); ! s = "Developer - Sound, Linux port"; ! AddCredit(s, 60.0f, 0); ! s = "Jason Morris"; ! AddCredit(s, 25.0f, 1); ! s = "Developer"; ! AddCredit(s, 60.0f, 0); ! s = "Test\n"; ! AddCredit(s, 23.0f, 1); ! AddCredit(tcString("Marco Belli"), 12.0f, 2); ! AddCredit(tcString("Marcelo C\341ceres"), 12.0f, 2); ! AddCredit(tcString("Rob Carpenter"), 12.0f, 2); ! AddCredit(tcString("Paul Daly"), 12.0f, 2); ! AddCredit(tcString("Dust"), 12.0f, 2); ! AddCredit(tcString("Jason Morris"), 12.0f, 2); ! AddCredit(tcString("Andrew Platfoot"), 12.0f, 2); ! AddCredit(tcString("Justin Priestman"), 12.0f, 2); ! AddCredit(tcString("Gregg Smith"), 38.0f+12.0f, 2); ! s = "Some 2D art courtesy of U.S. Navy, www.news.navy.mil/view_galleries.asp \n"; ! AddCredit(s, 60.0f, 0); ! s = "3D sky code\n"; ! AddCredit(s, 25.0f, 0); ! s = "Combat Simulator Project, csp.sourceforge.net \n"; ! AddCredit(s, 60.0f, 1); ! s = "Map data based on GTOPO30 archive distributed by the \nLand Processes Distributed Active Archive Center (LP DAAC)\nlpdaac.usgs.gov \n"; ! AddCredit(s, 100.0f, 0); ! s = "Thanks to the developers of these software libraries:\n"; ! AddCredit(s, 30.0f, 0); ! s = "wxWindows\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.wxwindows.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "Python 2.3\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.python.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "Boost Python\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.boost.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "OpenSceneGraph\n"; ! AddCredit(s, 20.0f, 0); ! s = "openscenegraph.sourceforge.net\n"; ! AddCredit(s, 60.0f, 0); ! s = "Special thanks to:"; ! AddCredit(s, 30.0f, 0); ! s = "Harpoon HQ, www.harpoonhq.com\n"; ! AddCredit(s, 30.0f, 0); ! s = "Mille-Sabords, www.mille-sabords.com\n"; ! AddCredit(s, 30.0f, 0); ! s = "Seawolves Surface Division, www.seawolves.org/fc\n"; ! AddCredit(s, 30.0f, 0); ! s = "and\n"; ! AddCredit(s, 30.0f, 0); ! ! s = "To those who offered advice through e-mail and \nthe global_conflict discussion group"; ! AddCredit(s, 120.0f, 0); - s = "GLOBAL CONFLICT BLUE"; - AddCredit(s, 20.0f, 0); ! s = "An open source project"; ! AddCredit(s, 20.0f, 0); ! s = "www.gcblue.com"; ! AddCredit(s, 20.0f, 0); ! s = "Copyright (C) 2002-2004, All rights reserved.\n"; ! AddCredit(s, 60.0f, 0); - FontFamily ff(L"Arial"); - mpFont = new Font(&ff,16,FontStyleRegular,UnitPixel); - if (mpFont == NULL) { - WTL("tcCreditView - mpFont creation failed\n"); - return false; - } - mpFontLarge = new Font(&ff,20,FontStyleBold,UnitPixel); - if (mpFontLarge == NULL) { - WTL("tcCreditView - mpFontLarge creation failed\n"); - return false; - } - mpFontSmall = new Font(&ff,12,FontStyleRegular,UnitPixel); - if (mpFontSmall == NULL) { - WTL("tcCreditView - mpFontSmall creation failed\n"); - return false; - } ! mpBrush = new SolidBrush(Color(0xFEFFFFFF)); // color is ARGB ! if (mpBrush == NULL) { ! WTL("tcCreditView - mpBrush creation failed\n"); ! return false; ! } ! mpPen = new Pen(Color(255,200,200,200),2); ! if (mpPen == NULL) { ! WTL("tcCreditView - mpPen creation failed\n"); ! return false; ! } ! Rewind(); ! return true; } /*******************************************************************************/ int tcCreditView::Draw() { ! static WCHAR szwchar[256]; ! UINT32 nDeltaTime = mcTime.snCount_30Hz - mnStartTime; ! ! Graphics *pGraphics; ! Erase(); ! if (!GetGraphics(pGraphics)) { ! return false; ! } ! DrawBackground(pGraphics); ! // Get the text rendering hint. ! TextRenderingHint oldhint = pGraphics->GetTextRenderingHint(); ! // Set the text rendering hint to TextRenderingHintAntiAlias. ! pGraphics->SetTextRenderingHint(TextRenderingHintAntiAlias); ! float fY = (float)mnHeight - 2*0.5f*(float)nDeltaTime; ! float fX = 0.5f*(float)mnWidth; ! ! const UINT32 nColorFade = 0x8E328032; ! const UINT32 nColorBright = 0xFE64FF64; ! mpBrush->SetColor(Color(nColorBright)); // font color ! //DrawTextCentered(pGraphics, mpFont, mpBrush, crawlstring.GetBuffer(), fX,fY); ! static int nFlashId = -1; ! static bool bFlash = false; ! static UINT32 snFocusTime; ! static tcString szFocus; ! // reset static variables if rewind occured ! if (mbDrawRewind) { ! nFlashId = -1; ! bFlash = false; ! mbDrawRewind = false; ! } ! if (bFlash) { ! if (nFlashId >= 0) {szFocus = maCredit[nFlashId].mzCaption;} ! snFocusTime = mcTime.snCount_30Hz; ! mpBrush->SetColor(Color(255,255,255,255)); ! pGraphics->FillRectangle(mpBrush,0,0,mnWidth,mnHeight); ! mpSound->PlayEffect(SEFFECT_EXPLOSION2); ! } ! if (nFlashId >= 0) { ! UINT32 nDeltaFocusTime = (mcTime.snCount_30Hz - snFocusTime); ! } ! for (int n=0;n<(int)mnCredits;n++) { ! tcString s = maCredit[n].mzCaption; ! const float fEffectZone = 60.0f; ! float dyeffect = fY - ((float)mnHeight - fEffectZone); ! if ((dyeffect >= 0)&&(dyeffect <= fEffectZone)) { ! mpBrush->SetColor(Color(nColorFade)); // font color ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 40.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 40.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 30.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 30.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 20.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 20.0f*dyeffect,fY); ! mpBrush->SetColor(Color(nColorBright)); // font color ! } ! else if (fY <= (float)mnHeight) { ! if ((n > nFlashId)&&(maCredit[n].mnEffect == 1)) { ! nFlashId = n; ! bFlash = true; ! } ! else { ! bFlash = false; ! } ! Font *pFont = mpFont; ! if (maCredit[n].mnEffect == 1) ! { ! pFont = mpFontLarge; ! } ! else if (maCredit[n].mnEffect == 2) ! { ! pFont = mpFontSmall; ! } ! mpBrush->SetColor(Color(nColorFade)); // font color ! ! DrawTextCentered(pGraphics, pFont, mpBrush, s.GetBuffer(), ! fX + 1.0f,fY + 1.0f); ! mpBrush->SetColor(Color(nColorBright)); // font color ! DrawTextCentered(pGraphics, pFont, mpBrush, s.GetBuffer(), fX,fY); ! } ! fY += maCredit[n].mfTrailSpace; ! } ! pGraphics->SetTextRenderingHint(oldhint); ! ReleaseGraphics(pGraphics); ! DrawBorder(); ! // rewind after credits are done crawling ! if (fY < -100.0f) { ! Rewind(); ! } ! return true; } --- 38,301 ---- void tcCreditView::AddCredit(tcString& s, float afTrailSpace, int effect) { ! if (mnCredits >= MAX_CREDITS) {return;} ! maCredit[mnCredits].mfTrailSpace = afTrailSpace; ! maCredit[mnCredits].mnEffect = effect; ! maCredit[mnCredits++].mzCaption = s; } /*******************************************************************************/ bool tcCreditView::Init() { ! tcString s; ! s = "------- C R E D I T S -------"; ! AddCredit(s, 40.0f, 1); ! s = "Dewitt \"Cole\" Colclough"; ! AddCredit(s, 25.0f, 1); ! s = "Project manager and lead developer\n"; ! AddCredit(s, 80.0f, 0); ! s = "Marcelo C\341ceres (op4_delta)"; ! AddCredit(s, 25.0f, 1); ! s = "3D art"; ! AddCredit(s, 60.0f, 0); ! s = "Marco Belli"; ! AddCredit(s, 25.0f, 1); ! s = "Developer - Sound, Linux port"; ! AddCredit(s, 60.0f, 0); ! s = "Jason Morris"; ! AddCredit(s, 25.0f, 1); ! s = "Developer"; ! AddCredit(s, 60.0f, 0); ! s = "Test\n"; ! AddCredit(s, 23.0f, 1); ! AddCredit(tcString("Marco Belli"), 12.0f, 2); ! AddCredit(tcString("Marcelo C\341ceres"), 12.0f, 2); ! AddCredit(tcString("Rob Carpenter"), 12.0f, 2); ! AddCredit(tcString("Paul Daly"), 12.0f, 2); ! AddCredit(tcString("Dust"), 12.0f, 2); ! AddCredit(tcString("Jason Morris"), 12.0f, 2); ! AddCredit(tcString("Andrew Platfoot"), 12.0f, 2); ! AddCredit(tcString("Justin Priestman"), 12.0f, 2); ! AddCredit(tcString("Gregg Smith"), 38.0f+12.0f, 2); ! s = "Some 2D art courtesy of U.S. Navy, www.news.navy.mil/view_galleries.asp \n"; ! AddCredit(s, 60.0f, 0); ! s = "3D sky code\n"; ! AddCredit(s, 25.0f, 0); ! s = "Combat Simulator Project, csp.sourceforge.net \n"; ! AddCredit(s, 60.0f, 1); ! s = "Map data based on GTOPO30 archive distributed by the \nLand Processes Distributed Active Archive Center (LP DAAC)\nlpdaac.usgs.gov \n"; ! AddCredit(s, 100.0f, 0); ! s = "Thanks to the developers of these software libraries:\n"; ! AddCredit(s, 30.0f, 0); ! s = "wxWindows\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.wxwindows.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "Python 2.3\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.python.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "Boost Python\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.boost.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "OpenSceneGraph\n"; ! AddCredit(s, 20.0f, 0); ! s = "openscenegraph.sourceforge.net\n"; ! AddCredit(s, 60.0f, 0); ! s = "Special thanks to:"; ! AddCredit(s, 30.0f, 0); ! s = "Harpoon HQ, www.harpoonhq.com\n"; ! AddCredit(s, 30.0f, 0); ! s = "Mille-Sabords, www.mille-sabords.com\n"; ! AddCredit(s, 30.0f, 0); ! s = "Seawolves Surface Division, www.seawolves.org/fc\n"; ! AddCredit(s, 30.0f, 0); ! s = "and\n"; ! AddCredit(s, 30.0f, 0); + s = "To those who offered advice through e-mail and \nthe global_conflict discussion group"; + AddCredit(s, 120.0f, 0); ! s = "GLOBAL CONFLICT BLUE"; ! AddCredit(s, 20.0f, 0); ! s = "An open source project"; ! AddCredit(s, 20.0f, 0); ! s = "www.gcblue.com"; ! AddCredit(s, 20.0f, 0); + s = "Copyright (C) 2002-2004, All rights reserved.\n"; + AddCredit(s, 60.0f, 0); ! FontFamily ff(L"Arial"); ! mpFont = new Font(&ff,16,FontStyleRegular,UnitPixel); ! if (mpFont == NULL) { ! WTL("tcCreditView - mpFont creation failed\n"); ! return false; ! } ! mpFontLarge = new Font(&ff,20,FontStyleBold,UnitPixel); ! if (mpFontLarge == NULL) { ! WTL("tcCreditView - mpFontLarge creation failed\n"); ! return false; ! } ! mpFontSmall = new Font(&ff,12,FontStyleRegular,UnitPixel); ! if (mpFontSmall == NULL) { ! WTL("tcCreditView - mpFontSmall creation failed\n"); ! return false; ! } ! mpBrush = new SolidBrush(Color(0xFEFFFFFF)); // color is ARGB ! if (mpBrush == NULL) { ! WTL("tcCreditView - mpBrush creation failed\n"); ! return false; ! } ! mpPen = new Pen(Color(255,200,200,200),2); ! if (mpPen == NULL) { ! WTL("tcCreditView - mpPen creation failed\n"); ! return false; ! } ! ! Rewind(); ! return true; } /*******************************************************************************/ int tcCreditView::Draw() { ! static WCHAR szwchar[256]; ! UINT32 nDeltaTime = mcTime.snCount_30Hz - mnStartTime; ! Graphics *pGraphics; ! Erase(); ! if (!GetGraphics(pGraphics)) { ! return false; ! } ! DrawBackground(pGraphics); ! // Get the text rendering hint. ! TextRenderingHint oldhint = pGraphics->GetTextRenderingHint(); + // Set the text rendering hint to TextRenderingHintAntiAlias. + pGraphics->SetTextRenderingHint(TextRenderingHintAntiAlias); ! float textVelocity = 0.0007f*mnHeight; ! float fY = (float)mnHeight - textVelocity*(float)nDeltaTime; ! float fX = 0.5f*(float)mnWidth; ! const UINT32 nColorFade = 0x8E328032; ! const UINT32 nColorBright = 0xFE64FF64; ! mpBrush->SetColor(Color(nColorBright)); // font color ! //DrawTextCentered(pGraphics, mpFont, mpBrush, crawlstring.GetBuffer(), fX,fY); ! static int nFlashId = -1; ! static bool bFlash = false; ! static UINT32 snFocusTime; ! static tcString szFocus; ! // reset static variables if rewind occured ! if (mbDrawRewind) { ! nFlashId = -1; ! bFlash = false; ! mbDrawRewind = false; ! } ! if (bFlash) { ! if (nFlashId >= 0) {szFocus = maCredit[nFlashId].mzCaption;} ! snFocusTime = mcTime.snCount_30Hz; ! mpBrush->SetColor(Color(255,255,255,255)); ! pGraphics->FillRectangle(mpBrush,0,0,mnWidth,mnHeight); ! mpSound->PlayEffect(SEFFECT_EXPLOSION2); ! } ! if (nFlashId >= 0) { ! UINT32 nDeltaFocusTime = (mcTime.snCount_30Hz - snFocusTime); ! } ! for (int n=0;n<(int)mnCredits;n++) { ! tcString s = maCredit[n].mzCaption; ! const float fEffectZone = 60.0f; ! float dyeffect = fY - ((float)mnHeight - fEffectZone); ! if ((dyeffect >= 0)&&(dyeffect <= fEffectZone)) { ! mpBrush->SetColor(Color(nColorFade)); // font color ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 40.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 40.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 30.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 30.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 20.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 20.0f*dyeffect,fY); ! mpBrush->SetColor(Color(nColorBright)); // font color ! } ! else if (fY <= (float)mnHeight) { ! if ((n > nFlashId)&&(maCredit[n].mnEffect == 1)) { ! nFlashId = n; ! bFlash = true; ! } ! else { ! bFlash = false; ! } ! Font *pFont = mpFont; ! if (maCredit[n].mnEffect == 1) ! { ! pFont = mpFontLarge; ! } ! else if (maCredit[n].mnEffect == 2) ! { ! pFont = mpFontSmall; ! } ! mpBrush->SetColor(Color(nColorFade)); // font color ! DrawTextCentered(pGraphics, pFont, mpBrush, s.GetBuffer(), ! fX + 1.0f,fY + 1.0f); ! mpBrush->SetColor(Color(nColorBright)); // font color ! DrawTextCentered(pGraphics, pFont, mpBrush, s.GetBuffer(), fX,fY); ! } ! fY += maCredit[n].mfTrailSpace; ! } ! ! pGraphics->SetTextRenderingHint(oldhint); ! ReleaseGraphics(pGraphics); ! DrawBorder(); ! ! // rewind after credits are done crawling ! if (fY < -100.0f) { ! Rewind(); ! } ! return true; } *************** *** 312,317 **** void tcCreditView::Rewind() { ! mnStartTime = mcTime.snCount_30Hz; ! mbDrawRewind = true; } --- 312,317 ---- void tcCreditView::Rewind() { ! mnStartTime = mcTime.snCount_30Hz; ! mbDrawRewind = true; } *************** *** 326,344 **** : tcWindow(parent, pos, size, name) { ! mpFont = NULL; ! mpFontLarge = NULL; ! mpFontSmall = NULL; ! mpBrush = NULL; ! mpSound = NULL; ! mnCredits = 0; ! mbDrawRewind = false; } tcCreditView::~tcCreditView() { ! if (mpFont != NULL) {delete mpFont;} ! if (mpFontLarge != NULL) {delete mpFontLarge;} ! if (mpFontSmall != NULL) {delete mpFontSmall;} ! if (mpBrush != NULL) {delete mpBrush;} ! if (mpPen != NULL) {delete mpPen;} } --- 326,344 ---- : tcWindow(parent, pos, size, name) { ! mpFont = NULL; ! mpFontLarge = NULL; ! mpFontSmall = NULL; ! mpBrush = NULL; ! mpSound = NULL; ! mnCredits = 0; ! mbDrawRewind = false; } tcCreditView::~tcCreditView() { ! if (mpFont != NULL) {delete mpFont;} ! if (mpFontLarge != NULL) {delete mpFontLarge;} ! if (mpFontSmall != NULL) {delete mpFontSmall;} ! if (mpBrush != NULL) {delete mpBrush;} ! if (mpPen != NULL) {delete mpPen;} } Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapView.cpp,v retrieving revision 1.15.2.2 retrieving revision 1.15.2.3 diff -C2 -d -r1.15.2.2 -r1.15.2.3 *** tcMapView.cpp 25 Jan 2004 17:36:30 -0000 1.15.2.2 --- tcMapView.cpp 17 Feb 2004 14:27:03 -0000 1.15.2.3 *************** *** 96,104 **** mfGridBaseLon_rad = mfGridSize_rad*floorf(mrectCurrentView.left/mfGridSize_rad); mfGridBaseLat_rad = mfGridSize_rad*floorf(mrectCurrentView.bottom/mfGridSize_rad); ! mfScale_pelprad = mnWidth/mfLonWidth; ! mfScale_radppel = 1/mfScale_pelprad; ! // TODO: update ! // if(mpDDS_Terrain!=NULL) mpMapData->UpdateSurface(mpDDS_Terrain,mrectCurrentView); } /** * Works with Thaw to prevent flicker on resize --- 96,106 ---- mfGridBaseLon_rad = mfGridSize_rad*floorf(mrectCurrentView.left/mfGridSize_rad); mfGridBaseLat_rad = mfGridSize_rad*floorf(mrectCurrentView.bottom/mfGridSize_rad); ! ! mfScaleX_pelprad = mnWidth/mfLonWidth; ! mfScaleX_radppel = 1/mfScaleX_pelprad; ! mfScaleY_pelprad = mnHeight/mfLatWidth; ! mfScaleY_radppel = 1/mfScaleY_pelprad; } + /** * Works with Thaw to prevent flicker on resize *************** *** 115,120 **** tcPoint tcMapView::GeoToScreen(tcPoint pgeo) { tcPoint pscreen; ! pscreen.x = (pgeo.x - mfLonCenter)*mfScale_pelprad + mnXCenter; ! pscreen.y = (-pgeo.y + mfLatCenter)*mfScale_pelprad + mnYCenter; return pscreen; } --- 117,122 ---- tcPoint tcMapView::GeoToScreen(tcPoint pgeo) { tcPoint pscreen; ! pscreen.x = (pgeo.x - mfLonCenter)*mfScaleX_pelprad + mnXCenter; ! pscreen.y = (-pgeo.y + mfLatCenter)*mfScaleY_pelprad + mnYCenter; return pscreen; } *************** *** 122,138 **** tcPoint tcMapView::GeoToScreen(float afLon, float afLat) { tcPoint pscreen; ! pscreen.x = (afLon - mfLonCenter)*mfScale_pelprad + mnXCenter; ! pscreen.y = (-afLat + mfLatCenter)*mfScale_pelprad + mnYCenter; return pscreen; } /***********************************************************************************/ float tcMapView::GeoExtentToScreen(float afExtent_rad) { ! return afExtent_rad*mfScale_pelprad; } /***********************************************************************************/ tcPoint tcMapView::ScreenToGeo(wxPoint pscreen) { tcPoint pgeo; ! pgeo.x = ((float)pscreen.x - mnXCenter)*mfScale_radppel + mfLonCenter; ! pgeo.y = ((float)-pscreen.y + mnYCenter)*mfScale_radppel + mfLatCenter; return pgeo; } --- 124,140 ---- tcPoint tcMapView::GeoToScreen(float afLon, float afLat) { tcPoint pscreen; ! pscreen.x = (afLon - mfLonCenter)*mfScaleX_pelprad + mnXCenter; ! pscreen.y = (-afLat + mfLatCenter)*mfScaleY_pelprad + mnYCenter; return pscreen; } /***********************************************************************************/ float tcMapView::GeoExtentToScreen(float afExtent_rad) { ! return afExtent_rad*mfScaleX_pelprad; } /***********************************************************************************/ tcPoint tcMapView::ScreenToGeo(wxPoint pscreen) { tcPoint pgeo; ! pgeo.x = ((float)pscreen.x - mnXCenter)*mfScaleX_radppel + mfLonCenter; ! pgeo.y = ((float)-pscreen.y + mnYCenter)*mfScaleY_radppel + mfLatCenter; return pgeo; } *************** *** 140,145 **** tcPoint tcMapView::ScreenToGeo(float x, float y) { tcPoint pgeo; ! pgeo.x = (x - mnXCenter)*mfScale_radppel + mfLonCenter; ! pgeo.y = (-y + mnYCenter)*mfScale_radppel + mfLatCenter; return pgeo; } --- 142,147 ---- tcPoint tcMapView::ScreenToGeo(float x, float y) { tcPoint pgeo; ! pgeo.x = (x - mnXCenter)*mfScaleX_radppel + mfLonCenter; ! pgeo.y = (-y + mnYCenter)*mfScaleY_radppel + mfLatCenter; return pgeo; } *************** *** 162,166 **** wxPoint pos = wxWindow::GetPosition(); // mnWidth and mnHeight updated by tcWindow::OnSize - terrainView->SetSize(wxRect(pos.x,pos.y,mnWidth,mnHeight)); CalcViewParameters(); } --- 164,167 ---- *************** *** 173,176 **** --- 174,187 ---- (p.y >= mrectCurrentView.bottom)&&(p.y <= mrectCurrentView.top); } + + /** + * override of wxWindow::SetSize so that terrainView->SetSize is called as well + */ + void tcMapView::SetSize(const wxRect& rect) + { + terrainView->SetSize(rect); + wxWindow::SetSize(rect); + } + /***********************************************************************************/ void tcMapView::SetViewCenterZoom(wxPoint pscreen, float afZoom) *************** *** 337,344 **** ! fKmPerPel = mfScale_radppel*C_RADTOKM; // calculate closest power of 10 km dist that corresponds to (about) 100 pixels fKmScale = expf(logf(10.0f)*floorf(log10f(fKmPerPel*120.0f))); ! nScaleBarWidth = (int)(fKmScale*C_KMTORAD*mfScale_pelprad); tcString sText; --- 348,355 ---- ! fKmPerPel = mfScaleX_radppel*C_RADTOKM; // calculate closest power of 10 km dist that corresponds to (about) 100 pixels fKmScale = expf(logf(10.0f)*floorf(log10f(fKmPerPel*120.0f))); ! nScaleBarWidth = (int)(fKmScale*C_KMTORAD*mfScaleX_pelprad); tcString sText; *************** *** 1299,1303 **** // search for hook ! fHookDistance = mfScale_radppel*15.0f; // 15 pixels fMinDistance = 1e15f; nMinID = NULL_INDEX; --- 1310,1314 ---- // search for hook ! fHookDistance = mfScaleX_radppel*15.0f; // 15 pixels fMinDistance = 1e15f; nMinID = NULL_INDEX; *************** *** 1326,1330 **** float dx,dy; float fDirection_rad = (float)C_PIOVER180*afDirection_deg; ! float dr = mfScale_radppel*16.0f; // 32 pixels dx = sinf(fDirection_rad)*dr; --- 1337,1341 ---- float dx,dy; float fDirection_rad = (float)C_PIOVER180*afDirection_deg; ! float dr = mfScaleX_radppel*16.0f; // 32 pixels dx = sinf(fDirection_rad)*dr; Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 *** tcObjectControl.cpp 19 Jan 2004 21:20:58 -0000 1.9.2.1 --- tcObjectControl.cpp 17 Feb 2004 14:27:03 -0000 1.9.2.2 *************** *** 51,136 **** void tcAIPanel::Draw(Graphics *apGraphics) { ! static WCHAR szwchar[255]; ! float textx, texty; ! char zBuff[128]; ! std::string s; ! if (mpAIData == NULL) {return;} [...2904 lines suppressed...] ! } ! mpFontLarge = new Font(&ff,14,FontStyleBold,UnitPixel); ! if (mpFontLarge == NULL) ! { ! WTL("tcObjectControl - mpFontLarge creation failed\n"); ! } ! mpBrush = new SolidBrush(Color(254,100,255,100)); ! if (mpBrush == NULL) ! { ! WTL("tcObjectControl - mpBrush creation failed\n"); ! } } tcObjectControl::~tcObjectControl() { ! if (mpPen != NULL) {delete mpPen;} ! if (mpFont != NULL) {delete mpFont;} ! if (mpFontLarge != NULL) {delete mpFontLarge;} ! if (mpBrush != NULL) {delete mpBrush;} } Index: tcStartView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcStartView.cpp,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -d -r1.8 -r1.8.2.1 *** tcStartView.cpp 3 Dec 2003 05:50:19 -0000 1.8 --- tcStartView.cpp 17 Feb 2004 14:27:03 -0000 1.8.2.1 *************** *** 41,45 **** { char zBuff[96]; ! for(int i=0; i < N_START_BUTTONS; i++) { --- 41,45 ---- { char zBuff[96]; ! int buttonReduction = (mnWidth < 1000) ? 10 : 0; // to support 800 x 600 mode for(int i=0; i < N_START_BUTTONS; i++) { *************** *** 49,54 **** MultiByteToWideChar(CP_ACP, 0, zBuff, -1, mzwchar, 255); pButton->mpiButtonOff = new Image(mzwchar,false); ! pButton->mnButtonWidth = pButton->mpiButtonOff->GetWidth(); ! pButton->mnButtonHeight = pButton->mpiButtonOff->GetHeight(); sprintf(zBuff,"%sstart%d%s",IMAGE_PATH,i,"_on.jpg"); --- 49,54 ---- MultiByteToWideChar(CP_ACP, 0, zBuff, -1, mzwchar, 255); pButton->mpiButtonOff = new Image(mzwchar,false); ! pButton->mnButtonWidth = pButton->mpiButtonOff->GetWidth() - buttonReduction; ! pButton->mnButtonHeight = pButton->mpiButtonOff->GetHeight() - buttonReduction; sprintf(zBuff,"%sstart%d%s",IMAGE_PATH,i,"_on.jpg"); *************** *** 319,323 **** xpos += 0*pButton->mnButtonWidth; ypos += pButton->mnButtonHeight; ! ypos += 32; } --- 319,323 ---- xpos += 0*pButton->mnButtonWidth; ypos += pButton->mnButtonHeight; ! ypos += mnButtonSpacing; } *************** *** 370,373 **** --- 370,374 ---- mnXStart = 200; mnYStart = 300; + mnButtonSpacing = 32; } else if (parentSize.GetHeight() > 700) *************** *** 375,383 **** mnXStart = 200; mnYStart = 200; } else { ! mnXStart = 200; ! mnYStart = 50; } --- 376,386 ---- mnXStart = 200; mnYStart = 200; + mnButtonSpacing = 32; } else { ! mnXStart = 150; ! mnYStart = 180; ! mnButtonSpacing = 18; } |