Advertisement
apl-mhd

msmun

Dec 23rd, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.15 KB | None | 0 0
  1. # include "iGraphics.h"
  2.  
  3. int firstY=0, midY=75;
  4. double xa[]={10, 15, 20};
  5. double ya[]={10, 20, 10};
  6. void yaxis(){
  7.  
  8.     if(firstY >=585)
  9.         firstY = 0;
  10.     else
  11.         firstY +=4;
  12.  
  13.     if(midY >=585)
  14.         midY = 0;
  15.     else
  16.         midY +=4;
  17. }
  18.  
  19.  
  20.  
  21. void iDraw()
  22. {
  23.     iClear();
  24.     iSetColor(1000, 15000,3000);
  25.  
  26.     iFilledRectangle(50,firstY,100,15);
  27.     iSetColor(255, 00,000);
  28.     iFilledRectangle(50, midY,100,15);
  29.     iSetColor(255, 00,000);
  30.     iFilledPolygon(xa, ya, 6);
  31. }
  32.  
  33. void iMouseMove(int mx, int my) {
  34.    
  35. }
  36.  
  37. void iMouse(int button, int state, int mx, int my) {
  38.     if(button==GLUT_RIGHT_BUTTON && state==GLUT_UP) {
  39.        
  40.     } else if(button==GLUT_LEFT_BUTTON && state==GLUT_DOWN) {
  41.        
  42.     } else if(button==GLUT_LEFT_BUTTON && state==GLUT_UP) {
  43.    
  44.     }
  45. }
  46.  
  47. void iKeyboard(unsigned char key) {
  48.     if(key=='q') {
  49.         //animate=(animate+1)%2;
  50.        
  51.     }
  52. }
  53.  
  54. void iSpecialKeyboard(unsigned char key) {
  55.     if(key==GLUT_KEY_PAGE_UP) {
  56.        
  57.     } else if(key==GLUT_KEY_PAGE_DOWN) {
  58.        
  59.     }
  60.     if(key==GLUT_KEY_UP){
  61.    
  62.     }
  63.     if(key==GLUT_KEY_RIGHT){
  64.    
  65.     }
  66.     if(key==GLUT_KEY_LEFT){
  67.    
  68.     }
  69.  
  70. }
  71.  
  72.  
  73.  
  74. int main() {
  75.    
  76.     iSetTimer(.000001, yaxis);
  77.     iInitialize(400, 600, "Bouncing Ball");
  78.     return 0;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement