Author Topic: DirectInput framework for C++  (Read 743 times)

0 Members and 1 Guest are viewing this topic.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5098
  • Karma: 380
    • View Profile
DirectInput framework for C++
« on: March 14, 2007 »


Here's a basic framework for using DirectInput.  It shows how to use the keyboard, mouse and joystick.
Myself, I prefer to use Windows messages to handle mouse and keyboard and winmm.lib to handle joysticks, but here's the DirectX method.

Jim
Challenge Trophies Won:

Offline rdc

  • Pentium
  • *****
  • Posts: 1480
  • Karma: 138
    • View Profile
    • Clark Productions
Re: DirectInput framework for C++
« Reply #1 on: March 14, 2007 »
Another nice one Jim. :)

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4130
  • Karma: 223
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: DirectInput framework for C++
« Reply #2 on: March 14, 2007 »
Cool. Works like a charm.

Is there any differents or pro/contra using dinput instead of processing WM_KEYXXX/wparam ?
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5098
  • Karma: 380
    • View Profile
Re: DirectInput framework for C++
« Reply #3 on: March 14, 2007 »
Yeah, the key handling doesn't let you get what order the keys were pressed in.
DirectInput lets you poll the mouse instead of waiting for events, which might make processing relative movements easier.
Jim
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4130
  • Karma: 223
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: DirectInput framework for C++
« Reply #4 on: March 14, 2007 »
Thanks for the info, Jim!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 16787
  • Karma: 439
  • evil/good
    • View Profile
    • My Homepage
Re: DirectInput framework for C++
« Reply #5 on: March 14, 2007 »
I'm looking forward to knowing the syntax enough to be able to try all these nice frameworks you have posted Jim.

I just want to say thank you for taking the time to do it, I appreciate it, I appreciate it very much.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4130
  • Karma: 223
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: DirectInput framework for C++
« Reply #6 on: March 14, 2007 »
Definately. Those frameworks are outstanding. Especially when you are new
to this DirectX stuff - it saves you from a lot of headaches when it come to
detail.

Especially Direct3D framework has so many cool things already implanted.
Texture generation, fullscreen/window switch, basic WinApi stuff in WindowProc
and of course the basic 3D functions.

I really tend to start spending some time with DirectX - but on the other hand
I have too much other things to do - which is really a shame. If I had more
time I would definately start coding upon Jim's frameworks.
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won: