Jump to content
  • Advertisement
Sign in to follow this  
sunsflower

Problem with dinput when seperate one project into two

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

I wrote a small 2d engine in one project and it works well. But as the engine become bigger and bigger I found it necessary to divide it. So I put all the initialization of direct11 and dinput into one project and other game logic into another. I add the former path to latter's additional include and I didn't forget to add lib file(the first project is a static library now). It worked well with d3d, but every time I compile the second project, It shows something like "missing type specifier", "unknown override specifier".. in the dinput initialization class. I add pragma comment(lib, "dinput8.lib) and #include to both project but nothing changed. It still failed when compiling due to those dinput stuff.. Have you met something like this before? What's wrong with this?

Share this post


Link to post
Share on other sites
Advertisement
OK, this is probably not exactly what you wanted, but (assuming you're using Visual Studio) why don't you put the files in different folders? I mean, not Windows folders but VS folders (I think they're called filters). They're pretty good for organizing code without making it more difficult to use.

PS: I almost forgot. DirectInput is s**t. Not even Microsoft recommends its use. So IMO you should use Raw Input for keyboard and mouse and Xinput for gamepad.

Share this post


Link to post
Share on other sites

but I really need to seperate it because I also have to develop a scene editor which is based on the same engine but have different logic to the game...

Okay, that's different. I'm making my own engine too and I use two projects which DON'T share any files because they must have different behavior. It also prevents some mistakes too.

I still think you shouldn't use DirectInput, though.

Share this post


Link to post
Share on other sites
But raw input doesn't support detecting many keys at a time..And it is not well documented, which makes it hard to get it to work..It's really tough knotty..

Share this post


Link to post
Share on other sites

But raw input doesn't support detecting many keys at a time..And it is not well documented, which makes it hard to get it to work..It's really tough knotty..

What??? "Doesn't support many keys at a time"? Can you explain how can the character in my engine jump forward (which requires both W and Space pressed at the same time)? Most games use raw input and it's not that complicated to learn.

You can't search in the MSDN, though. I've read an amazing page which helped me a lot. I'll post the link later.

 

EDIT: This is the "amazing page which helped me a lot": http://blog.molecular-matters.com/2011/09/05/properly-handling-keyboard-input/

This is a list of reasons to stay away from DirectInput: http://www.gamedev.net/blog/233/entry-1567278-reasons-not-to-use-directinput-for-keyboard-input/

This is Microsoft telling you not to use it: https://msdn.microsoft.com/en-us/library/ee418864.aspx#DirectInput

Edited by LHLaurini

Share this post


Link to post
Share on other sites
But how can I receive many keyboard input at a time? I didn't find any way of doing so..Should I use that buffer method?(I'm not smart I guess...)

Share this post


Link to post
Share on other sites

You receive a message that key A got pressed, then you receive another that key B got pressed (without first getting a message that key A was released) and therefore you know both keys A and B are pressed...

Edited by wintertime

Share this post


Link to post
Share on other sites

But how can I receive many keyboard input at a time? I didn't find any way of doing so..Should I use that buffer method?(I'm not smart I guess...)

I keep an array containing states for each key (down or up). So if I want to know if the "w" key is down, I just do "if (Keys['w'] == true)", but always IN THE MAIN LOOP.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!