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.

Geek Culture / Any C++ / Direct X programmers - gimme da codez!!

Author
Message
KNau
21
Years of Service
User Offline
Joined: 25th Nov 2002
Location: Canada
Posted: 24th Nov 2003 16:28
Hi! I'm trying to offer an illustrative example to some colleagues of the differences in code styles for DBPro and C++ and how much faster / easier it is to code in DB.

What I would like to do is show the initialization code for both. Is there anyone out there who could post the C++ equivalent to the following or point me to a webpage that has it? Thanks!

DB Initialization:


C++ Initialization?

http://www.canceriannewmedia.com
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 24th Nov 2003 16:34 Edited at: 24th Nov 2003 16:39
I'm not going to re-do DirectX initialisation code in C - its a really pain, so :

Somewhere on the internet is my Amnesia DLL (its based - loosely - on Andy Southgate's RiscOS Amnesia module), and is a pretty fast 2D sprite library (collisions, scaling, rotating etc). If I can find an old site with it on, I'll let you know.

Looks like I never made it Freeware and never released the source I'll have to see if I can find it on my really old backups.

The alternative is to look at the Microsoft DirectX SDK, and put the code from the examples.


Mirrors are more fun than television. Well, that was fun, in a not-so-fun sort of way...
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 24th Nov 2003 16:46
hahaa ... :: walks off laughing ::
i'll post it up after work, it's not something i could write up in 20minutes

i'd suggest the SDK too


To Survive You Must Evolve... This Time Van Will Not Escape His Fate!
900mhz | 256mb | FX5200Ti 52.16 | Dx9 | WXP-Pro
KNau
21
Years of Service
User Offline
Joined: 25th Nov 2002
Location: Canada
Posted: 24th Nov 2003 19:49
Ok, don't go putting yourself out if the code is that long, lol. I'm not eager to reinstall the DirectX SDK or Visual C++ (I got them with a game programming book) but I thought it would be a funny comparison to make.

http://www.canceriannewmedia.com
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 24th Nov 2003 19:56
Its not particularly long - its just painful...


Mirrors are more fun than television. Well, that was fun, in a not-so-fun sort of way...
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 24th Nov 2003 20:02
well it's not that its hard... just long.
you have to declare the device and interface, allocate the memory for each device you setup and declare.
setup the main class, create the instance, setup the new camera fov so and update it per loop rather than leaving d3d to update it.
and setting up the colours are a pain in the ass, cause you have to then edit the device's settings and reinitilise the device again.


To Survive You Must Evolve... This Time Van Will Not Escape His Fate!
900mhz | 256mb | FX5200Ti 52.16 | Dx9 | WXP-Pro
Shock
AGK Developer
21
Years of Service
User Offline
Joined: 24th Oct 2002
Location: United Kingdom
Posted: 24th Nov 2003 21:10
Quote: "Its not particularly long - its just painful..."

Quote: "well it's not that its hard... just long."


LOL


Sticking feathers up your butt doesn't make you a chicken.
Sonic
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location: UK
Posted: 24th Nov 2003 21:12
Here's some straight C code (source & credit to Andre LeMothe). Its DirectDraw 16BIT rather than Direct3D but you might have some fun seeing what ya gotta do to get the old 2D games up and running

I think Direct3D is somewhat simpler than this in actual fact.



"My ignorance amuses me..."
http://www.victory-road.co.uk
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 24th Nov 2003 21:25
Painful isn 't it ?


Mirrors are more fun than television. Well, that was fun, in a not-so-fun sort of way...
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 24th Nov 2003 22:23
ack!

-RUST-
KNau
21
Years of Service
User Offline
Joined: 25th Nov 2002
Location: Canada
Posted: 24th Nov 2003 22:28
ROFL, I think I'll stick to DB for now

http://www.canceriannewmedia.com
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 24th Nov 2003 22:34
Yes, its the same reason I use DBPro - got so fed up with any crash taking out the whole computer...

You can however, have the best of both worlds, by using IanM's interface, C and DBPro...


Mirrors are more fun than television. Well, that was fun, in a not-so-fun sort of way...
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 24th Nov 2003 22:43
Quote: "Here's some straight C code (source & credit to Andre LeMothe). "


Did you get it from one of his Premier press books? Good, aren't they

"Help! My keyboard is stuckkkkkkkkkkkkkkkkkkkkkkkkkkkkk"

Mercenaries in Space demo @ http://www.davidtattersall.me.uk
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 24th Nov 2003 22:47
so this code:



does the same as this code:



hehe, thats wonderful


GO TO THE ETERNAL DESTINY FORUMS!!! http://forums.eternaldestinyonline.com
Do it now!!!
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 24th Nov 2003 23:19
No, its more like :



The rest is windows processing.


Mirrors are more fun than television. Well, that was fun, in a not-so-fun sort of way...
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 24th Nov 2003 23:40
I see you and I read the same book Sonic

Beauty, eh? RoooooOoooooKoooooKoooooRoooooOoooooKoooooKooooo!
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 25th Nov 2003 00:00


personally i thought that was more what he wanted ^_^ but hey... as i said it's lengthy


To Survive You Must Evolve... This Time Van Will Not Escape His Fate!
900mhz | 256mb | FX5200Ti 52.16 | Dx9 | WXP-Pro
Archaikz
21
Years of Service
User Offline
Joined: 11th Apr 2003
Location:
Posted: 25th Nov 2003 00:19
thats why most people starting out would use something like allegro or sdl. In my opinion allegro is the easiest librarys out there and going from dbp to allegro is nothing if you know the basics of c. 2d wise anyway. Using 3d on the other hand is another story.

setting up the same thing in allegro:


as you see the allegro version is not much longer than the dbp version. its just 2d though
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 25th Nov 2003 00:45
and chiming in for the vb.net guys...



-RUST-
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Nov 2003 09:14
I could post C++ code to show a sphere rotating around another sphere if anyone wants. It's a few pages though. Whereas DB would be less than 10 lines of code.
feiting
20
Years of Service
User Offline
Joined: 19th Oct 2003
Location:
Posted: 25th Nov 2003 12:11
don't you just love how MS puts in functions with parameters that must always be a certain value?

template function(...,3,2) (must always be 3 and 2)

He who does not take the assassin job, will get killed by one who does.
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 25th Nov 2003 12:29 Edited at: 25th Nov 2003 12:30
Try to avoid templates

You can see how inefficient DirectX is (and by association using DirectX) though. I bet DirectX 10 wont improve it (on Longhorn anyway)... Getting rid of COM objects would be a good start...


Mirrors are more fun than television. Well, that was fun, in a not-so-fun sort of way...

Login to post a reply

Server time is: 2024-09-20 20:12:54
Your offset time is: 2024-09-20 20:12:54