Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[CS:DE] Take Screenshot / Snapshot of game


Slasheree
 Share

Recommended Posts

With this tutorial I'll show you the way I found to take screenshots of your game, this source with some modifications will surely work with any other version of Eclipse.

First let's start by going to where the engine handles when a key goes up (HandleKeyUp in CS:DE)

Add below If Not chatOn Then

```

If keyCode = vbKeySnapshot Then

TakeScreenShot

End If

```

Then in the form where the graphics are processed (frmMain in CS:DE) add a picturebox of any size (I made small) and name it Picture1

Then in the Form_Load() add this anywhere in it:

```

Picture1.height = 600

Picture1.Width = 800

Picture1.top = 0

Picture1.left = 0

```

Then we will add the function to actually take the screenshot, go to modDirectX8 and add in the bottom

```

Public Function TakeScreenShot()

Dim filename As String

Dim i As Long

Dim imX As Long

Dim imY As Long

'align form, because it gets the screenshot wrong in some positions...

With frmMain

.top = (Screen.height - .height) / 2

.left = (Screen.Width - .Width) / 2

End With

'check for a "free" name

Do

i = i + 1

filename = App.path & "\screenshot_" & Format(i, "0000") & ".bmp"

Loop Until Len(dir(filename)) = 0

'take and save uncropped screenshot

keybd_event vbKeySnapshot, 0, 0, 0 'will pretend you pressed the Print Screen button

DoEvents

SavePicture Clipboard.GetData(vbCFBitmap), filename

DoEvents

'load and edit the screenshot (crop)

imX = (((Screen.Width + frmMain.left) - Screen.Width) / 15) + 3

imY = (((Screen.height + frmMain.top) - Screen.height) / 15) + 25

frmMain.Picture1.PaintPicture LoadPicture(filename), 0, 0, 800, 600, imX, imY, 800, 600

'save screenshot cropped

Kill filename

SavePicture frmMain.Picture1.Image, filename

DoEvents

'send message so they know it worked

AddText "Screenshot saved [" & Right$(filename, 16) & "]", BrightBlue

End Function

```

And I guess we are done ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)

I hope this works for you, if it doesn't maybe it's because I edited the engine too much, but here is some important information

1- in imY = (((Screen.height + frmMain.top) - Screen.height) / 15) + 25 I divided by 15 because of a conversion needed for the twips and added 25 because it's the thickness of the part of the form that has the name and minimize maximize and close buttons, this might mess up the screenshot for people with a dpi different from 100% (96dpi I think)

2- I still haven't fully tested this with other monitor resolutions, gotta free up some space in my desktop to change and test, or maybe you could give me some feedback on what happens to you ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)

[EDIT] Forgot to say that to take a screenshot you use the Print Screen button ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...