Capturing screen image and saving to bitmap.

Posted By: SirCamaris

Capturing screen image and saving to bitmap. - 11/11/08 22:23

I'm trying to capture a screen image and save it as a bitmap in the game folder, but it doesn't work. The goal is to create a bitmap called "result.bmp" Here is my code:

BMAP* screen_shot_map = "#400x300x16"; //create temporary bitmap

function grab_screen()

{bmap_for_screen(screen_shot_map,1,0); //get screen image
if (key_p == 1)
bmap_save(screen_shot_map,"result.bmp"); //place screen image into "result.bmp" after pressing key_p
}

function main()

{video_mode = 7;
level_load("BrooklynApartments.wmb");
wait(3);
grab_screen();
}
Posted By: flutschi

Re: Capturing screen image and saving to bitmap. - 11/11/08 23:09

Hmm, in der Hilfe steht..

"Nur 16-Bit-Bitmaps von PCX oder BMP Bilddateien können verwendet werden. Die modifizierte Bitmap wird mit game_save gesichert, ist aber frühestens einen Framezyklus nach der bmap_for_screen-Anweisung verfügbar (fügen Sie wait(1) ein). "

"depth -
Farbtiefe 0 keine Änderung
16 16 bit / high color
32 32 bit / true color
"

Nun die Frage:

Hast du standart 32 Bit? dann wird das GameStudio wohl übernehmen und dadurch hast du nicht die bedingungen für bmap_for_screen erfüllt, die da währen "nur 16-Bit..."

und da steht noch "... füge ein Wait(1) ein.. " was ich bei dir auch nicht sehe.. smile


Ich hab noch nie mit screenshots gearbeitet, aber so wie's in der Hilfe steht würde das zu deinem Problem passen..

Hoffe hat dir geholfen!


PS: ich arbeite in der Main mit ON_P = grab_screen();.. ich habs so in nem Tutorial gelernt, und nu frage ich mich was besser ist? deine Version oder meine?
Posted By: SirCamaris

Re: Capturing screen image and saving to bitmap. - 11/12/08 01:10

Pressing F6 will take a screenshot(@ set resolution) and place it in the folder containing the .wmb. "file_for_screen and SAVEDIR" are two other commands mentioned in the acknex manual for saving screen shots(although I haven't been able to implement them yet).
© 2023 lite-C Forums