Jefferson Sanchez / Ping_Pong
Embed: (wiki syntax)

« Back to documentation index

Paddle Class Reference

Paddle Class Reference

This library has been made to allow the paddle to update, check its position .etc This will make the coding later on in the main file a bit easier to manipulate. More...

#include <Paddle.h>

Public Member Functions

 Paddle (int x_1, int x_2, int y_1, int y_2)
 The following show the connections to the K64F.
int lookforX1 ()
 Checks to see what pixels are on in the X coordinate for player 1 and returns a value for X1.
int lookforX2 ()
 Allows to check to see what pixels are on in the X coordinate for player 2 and returns a value for X2.
int lookforY1 ()
 Checks to see what pixels are on in the Y coordinate for player 1 and returns a value for Y1 .
int lookforY2 ()
 Check to see what pixels are on in the Y coordinate for player 2 and returns a value for Y2.
void YPaddle (N5110 &display)
 Once the coordinates have been obtained it will display them on the lcd.
void Moving_Paddle (N5110 &display)
 Once the coordinates have been obtained it will update the display when the paddle moves.
void Refresh_pos (AnalogIn &p1)
 This function allow me to refresh the position of Player 1.

Detailed Description

This library has been made to allow the paddle to update, check its position .etc This will make the coding later on in the main file a bit easier to manipulate.

Revision 1.0

Author:
Jefferson Sanchez
Date:
April 2016

Definition at line 22 of file Paddle.h.


Constructor & Destructor Documentation

Paddle ( int  x_1,
int  x_2,
int  y_1,
int  y_2 
)

The following show the connections to the K64F.

Parameters:
pinconnected to PTB3 in a Digital Input
PinConnected to PTB2 in a Digital Input
Pinconnected to +5v and GND to be able to obtain a interger value.

Definition at line 33 of file Paddle.h.


Member Function Documentation

int lookforX1 (  )

Checks to see what pixels are on in the X coordinate for player 1 and returns a value for X1.

Definition at line 12 of file Paddle.cpp.

int lookforX2 (  )

Allows to check to see what pixels are on in the X coordinate for player 2 and returns a value for X2.

Definition at line 17 of file Paddle.cpp.

int lookforY1 (  )

Checks to see what pixels are on in the Y coordinate for player 1 and returns a value for Y1 .

Definition at line 22 of file Paddle.cpp.

int lookforY2 (  )

Check to see what pixels are on in the Y coordinate for player 2 and returns a value for Y2.

Definition at line 27 of file Paddle.cpp.

void Moving_Paddle ( N5110 &  display )

Once the coordinates have been obtained it will update the display when the paddle moves.

Definition at line 43 of file Paddle.cpp.

void Refresh_pos ( AnalogIn &  p1 )

This function allow me to refresh the position of Player 1.

void YPaddle ( N5110 &  display )

Once the coordinates have been obtained it will display them on the lcd.

for(int i = y1; i <= y2; i++) { display.setPixel(x1, i); display.setPixel(x2, i); }

display.refresh(); }

Definition at line 32 of file Paddle.cpp.