|
Re: set BMAP by function
[Re: XD1v0]
#263178
04/28/09 07:26
04/28/09 07:26
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
This (untested) SHOULD work fine. function create_my_bmap (BMAP* this)
{
BMAP* fb = bmap_createblack(256,256,24);
BMAP* this;
wait(1);
// do something with fb
...
//
wait(1);
this = fb;
BMAP* that = fb;
//is now done! both "this" and "that" and "fb" are ALL pointing at SAME bmap.
}
But I would try to avoid this type of programming, its going to be very easy to end up with "invalid pointer" errors.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: set BMAP by function
[Re: Spirit]
#263187
04/28/09 08:24
04/28/09 08:24
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Oh crud! Sorry, Ignore my previous post. I didnt notice that "this" was arriving as a parameter....
Spirits first looks good to me... The second one will only work if there is NO waits in there. And I believe XD1v0 needed them in there.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: set BMAP by function
[Re: EvilSOB]
#263189
04/28/09 08:38
04/28/09 08:38
|
Joined: Jun 2008
Posts: 151 Ukraine
XD1v0
OP
Member
|
OP
Member
Joined: Jun 2008
Posts: 151
Ukraine
|
The second one will only work if there is NO waits in there. And I believe XD1v0 needed them in there. You understand rightly, i need use wait in function. I want do something like this.
#include <acknex.h>
#include <default.c>
PANEL* cool_pan =
{
scale_x = 0.5; scale_y = 0.5;
flags = SHOW;
}
function create_screen_bmap (BMAP* this,VECTOR* pos,VECTOR* aang)
{
BMAP* fb = bmap_createblack(screen_size.x,screen_size.y,24);
vec_set(camera.x,pos);vec_set(camera.pan,aang);
wait(1);// render screen in new position and angle
bmap_for_screen(fb,0,1);
this = fb;
}
void main ()
{
level_load(0);ent_create("sphere.mdl",nullvector,NULL);
create_screen_bmap(cool_pan.bmap,vector(-50,0,0),nullvector);beep();
// I want render screen into panel.bmap, but this dont work
}
Last edited by XD1v0; 04/28/09 08:40.
A7 Commercial Celeron 1700, GeForce 5500 FX 256mb, 1 Gb Ram
|
|
|
Re: set BMAP by function
[Re: XD1v0]
#263247
04/28/09 16:19
04/28/09 16:19
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
Expert
|
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
BMAP* fb = bmap_createblack(screen_size.x,screen_size.y,24); var vHandle; vHandle = handle(fb); // put waits in here until you are fine  fb = ptr_for_handle(vHandle); bmap_for_screen(fb,0,1);
no science involved
|
|
|
Re: set BMAP by function
[Re: XD1v0]
#263315
04/29/09 02:30
04/29/09 02:30
|
Joined: Jul 2008
Posts: 553 Singapore
delinkx
User
|
User
Joined: Jul 2008
Posts: 553
Singapore
|
i managed to get the screen capture but the black bitmap is overlaying the bitmap. see image below:
#include <acknex.h>
#include <default.c>
BMAP* panel_created;
PANEL* cool_pan =
{
scale_x = 0.5; scale_y = 0.5;
//bmap = temp_bmap;
flags = SHOW;
alpha = 100;
}
function create_screen_bmap (VECTOR* pos,VECTOR* aang)
{
panel_created = bmap_createblack(screen_size.x,screen_size.y,24);
//vec_set(camera.x,pos);
//vec_set(camera.pan,aang);
wait(1);// render screen in new position and angle
bmap_for_screen(panel_created,0,1);
wait(1);
//this = fb;
//panel_created = fb;
}
void main ()
{
level_load("arena.wmb");
wait(2);
create_screen_bmap(vector(0,0,0),nullvector);
cool_pan->bmap = panel_created;
cool_pan->flags = SHOW;
wait(1);
beep();
// I want render screen into panel.bmap, but this dont work
}
|
|
|
Re: set BMAP by function
[Re: delinkx]
#263354
04/29/09 08:38
04/29/09 08:38
|
Joined: Jul 2008
Posts: 553 Singapore
delinkx
User
|
User
Joined: Jul 2008
Posts: 553
Singapore
|
ok FIXED.. a wait(1) was missing to update the bitmap. here is the (tested) code:
#include <acknex.h>
#include <default.c>
BMAP* panel_created;
PANEL* cool_pan =
{
scale_x = 0.5; scale_y = 0.5;
flags = SHOW;
alpha = 100;
}
function create_screen_bmap (VECTOR* pos,VECTOR* aang)
{
panel_created = bmap_createblack(screen_size.x,screen_size.y,24);
vec_set(camera.x,pos);
vec_set(camera.pan,aang);
wait(1);// render screen in new position and angle
bmap_for_screen(panel_created,0,1);
wait(1);
}
void main ()
{
level_load("arena.wmb");
wait(2);
create_screen_bmap(vector(0,0,0),nullvector);
wait(1);
cool_pan->bmap = panel_created;
cool_pan->flags = SHOW;
wait(1);
beep();
// I want render screen into panel.bmap, but this dont work
}
make sure ur camera is facing wat u want to take screenshot.
|
|
|
|