Jump to content

  • Log In with Google      Sign In   
  • Create Account

mouse input


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
26 replies to this topic

#1 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 24 October 2012 - 04:44 PM

i want to use mouse input for my pong game, should I use direct input?

Sponsor:

#2 Manill66   Members   -  Reputation: 261

Like
1Likes
Like

Posted 24 October 2012 - 06:42 PM

Use SFML! It's great and you can use it for commercial use if you want to! It also includes sounds and I forget if it includes anything else. It is also free. I also found a pong tutorial with SFML!

Website: http://www.sfml-dev.org/
Licensing: http://www.sfml-dev.org/license.php
Pong Tutorial: http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx

#3 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 24 October 2012 - 07:27 PM

I am using dx9

#4 superman3275   Crossbones+   -  Reputation: 2011

Like
0Likes
Like

Posted 24 October 2012 - 07:36 PM

I am using dx9

Yes, however normally people who use DirectX or OpenGL use SFML, Allegro, or SDL for input because it's easier. It's really your choice however. I'd recommend either using Allegro or SDL, because with SFML you have to do a lot of extra stuff to capture input with it. You can either use Direct Input or an Input Library, with the latter being easier. If you're main goal is to learn all about DirectX however, you can use Direct Input.

I'm a game programmer and computer science ninja ph34r.png!

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

 

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here smile.png!


#5 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 24 October 2012 - 07:38 PM

I am doing my best to learn dx9

#6 superman3275   Crossbones+   -  Reputation: 2011

Like
-1Likes
Like

Posted 24 October 2012 - 07:39 PM

Well if you want to learn DirectX strictly then using Direct Input would be your best bet. Later on if it gets too difficult you can progress to an Input Library, but you seem smart enough to be able to handle Direct Input :)!

I'm a game programmer and computer science ninja ph34r.png!

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

 

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here smile.png!


#7 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 24 October 2012 - 07:47 PM

thanks, I am doing all I can to learn dx9, is there any tutorials I can use to help me understand how to incorporate the mouse in my pong game.I am going to use direct input.

#8 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 24 October 2012 - 08:08 PM

I am getitng the following error.
1> c:\program files\microsoft directx sdk (june 2010)\include\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800
do I need to include an older sdk for dx.

#9 superman3275   Crossbones+   -  Reputation: 2011

Like
0Likes
Like

Posted 24 October 2012 - 08:30 PM

This is a great tutorial. It talks about how to get all types of input and how to apply them to game development.
About the error, you need:
#define DIRECTINPUT_VERSION 0x0900
When it says it's defaulting to 0x0800, it means it's defaulting to DirectX 8 input (Notice the 800 instead of 900).
if the above code doesn't work, then just use this:
#define DIRECTINPUT_VERSION 0x0800

Edited by superman3275, 24 October 2012 - 08:36 PM.

I'm a game programmer and computer science ninja ph34r.png!

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

 

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here smile.png!


#10 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 24 October 2012 - 08:35 PM

I have an error using dx8 and dx9.
c:\program files\microsoft sdks\windows\v7.0a\include\objidl.h(11280): error C2061: syntax error : identifier '__RPC__out_xcount_part'
1>c:\program files\microsoft sdks\windows\v7.0a\include\objidl.h(11281): error C2059: syntax error : ')'
1>c:\program files\microsoft sdks\windows\v7.0a\include\objidl.h(11281): fatal error C1903: unable to recover from previous error(s); stopping compilation
1>
I am really lost on this one.

#11 superman3275   Crossbones+   -  Reputation: 2011

Like
0Likes
Like

Posted 24 October 2012 - 08:37 PM

Did you install the DirectX SDK? If the DirectX SDK was installed after the Windows SDK, the DirectX \include directory will come before the Windows SDK \include directory in your PATH. This means that Visual Studio will be build with the version of objidl.h that ships in the DirectX SDK. You must build with the version of objidl.h that ships in the Windows 7 SDK.

