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.
Dependencies: mbed
Surface Class Reference
surface Class @1 the leftside of the line move toward right then the rightside should also move to the right to keep the length @2 the line will be random length but must be suitable @3 makesure there are two surface for player to stay More...
#include <surface.h>
Public Member Functions | |
Surface () | |
Constructor. | |
~Surface () | |
Destructor. | |
void | init (int y1, int y2) |
init the line at first to set the initial position. | |
void | line_1 () |
set line1 movement. | |
void | line_2 () |
set line2 movement. | |
void | line_3 () |
set line3 movement. | |
void | line_4 () |
set line4 movement. | |
void | line_5 () |
set line5 movement. | |
void | line_6 () |
set line6 movement. | |
Line | getline_1 () |
Gets line 1. | |
Line | getline_2 () |
Gets line 2. | |
Line | getline_3 () |
Gets line 3. | |
Line | getline_4 () |
Gets line 4. | |
Line | getline_5 () |
Gets line 5. | |
Line | getline_6 () |
Gets line 6. |
Detailed Description
surface Class @1 the leftside of the line move toward right then the rightside should also move to the right to keep the length @2 the line will be random length but must be suitable @3 makesure there are two surface for player to stay
- Date:
- April 22th 2020
#include "mbed.h" #include "N5110.h" #include "Gamepad.h" #include "surface.h" #include <cstdlib> #include <ctime> N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Gamepad gamepad; Surface _surface; Line line_1_value; Line line_2_value; Line line_3_value; Line line_4_value; Line line_5_value; Line line_6_value; int main() { _surface.init(20,40); while(1) { //draw line 1 _surface.line_1(); line_1_value = _surface.getline_1(); lcd.drawLine(line_1_value.left,line_1_value.y,line_1_value.right,line_1_value.y,FILL_BLACK); //draw line 2 _surface.line_2(); line_2_value = _surface.getline_2(); lcd.drawLine(line_2_value.left,line_2_value.y,line_2_value.right,line_2_value.y,FILL_BLACK); //draw line 3 _surface.line_3(); line_3_value = _surface.getline_3(); lcd.drawLine(line_3_value.left,line_3_value.y,line_3_value.right,line_3_value.y,FILL_BLACK); //draw line 4 _surface.line_4(); line_4_value = _surface.getline_4(); lcd.drawLine(line_4_value.left,line_4_value.y,line_4_value.right,line_4_value.y,FILL_BLACK); //draw line 5 _surface.line_5(); line_3_value = _surface.getline_5(); lcd.drawLine(line_5_value.left,line_5_value.y,line_5_value.right,line_5_value.y,FILL_BLACK); //draw line 6 _surface.line_6(); line_6_value = _surface.getline_6(); lcd.drawLine(line_6_value.left,line_6_value.y,line_6_value.right,line_6_value.y,FILL_BLACK); } }
Definition at line 75 of file surface.h.
Constructor & Destructor Documentation
Surface | ( | ) |
~Surface | ( | ) |
Member Function Documentation
Line getline_1 | ( | ) |
Line getline_2 | ( | ) |
Line getline_3 | ( | ) |
Line getline_4 | ( | ) |
Line getline_5 | ( | ) |
Line getline_6 | ( | ) |
void init | ( | int | y1, |
int | y2 | ||
) |
init the line at first to set the initial position.
- Parameters:
-
y1 the lower line height. y2 the upper line height.
Definition at line 7 of file surface.cpp.
void line_1 | ( | ) |
set line1 movement.
Definition at line 41 of file surface.cpp.
void line_2 | ( | ) |
set line2 movement.
Definition at line 56 of file surface.cpp.
void line_3 | ( | ) |
set line3 movement.
Definition at line 71 of file surface.cpp.
void line_4 | ( | ) |
set line4 movement.
Definition at line 86 of file surface.cpp.
void line_5 | ( | ) |
set line5 movement.
Definition at line 101 of file surface.cpp.
void line_6 | ( | ) |
set line6 movement.
Definition at line 116 of file surface.cpp.
Generated on Thu Jul 14 2022 07:54:31 by
