I really need help

This is a discussion on I really need help within the Game Programming forums, part of the General Programming Boards category; i am stuck and darn stuck i am trying to make a kunar lander like this in c++ Play LunarLander ...

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    4

    Unhappy I really need help

    i am stuck and darn stuck i am trying to make a kunar lander like this in c++

    Play LunarLander Game

    in this program i am stuck at the fireing rocket stage

    i need a function that tell me the duration i have pressed a key


    e.g
    i press "A" or any key it gives me the time from when i press A and leave it in millisecond

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,453
    Well it all depends on your operating system and compiler, and whether you're writing a console or GUI program.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Jan 2011
    Posts
    4

    thnx for the rply

    i am doing this with c++,

    borland 5 or turbo 3.2

    windows xp & 7

    not gui console based

  4. #4
    The Dragon Reborn
    Join Date
    Nov 2009
    Location
    Dublin, Ireland
    Posts
    629
    use a game programming tool..like xna or allegro or ... (opengl )
    i assume it will be a pain in the butt to do it with command line
    You ended that sentence with a preposition...Bastard!

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,453
    Can either of those compilers generate win32 programs?

    If not, you should consider upgrading to something more in tune with your real operating system. Relying on backward compatibility will only get you so far...

    Win32 Console Applications 5
    With this, you can also add timing to see how long it took between various key events.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User
    Join Date
    Jan 2011
    Posts
    4

    ?

    i have done my project to quiet an extent but am stuck am doing my bachlour so am stuck with c++...i cant seem to sove this issue

  7. #7
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    You won't get a WndProc in console mode but I think you can use GetAsyncKeyState(). If you can use that (I'm not sure b/c I almost never use console mode) then start a timer when it is down and stop the timer when it is up. Subtract the start time from the end time and you will know how long the key has been held down.

Popular pages Recent additions subscribe to a feed

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21