/******************************************************************** File: Ball.h Author: Dana Vrajitoru Project: A simple 2D animation program based on the Breakout game. Last updated: February 6, 2017. A class handling a 2D circle moving on the screen. ********************************************************************/ #ifndef BALL_H #define BALL_H inline float randUnit() { return float(abs(rand()))/RAND_MAX; } class Ball { public: // The ball's position float x, y; // How big the ball is float radius; // Velocity over x and y float vx, vy; // Color of the ball float r, g, b; // Bounding box float bwidth, bheight; GLUquadric *disk; // default constructor with given Ball(float rad = 1.0); // Define the boundaries for the window void setBox(float bw, float bh); // Set the color of the object void setColor(float valr, float valg, float valb); // Change its coordinates void jumpTo(float posx, float posy); // Initialize the speed to some values. void setSpeed(float tx, float ty); // Reset the value of the speed with random values between 0 and the limit. void randomizeSpeed(float limit); // Move the ball from the current position based on its velocity void move(); // Draw the ball at given coordinates void draw(); }; #endif