locked
Metro DirectInput Sample?

    Question

  • Hello:

     

    I'm just starting to learn DirectX but I understand C++ okay.  I get the basic idea behind the Direct2D Basic Animation sample and can move the triangle into alternate geometry paths, but I want to use the keyboard to control where the triangle goes. 

     

    1. Which of the Metro Style App Samples best illustrates the ideal method to retrieve keyboard input via a Metro DirectX App? 
    2. Which of the Metro Style App Samples best illustrates the ideal method to retrieve usb Sidewinder like [1] gamepad input via a Metro DirectX App?

     

    If possible, I would rather avoid using hacks to access input devices.

     

    Thanks,

     

    Shawn

    [1] - I'm sorry to see the Sidewinder joysticks/gamepads discontinued.  They were in my mind the best joysticks ever made [ You can tell I haven't played games in a while...]



    • Edited by Shawn Eary Wednesday, September 28, 2011 3:22 AM
    Wednesday, September 28, 2011 3:20 AM

Answers

All replies

  • There was a session at build about the different control mechanism: http://channel9.msdn.com/events/BUILD/BUILD2011/PLAT-754T

    The slide contains code samples for different input devices. You would most likely have no luck with old joysticks and gamepads as Metro requires the usage of Xinput compatible devices in thios area.

    Wednesday, September 28, 2011 4:59 PM
  • Here is a sample for keyboard and mouse input:

    http://code.msdn.microsoft.com/windowsapps/Simple-Direct3D-111-Game-b18d89cb

    and here is a sample for Xinput compatible devices (xbox controller is used in this one):

    http://code.msdn.microsoft.com/windowsapps/Simple-XInput-Controller-77c4b8e5

     


    Jeff Sanders (MSFT)
    • Marked as answer by Shawn Eary Friday, September 30, 2011 4:07 AM
    Wednesday, September 28, 2011 5:02 PM
    Moderator
  • There was a session at build about the different control mechanism: http://channel9.msdn.com/events/BUILD/BUILD2011/PLAT-754T

    Even though I would like to go to the "Build" conference someday, I can't really afford it right now. I'm a web programmer in Oklahoma so I don't make as much money as some developers. Thanks for the link though. It's good to hear that Microsoft is moving onto a new API. With any luck for me, the new API will be easier. The keyboard API was easy enough.
    You would most likely have no luck with old joysticks and gamepads as Metro requires the usage of Xinput compatible devices in this area.
    That's really not a problem since the Xbox 360 Wired Controller appears to be selling at Walmart for a reasonable cost. Hopefully it uses a USB interface. Walmart says it works on PCs. It's good to know that Microsoft is still making Joysticks :-) I think Microsoft understands multimedia performance quite well.
    Friday, September 30, 2011 4:07 AM
  • Here is a sample for keyboard and mouse input:

    http://code.msdn.microsoft.com/windowsapps/Simple-Direct3D-111-Game-b18d89cb

    and here is a sample for Xinput compatible devices (xbox controller is used in this one):

    http://code.msdn.microsoft.com/windowsapps/Simple-XInput-Controller-77c4b8e5

     


    Jeff Sanders (MSFT)


    Yeah, the first example is really good.  I didn't have much time to play with this tonight, but I was able to hack the keyboard code of the MoveLookController from the Simple-Direct3D-111-Game into the Direct 2D Basic Animation example that I was playing with and move the triangle back and forth.   If I can get some more time to play with this, I shouldn't be too far from a basic Asteroids game.  I'll bet you're wondering why in the world a web programmer like myself doesn't just use Silverlight.  I honestly don't know.  When Windows 8 Developer Preview became available for download via the masses, something just drew me to DirectX.  Maybe it's because the new Metro DirectX is supposed to be easier.

    BTW: I just found out tonight [1] that University of Oklahoma is looking for Video Game Programmers; unfortunately, I don't qualify at this time (maybe one of the readers here does):

    1. https://jobs.ou.edu/applicants/jsp/shared/position/JobDetails_css.jsp?postingId=250096  (Id subject to change)
    2. https://jobs.ou.edu/applicants/jsp/shared/position/JobDetails_css.jsp?postingId=250105  (Id subject to change)
    3. https://jobs.ou.edu/applicants/jsp/shared/position/JobDetails_css.jsp?postingId=250605  (Id subject to change)

    [1] - The job listings could have been out there for a while.  I just noticed them tonight because I was looking for a web developer job at OU [2].  The trouble is my transcript is a real work of "art"; unfortunately, I don't think I can claim Attention Deficit Disorder.

    [2] - Another downer for me is that the web developers jobs at OU are looking for Flash Programmers, but I just know Silverlight using rudimentary WCF for data commo...

    Note: I don't work for OU, but I wish I did.  I, unfortunately, only have a Bachelor's degree and OU generally prefers staff (non-faculty) that have Master's degrees.

    With Thanks to Mr. Sanders and Mr. Kornmann,

    Shawn 

    Friday, September 30, 2011 4:29 AM
  • Even though I would like to go to the "Build" conference someday, I can't really afford it right now. I'm a web programmer in Oklahoma so I don't make as much money as some developers. Thanks for the link though. It's good to hear that Microsoft is moving onto a new API. With any luck for me, the new API will be easier. The keyboard API was easy enough.
    This was not a advertisement for build. I would just give you a link to the recorded session and the slides for the talk about input.
    That's really not a problem since the Xbox 360 Wired Controller appears to be selling at Walmart for a reasonable cost. Hopefully it uses a USB interface. Walmart says it works on PCs. It's good to know that Microsoft is still making Joysticks :-) I think Microsoft understands multimedia performance quite well.
    Standard wired Xbox 360 controllers works fine on the PC. Only special device could make some trouble. But they are normally part of the games that make use of them and not sell separated at stores.
    Friday, September 30, 2011 5:41 AM
  • I'll bet you're wondering why in the world a web programmer like myself doesn't just use Silverlight.  I honestly don't know.  When Windows 8 Developer Preview became available for download via the masses, something just drew me to DirectX.  Maybe it's because the new Metro DirectX is supposed to be easier.

    Slightly Off-Topic:

    Silverlight 5 will support a somewhat scaled down version of XNA. XNA is a managed DirectX Version that can be used on Xbox 360, Windows Mobile 7 and the PC (but at least for now not for Metro apps). As it follows mostly the same principles you will be able to use most of your 3D knowledge you will get from DirectX although with Silverlight if you want.

    Friday, September 30, 2011 5:49 AM