Look at your VC++ Directory Settings in VS and see if the Windows SDK include path (C:\Program Files\Microsoft SDKs\Windows\v7.0\Include) is at the top of the list. This will make Visual Studio use the SDK resources first. You should also change the settings for the Executable and Library directories, so that the Windows SDK directories are at the top.

To change the directories, in Visual Studio IDE, go to Tools, Options, Projects and Solutions, VC++ Directories.

Edited by superman3275, 24 October 2012 - 08:38 PM.

I'm a game programmer and computer science ninja ph34r.png!

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

 

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here smile.png!


#12 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 24 October 2012 - 08:52 PM

well I did everything but I am still getting the same error.

#13 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 24 October 2012 - 09:08 PM

well after much work I am now only getting the following error.
ID3DXSprite.obj : error LNK2001: unresolved external symbol _GUID_SysMouse
1>
the #define line of code helped

#14 superman3275   Crossbones+   -  Reputation: 2011

Like
0Likes
Like

Posted 24 October 2012 - 09:26 PM

Link with dxguid.lib and dinput8.lib.
The SDK-Docs. At the end of each page describing a function there says what header and lib to use.

I'm a game programmer and computer science ninja ph34r.png!

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

 

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here smile.png!


#15 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 24 October 2012 - 09:43 PM

I did that and now the dumb thing wont generate a exe file.,it compiles fine.

#16 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 24 October 2012 - 09:49 PM

I am going to do some reading about dxinput and then ask questions later.

#17 Khatharr   Crossbones+   -  Reputation: 3003

Like
0Likes
Like

Posted 24 October 2012 - 10:02 PM

You can take a look at something I posted a while back. The Input namespace is implemented using DirectInput. It's a bit of a mess since it does some stuff like key-mapping and abstraction, but you should be able to just look over the "initialize" and "update" functions and the mouse related functions and see how to set it up and read mouse input.

Here's a link to the project:

http://www.gamedev.n...attach_id=10098

Please note that I wrote this a while back and I've learned a lot of important stuff since then, so don't think that this is actually good code. It's not horrible, but it's not designed at a professional level either. It's just an example of the basic underlying procedure. The files you want in the archive are "Bricks/Bricks/ns_Input.h" and "Bricks/Bricks/ns_Input.cpp".

Hope that helps. Posted Image

Edited by Khatharr, 24 October 2012 - 10:05 PM.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

#18 phil67rpg   Members   -  Reputation: 767

Like
0Likes
Like

Posted 24 October 2012 - 10:16 PM

there is alot of good tutorials out there, let me do some learning then I will proceed to do some further work on my game.thanks for all the help everyone

#19 BeerNutts   Crossbones+   -  Reputation: 2945

Like
0Likes
Like

Posted 25 October 2012 - 09:03 AM

Phil, with the trouble you have with...well, everything, you really should stick to the simpler API's, and DX9 isn't one of those. SFML is a simple API, and easy to use. Just my opinion.
My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

#20 Evil Steve   Members   -  Reputation: 1982

Like
1Likes
Like

Posted 25 October 2012 - 09:09 AM

Nooooooooooooo! Never use DirectInput for keyboard or mouse input. Just use WM_MOUSEMOVE, WM_LBUTTONDOWN and so on.

Using DirectInput will remove pointer ballistics, which will make your mouse pointer feel extremely sluggish. It's also hundreds of lines of code to set up and use, where as window messages are "free". And finally, it's actually slower than using window messages - DirectInput spawns another thread to process raw input messages, meaning it has a higher overhead.

If you're just doing this to learn DirectInput, then go ahead - but never use DirectInput for keyboard or mouse input in a shipping product.



EDIT: From here: http://msdn.microsoft.com/en-us/library/ee418864.aspx:


Summary

Overall, the best method to receive high-definition mouse movement data is WM_INPUT. If your users are just moving a mouse pointer, then consider using WM_MOUSEMOVE to avoid needing to perform pointer ballistics. Both of these window messages will work well even if the mouse isn't a high-definition mouse. By supporting high definition, Windows games can offer more precise control to users.

Edited by Evil Steve, 25 October 2012 - 09:11 AM.

Steve Macpherson
Systems Programmer

Rockstar North





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS