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
Objects/Object.h@43:2cd1cfe07770, 2020-05-18 (annotated)
- Committer:
- el19tb
- Date:
- Mon May 18 06:34:53 2020 +0000
- Revision:
- 43:2cd1cfe07770
- Parent:
- 40:8cc82e3fce06
- Child:
- 46:e39abe665271
fixed bugs throughout program, fixed array size issue, fixed functions
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| el19tb | 31:70521f37e004 | 1 | #ifndef OBJECT_H |
| el19tb | 31:70521f37e004 | 2 | #define OBJECT_H |
| el19tb | 31:70521f37e004 | 3 | |
| el19tb | 31:70521f37e004 | 4 | // holds information about object |
| el19tb | 31:70521f37e004 | 5 | struct ObjectInfo |
| el19tb | 31:70521f37e004 | 6 | { |
| el19tb | 31:70521f37e004 | 7 | float x; // x pos |
| el19tb | 31:70521f37e004 | 8 | int y; // y pos |
| el19tb | 31:70521f37e004 | 9 | int dir; // direction of object |
| el19tb | 31:70521f37e004 | 10 | char c; // type of object |
| el19tb | 31:70521f37e004 | 11 | }; |
| el19tb | 31:70521f37e004 | 12 | |
| el19tb | 38:a6e040bf0e35 | 13 | struct Rect |
| el19tb | 38:a6e040bf0e35 | 14 | { |
| el19tb | 38:a6e040bf0e35 | 15 | float right_side; |
| el19tb | 38:a6e040bf0e35 | 16 | float left_side; |
| el19tb | 38:a6e040bf0e35 | 17 | float up; |
| el19tb | 38:a6e040bf0e35 | 18 | float bottom; |
| el19tb | 38:a6e040bf0e35 | 19 | }; |
| el19tb | 38:a6e040bf0e35 | 20 | |
| el19tb | 31:70521f37e004 | 21 | // keeps track of functions related to Objects |
| el19tb | 31:70521f37e004 | 22 | class Object |
| el19tb | 31:70521f37e004 | 23 | { |
| el19tb | 31:70521f37e004 | 24 | public: |
| el19tb | 38:a6e040bf0e35 | 25 | // constructor |
| el19tb | 31:70521f37e004 | 26 | Object(); |
| el19tb | 31:70521f37e004 | 27 | |
| el19tb | 31:70521f37e004 | 28 | int slow; |
| el19tb | 31:70521f37e004 | 29 | int medium; |
| el19tb | 31:70521f37e004 | 30 | int fast; |
| el19tb | 31:70521f37e004 | 31 | |
| el19tb | 32:84e79aa7858c | 32 | int row; |
| el19tb | 38:a6e040bf0e35 | 33 | |
| el19tb | 38:a6e040bf0e35 | 34 | int seperation; |
| el19tb | 38:a6e040bf0e35 | 35 | int grid; |
| el19tb | 38:a6e040bf0e35 | 36 | int size; |
| el19tb | 40:8cc82e3fce06 | 37 | int speed; |
| el19tb | 32:84e79aa7858c | 38 | |
| el19tb | 31:70521f37e004 | 39 | int screenWidth; |
| el19tb | 31:70521f37e004 | 40 | int screenHeight; |
| el19tb | 31:70521f37e004 | 41 | |
| el19tb | 31:70521f37e004 | 42 | ObjectInfo object; |
| el19tb | 38:a6e040bf0e35 | 43 | Rect rectangle; // used to check for collision |
| el19tb | 31:70521f37e004 | 44 | |
| el19tb | 31:70521f37e004 | 45 | public: |
| el19tb | 31:70521f37e004 | 46 | |
| el19tb | 31:70521f37e004 | 47 | void setRow(int row); |
| el19tb | 31:70521f37e004 | 48 | void setSeperation(int seperation); |
| el19tb | 31:70521f37e004 | 49 | void setSprite(char type); |
| el19tb | 38:a6e040bf0e35 | 50 | void determineVehicleRecParamaters(char c); |
| el19tb | 38:a6e040bf0e35 | 51 | void createRect(int x, int y); |
| el19tb | 38:a6e040bf0e35 | 52 | void determineLogRecParamaters(char c); |
| el19tb | 38:a6e040bf0e35 | 53 | void setDir(int dir); |
| el19tb | 38:a6e040bf0e35 | 54 | void speedSlow(int dir); |
| el19tb | 38:a6e040bf0e35 | 55 | void speedMedium(int dir); |
| el19tb | 38:a6e040bf0e35 | 56 | void speedFast(int dir); |
| el19tb | 38:a6e040bf0e35 | 57 | void initializeLogParameters(); |
| el19tb | 43:2cd1cfe07770 | 58 | void initializeScreenParameters(); |
| el19tb | 38:a6e040bf0e35 | 59 | |
| el19tb | 31:70521f37e004 | 60 | }; |
| el19tb | 31:70521f37e004 | 61 | |
| el19tb | 31:70521f37e004 | 62 | #endif |