Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Quad, M_D), 1,217 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Screenshots to Panels #449444
03/20/15 20:17
03/20/15 20:17
Joined: Mar 2015
Posts: 8
2
2teach Offline OP
Newbie
2teach  Offline OP
Newbie
2

Joined: Mar 2015
Posts: 8
Using Lite C, I need to take a screenshot (as is done by tapping F6), scale down the image, and have it appear at the lower left corner of the screen. I've tried several times using "bmap_for_entity" and "bmap_for_screen" but apparently haven't gotten the combination right. (A noobie? You guessed it. One who would be very grateful for some successful snippets.)

Re: Screenshots to Panels [Re: 2teach] #449447
03/20/15 21:18
03/20/15 21:18

M
Malice
Unregistered
Malice
Unregistered
M



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: ] #449448
03/20/15 22:08
03/20/15 22:08
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline
Expert
alibaba  Offline
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
Something like this (untested):

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);
}


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: Screenshots to Panels [Re: alibaba] #449449
03/20/15 22:57
03/20/15 22:57

M
Malice
Unregistered
Malice
Unregistered
M



Quote:
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: ] #449450
03/20/15 23:15
03/20/15 23:15
Joined: Mar 2015
Posts: 8
2
2teach Offline OP
Newbie
2teach  Offline OP
Newbie
2

Joined: Mar 2015
Posts: 8
It's great to hear from two pros. Got to confess I'm not familiar with the "void shot()" code and am not sure where it or the following code goes. Do I put the BMAP lines in a function? What code tells the program to capture the screenshot that we'll put into testPan? Thanks very much for your help and your patience.

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 Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
This is just compilation of the above help.

Code:
//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.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Screenshots to Panels [Re: DLively] #449457
03/21/15 01:01
03/21/15 01:01
Joined: Mar 2015
Posts: 8
2
2teach Offline OP
Newbie
2teach  Offline OP
Newbie
2

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 Offline
Serious User
DLively  Offline
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 laugh

Last edited by DLively; 03/21/15 01:05.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Screenshots to Panels [Re: DLively] #449459
03/21/15 01:37
03/21/15 01:37
Joined: Mar 2015
Posts: 8
2
2teach Offline OP
Newbie
2teach  Offline OP
Newbie
2

Joined: Mar 2015
Posts: 8
That did it! I'm a first-time forum user after more years than I'll admit. Dlively, alibaba, and Malice have made me a believer. Hope to return the favor some day.

Re: Screenshots to Panels [Re: 2teach] #449460
03/21/15 03:06
03/21/15 03:06

M
Malice
Unregistered
Malice
Unregistered
M



@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.
Code:
//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..
Code:
//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.
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1