utility.h
Go to the documentation of this file.00001 00002 // 00003 // PocketHAL 00004 // Copyright 2004 by Thierry Tremblay 00005 // 00007 00008 #ifndef POCKETHAL_UTIL_H 00009 #define POCKETHAL_UTIL_H 00010 00011 #include <PocketHAL/surface.h> 00012 00013 #undef DrawText // Prevent conflict with win32's DrawText() 00014 00015 00016 00017 namespace PHAL 00018 { 00019 00021 // 00022 // Color constants 00023 // 00025 00026 const uint16_t COLOR_BLACK = 0x0000; 00027 const uint16_t COLOR_DARKGRAY = 0x4208; 00028 const uint16_t COLOR_GRAY = 0x8410; 00029 const uint16_t COLOR_LIGHTGRAY = 0xC618; 00030 const uint16_t COLOR_WHITE = 0xFFFF; 00031 00032 const uint16_t COLOR_RED = 0x1F << 11; 00033 const uint16_t COLOR_GREEN = 0x3F << 5; 00034 const uint16_t COLOR_BLUE = 0x1F; 00035 00036 const uint16_t COLOR_YELLOW = COLOR_RED | COLOR_GREEN; 00037 const uint16_t COLOR_PINK = COLOR_RED | COLOR_BLUE; 00038 const uint16_t COLOR_CYAN = COLOR_GREEN | COLOR_BLUE; 00039 00040 00041 00043 // 00044 // Utility functions 00045 // 00047 00048 // Clear the surface with the specified color 00049 void Clear( Surface* surface, uint16_t color ); 00050 00051 // Draw a character at the specified location 00052 // Return true on success or false if the character would be drawn outside the surface dimensions. 00053 bool DrawChar( Surface* surface, int x, int y, char character, uint16_t color = COLOR_WHITE ); 00054 00055 // Draw some text at the specified location 00056 void DrawText( Surface* surface, int x, int y, const char* text, uint16_t color = COLOR_WHITE ); 00057 00058 00059 00060 } // end of namespace PHAL 00061 00062 00063 00064 #endif
