Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

fireking

implementing call backs (like vb events)

This topic is 5758 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

well i have a class, a tile class that is. And this tile class has "events". These events work just like vb events, and they are similair to the winapi call back (like WindowProc) How can i set this up? so that the user can define which proc is called when this event occurs. I believe these are called function pointers, but i am not sure. I just need a way for a user to define what happens when the event is called, without editing the actual class. So im guessing you would set a variable to a function pointer, (similair to setting the WindowProc for a WNDCLASSEX). Thanks, --Fireking Owner/Leader Genetics 3rd Dimension Development

Share this post


Link to post
Share on other sites
Advertisement
Function pointers will do what you want.
You can also define an interface which classes need to implement (and then register with the event generating class) to receive events.


VB events are (poorly) implemented using COM connection points.
If you use connection points in your C++ code (and ole automation compatible types) then you can even use the COM object in VB ''with events''. Connection points are fairly complicated.


Share this post


Link to post
Share on other sites
er, ok, but I dont know how to use function pointers, i thought you would explain them to me

and i dont intend to use vb events from a com object or whatever, im just describing what i want to do by comparing with vb events, because its basically like calling a function that the user defines. Thats what im wanting to do, let the user define OnEnter() for the tiles, and OnExit() for the tiles.

--Fireking

Owner/Leader
Genetics 3rd Dimension Development

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!