gfx_type.h

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

Generated on Wed Dec 23 23:27:50 2009 for OpenTTD by  doxygen 1.5.6