Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: RETRO_BallsAndPaddle RETRO_BallAndHoles
Ball.h
- Committer:
- maxint
- Date:
- 2015-02-28
- Revision:
- 5:065f19e08dcb
- Parent:
- 3:441dc90d10ce
File content as of revision 5:065f19e08dcb:
#pragma once
#include "mbed.h"
#include "Color565.h"
#include "font_OEM.h"
#include "LCD_ST7735.h"
#include "Shapes.h"
#include "Vector.h"
#include "Physics.h"
class Ball
{
public:
static const bool fFixed=false;
bool fActive;
Ball();
Ball(LCD_ST7735* pDisp);
void initialize(int X, int Y, int R, uint16_t uColor);
void setSpeed(int X, int Y);
void changeSpeed(bool fUp);
void unmove();
void update();
void clear();
void clearPrev();
void draw();
void redraw();
Position pos;
int nRadius;
Vector vSpeed;
Circle getBoundingCircle();
bool collides(Rectangle r);
bool collides(Circle cObject);
bool collides(Line ln);
void Bounce(Vector vBounce);
void BounceAgainst(Vector vBounce);
private:
uint16_t uColor;
uint16_t uColorHigh;
uint16_t uColorMid;
uint16_t uColorLow;
LCD_ST7735* pDisp;
uint16_t dimmedColor(uint16_t uColor);
};