Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 744 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to call a function through a function paramater #402679
06/09/12 01:09
06/09/12 01:09
Joined: Dec 2009
Posts: 256
USA , NY
msmith2468 Offline OP
Member
msmith2468  Offline OP
Member

Joined: Dec 2009
Posts: 256
USA , NY
Basically I am trying to make my own button. Everything works great but I want to specify a function to be called when the button is pressed.

for example

functing MikesBtn(var SIZEX, var SIZEY, VOID* LeftClickFunction){
if(Left click){Run LeftClickFunction};
}

Basically when I define a button I want to specify what action it should take when the button is pressed. I would also like to include parameters in the functions I call.

The built in button function has this ability to specify the function. I can not seem to figure out what to do. Thanks for the help.


Mikes Wicked Games

www.mikeswickedgames.com
Re: How to call a function through a function paramater [Re: msmith2468] #402695
06/09/12 11:46
06/09/12 11:46
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
use a dummy function:

void mybuttonfunc(void);

functing MikesBtn(var SIZEX, var SIZEY, VOID* LeftClickFunction)
{
if(Left click)
{
mybuttonfunc = LeftClickFunction;
if(mybuttonfunc) mybuttonfunc();
}
}


Last edited by MasterQ32; 06/09/12 11:46.

Visit my site: www.masterq32.de
Re: How to call a function through a function paramater [Re: MasterQ32] #402734
06/09/12 18:23
06/09/12 18:23
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
That should work and will work fine with the 3dgs button setup. Don't make the game making any harder than it has to be by reinventing the wheel here.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Re: How to call a function through a function paramater [Re: FoxHound] #402908
06/11/12 19:15
06/11/12 19:15
Joined: Dec 2009
Posts: 256
USA , NY
msmith2468 Offline OP
Member
msmith2468  Offline OP
Member

Joined: Dec 2009
Posts: 256
USA , NY
Thanks a lot!

@FoxHound - I do not intend to reinvent the wheel. The built in button function is very useful. All I am doing Is remaking the wheel to see and thoroughly understand how it works. I have already learned much from my own button design. I do not expect my button to be better or more efficient then the built in button function but there is a special satisfaction in creating something of your own. I know everything about my button because I built it. If I do not like something I can change it. Instead of trying to find a hack job work around for something someone else built.

I have so far created my button to be built from scratch when the function is called. An image with the size, color, location specified is created and the button responds to, mouse over, left click, and right click.

Thanks for the help and comments!


Mikes Wicked Games

www.mikeswickedgames.com
Re: How to call a function through a function paramater [Re: msmith2468] #402912
06/11/12 19:46
06/11/12 19:46
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
There are plenty of things about 3dgs that I don't like but the button system in the panels is not one of them.

http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=402345#Post402345

The things I do with buttons in this thing, plus panel pointers when you click the buttons is a bit over the top.

However learning how to make a button from scratch is a pretty good way to learn in depth programming and I salute that.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!

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