This a Library that can be used to make ping pong the Nokia Lcd 5110.
Ball.cpp
- Committer:
- el14jpps
- Date:
- 2016-05-05
- Revision:
- 1:4893a8f7147f
- Parent:
- 0:ef8d5a4464a3
File content as of revision 1:4893a8f7147f:
/**
**
@file Ball.cpp
@brief File containing all the functions prototypes , void etc for the ball.
@brief Shows examples of creating Doxygen documentation.
@brief Revision 1.0.
@author Jefferson Sanchez
@date April 2016
*/
#include "Ball.h"
// @paramFunction to set the x value
void ball::setX(int value)
{
x = value;
}
// Function to set the y value
void ball::setY(int value)
{
y = value;
}
// Function to look for or check for the x value to be later used on the code .
int ball::lookforX()
{
return x;
}
// Function to look for or check for the y value to be later used on the code
int ball::lookforY()
{
return y;
}
// Function to look for or check for the x value to ve later used on the code
int ball::lookforPos_stateX()
{
return x_Pos_state;
}
int ball::lookforPos_stateY()
{
return y_Pos_state;
}
void ball::BallcollisionState(int xPos_state, int yPos_state)
{
x_Pos_state = xPos_state;
y_Pos_state = yPos_state;
}
void ball::dbal(N5110 &display)
{
// this states the diameter of the ball
for(int i = -3; i < 3; i++)
for(int j = -3; j < 3; j++)
display.setPixel(x + j, y + i);
display.refresh();
}
void ball::clear_dbal(N5110 &display)
{
//states the clearing of the ball as it moves
for(int i = -3; i < 3; i++)
for(int j = -3; j < 3; j++)
display.clearPixel(x + j, y + i);
display.refresh();
}
void ball::Refresh_pos()
{
x += x_Pos_state;
y += y_Pos_state;
}
// end of code
Jefferson Sanchez