Using GrabImage() to grab game screen
Monkey Forums/Monkey Programming/Using GrabImage() to grab game screen| 
 | ||
| Could somebody explain to me how to use mojo's grabimage to grab the game's screen? I need it for my pause screen and I cant seem to get it to work :P kinda wish it functioned like the grabimage in BMax | 
| 
 | ||
| Doesn't work like that. You gotta use ReadPixels. | 
| 
 | ||
| As what Nobuyuki has said, you have to use ReadPixels if you want to capture an image on the game screen. The grabimage is used to grab an image from a spritesheet. | 
| 
 | ||
| You can use this function: .... MyImage:Image=ScreenGrab(40,40,200,300) ..... Function ScreenGrab:Image(X%,Y%,Width%,Height%) If X<0 Error "Screen Grab Error" If Y<0 Error "Screen Grab Error" If (X+Width)>DeviceWidth() Error "Screen Grab Error" If (Y+Height)>DeviceHeight() Error "Screen Grab Error" PushMatrix SetMatrix 1,0,0,1,0,0 Local ScreenShot:Image ScreenShot = CreateImage(Width,Height) Local pixels:Int[] =New Int[Width*Height] ReadPixels(pixels, X, Y, Width,Height) ScreenShot.WritePixels(pixels, 0, 0, Width,Height) Return ScreenShot PopMatrix End | 
| 
 | ||
| @midimaster yeah, I found your code elsewhere in the forums and put it to good use. to you, and everyone else in this topic: thanks for your help :) |