Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [GDK] - Bouncing Balls (less boring than a rotating cube)

Author
Message
WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 13th Mar 2012 05:29 Edited at: 13th Mar 2012 05:30
There was nuthin on TV and I didn't want to rotate a cube so I decided to create some bouncing balls. This took all of 10 minutes to complete. I was also fed up with reading up on programming documentation.

Nothing special but it does show how to use the <vector> STL library with Dark GDK.

If you copy and paste this source into your own project then don't forget to set:

Project-Properties / Configuration Properties / C/C++ / Code Generation / Runtime Library -> /MT (Not MTd)



And it's been ages since a C++ snippet was posted...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 18th Mar 2012 23:04
you've stumped me on the above, was hopping to turn in into basic but I'm lost with the code.

can't work out where the array are or the types use, if c++ uses such things.

Dark Physics makes any hot drink go cold.
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 19th Mar 2012 02:28 Edited at: 19th Mar 2012 02:47
Here's the DBPro conversion if anyone’s interested.



Edit: Fixed the bounce.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 19th Mar 2012 09:28 Edited at: 19th Mar 2012 10:03
cheers WickedX for the conversion I was close up not close enough to make it go.

Plus good Demo to WLGfx almost look like a physx demo. going to adda floor to my copy .

Dark Physics makes any hot drink go cold.
WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 20th Mar 2012 04:55
Wow! Been a while since using DBP the code looked odd for a moment there.

Cheers WickedX and HowDo... I've an idea for another simple one which I'll start playing about with. Similar to a pool table type of effect.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 8th Apr 2012 14:55
Quote: "can't work out where the array are or the types use, if c++ uses such things."

The 'array' is defined here:

BOBJ is basically a UDT, and vector is a kind of dynamic array that's built into C++.

WLGfx, I'd post some C++ stuff but I use Ogre.

Login to post a reply

Server time is: 2024-03-29 05:12:38
Your offset time is: 2024-03-29 05:12:38