Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,767 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
set BMAP by function #263171
04/28/09 07:00
04/28/09 07:00
Joined: Jun 2008
Posts: 151
Ukraine
XD1v0 Offline OP
Member
XD1v0  Offline OP
Member

Joined: Jun 2008
Posts: 151
Ukraine
How set BMAP pointer if in function I use wait?
Example (this code dont work)
Code:
function create_my_bmap (BMAP* this)
{
	BMAP* fb = bmap_createblack (256,256,24);
	wait(1);
	// do something with fb
	...
	//
	wait(1);
	this = fb;
}

whistle

Last edited by XD1v0; 04/28/09 07:00.

A7 Commercial cool
Celeron 1700, GeForce 5500 FX 256mb, 1 Gb Ram
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 Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
This (untested) SHOULD work fine.
Code:
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: XD1v0] #263179
04/28/09 07:33
04/28/09 07:33
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline
User
delinkx  Offline
User

Joined: Jul 2008
Posts: 553
Singapore
y u passing a BMAP pointer as parameter to the create_my_bmap fucntion when u want to create a bitmap. explain wat u wanna do exactly.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: set BMAP by function [Re: delinkx] #263183
04/28/09 08:06
04/28/09 08:06
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
When you want to change a pointer, you need to pass a pointer to that pointer as a parameter. This is the correct function:

Code:
function create_my_bmap (BMAP** this)
{
	BMAP* fb = bmap_createblack (256,256,24);
	// do something with fb
	...
	//
	*this = fb;
}


But instead of changing a parameter its better when the function returns the bitmap pointer:

Code:
BMAP* create_my_bmap ()
{
	BMAP* fb = bmap_createblack (256,256,24);
	// do something with fb
	...
	//
	return fb;
}


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 Offline
Expert
EvilSOB  Offline
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 Offline OP
Member
XD1v0  Offline OP
Member

Joined: Jun 2008
Posts: 151
Ukraine
Quote:
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.
Code:
#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 cool
Celeron 1700, GeForce 5500 FX 256mb, 1 Gb Ram
Re: set BMAP by function [Re: XD1v0] #263245
04/28/09 16:05
04/28/09 16:05
Joined: Jun 2008
Posts: 151
Ukraine
XD1v0 Offline OP
Member
XD1v0  Offline OP
Member

Joined: Jun 2008
Posts: 151
Ukraine
Is possible do this on Lite-c? Somebody? crazy


A7 Commercial cool
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
F
fogman Offline
Expert
fogman  Offline
Expert
F

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 smile

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 Offline
User
delinkx  Offline
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:



Code:
#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
}




A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
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 Offline
User
delinkx  Offline
User

Joined: Jul 2008
Posts: 553
Singapore
ok FIXED.. a wait(1) was missing to update the bitmap. here is the (tested) code:

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.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Page 1 of 2 1 2

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

Gamestudio download | 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