I am currently trying to develop a simple snake game on ios. The tutorial requires me to use however this does not work on my mac. What would be an alternative for _kbhit ? I am new to c++ so would appreciate any help!
Asked
Active
Viewed 262 times
1 Answers
2
There is none. You'll have to use a library (like PDCurses or similar) to abstract that from your code or make the platform dependent implementation yourself.

Ted Lyngmo
- 93,841
- 5
- 60
- 108
-
@Curly22 The library was just an example to make it simple to circumvent the fact that there is no alternative for `_kbhit` in standard C++. That said, `iOS` might have something platform specific that you could use. It wouldn't be portable, but if you only target `iOS` (or similar platforms), it may be ok. Checkout their pages for [termios.h](https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/tcgetattr.3.html) - but as I said, going with a library makes it easier and more portable. – Ted Lyngmo Dec 06 '19 at 13:43
-
Does iOS even ***have*** a console? – user253751 Dec 06 '19 at 15:54
-
@Curly22 What would be a correct answer to your question? – Ted Lyngmo Dec 08 '19 at 05:23