modchick
05-22-02, 09:15 AM
I need to produce 4 triangles which will appear when the letter 't' is pressed. Does anyone know the code in c++ to do this?
|
|
View Full Version : Please help me with my c++ problem!!! modchick 05-22-02, 09:15 AM I need to produce 4 triangles which will appear when the letter 't' is pressed. Does anyone know the code in c++ to do this? moonfish 05-23-02, 12:10 AM do you mean something like: #include <stdio.h> int main (void) { char in,Tfour[55] = {" * * *\n *** *** ***\n ***** ***** *****\n"}; scanf("%c",&in); if(in=='T' || in== 't')printf("%s",Tfour); return 0; } or are you doing a graphics project? and if so what API do you use? I've used openGL and glut. If your using GL you need to create a window with a keyboard callback and a display callback. In the main function initialize your window, pass the keyboard, and Display callbacks to the window object and begin the main GL loop. In keyboard callback check if input == 't' then set a global bool. At the end refresh the screen with glutpoistredisplay(void); In the Display call back check the bool and if true run a glDraw(GL_tryangels); followed by your points and glend(); then swap the buffers if you are using double buffering. |