Guest User

Untitled

a guest
Dec 15th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <GL/glew.h>
  2. #include <GL/freeglut.h>
  3. #include <GL/gl.h>
  4. #include <math.h>
  5. #include "Bullet.h"
  6. #include "DrawBresenhamLine.h"
  7.  
  8. Bullet::Bullet(double _x, double _y, int a){
  9.     x = _x;
  10.     y = _y;
  11.     angle = a;
  12. }
  13.  
  14. void Bullet::drawBullet(double _x, double _y){
  15.    
  16.     update();
  17.  
  18.     glPushMatrix();
  19.  
  20.     glBegin(GL_POINTS);
  21.         glVertex3f(_x, _y, 0);
  22.     glEnd();
  23.  
  24.     glPopMatrix();
  25. }
  26.  
  27. void Bullet::update(){
  28.     x -= 25 * sin(angle * M_PI / 180);
  29.     y += 25 * cos(angle * M_PI / 180);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment