Code archives/Graphics/Smart ScreenShot Taker

This code has been declared by its author to be Public Domain code.

Download source code

Smart ScreenShot Taker by jackzip8
(Posted 23 years ago)
The function will take a screenshot and remember the last
screenshot taken through that of a data file which the
function creates to obtain the last screenshot taken!
You can also specify a directory where you want the screenshots to be put at as well. This function is very useful for any application where you might need to take screenshots on a regular basis and don't wont to lose existing screenshots! I hope you find this code useful like i have.
Global Int1%	;For writing to our '.egl' datafile

;hit spacebar to save a screenshot
If KeyHit(57) = True Then Screenshot()


Function Screenshot()

	ChangeDir "E:\Blitz3D\Blitz3D Demos\fpstest\egyptian level\ScreenShots"
	
			screenin = ReadFile("screenshot.egl") ; you can change the extension to whatever you want!
			If screenin = 0 Then currentshot = 0:Goto phase2
			currentshot = ReadInt( screenin )
				  CloseFile( screenin )
	
.phase2		iFileNumber% = currentshot
	    Repeat
	        iFileNumber = iFileNumber + 1
	        sFileName$ = "Egyptian_Level" + String$("0", 3 - Len(Str$(iFileNumber))) + iFileNumber + ".bmp"
	    Until Not(FileType(sFileName))

	Int1 = iFileNumber	
		
			screenout = WriteFile("screenshot.egl") ; Same as above!
			WriteInt( screenout, Int1 )
			  	  CloseFile( screenout )
    
    SaveBuffer FrontBuffer(), sFileName

	ChangeDir "E:\Blitz3D\Blitz3D Demos\fpstest\egyptian level" ; Change back to previous directory

End Function