Archived

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

Libraries and Implementation hiding

This topic is 5588 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

Ok...say I want to make a library some sort of bitmap library. That look like the following. BMPLIB_PRIV.H class CBitmap { ...... }; BMPLIB.cpp // //Implementation stuff here // VOID CBitmap::Dray(int x, int y); What does my public header file have to look like so the user only has to link with the library and include the public header file to use my object? Say through an opaque pointer BMPLIB_PUB.H // //What I have now is // typedef class CBitmap* PCBitmap; If I do this it won''t let me call through my object. It gives me use of undefined type. Is there any way around this or do I have to define an interface and use inheritence?

Share this post


Link to post
Share on other sites
If you want OO & opaque pointers, you need to define an interface (that provides the opaqueness).

Ignoring the opaqueness, all they need is the header & the libraries compiled under all the different flavors (if you link the CRT, kinda need to provide a lib for each flavor of the CRT, Single/Multi-threaded, Dll/static, debug/release).

Share this post


Link to post
Share on other sites
My collisions are all based on circles in my game. Let me tell you why circles are so fantastic for collisions:

1) Radius = all the needed collision map data.
2) Given that everything moves in either a straight line or a simple line+accel, you can derrive formulas to test how close two objects come, and whether and when they touch in a given amount of time (say one frames worth of time) this gives you exact collisions.
3) Testing a collision between two objects is FAST:

you need to test to see if this is true.
(pulse->radius + meteor->radius)^2
>
(pulse->x - meteor->x)^2+(pulse->y - meteor->y)^2

Now many of you will argue that your objects are not all circles, such as missiles and things. But how often is a player or a rock going to be able to sneak up on a missile from behind and hit it? If you keep the hotspots of your pulses in the center of the front bulge and test for collisions in a radius out from that point, youll be pleasantly suprised with both collision performance (even brute force collision testings) and find that unlike bounding rectangle collisions, bounding circles are quite realistic to moving objects.

Only great minds know that everything they do is there for the pleasure of those who can enjoy the fruits of their labor. Who wants to make a kick-ass game that only you think is cool?

Share this post


Link to post
Share on other sites
quote:
Original post by pTymN
My collisions are all based on circles in my game. Let me tell you why circles are so fantastic for collisions:

1) Radius = all the needed collision map data.
2) Given that everything moves in either a straight line or a simple line+accel, you can derrive formulas to test how close two objects come, and whether and when they touch in a given amount of time (say one frames worth of time) this gives you exact collisions.
3) Testing a collision between two objects is FAST:

you need to test to see if this is true.
(pulse->radius + meteor->radius)^2
>
(pulse->x - meteor->x)^2+(pulse->y - meteor->y)^2

Now many of you will argue that your objects are not all circles, such as missiles and things. But how often is a player or a rock going to be able to sneak up on a missile from behind and hit it? If you keep the hotspots of your pulses in the center of the front bulge and test for collisions in a radius out from that point, youll be pleasantly suprised with both collision performance (even brute force collision testings) and find that unlike bounding rectangle collisions, bounding circles are quite realistic to moving objects.

Only great minds know that everything they do is there for the pleasure of those who can enjoy the fruits of their labor. Who wants to make a kick-ass game that only you think is cool?



wtf?

Share this post


Link to post
Share on other sites