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
hole.cpp@0:1465fd20e75b, 2017-04-26 (annotated)
- Committer:
- weixitao
- Date:
- Wed Apr 26 16:38:33 2017 +0000
- Revision:
- 0:1465fd20e75b
- Child:
- 1:83459533ff72
four holes and treasure and man
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| weixitao | 0:1465fd20e75b | 1 | #include "Treasure.h" |
| weixitao | 0:1465fd20e75b | 2 | #include "N5110.h" |
| weixitao | 0:1465fd20e75b | 3 | #include "hole.h" |
| weixitao | 0:1465fd20e75b | 4 | extern N5110 lcd; |
| weixitao | 0:1465fd20e75b | 5 | |
| weixitao | 0:1465fd20e75b | 6 | void hole::hole_place() |
| weixitao | 0:1465fd20e75b | 7 | { |
| weixitao | 0:1465fd20e75b | 8 | |
| weixitao | 0:1465fd20e75b | 9 | //top left |
| weixitao | 0:1465fd20e75b | 10 | holeX = rand()%27+5; |
| weixitao | 0:1465fd20e75b | 11 | holeY = rand()%14+5; |
| weixitao | 0:1465fd20e75b | 12 | |
| weixitao | 0:1465fd20e75b | 13 | // top right |
| weixitao | 0:1465fd20e75b | 14 | holeX1 = rand()%27+47; |
| weixitao | 0:1465fd20e75b | 15 | holeY1 = rand()%14+5; |
| weixitao | 0:1465fd20e75b | 16 | |
| weixitao | 0:1465fd20e75b | 17 | // button left |
| weixitao | 0:1465fd20e75b | 18 | holeX2 = rand()%27+5; |
| weixitao | 0:1465fd20e75b | 19 | holeY2 = rand()%14+29; |
| weixitao | 0:1465fd20e75b | 20 | |
| weixitao | 0:1465fd20e75b | 21 | //button right |
| weixitao | 0:1465fd20e75b | 22 | holeX3 = rand()%27+47; |
| weixitao | 0:1465fd20e75b | 23 | holeY3 = rand()%14+29; |
| weixitao | 0:1465fd20e75b | 24 | } |
| weixitao | 0:1465fd20e75b | 25 | |
| weixitao | 0:1465fd20e75b | 26 | void hole::hole_show() |
| weixitao | 0:1465fd20e75b | 27 | { |
| weixitao | 0:1465fd20e75b | 28 | |
| weixitao | 0:1465fd20e75b | 29 | lcd.drawCircle(holeX,holeY,5,FILL_BLACK); |
| weixitao | 0:1465fd20e75b | 30 | lcd.drawCircle(holeX1,holeY1,5,FILL_BLACK); |
| weixitao | 0:1465fd20e75b | 31 | lcd.drawCircle(holeX2,holeY2,5,FILL_BLACK); |
| weixitao | 0:1465fd20e75b | 32 | lcd.drawCircle(holeX3,holeY3,5,FILL_BLACK); |
| weixitao | 0:1465fd20e75b | 33 | |
| weixitao | 0:1465fd20e75b | 34 | |
| weixitao | 0:1465fd20e75b | 35 | } |