1 registered members (AndrewAMD),
972
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Screenshots to Panels
[Re: 2teach]
#449447
03/20/15 21:18
03/20/15 21:18
|
Malice
Unregistered
|
Malice
Unregistered
|
create a panel
PANEL pan_conner = {
.... }
In the main function set the panel to no show(OR never set it to show in the define creation)
pan_conner ->flags &= SHOW;
**now write a function to show it.
function show_pan {
// use a key lock with this if(key_x ) { pan_conner->bmap= "name_of_screen_shot.bmp" pan_conner->scale_x = 0.25; pan_conner->scale_y = 0.25; ... adjust loctaion if need to ... pan_conner->flags |= SHOW; } }
Something like that should do it..
|
|
|
Re: Screenshots to Panels
[Re: alibaba]
#449449
03/20/15 22:57
03/20/15 22:57
|
Malice
Unregistered
|
Malice
Unregistered
|
scale down the image, and have it appear at the lower left corner of the screen. @alibaba He'll need to scale the panel down as well... testPan.scale_x and testPan.scale_y also for the panel to apper lower left, he'll need to find the width and height of the bmap and screen.size_x_y and the correct placement of the panel in the shot() function. testPan.pos_x = (screen_size.x-bmap_width(testPan.bmap))/4; tesPan.pos_y = (screen_size.y - bmap_height(testPan.bmap))/4; EDIT*** better for scaled panel use testPan.pos_x = (screen_size.x - testPan.size_x)/4; I can't test, I have no SED lol
Last edited by Malice; 03/20/15 23:07.
|
|
|
Re: Screenshots to Panels
[Re: 2teach]
#449451
03/20/15 23:37
03/20/15 23:37
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
Serious User
|
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
This is just compilation of the above help.
//panel that will hold the bmap
PANEL* testPan {};
//the function that does your task
void shot()
{
//Create a bmap at runtime
BMAP* testB=bmap_createblack(screen_size.x,screen_size.y,32);
//Get the screenshot and
bmap_for_screen(testB,0,1);
//use the just created bmap as the 'bmap' source
testPan.bmap=testB;
//Make the panel visible
set(testPan,SHOW);
//while the scale size is greater than 0.25 (25%)
while(testPan.size_x > 0.25){wait(1);//always wait 1 frame each cycle
//change to a higher number 0.5 for a faster scale time
testPan.size_x -= 0.05 * time_step;
// Keep the panel aligned while scaling
testPan.pos_x = (screen_size.x - testPan.size_x)/4;
testPan.pos_y = (screen_size.y - testPan.size_y)/4;
}
}
//In the function main
function main(){
//infinitely
while(1){wait(1);
if(key_x) shot();//update the corner image with the x key
}
}
of coarse the code i've lumped together is untested and based off the answers above.
Last edited by DLively; 03/20/15 23:46.
|
|
|
Re: Screenshots to Panels
[Re: DLively]
#449457
03/21/15 01:01
03/21/15 01:01
|
Joined: Mar 2015
Posts: 8
2teach
OP
Newbie
|
OP
Newbie
Joined: Mar 2015
Posts: 8
|
Many thanks to DLively, Malice, and alibaba, we're almost there. The code is now capturing and showing the screen shot, but isn't scaling it (and may not be placing it in the lower left corner--I can't tell because the screenshot occupies the whole screen). Here's the current code--please let me know what I'm missing.
PANEL* testPan = {}
void shot() { BMAP* testB=bmap_createblack(screen_size.x,screen_size.y,32); bmap_for_screen(testB,0,1); testPan.bmap=testB; set(testPan,SHOW); while (testPan.size_x > 0.25) { wait(1); testPan.size_x -=0.05*time_step; testPan.pos_x = (screen_size.x - testPan.size_x)/4; testPan.pos_y = (screen_size.y - testPan.size_y)/4; } }
function main() { video_mode = 8; fps_max = 60; level_load("Level1.wmb"); def_move(); mtl_hdr.skill3 = floatv(50); pp_set(NULL,mtl_hdr); while(1) { wait (1); if(key_x) shot(); }
}
|
|
|
Re: Screenshots to Panels
[Re: 2teach]
#449458
03/21/15 01:04
03/21/15 01:04
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
Serious User
|
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
replace while (testPan.size_x > 0.25) { wait(1); testPan.size_x -=0.05*time_step; with while (testPan.scale_x > 0.25) { wait(1); testPan.scale_x -=0.05*time_step; Edit: Woops
Last edited by DLively; 03/21/15 01:05.
|
|
|
Re: Screenshots to Panels
[Re: 2teach]
#449460
03/21/15 03:06
03/21/15 03:06
|
Malice
Unregistered
|
Malice
Unregistered
|
@2teach - you want to spend a lot of time looking here... http://www.opserver.de/coni_users/web_users/pirvu/aum/aumonline_e/index.html@Dlively Why only scale the x not the y also? And you shouldn't use hard coded values.
//while the scale size is greater than 0.25 (25%)
while(testPan.scale_x > 0.25){
//change to a higher number 0.5 for a faster scale time
testPan.scale_x -= 0.05 * time_step;
testPan.scale_y -= 0.05 * time_step;
// Keep the panel aligned while scaling
testPan.pos_x = (screen_size.x - testPan.size_x)/4;
testPan.pos_y = (screen_size.y - testPan.size_y)/4;
wait(1);//always wait 1 frame each cycle
}
Also you should use this key check lock system..
//In the function main
function main(){
int int_key_x_lock = 0;
//infinitely
while(1){
////The lock will makes sure you get one screen shot per key press only
if(key_x != 1 && int_key_x_lock == 1)
int_key_x_lock =0;
if(key_x && int_key_x_lock == 0)
{
int_key_x_lock =1;
shot();//update the corner image with the x key
}
wait(1); }
}
*** Final edit made
Last edited by Malice; 03/21/15 03:25.
|
|
|
|