2036 mbed lab4
Dependencies: 4DGL-uLCD-SE PinDetect
Die.h@0:bbda88bee65a, 2022-03-28 (annotated)
- Committer:
- lhanks02
- Date:
- Mon Mar 28 18:44:30 2022 +0000
- Revision:
- 0:bbda88bee65a
lab4
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lhanks02 | 0:bbda88bee65a | 1 | #define WHITE 0xFFFFFF |
lhanks02 | 0:bbda88bee65a | 2 | #include "mbed.h" |
lhanks02 | 0:bbda88bee65a | 3 | |
lhanks02 | 0:bbda88bee65a | 4 | enum DieState{ROLL,REMOVED};//dice class, members are positions, colors, value of dice, and a state |
lhanks02 | 0:bbda88bee65a | 5 | class Die{ |
lhanks02 | 0:bbda88bee65a | 6 | public: |
lhanks02 | 0:bbda88bee65a | 7 | Die(int x11=0, int y11=0, int x12=0, int y12=0, int col=WHITE, int val=0){ |
lhanks02 | 0:bbda88bee65a | 8 | x1=x11; |
lhanks02 | 0:bbda88bee65a | 9 | x2=x12; |
lhanks02 | 0:bbda88bee65a | 10 | y1=y11; |
lhanks02 | 0:bbda88bee65a | 11 | y2=y12; |
lhanks02 | 0:bbda88bee65a | 12 | Color=col; |
lhanks02 | 0:bbda88bee65a | 13 | value=val; |
lhanks02 | 0:bbda88bee65a | 14 | currDieState=ROLL; |
lhanks02 | 0:bbda88bee65a | 15 | }; |
lhanks02 | 0:bbda88bee65a | 16 | void rollDie(); |
lhanks02 | 0:bbda88bee65a | 17 | void drawDie();//functions for rolling, drawing, and setting and getting data members |
lhanks02 | 0:bbda88bee65a | 18 | void setCurrDieState(DieState v); |
lhanks02 | 0:bbda88bee65a | 19 | DieState getCurrDieState(); |
lhanks02 | 0:bbda88bee65a | 20 | int getx1(); |
lhanks02 | 0:bbda88bee65a | 21 | int getx2(); |
lhanks02 | 0:bbda88bee65a | 22 | int gety1(); |
lhanks02 | 0:bbda88bee65a | 23 | int gety2(); |
lhanks02 | 0:bbda88bee65a | 24 | int getColor(); |
lhanks02 | 0:bbda88bee65a | 25 | int getValue(); |
lhanks02 | 0:bbda88bee65a | 26 | |
lhanks02 | 0:bbda88bee65a | 27 | |
lhanks02 | 0:bbda88bee65a | 28 | private: |
lhanks02 | 0:bbda88bee65a | 29 | int x1; |
lhanks02 | 0:bbda88bee65a | 30 | int x2; |
lhanks02 | 0:bbda88bee65a | 31 | int y1; |
lhanks02 | 0:bbda88bee65a | 32 | int y2; |
lhanks02 | 0:bbda88bee65a | 33 | int Color; |
lhanks02 | 0:bbda88bee65a | 34 | int value; |
lhanks02 | 0:bbda88bee65a | 35 | DieState currDieState; |
lhanks02 | 0:bbda88bee65a | 36 | |
lhanks02 | 0:bbda88bee65a | 37 | |
lhanks02 | 0:bbda88bee65a | 38 | }; |