gfx_type.h

Go to the documentation of this file.
00001 /* $Id: gfx_type.h 15428 2009-02-09 02:57:15Z rubidium $ */
00002 
00005 #ifndef GFX_TYPE_H
00006 #define GFX_TYPE_H
00007 
00008 #include "core/endian_type.hpp"
00009 #include "core/enum_type.hpp"
00010 #include "core/geometry_type.hpp"
00011 #include "zoom_type.h"
00012 
00013 typedef uint32 SpriteID;      
00014 
00016 struct PalSpriteID {
00017   SpriteID sprite;  
00018   SpriteID pal;     
00019 };
00020 typedef int32 CursorID;
00021 
00022 enum WindowKeyCodes {
00023   WKC_SHIFT = 0x8000,
00024   WKC_CTRL  = 0x4000,
00025   WKC_ALT   = 0x2000,
00026   WKC_META  = 0x1000,
00027 
00028   /* Special ones */
00029   WKC_NONE        =  0,
00030   WKC_ESC         =  1,
00031   WKC_BACKSPACE   =  2,
00032   WKC_INSERT      =  3,
00033   WKC_DELETE      =  4,
00034 
00035   WKC_PAGEUP      =  5,
00036   WKC_PAGEDOWN    =  6,
00037   WKC_END         =  7,
00038   WKC_HOME        =  8,
00039 
00040   /* Arrow keys */
00041   WKC_LEFT        =  9,
00042   WKC_UP          = 10,
00043   WKC_RIGHT       = 11,
00044   WKC_DOWN        = 12,
00045 
00046   /* Return & tab */
00047   WKC_RETURN      = 13,
00048   WKC_TAB         = 14,
00049 
00050   /* Space */
00051   WKC_SPACE       = 32,
00052 
00053   /* Function keys */
00054   WKC_F1          = 33,
00055   WKC_F2          = 34,
00056   WKC_F3          = 35,
00057   WKC_F4          = 36,
00058   WKC_F5          = 37,
00059   WKC_F6          = 38,
00060   WKC_F7          = 39,
00061   WKC_F8          = 40,
00062   WKC_F9          = 41,
00063   WKC_F10         = 42,
00064   WKC_F11         = 43,
00065   WKC_F12         = 44,
00066 
00067   /* Backquote is the key left of "1"
00068    * we only store this key here, no matter what character is really mapped to it
00069    * on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °) */
00070   WKC_BACKQUOTE   = 45,
00071   WKC_PAUSE       = 46,
00072 
00073   /* 0-9 are mapped to 48-57
00074    * A-Z are mapped to 65-90
00075    * a-z are mapped to 97-122 */
00076 
00077   /* Numerical keyboard */
00078   WKC_NUM_DIV     = 138,
00079   WKC_NUM_MUL     = 139,
00080   WKC_NUM_MINUS   = 140,
00081   WKC_NUM_PLUS    = 141,
00082   WKC_NUM_ENTER   = 142,
00083   WKC_NUM_DECIMAL = 143,
00084 
00085   /* Other keys */
00086   WKC_SLASH       = 144, 
00087   WKC_SEMICOLON   = 145, 
00088   WKC_EQUALS      = 146, 
00089   WKC_L_BRACKET   = 147, 
00090   WKC_BACKSLASH   = 148, 
00091   WKC_R_BRACKET   = 149, 
00092   WKC_SINGLEQUOTE = 150, 
00093   WKC_COMMA       = 151, 
00094   WKC_PERIOD      = 152, 
00095   WKC_MINUS       = 153, 
00096 };
00097 
00099 struct AnimCursor {
00100   static const CursorID LAST = MAX_UVALUE(CursorID);
00101   CursorID sprite;   
00102   byte display_time; 
00103 };
00104 
00106 struct CursorVars {
00107   Point pos, size, offs, delta; 
00108   Point draw_pos, draw_size;    
00109   int short_vehicle_offset;     
00110   SpriteID sprite; 
00111   SpriteID pal;
00112 
00113   int wheel;       
00114 
00115   /* We need two different vars to keep track of how far the scrollwheel moved.
00116    * OSX uses this for scrolling around the map. */
00117   int v_wheel;
00118   int h_wheel;
00119 
00120   const AnimCursor *animate_list; 
00121   const AnimCursor *animate_cur;  
00122   uint animate_timeout;           
00123 
00124   bool visible;    
00125   bool dirty;      
00126   bool fix_at;     
00127   bool in_window;  
00128 
00129   bool vehchain;   
00130 };
00131 
00132 struct DrawPixelInfo {
00133   void *dst_ptr;
00134   int left, top, width, height;
00135   int pitch;
00136   ZoomLevel zoom;
00137 };
00138 
00139 struct Colour {
00140 #if TTD_ENDIAN == TTD_BIG_ENDIAN
00141   uint8 a, r, g, b; 
00142 #else
00143   uint8 b, g, r, a; 
00144 #endif /* TTD_ENDIAN == TTD_BIG_ENDIAN */
00145 
00146   operator uint32 () const { return *(uint32 *)this; }
00147 };
00148 
00150 enum FontSize {
00151   FS_NORMAL,
00152   FS_SMALL,
00153   FS_LARGE,
00154   FS_END,
00155 };
00156 DECLARE_POSTFIX_INCREMENT(FontSize);
00157 
00163 struct SubSprite {
00164   int left, top, right, bottom;
00165 };
00166 
00167 enum Colours {
00168   COLOUR_DARK_BLUE,
00169   COLOUR_PALE_GREEN,
00170   COLOUR_PINK,
00171   COLOUR_YELLOW,
00172   COLOUR_RED,
00173   COLOUR_LIGHT_BLUE,
00174   COLOUR_GREEN,
00175   COLOUR_DARK_GREEN,
00176   COLOUR_BLUE,
00177   COLOUR_CREAM,
00178   COLOUR_MAUVE,
00179   COLOUR_PURPLE,
00180   COLOUR_ORANGE,
00181   COLOUR_BROWN,
00182   COLOUR_GREY,
00183   COLOUR_WHITE,
00184   COLOUR_END,
00185   INVALID_COLOUR = 0xFF,
00186 };
00187 
00189 enum TextColour {
00190   TC_FROMSTRING  = 0x00,
00191   TC_BLUE        = 0x00,
00192   TC_SILVER      = 0x01,
00193   TC_GOLD        = 0x02,
00194   TC_RED         = 0x03,
00195   TC_PURPLE      = 0x04,
00196   TC_LIGHT_BROWN = 0x05,
00197   TC_ORANGE      = 0x06,
00198   TC_GREEN       = 0x07,
00199   TC_YELLOW      = 0x08,
00200   TC_DARK_GREEN  = 0x09,
00201   TC_CREAM       = 0x0A,
00202   TC_BROWN       = 0x0B,
00203   TC_WHITE       = 0x0C,
00204   TC_LIGHT_BLUE  = 0x0D,
00205   TC_GREY        = 0x0E,
00206   TC_DARK_BLUE   = 0x0F,
00207   TC_BLACK       = 0x10,
00208   TC_INVALID     = 0xFF,
00209 
00210   IS_PALETTE_COLOUR = 0x100, 
00211 };
00212 DECLARE_ENUM_AS_BIT_SET(TextColour);
00213 
00215 enum PaletteAnimationSizes {
00216   PALETTE_ANIM_SIZE_WIN   = 28,   
00217   PALETTE_ANIM_SIZE_DOS   = 38,   
00218   PALETTE_ANIM_SIZE_START = 217,  
00219 };
00220 
00222 enum FillRectMode {
00223   FILLRECT_OPAQUE,  
00224   FILLRECT_CHECKER, 
00225   FILLRECT_RECOLOUR, 
00226 };
00227 
00229 enum PaletteType {
00230   PAL_DOS,        
00231   PAL_WINDOWS,    
00232   PAL_AUTODETECT, 
00233   MAX_PAL = 2,    
00234 };
00235 
00237 enum SpriteType {
00238   ST_NORMAL   = 0,      
00239   ST_MAPGEN   = 1,      
00240   ST_FONT     = 2,      
00241   ST_RECOLOUR = 3,      
00242   ST_INVALID  = 4,      
00243 };
00244 
00245 #endif /* GFX_TYPE_H */

Generated on Mon Feb 16 23:12:06 2009 for openttd by  doxygen 1.5.6