#include <RScreenUtils.h>
Public Methods | |
| RScreenUtils () | |
| constuctor. More... | |
| TInt | Open () |
| Initialize class. More... | |
| void | Close () |
| Close. More... | |
| void | Blank (TUint16 aColor) |
| Clear screen to color. More... | |
| void | Number (TUint aX, TUint aY, TUint32 aNumber, TUint16 aForeColor, TUint16 aBackColor) |
| Draw a number in decimal. More... | |
| void | HexNumber (TUint aX, TUint aY, TUint32 aNumber, TUint16 aForeColor, TUint16 aBackColor) |
| Draw a number in hexdecimal. More... | |
| TUint16 * | ScreenBase () |
| Base address of screen memory. More... | |
| void | DrawPicture (TPicture &aPicture) |
| Draw a picture on the screen. More... | |
| void | BlankArea (TBlank &aBlank) |
| Blank an area of the screen. More... | |
Private Methods | |
| TUint32 | BCDNumber (TUint32 aNumber) |
| Convert a number to BCD. More... | |
| void | BlankAsm (TUint16 aColor) |
| Blank the whole screen. More... | |
| void | BlankAreaAsm (TBlank *aBlank) |
| Blank an area of the screen. More... | |
| void | DrawPictureAsm (TPicture *aPicture) |
| Draw a picture on the screen. More... | |
Static Private Methods | |
| void | NumberAsm (TUint16 *aPos, TUint32 aNumber, TUint16 aForeColor, TUint16 aBackColor) |
| Draws a hex number on the screen. More... | |
Private Attributes | |
| TUint16 * | iScreenBase |
| Base address of screen memory. More... | |
This class provides utilities to plot numbers and sprites direct to the screen. It also provides the base address of the screen. All X coordinates are in steps of 2 pixels (ie one 32 bit word).
Definition at line 26 of file RScreenUtils.h.
|
|
constuctor.
Definition at line 37 of file RScreenUtils.cpp.
00037 : iScreenBase(NULL) { 00038 } |
|
|
Initialize class. Gets the screen info and works out the screen base address.
Definition at line 49 of file RScreenUtils.cpp. References iScreenBase. Referenced by CMap::ConstructL(), and RStatus::Open().
00049 {
00050 // get the screen info so we can work out the base address of the screen
00051 TPckgBuf<TScreenInfoV01> info;
00052 UserSvr::ScreenInfo(info);
00053 if(info().iScreenAddressValid==EFalse ||
00054 info().iScreenSize.iWidth!=640 ||
00055 info().iScreenSize.iHeight!=200) {
00056 return KErrNotSupported;
00057 }
00058
00059 // screen memory is 2 bytes per pixel, top 4 bits unused,
00060 // 4 bits green, 4 bits blue.
00061 iScreenBase=STATIC_CAST(TUint16*,info().iScreenAddress);
00062 // there is palette information at the start of the screen
00063 // memory, for 12 bits per pixel this is 16 2 byte entries,
00064 // the first of which defines that the pixel size is 12 bits.
00065 // actual pallete information is ignored.
00066 iScreenBase += 16;
00067 return (KErrNone);
00068 }
|
|
|
Close.
Definition at line 77 of file RScreenUtils.cpp. References iScreenBase. Referenced by RStatus::Close(), and CMap::ConstructL().
00077 {
00078 iScreenBase=NULL;
00079 }
|
|
|
Clear screen to color.
Definition at line 118 of file RScreenUtils.cpp. References BlankAsm(), and iScreenBase.
00118 {
00119 if(iScreenBase==NULL)
00120 return;
00121 BlankAsm(aColor);
00122 }
|
|
||||||||||||||||||||||||
|
Draw a number in decimal. Converts the number to binary coded decimal then calls HexNumber() to plot it.
Definition at line 92 of file RScreenUtils.cpp. References BCDNumber(), and HexNumber(). Referenced by RStatus::Update().
|
|
||||||||||||||||||||||||
|
Draw a number in hexdecimal.
Definition at line 105 of file RScreenUtils.cpp. References iScreenBase, and NumberAsm(). Referenced by Number().
00106 {
00107
00108 if(iScreenBase==NULL)
00109 return;
00110 TUint offset=aX+aY*640;
00111 NumberAsm(iScreenBase+offset,aNumber,aForeColor,aBackColor);
00112 }
|
|
|
Base address of screen memory.
Definition at line 72 of file RScreenUtils.cpp. References iScreenBase. Referenced by CMap::ConstructL().
00072 {
00073 return iScreenBase;
00074 }
|
|
|
Draw a picture on the screen.
Definition at line 25 of file RScreenUtils.cpp. References DrawPictureAsm(). Referenced by RStatus::Update(), and RStatus::UpdateSingle().
00025 {
00026 DrawPictureAsm(&aPicture);
00027 }
|
|
|
Blank an area of the screen.
Definition at line 32 of file RScreenUtils.cpp. References BlankAreaAsm(). Referenced by RStatus::UpdateSingle().
00032 {
00033 BlankAreaAsm(&aBlank);
00034 }
|
|
|
Convert a number to BCD.
Definition at line 125 of file RScreenUtils.cpp. Referenced by Number().
00125 {
00126 TUint32 out=0;
00127 TInt digit=0;
00128 while(aNumber!=0) {
00129 out += (aNumber%10) << (4*digit);
00130 digit++;
00131 aNumber /= 10;
00132 }
00133 return out;
00134 }
|
|
||||||||||||||||||||
|
Draws a hex number on the screen.
Referenced by HexNumber(). |
|
|
Blank the whole screen.
Referenced by Blank(). |
|
|
Blank an area of the screen.
Referenced by BlankArea(). |
|
|
Draw a picture on the screen.
Referenced by DrawPicture(). |
|
|
Base address of screen memory. number.s and blank.s require that this is the first data member of the object Definition at line 72 of file RScreenUtils.h. Referenced by Blank(), Close(), HexNumber(), Open(), and ScreenBase(). |