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: N5110 mbed PowerControl
Diff: GameScreen.cpp
- Revision:
- 6:b1c54f8b28fe
- Parent:
- 5:d395a7134278
- Child:
- 8:ebddb721f1ee
--- a/GameScreen.cpp Mon Mar 09 21:14:47 2015 +0000 +++ b/GameScreen.cpp Tue Mar 10 02:32:10 2015 +0000 @@ -159,5 +159,38 @@ return closestPlatform; } +//@Override of base class function +//had to override and rewrite since N5110 is written to write horizontal this needs vertical +// this function reads existing font5x7 and rotate matrix to become font7x5 matrix. +// +// for example the number 4 font5x7 = 0x18,0x14,0x12,0x7F,0x10 +// font7x5 = 0x02,0x06,0x10,0x12,0x1E,0x2,0x2 +//then it is printed! +void GameScreen::printString(const char * str,int x,int y) +{ + while (*str) + { + //each byte in row + for (int i = 0; i < 5; i++) + { + //each bit in byte + for (int b = 1; i < 8; b++) + { + if (font5x7[(*str - 32)*5 + i] & (2^b)) //bitwise comparison + { + + setPixel(y+b-1,x-i); + } + else + clearPixel(y+b-1,x-i); + } + } + str++; + + } + refresh(); + + +}