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: 25LCxxx_SPI CommonTypes Gameduino mbed
PlayerName.cpp@0:5fa232ee5fdf, 2013-06-04 (annotated)
- Committer:
- RichardE
- Date:
- Tue Jun 04 20:16:33 2013 +0000
- Revision:
- 0:5fa232ee5fdf
Started conversion from Maple version of game. So far Gameduino seems to have been initialised OK and just displays a sign on message. Lots of commented out code.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| RichardE | 0:5fa232ee5fdf | 1 | /* |
| RichardE | 0:5fa232ee5fdf | 2 | * SOURCE FILE : PlayerName.cpp |
| RichardE | 0:5fa232ee5fdf | 3 | * |
| RichardE | 0:5fa232ee5fdf | 4 | * Definition of class PlayerName. |
| RichardE | 0:5fa232ee5fdf | 5 | * Contains the name that appears in a high score table for example. |
| RichardE | 0:5fa232ee5fdf | 6 | * |
| RichardE | 0:5fa232ee5fdf | 7 | */ |
| RichardE | 0:5fa232ee5fdf | 8 | |
| RichardE | 0:5fa232ee5fdf | 9 | #include "PlayerName.h" |
| RichardE | 0:5fa232ee5fdf | 10 | |
| RichardE | 0:5fa232ee5fdf | 11 | /***************/ |
| RichardE | 0:5fa232ee5fdf | 12 | /* CONSTRUCTOR */ |
| RichardE | 0:5fa232ee5fdf | 13 | /***************/ |
| RichardE | 0:5fa232ee5fdf | 14 | PlayerName::PlayerName() { |
| RichardE | 0:5fa232ee5fdf | 15 | // Initialise name to all 'X' characters. |
| RichardE | 0:5fa232ee5fdf | 16 | for( UInt8 i = 0; i < Length; ++i ) { |
| RichardE | 0:5fa232ee5fdf | 17 | Name[ i ] = 'X'; |
| RichardE | 0:5fa232ee5fdf | 18 | } |
| RichardE | 0:5fa232ee5fdf | 19 | Name[ Length ] = (char)0; |
| RichardE | 0:5fa232ee5fdf | 20 | } |
| RichardE | 0:5fa232ee5fdf | 21 | |
| RichardE | 0:5fa232ee5fdf | 22 | /**************/ |
| RichardE | 0:5fa232ee5fdf | 23 | /* DESTRUCTOR */ |
| RichardE | 0:5fa232ee5fdf | 24 | /**************/ |
| RichardE | 0:5fa232ee5fdf | 25 | PlayerName::~PlayerName() { |
| RichardE | 0:5fa232ee5fdf | 26 | } |
| RichardE | 0:5fa232ee5fdf | 27 | |
| RichardE | 0:5fa232ee5fdf | 28 | /************************************************************/ |
| RichardE | 0:5fa232ee5fdf | 29 | /* COPY ONE NAME TO ANOTHER WITHOUT CREATING A NEW INSTANCE */ |
| RichardE | 0:5fa232ee5fdf | 30 | /************************************************************/ |
| RichardE | 0:5fa232ee5fdf | 31 | // Pass pointer to name to copy to in dest. |
| RichardE | 0:5fa232ee5fdf | 32 | void PlayerName::CopyTo( PlayerName *dest ) const { |
| RichardE | 0:5fa232ee5fdf | 33 | for( UInt8 i = 0; i < Length; ++i ) { |
| RichardE | 0:5fa232ee5fdf | 34 | dest->Name[ i ] = Name[ i ]; |
| RichardE | 0:5fa232ee5fdf | 35 | } |
| RichardE | 0:5fa232ee5fdf | 36 | dest->Name[ Length ] = (char)0; |
| RichardE | 0:5fa232ee5fdf | 37 | } |
| RichardE | 0:5fa232ee5fdf | 38 |