Qbound Posted December 6, 2009 Share Posted December 6, 2009 Hi Werker's, if you want to take screenshots you can use the SaveBuffer() function on the Backbuffer(), thats an easy way. But what about the naming? My Game NightFist is slowly growing and i want to document my progress with screenshots. Therefore i took a few minutes to find an easy solution to create good names. Here is my way #include <time.h> #include <string> // Take Screenshot? if( KeyHit( KEY_F12 ) ) { // // Create the name and save it (using the format 'NightFist_2009_12_06-13_59_42.jpg' // // Variablen init time_t mTime = time( NULL ); // Time tm *mDate = localtime( &mTime ); // DateTime Structure char cBuf[40]; // copy Buffer // Now Create the TimeStamp for the file sprintf( cBuf, "%4d_%2d_%2d-%2d_%2d_%2d", mDate->tm_year + 1900, mDate->tm_mon + 1, mDate->tm_mday, mDate->tm_hour, mDate->tm_min, mDate->tm_sec ); // Start with the Prefix std::string strName = "NightFist_"; // Then the Timestamp strName += cBuf; // and the ending strName += ".jpg"; // Save Buffer SaveBuffer( BackBuffer(), (str)strName.c_str(), 85 ); } have fun and let us see your screenshots cu Oliver 1 Quote Windows Vista 64 / Win7 64 | 12GB DDR3 1600 | I7 965 | 2 * 280GTX sli | 2 * 300GB Raptor | 2 * 1.5TB Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 6, 2009 Share Posted December 6, 2009 This looks very good! I have an error though: it says that 'string' is an undeclared identifier, which is weird because it's a data type. Quote Link to comment Share on other sites More sharing options...
Qbound Posted December 6, 2009 Author Share Posted December 6, 2009 Ah thanks for the tipp Aggror, there is the string include and the namespace missing. i have updated the code. this should work. cu Oliver Quote Windows Vista 64 / Win7 64 | 12GB DDR3 1600 | I7 965 | 2 * 280GTX sli | 2 * 300GB Raptor | 2 * 1.5TB Link to comment Share on other sites More sharing options...
darrenc182 Posted December 8, 2009 Share Posted December 8, 2009 This looks very good! I have an error though: it says that 'string' is an undeclared identifier, which is weird because it's a data type. It's probably because you haven't included using std namespace; before using the string data type, or you should use std::string in place of string. Either option will get you the same results, but the latter does not require using std namespace be defined first. Quote Intel 2nd Generation i5 Quad Core Running at 3.30GHz. 8GB RAM, GeForce GTX 460 1024MB DDR5. Link to comment Share on other sites More sharing options...
Umnik Posted December 22, 2009 Share Posted December 22, 2009 Who buffer save if i use a Framewerk.h? SaveBuffer( buffer, (str)strName.c_str(), 99 ); I obtained only black images Quote Windows 7 Ultimate x64bit / Intel Core 2 Quad Q8400 / 4GB DDR2 SDRAM / GeForce 8800 GTS Resource War Developer [ dev blog ] Link to comment Share on other sites More sharing options...
Canardia Posted December 22, 2009 Share Posted December 22, 2009 You need to get ColorBuffer(buffer,0) of the buffer. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Umnik Posted December 23, 2009 Share Posted December 23, 2009 You need to get ColorBuffer(buffer,0) of the buffer. I'm use: SaveBuffer( CurrentBuffer(), (str)strName.c_str(), 99 ); Quote Windows 7 Ultimate x64bit / Intel Core 2 Quad Q8400 / 4GB DDR2 SDRAM / GeForce 8800 GTS Resource War Developer [ dev blog ] Link to comment Share on other sites More sharing options...
Canardia Posted December 24, 2009 Share Posted December 24, 2009 There is no command called CurrentBuffer(), I think you meant BackBuffer(). Then your command should be: SaveBuffer( GetColorBuffer(BackBuffer(),0), (str)strName.c_str(), 99 ); 1 Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Umnik Posted December 24, 2009 Share Posted December 24, 2009 There is no command called CurrentBuffer(), I think you meant BackBuffer(). Ok, Thanks! Quote Windows 7 Ultimate x64bit / Intel Core 2 Quad Q8400 / 4GB DDR2 SDRAM / GeForce 8800 GTS Resource War Developer [ dev blog ] Link to comment Share on other sites More sharing options...
darrenc182 Posted December 29, 2009 Share Posted December 29, 2009 I had something similar to this working in earlier version of LE, but now all I get is a black image. Here is some code: SaveBuffer(BackBuffer(),filename, 100); strcpy(g_strScreenshot, filename); g_bScreenshotMsg = true; sprintf(temp, "Saved screenshot as: %s", g_strScreenshot); AppLog(temp, 0); done=true; I am using Framewerk and LE 2.28, do I need to pass a buffer from Framewerk or is using BackBuffer still fine? Quote Intel 2nd Generation i5 Quad Core Running at 3.30GHz. 8GB RAM, GeForce GTX 460 1024MB DDR5. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.