gfx_type.h

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

Generated on Wed Jan 20 23:38:35 2010 for OpenTTD by  doxygen 1.5.6