how i check for arrow keys using standard io functions? (nothing of allegro)
how i check for arrow keys using standard io functions? (nothing of allegro)
What do you mean by "standard"? Each Operating System and Compiler on it might have it's own way of implementing such functions. But most of them support the 'getch()', a function for a requirement as yours.
On my machine (Win98) using Bloodshed Dev compiler you have to include conio_mingw.h or similar instead of the normal conio.h, and the function is actually _getch();
The values it returns for the arrow keys are 75, 76, 80, and 81 - I THINK, but test them yourself, and again - this is for the above platform, etc...
BTW: on my system - "getch()" does not work. That is, it would retrieve the char but would the function would not return till the carriage return was pressed! So after pouring over my headers I found the older, renamed "_getch()", which returned immediately..
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
Also, the key codes are different between OS's (I think)
So just cuz it works for 98 doesn't mean it will work for 2000