Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Question about dbGetImage, or print screen

Author
Message
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 19th Jun 2008 05:29
I have heard in another thread that another way of doing print screen was dbGetImage. I tried to get it working, but I couldn't....

I want to have a way where you press P and it takes a picture of the screen, then it saves it. Is dbGetImage the way to go?

Thanks.

Your signature has been erased by a mod - 120 high maximum please
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 19th Jun 2008 12:39
Sure, I use something like:



choose a free image number. The name extension gives the format. It can be also 'jpg', but I don't know how to specify the jpg quality output (that is set rather low).
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 19th Jun 2008 14:41
OK, thanks, I think that explains it all.

Your signature has been erased by a mod - 120 high maximum please
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 19th Jun 2008 14:51 Edited at: 19th Jun 2008 14:53
Now it still doesn't work...

Am I doing something wrong? All I have is


That is it for the taking a picture code. Should it be in the mainloop? Out of the mainloop?

[edit] Sorry about the terrible picture I didn't realize it was that bad quality....

Your signature has been erased by a mod - 120 high maximum please

Attachments

Login to view attachments
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 19th Jun 2008 16:50
That looks like something doesn't work, lol
I think some previous action has caused this violation, try with a different image number...
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 19th Jun 2008 21:47
Uh, you should do something to see if P was down the last frame, you might be overloading the processor or something by doing that.

If you can do any models for FW, reply to the FleetWars thread.

Click here!
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 20th Jun 2008 02:47
Yeah, I tried changing the id number, but I still get this error-

Unhandled exception at 0x00b9ebdf in Physics.exe: 0xC0000005: Access violation reading location 0x00000000.

Does anyone have one that works? Like it takes a picture?

Thanks.

Your signature has been erased by a mod - 120 high maximum please
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 21st Jun 2008 05:13
comment out the picture-taking code, see if a violation still exists.

and give us the relevant code surrounding it, please.
waka324
16
Years of Service
User Offline
Joined: 31st Mar 2008
Location:
Posted: 21st Jun 2008 08:11
dbGetImage() does NOT work with sprites... just a heads up!
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 21st Jun 2008 08:27
sounds like you'll have to convert all sprites to bitmaps and paste accordingly.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 21st Jun 2008 12:38
Sprites can be get, I read from IanM:

Quote: "If you have backsave on then you can't capture sprites. If you don't, you can."




So it is about setting 2nd parameter to 0 for sprites, and then after getting the image, it can be turned on again.
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 21st Jun 2008 17:56


This isn't exactly what I am doing, but it is practically the same. I can't give you the other code because it is pretty long and I don't want people to steal it, not that I am saying you will steal it, but there are people.

Does it work with 3D objects? maybe that is the problem. I don't really know.

Thanks.

Your signature has been erased by a mod - 120 high maximum please
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 21st Jun 2008 20:32
hm... It does seem like it wouldn't work with 3D objects, it might be too much to process......

Your signature has been erased by a mod - 120 high maximum please
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 22nd Jun 2008 06:48
The code snippet by Morcilla looks to work fine for me.
Quote: "dbGetImage(image_number,0,0,dbScreenWidth(),dbScreenHeight(),1);
dbSaveImage("my_filename.bmp",image_number,0);
dbDeleteImage(image_number);"




Quote: "Now it still doesn't work..."

I suspect you are looping through your capture code at your screen display rate, trying to make 60+ captures per second, because your program is seeing the key pressed through every game loop and therefore overloading your system.

Make sure that you can only get one screen capture happening per key press (use key press flags of whatever sort you like to do this).
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 22nd Jun 2008 10:07
I'm working on a personal library and wrote this function today:



it only returns true on a single click. perhaps you can adapt it for your own needs?
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 22nd Jun 2008 11:56
programing maniac, two things:
1.- You forgot the file name extension: .jpg or .bmp
2.- The last dbGetImage parameter ",1" is also missing.

No problems with this so far:



(Repeated keys just will take the pic several times)
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 22nd Jun 2008 18:03
Thanks, I think I got it working! At least it doesn't have that error anymore when I press spacebar.

Quote: "programing maniac, two things:
1.- You forgot the file name extension: .jpg or .bmp
2.- The last dbGetImage parameter ",1" is also missing."


I think that was the problem, seems like something I would do.

My next problem is where does it get saved? I looked everywhere for the file, but I couldn't find it.....

Once again, thanks to all!

Your signature has been erased by a mod - 120 high maximum please
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 22nd Jun 2008 21:48
Does it even save it? I tried a search, and I still couldn't find it..... I can find almost anything when I do a search of my computer.....

Your signature has been erased by a mod - 120 high maximum please
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 22nd Jun 2008 23:21
try the project directory?
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 22nd Jun 2008 23:55
I did, and i can't find it....

[edit] Woops, I have been using the wrong key..... It still gives me the same error!!!

Even when I do this-


which makes it so that it doesn't over load- I still get this-



I don't know why!!! From what everyone has said, it should work.

Your signature has been erased by a mod - 120 high maximum please

Login to post a reply

Server time is: 2024-09-30 01:24:51
Your offset time is: 2024-09-30 01:24:51