GML Create screenshot/sprite from view

S

Schakal

Guest
Hallo everybody,

i have problems with views and taking screenshots/sprites.
i use the extension perfect-fit-mobile-template from the marketplace. that means on mobile phones i use a view from the most space of the room on the whole display.

on windows without the the extension i can use
Code:
w = surface_get_width(application_surface);
h = surface_get_height(application_surface);

tempsurf = surface_create(w,h);
surface_set_target(tempsurf);

draw_clear(c_black);
draw_set_colour_write_enable(true,true,true,false);
draw_enable_alphablend(false);
draw_surface(application_surface,0,0);
draw_set_colour_write_enable(true,true,true,true);
draw_enable_alphablend(true);
surface_reset_target();

spriteExplodeBG = sprite_create_from_surface(tempsurf, 0, 0, w, h, false, false, 0, 0);;
surface_free(tempsurf);
(I founded this code snippet in the past)

screen_save() is not fast enough for my situation

but i dont know how i get this with a view working :( i get only streched pictures...
Can somebody help me?

Thanks :)
 
Last edited by a moderator:

RangerX

Member
You can't.
There's "screen_save()" and then there's "sprite_create_from_surface()". I don't know of any other capture functions.
I guess you'll have to search for an add on or something.
 
S

Schakal

Guest
yes i guess too... my solution for now is create a surface screenshot and "scale" it on every use.
short discription of my problem and workarround:
i use perfect-fit-mobile-template and the sprite-exploder extension from the market.

i want that the sprite-exploder use a current take screen shot and let it explode before leaving a room.
but the surface screenshot ist streched because the perfect-fit-mobile-template view is working.
(i use landscape mode for my game, so the view cut the upper und lower area from the room)

my only solution is the scale the exploding sprites. not the the particle higth, but the "copy area" from the streched screenshot.

in obj_dissolve_particle.draw_event

Code:
global.screenshot_y_scale = global.viewport_heigth /  room_height
// Draw the sprite
draw_sprite_general(spr_screenshot, -1, xx  , yy / global.screenshot_y_scale, size , size, x, y, scale , scale , rotation, c_white, c_white, c_white, c_white, alpha);
 
Top