[Gcblue-commits] gcb_wx/src/graphics ObjectUpdater.cpp,1.15,1.16 tc3DViewer.cpp,1.14,1.15 tcChatBox.
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-04-29 18:53:36
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27631/src/graphics Modified Files: ObjectUpdater.cpp tc3DViewer.cpp tcChatBox.cpp tcConsoleBox.cpp tcEditBox.cpp tcGameView.cpp tcHookInfo.cpp tcMapView.cpp tcNetworkView.cpp Log Message: Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcNetworkView.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcNetworkView.cpp 17 Apr 2005 22:35:31 -0000 1.8 --- tcNetworkView.cpp 29 Apr 2005 18:52:53 -0000 1.9 *************** *** 36,39 **** --- 36,40 ---- #include "tcSimState.h" #include "common/tcOptions.h" + #include "tcUserInfo.h" *************** *** 76,80 **** float y = (float)statusBoxBounds.y + 10.0f; ! DrawTextR("Connection Status", x, y, defaultFont.get(), color, 12.0f, CENTER_CENTER); --- 77,81 ---- float y = (float)statusBoxBounds.y + 10.0f; ! DrawTextR("Connection Status", x, y, defaultFont.get(), color, 14.0f, CENTER_CENTER); *************** *** 88,92 **** std::string connectionStatus = tcMultiplayerInterface::Get()->GetConnectionStatus(*iter); ! DrawTextR(connectionStatus.c_str(), x, y, defaultFont.get(), color, 12.0f, LEFT_CENTER); } --- 89,93 ---- std::string connectionStatus = tcMultiplayerInterface::Get()->GetConnectionStatus(*iter); ! DrawTextR(connectionStatus.c_str(), x, y, defaultFont.get(), color, 14.0f, LEFT_CENTER); } *************** *** 109,121 **** void tcNetworkView::JoinGame(wxCommandEvent& event) { ! if (networkMode != MULTIPLAYER_CLIENT) { ! chatBox->Print("Must be in client mode and connected to join game"); return; } ! ! if (tcMultiplayerInterface::Get()->GetNumConnections() == 0) { ! chatBox->Print("Must be connected to join game"); return; } --- 110,129 ---- void tcNetworkView::JoinGame(wxCommandEvent& event) { ! if (networkMode == MULTIPLAYER_OFF) { ! chatBox->Print("Must be in multiplayer mode to join game"); return; } ! else if (networkMode == MULTIPLAYER_CLIENT) { ! if (tcMultiplayerInterface::Get()->GetNumConnections() == 0) ! { ! chatBox->Print("Must connect first to join game"); ! return; ! } ! } ! else if (!tcSimState::Get()->IsScenarioLoaded()) ! { ! chatBox->Print("Server must load scenario before starting game"); return; } *************** *** 240,243 **** --- 248,253 ---- tcMultiplayerInterface::Get()->SetName(s); + tcUserInfo::Get()->SetUsername(s); + tcOptions::Get()->SetOptionString("UserName", s.c_str()); } *************** *** 313,319 **** if (!tcOptions::Get()->OptionStringExists("UserName")) { ! tcOptions::Get()->SetOptionString("UserName", "observer"); } ! usernameEdit->SetBuffer(tcOptions::Get()->GetOptionString("UserName")); // add password edit box --- 323,333 ---- if (!tcOptions::Get()->OptionStringExists("UserName")) { ! tcOptions::Get()->SetOptionString("UserName", "Observer"); } ! const std::string& username = tcOptions::Get()->GetOptionString("UserName"); ! usernameEdit->SetBuffer(username.c_str()); ! tcMultiplayerInterface::Get()->SetName(username); ! tcUserInfo::Get()->SetUsername(username); ! // add password edit box *************** *** 322,326 **** passwordEdit->SetCommand(4); passwordEdit->SetClearOnReturn(false); ! usernameEdit->SetBuffer(""); if (!tcOptions::Get()->OptionStringExists("HostAddress")) --- 336,340 ---- passwordEdit->SetCommand(4); passwordEdit->SetClearOnReturn(false); ! passwordEdit->SetBuffer(""); if (!tcOptions::Get()->OptionStringExists("HostAddress")) Index: tcConsoleBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcConsoleBox.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcConsoleBox.cpp 16 Apr 2005 20:44:42 -0000 1.13 --- tcConsoleBox.cpp 29 Apr 2005 18:52:53 -0000 1.14 *************** *** 33,36 **** --- 33,63 ---- #endif + + + /** + * Catch key events to scroll buffer + */ + void tcConsoleBox::OnKeyDown(wxKeyEvent& event) + { + int nChar = event.GetKeyCode(); + + // WXK_PRIOR is Page up + // WXK_NEXT is Page down + + if (nChar == WXK_NEXT) + { + ScrollBuffer(-SCROLL_LINES); + } + else if (nChar == WXK_PRIOR) + { + ScrollBuffer(SCROLL_LINES); + } + else + { + event.Skip(); + } + } + + void tcConsoleBox::OnSize(wxSizeEvent& event) { *************** *** 145,148 **** --- 172,184 ---- nLines = (size_t)cursorLine; } + + if (lineOffset + MIN_LINES_DISPLAY > nLines) + { + nLines = min(nLines, MIN_LINES_DISPLAY); + } + else + { + nLines -= lineOffset; + } for(size_t i=0;i<nLines;i++) *************** *** 160,164 **** } ! DrawTextR(line.c_str(), fontSize, float(y), defaultFont.get(), fontColor, fontSize, LEFT_BASE_LINE); } --- 196,200 ---- } ! DrawTextR(line.c_str(), 8.0f, float(y), defaultFont.get(), fontColor, fontSize, LEFT_BASE_LINE); } *************** *** 175,178 **** --- 211,218 ---- } + unsigned int tcConsoleBox::GetLineOffset() const + { + return lineOffset; + } void tcConsoleBox::InitFromXml(TiXmlNode* config) *************** *** 183,187 **** fontSize = 10.0f; fontColor.set(0.392f, 1.0f, 0.392f, 1.0f); ! nyzero = mnHeight - 20; return; } --- 223,227 ---- fontSize = 10.0f; fontColor.set(0.392f, 1.0f, 0.392f, 1.0f); ! nyzero = mnHeight - 10; return; } *************** *** 243,246 **** --- 283,309 ---- /** + * Scroll displayed lines of buffer history + */ + void tcConsoleBox::ScrollBuffer(int delta) + { + int offset = (int)lineOffset + delta; + if (offset < 0) + { + offset = 0; + } + else if (offset > (int)textArray.GetCount()) + { + offset = textArray.GetCount(); + } + SetLineOffset((unsigned int)offset); + } + + void tcConsoleBox::SetLineOffset(unsigned int offset) + { + lineOffset = offset; + ForceRedraw(); + } + + /** * Updates position of most recent text to draw. This is * used for the delayed draw effect. If this effect is not *************** *** 259,262 **** --- 322,334 ---- else { + /* if viewing buffer history (lineOffset > 0), adjust + ** lineOffset so that view doesn't change as new lines + ** are added */ + int newLines = (int)textArray.GetCount() - cursorLine; + if (lineOffset != 0) + { + lineOffset += newLines; + } + if ((cursorLine = (int)textArray.GetCount()) > 0) { *************** *** 313,317 **** isMouseOver(false), isFocused(false), ! drawBorder(true) { InitFromXml(config); --- 385,390 ---- isMouseOver(false), isFocused(false), ! drawBorder(true), ! lineOffset(0) { InitFromXml(config); Index: tcHookInfo.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcHookInfo.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcHookInfo.cpp 29 Mar 2005 00:12:26 -0000 1.9 --- tcHookInfo.cpp 29 Apr 2005 18:52:53 -0000 1.10 *************** *** 405,408 **** --- 405,430 ---- color.set(0.4f, 1.0f, 0.4f, 1.0f); + + // multiplayer info + if (mpSS->IsMultiplayerActive()) + { + const std::string& controller = pHookedObj->GetController(); + + if (controller.size()) + { + s = "Controlled by "; + s += controller; + } + else + { + s = "No controller"; + } + + DrawTextR(s.c_str(), ftextx, ftexty, defaultFont.get(), color, fontSize, LEFT_BASE_LINE); + ftexty += 15; + color.set(0.4f, 1.0f, 0.4f, 1.0f); + } + + // AI action text for platform objects tcPlatformObject* pPlatformObj = dynamic_cast<tcPlatformObject*>(pHookedObj); *************** *** 446,450 **** mpSS->GetPlatformState(mnHookID, pHookedObj); ! if ((pHookedObj != NULL) && (mpUserInfo->IsOwnAlliance(pHookedObj->mnAlliance))) { DrawOwn(pHookedObj); --- 468,472 ---- mpSS->GetPlatformState(mnHookID, pHookedObj); ! if ((pHookedObj != NULL) && (mpUserInfo->IsOwnAlliance(pHookedObj->GetAlliance()))) { DrawOwn(pHookedObj); Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcMapView.cpp 16 Apr 2005 20:44:42 -0000 1.23 --- tcMapView.cpp 29 Apr 2005 18:52:53 -0000 1.24 *************** *** 1885,1889 **** { wxString s = wxString::Format("%04d", pMO->mnID); ! DrawTextR(s.c_str(), x-9.0f, y+15.0f, defaultFont.get(), symbolColor, 8.0, LEFT_BASE_LINE); } --- 1885,1889 ---- { wxString s = wxString::Format("%04d", pMO->mnID); ! DrawTextR(s.c_str(), x-9.0f, y+15.0f, defaultFont.get(), symbolColor, 10.0, LEFT_BASE_LINE); } Index: tcGameView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcGameView.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcGameView.cpp 11 Mar 2005 02:34:57 -0000 1.7 --- tcGameView.cpp 29 Apr 2005 18:52:53 -0000 1.8 *************** *** 279,283 **** pSOI->droll = 0; ! bool useTrue = ((mpUserInfo->IsOwnAlliance(apGameObj->mnAlliance))||(mpOptions->mnViewMode < 2)); if (useTrue) pSOI->mpObj = apGameObj->mpDBObject->mp3DObj; --- 279,283 ---- pSOI->droll = 0; ! bool useTrue = ((mpUserInfo->IsOwnAlliance(apGameObj->GetAlliance()))||(mpOptions->mnViewMode < 2)); if (useTrue) pSOI->mpObj = apGameObj->mpDBObject->mp3DObj; *************** *** 504,508 **** } } ! else if ((pMissileObj != NULL)&&(pMissileObj->mnAlliance == nOwnAlliance)) { bShowTarget = mpSS->GetSeekerTrack(mnHookID,track) != 0; --- 504,508 ---- } } ! else if ((pMissileObj != NULL)&&(pMissileObj->GetAlliance() == nOwnAlliance)) { bShowTarget = mpSS->GetSeekerTrack(mnHookID,track) != 0; *************** *** 611,615 **** point.x = (float)po->mcKin.mfLon_rad; point.y = (float)po->mcKin.mfLat_rad; ! int bAllianceMatch = (po->mnAlliance == anAlliance); if (bAllianceMatch&&(mpMapView->PointInView(point))&&(rnIndex < MAXMAPOBJ)) --- 611,615 ---- point.x = (float)po->mcKin.mfLon_rad; point.y = (float)po->mcKin.mfLat_rad; ! int bAllianceMatch = (po->GetAlliance() == anAlliance); if (bAllianceMatch&&(mpMapView->PointInView(point))&&(rnIndex < MAXMAPOBJ)) Index: ObjectUpdater.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/ObjectUpdater.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ObjectUpdater.cpp 10 Mar 2005 03:28:28 -0000 1.15 --- ObjectUpdater.cpp 29 Apr 2005 18:52:53 -0000 1.16 *************** *** 257,261 **** if (gameObject) { ! if ((displayMode == 3) || simState->mpUserInfo->IsOwnAlliance(gameObject->mnAlliance)) { UpdateTrue(node); --- 257,261 ---- if (gameObject) { ! if ((displayMode == 3) || simState->mpUserInfo->IsOwnAlliance(gameObject->GetAlliance())) { UpdateTrue(node); Index: tcChatBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcChatBox.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcChatBox.cpp 16 Apr 2005 20:44:42 -0000 1.3 --- tcChatBox.cpp 29 Apr 2005 18:52:53 -0000 1.4 *************** *** 49,58 **** --- 49,72 ---- void tcChatBox::Draw() { + if (!IsBackgroundEnabled()) + { + DrawRectangle(0, 0, float(mnWidth), float(mnHeight), + osg::Vec4(0, 0, 0, 0.3f), FILL_ON); + } + DrawChildren(); + + FinishDraw(); } + void tcChatBox::OnChar(wxKeyEvent& event) + { + } + void tcChatBox::OnKeyDown(wxKeyEvent& event) + { + } *************** *** 97,101 **** - /** * @param surfaceHost tcWindow to share surface of --- 111,114 ---- *************** *** 107,111 **** { ! LoadBackgroundImage("background.jpg"); if (config) --- 120,124 ---- { ! //LoadBackgroundImage("background.jpg"); if (config) Index: tcEditBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcEditBox.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcEditBox.cpp 17 Apr 2005 22:35:31 -0000 1.11 --- tcEditBox.cpp 29 Apr 2005 18:52:53 -0000 1.12 *************** *** 168,171 **** --- 168,173 ---- { isMouseOver = true; + + SetFocus(); } Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tc3DViewer.cpp 25 Mar 2005 03:48:07 -0000 1.14 --- tc3DViewer.cpp 29 Apr 2005 18:52:53 -0000 1.15 *************** *** 1194,1198 **** tcSensorMap* sensorMap = simState->GetSensorMap(); unsigned int ownAlliance = simState->mpUserInfo->GetOwnAlliance(); ! if (ownAlliance == obj->mnAlliance) { x = LonToX(obj->mcKin.mfLon_rad); --- 1194,1198 ---- tcSensorMap* sensorMap = simState->GetSensorMap(); unsigned int ownAlliance = simState->mpUserInfo->GetOwnAlliance(); ! if (ownAlliance == obj->GetAlliance()) { x = LonToX(obj->mcKin.mfLon_rad); |