Thread: buzzer?

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    6

    Question buzzer?

    is there a way that i can program a "buzzer" into my game so that if a key is pressed it will take them instantly to the next part. If you don't understand that ill try to explain it more but thanks in advanced for helping.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    putchar('\a')

    ?

  3. #3
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    If I understand your question you want for something to happen if the user presses a key?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  4. #4
    Registered User
    Join Date
    Jun 2007
    Posts
    6
    yes that if a user presses a key but doesnt have to press enter. also that different keys will do different things

  5. #5
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Where is the application supposed to run on? Windows, Mac, console, Linux?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  6. #6
    Registered User
    Join Date
    Jun 2007
    Posts
    6
    console

  7. #7
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    if you wan't the program to be interrupted when the user presses a key, you'll have to use a library.

  8. #8
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Well then... too many options:

    You can use PDCurses which is an excellent portable curses system. If you need help with installing and using it, let me know and I can help. Personally this is the better option. Both if you want to extend your console application to have colors and have more control over printing on the screen, and because it is portable across different systems.

    Or you can use the non portable CONIO library. I can't help you with this one. Others might. Only works in windows consoles. Has the same (less some) capabilities of curses above.

    Or you can use the C++ iostreams that are a language facility and don't need you to download and install anything. Much easier but limits the scope of what you can do.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  9. #9
    Registered User
    Join Date
    Jun 2007
    Posts
    6
    I'll download those when i get access to internet on my computer again but thanks for the help.

  10. #10
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    For the conio option, have a look at this FAQ: http://faq.cprogramming.com/cgi-bin/...&id=1043284392
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  11. #11
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    The iostream option is not possible. It depends on the system for console handling, which means it will wait for enter to be pressed.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  12. #12
    Registered User
    Join Date
    Jun 2007
    Posts
    24
    Corned Bee and Mario are right iostream wont work so you will have to download a library

  13. #13
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Not necessarily download. The Win32 API can do it, and it comes with most compilers. (Not VC++ Express.)
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  14. #14
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    I believe the Win32 API does come with VC++ Express, it is just part of a separate download. Its MFC that's not available.

  15. #15
    Registered User
    Join Date
    Jun 2007
    Posts
    24
    vc++ express doesn't come with win32 unless you download it seperatly I would know i was too cheap too aford anything else

Popular pages Recent additions subscribe to a feed