[Gcblue-commits] gcb_wx/src/graphics tcLauncherPopup.cpp,NONE,1.1 tc3DModel.cpp,1.16,1.17 tc3DWindow
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-12-07 04:01:22
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13689/src/graphics Modified Files: tc3DModel.cpp tc3DWindow.cpp tcMapView.cpp tcOOBView.cpp Added Files: tcLauncherPopup.cpp Log Message: Sonar work, passive sonar, torpedoes Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcMapView.cpp 5 Dec 2004 02:49:47 -0000 1.10 --- tcMapView.cpp 7 Dec 2004 04:00:41 -0000 1.11 *************** *** 452,458 **** osg::Vec4 color(0.784, 0.784, 0.784, 1.0); ! DrawTextR(sText.GetBuffer(), 50.0, mnHeight-25.0, defaultFont.get(), color, 16.0, CENTER_CENTER); ! nBarX1 = 120; nBarX2 = nBarX1 + nScaleBarWidth; --- 452,459 ---- osg::Vec4 color(0.784, 0.784, 0.784, 1.0); ! DrawTextR(sText.GetBuffer(), leftMargin + 50.0, mnHeight-25.0, ! defaultFont.get(), color, 16.0, CENTER_CENTER); ! nBarX1 = leftMargin + 120; nBarX2 = nBarX1 + nScaleBarWidth; *************** *** 492,496 **** osg::Vec4 color(1, 1, 1, 1); ! DrawTextR(sText.GetBuffer(), 50.0, mnHeight - 50.0, defaultFont.get(), color, 16.0, LEFT_BASE_LINE); } --- 493,498 ---- osg::Vec4 color(1, 1, 1, 1); ! DrawTextR(sText.GetBuffer(), leftMargin + 50.0, mnHeight - 50.0, ! defaultFont.get(), color, 16.0, LEFT_BASE_LINE); } *************** *** 628,632 **** /*** Draw grid ***/ ! DrawGrid(); /*** Draw scale bar ***/ --- 630,634 ---- /*** Draw grid ***/ ! //DrawGrid(); // disabled until the terrain view graphics are ported to OSG /*** Draw scale bar ***/ *************** *** 668,672 **** } ! DrawTextR(sText.GetBuffer(), 50.0, 50.0, defaultFont.get(), color, 16.0, LEFT_BASE_LINE); if ((mpOptions!=NULL) && (mpOptions->mbShowMapDebug)) --- 670,675 ---- } ! DrawTextR(sText.GetBuffer(), leftMargin + 50.0, 50.0, ! defaultFont.get(), color, 16.0, LEFT_BASE_LINE); if ((mpOptions!=NULL) && (mpOptions->mbShowMapDebug)) *************** *** 678,682 **** vp.mrectGeo.left,vp.mrectGeo.right,vp.mrectGeo.bottom,vp.mrectGeo.top, vp.mrectDisplay.X, vp.mrectDisplay.Y, vp.mrectDisplay.Width, vp.mrectDisplay.Height); ! DrawTextR(sText.GetBuffer(), 50.0, 80.0, defaultFont.get(), color, 16.0, LEFT_BASE_LINE); } --- 681,686 ---- vp.mrectGeo.left,vp.mrectGeo.right,vp.mrectGeo.bottom,vp.mrectGeo.top, vp.mrectDisplay.X, vp.mrectDisplay.Y, vp.mrectDisplay.Width, vp.mrectDisplay.Height); ! DrawTextR(sText.GetBuffer(), leftMargin + 50.0, 80.0, ! defaultFont.get(), color, 16.0, LEFT_BASE_LINE); } *************** *** 2031,2034 **** --- 2035,2046 ---- /** + * + */ + void tcTacticalMapView::SetTextLeftMargin(float x) + { + leftMargin = x; + } + + /** * OnLeaveWindow event handler */ *************** *** 2334,2337 **** --- 2346,2350 ---- meSymbology = NTDS; isLButtonDown = false; + leftMargin = 200.0f; ClearMapObjects(); Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tc3DModel.cpp 23 Nov 2004 23:30:55 -0000 1.16 --- tc3DModel.cpp 7 Dec 2004 04:00:28 -0000 1.17 *************** *** 24,30 **** #ifndef WX_PRECOMP #include "wx/wx.h" - //#ifdef WIN32 - //#include "wx/msw/private.h" // for MS Windows specific definitions - //#endif // WIN32 #endif // WX_PRECOMP --- 24,27 ---- *************** *** 32,35 **** --- 29,33 ---- #include "tcGameObject.h" #include "tcPlatformObject.h" + #include "tcOptions.h" #include "ObjectUpdater.h" #include "tcParticleEffect.h" *************** *** 70,74 **** std::string name = node.getName(); #ifdef _DEBUG ! std::cout << " - "<< name << "\n"; #endif /* --- 68,75 ---- std::string name = node.getName(); #ifdef _DEBUG ! if (tcOptions::Get()->log3DModelDetails) ! { ! std::cout << " - "<< name << "\n"; ! } #endif /* *************** *** 139,143 **** animationInfo.push_back(ai); ! std::cout << "added animation info for: " << name <<"\n"; } else --- 140,147 ---- animationInfo.push_back(ai); ! if (tcOptions::Get()->log3DModelDetails) ! { ! std::cout << "added animation info for: " << name <<"\n"; ! } } else *************** *** 396,400 **** { if (modelNode.valid()) return; // model already loaded ! std::cout << "Loading 3D model: " << model_name << " \n"; model_name = model_name + ".3ds"; --- 400,407 ---- { if (modelNode.valid()) return; // model already loaded ! if (tcOptions::Get()->log3DModelDetails) ! { ! std::cout << "Loading 3D model: " << model_name << " \n"; ! } model_name = model_name + ".3ds"; *************** *** 411,416 **** modelNode->accept(smoothingVisitor); } ! ! fprintf(stdout,"tc3DModel--Loaded 3D model: %s\n", model_name.c_str()); } --- 418,425 ---- modelNode->accept(smoothingVisitor); } ! if (tcOptions::Get()->log3DModelDetails) ! { ! fprintf(stdout,"tc3DModel--Loaded 3D model: %s\n", model_name.c_str()); ! } } --- NEW FILE: tcLauncherPopup.cpp --- /** ** @file tcLauncherPopup.cpp */ /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdwx.h" #include "tcLauncherPopup.h" #include "tcLauncher.h" #include "tcPlatformObject.h" #include "tcSimState.h" #include "tcTime.h" #include <stdio.h> #include <iostream> #ifdef _DEBUG #define new DEBUG_NEW #endif tc3DWindow* tcLauncherPopup::parent = 0; /** * */ void tcLauncherPopup::SetParent(tc3DWindow* par) { parent = par; } /** * */ void tcLauncherPopup::Draw() { unsigned currentCount = tcTime::Get()->Get30HzCount(); unsigned age = currentCount - birthCount; if (age % 10 == 0) redraw = true; if (!redraw) return; redraw = false; osg::Vec4 color(1, 1, 1, 1); float x = 10.0f; float y = 10.0f; tcPlatformObject* obj = dynamic_cast<tcPlatformObject*>(simState->GetObject(platformId)); DrawRectangleR(0, 0, float(mnWidth), float(mnHeight), osg::Vec4(0, 0, 0, 0.5f), FILL_ON); DrawBorder(); if (!obj) { DrawTextR("CONTROL UNAVAILABLE", x, y, defaultFont.get(), color, fontSize, CENTER_CENTER); HideUnusedObjects(); return; } tcLauncher* launcher = obj->GetLauncher(launcherIdx); if (!launcher) { DrawTextR("LAUNCHER ERROR", x, y, defaultFont.get(), color, fontSize, CENTER_CENTER); HideUnusedObjects(); return; } wxString s; wxSize textSize; s = wxString::Format("%s : %s x %d\n", launcher->displayName.c_str(), launcher->GetChildClassName().c_str(), launcher->mnCurrent); DrawTextR(s.c_str(), x, y, defaultFont.get(), color, fontSize, LEFT_CENTER); MeasureText(defaultFont.get(), fontSize, s.c_str(), textSize); x += float(textSize.GetWidth()) + 5.0f; launchButton.Set(x, x + 10.0f, y - 0.5f * float(textSize.GetHeight()), y + 0.5 * float(textSize.GetHeight())); if (launcher->GetLauncherStatus() == tcLauncher::LAUNCHER_READY) { color.set(0.4f, 1.0f, 0.4f, 1.0f); } else { color.set(1.0f, 0.4f, 0.4f, 1.0f); } DrawRectangleR(launchButton, color, FILL_ON); HideUnusedObjects(); } /** * @return associated launcher or NULL if error */ tcLauncher* tcLauncherPopup::GetLauncher() { tcPlatformObject* obj = dynamic_cast<tcPlatformObject*>(simState->GetObject(platformId)); if (!obj) { return 0; } else { return obj->GetLauncher(launcherIdx); } } /** * A hack job for now :) */ void tcLauncherPopup::OnLButtonDown(wxMouseEvent& event) { wxPoint pos = event.GetPosition(); if (launchButton.ContainsPoint(pos.x, pos.y)) { if (tcLauncher* launcher = GetLauncher()) { if (launcher->GetLauncherStatus() == tcLauncher::LAUNCHER_READY) { launcher->mnUncommitted -= 1; if (launcher->mnUncommitted < 0) { launcher->mnUncommitted = 0; // don't set new cmd here since this is an error case std::cerr << "Error - tcLauncherState::SetLaunch - negative uncommitted\n"; } //else //{ // commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); //} } } } else { ClearDrawObjects(); this->Destroy(); } } /** * */ void tcLauncherPopup::OnMouseOver(wxMouseEvent& event) { } /** * @param id Id of platform with launcher to control * @param idx Launcher idx on platform */ tcLauncherPopup::tcLauncherPopup(long id, unsigned idx, const wxPoint& pos) : tc3DWindow(parent, pos, wxSize(150, 50), "LauncherPopupControl", parent), platformId(id), launcherIdx(idx), redraw(true) { SetBaseRenderBin(parent->GetBaseRenderBin() + 10); birthCount = tcTime::Get()->Get30HzCount(); simState = tcSimState::Get(); wxASSERT(simState); SetActive(true); } tcLauncherPopup::~tcLauncherPopup() { } Index: tcOOBView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcOOBView.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcOOBView.cpp 2 Nov 2004 04:23:56 -0000 1.4 --- tcOOBView.cpp 7 Dec 2004 04:00:41 -0000 1.5 *************** *** 268,271 **** --- 268,274 ---- float yheader; + DrawRectangleR(0, 0, mnWidth, mnHeight, + osg::Vec4(0, 0, 0, 0.5f), FILL_ON); + yheader = GetCategoryY(surfaceObj); if (yheader > 0) *************** *** 443,446 **** --- 446,457 ---- } + /** + * Skips mouse move to allow tactical map underneath to receive + */ + void tcOOBView::OnMouseMove(wxMouseEvent& event) + { + event.Skip(); + } + tsOOBInfo* tcOOBView::ButtonContainingPoint(wxRealPoint pointf) { Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tc3DWindow.cpp 14 Nov 2004 22:52:21 -0000 1.11 --- tc3DWindow.cpp 7 Dec 2004 04:00:28 -0000 1.12 *************** *** 1685,1700 **** void tc3DWindow::MoveToTop() { ! /* ! if (!tcGraphicsEngine::Get()->MoveSurfaceToTop(mp2DSurface)) ! { ! std::cerr << "Error - tc3DWindow::MoveToTop() - surface not found" ! << std::endl; ! } ! if (mbCloned) ! { ! std::cerr << "Warning - tc3DWindow::MoveToTop() - called on shared surface" ! << std::endl; ! } ! */ } --- 1685,1689 ---- void tc3DWindow::MoveToTop() { ! wxWindow::Raise(); } *************** *** 1813,1816 **** --- 1802,1806 ---- root->setName(name.c_str()); osg::StateSet* stateSet = root->getOrCreateStateSet(); + stateSet->setMode(GL_BLEND, osg::StateAttribute::ON); stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF); stateSet->setMode(GL_DEPTH_WRITEMASK, osg::StateAttribute::OFF); *************** *** 1823,1826 **** --- 1813,1817 ---- groupStateSet->setMode(GL_DEPTH_WRITEMASK, osg::StateAttribute::OFF); groupStateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF); + groupStateSet->setMode(GL_BLEND, osg::StateAttribute::ON); textRoot = new osg::Geode; *************** *** 1842,1846 **** backgroundStateSet->setMode(GL_DEPTH_WRITEMASK, osg::StateAttribute::OFF); backgroundStateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF); ! backgroundStateSet->setMode(GL_BLEND, osg::StateAttribute::OFF); backgroundStateSet->setRenderBinDetails(baseRenderBin + backgroundRenderBin, "RenderBin"); --- 1833,1837 ---- backgroundStateSet->setMode(GL_DEPTH_WRITEMASK, osg::StateAttribute::OFF); backgroundStateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF); ! backgroundStateSet->setMode(GL_BLEND, osg::StateAttribute::ON); backgroundStateSet->setRenderBinDetails(baseRenderBin + backgroundRenderBin, "RenderBin"); |