Example of translation rotation scaling in C++
Example of reset translate and scale value
Write your own code below (Hint: write response for keypress for up/down/left/right arrow, which has been #define as KEY_UP/KEY_DOWN/KEY_LEFT/KEY_RIGHT)
CODE FOR ARROW KEYPRESS DETECTOR :-
#include <conio.h>
#include <iostream>
using namespace std;
#define KEY_UP 72
#define KEY_DOWN 80
#define KEY_LEFT 75
#define KEY_RIGHT 77
int main()
{
int S = 0;
while(1)
{
S = 0;
switch((c=getch())) {
case KEY_UP:
cout << "UP" << endl;
break;
case KEY_DOWN:
cout << "DOWN" << endl;
break;
case KEY_LEFT:
cout << "LEFT" << endl;
break;
case KEY_RIGHT:
cout << "RIGHT" << endl;
break;
default:
cout << "NULL" << endl;
break;
}
}
return 0;
}
Get Answers For Free
Most questions answered within 1 hours.