From: <de...@pr...> - 2004-01-28 13:33:12
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18691 Modified Files: GameScreen.cpp Log Message: see CHANGES.current Index: GameScreen.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Source/GameScreen.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** GameScreen.cpp 27 Jan 2004 20:54:26 -0000 1.30 --- GameScreen.cpp 28 Jan 2004 13:31:54 -0000 1.31 *************** *** 26,29 **** --- 26,32 ---- #include "GameScreen.h" + #include <ctime> + #include <iomanip> + #include <osg/Image> #include <osgDB/WriteFile> *************** *** 137,140 **** --- 140,156 ---- std::string m_Filename, m_Ext; bool m_SnapImageOnNextFrame; + std::string buildSuffix() { + time_t timer; + time(&timer); + tm* time_ptr = localtime(&timer); + std::ostringstream os; + os.fill( '0' ); + os << std::setw(2) << time_ptr->tm_mon + 1 << std::setw(2) << time_ptr->tm_mday << std::setw(2) << time_ptr->tm_year - 100; + std::string day = os.str(); + os.str(""); + os << std::setw(2) << time_ptr->tm_hour << std::setw(2) << time_ptr->tm_min << std::setw(2) << time_ptr->tm_sec; + std::string hour = os.str(); + return day + '-' + hour; + } public: SnapImageDrawCallback(const std::string& filename = "CSPScreen",const std::string& ext = ".bmp"): *************** *** 149,162 **** return m_SnapImageOnNextFrame; } - std::string buildSuffix() { - char tmp_char[128]; - _strdate(tmp_char); - std::string day = tmp_char; - day.erase(std::remove(day.begin(),day.end(),'/'),day.end()); - _strtime(tmp_char); - std::string hour = tmp_char; - hour.erase(std::remove(hour.begin(),hour.end(),':'),hour.end()); - return day + '-' + hour; - } virtual void operator()(const Producer::Camera& camera) { if (m_SnapImageOnNextFrame) { --- 165,168 ---- *************** *** 178,181 **** --- 184,188 ---- void GameScreen::on_PrintScreen() { + // for now, it is on previous frame ... but that should work. SnapImageDrawCallback sn; sn.setSnapImageOnNextFrame(true); *************** *** 360,364 **** simdata::Vector3 upVec = dynamic->getUpDirection(); simdata::Vector3 objectDir = dynamic->getDirection(); ! double speed_level = dynamic->getSpeed()/50.0; camPos = objectPos + 900.0* objectDir + ( 12.0 - (rand() % 5) ) * (objectDir^upVec) + ( 6.0 + (rand () % 3) ) * upVec; --- 367,371 ---- simdata::Vector3 upVec = dynamic->getUpDirection(); simdata::Vector3 objectDir = dynamic->getDirection(); ! //double speed_level = dynamic->getSpeed()/50.0; camPos = objectPos + 900.0* objectDir + ( 12.0 - (rand() % 5) ) * (objectDir^upVec) + ( 6.0 + (rand () % 3) ) * upVec; |