00001
00002
00035 #ifndef GFX_FUNC_H
00036 #define GFX_FUNC_H
00037
00038 #include "gfx_type.h"
00039 #include "strings_type.h"
00040
00041 void GameLoop();
00042
00043 void CreateConsole();
00044
00045 extern byte _dirkeys;
00046 extern bool _fullscreen;
00047 extern CursorVars _cursor;
00048 extern bool _ctrl_pressed;
00049 extern bool _shift_pressed;
00050 extern byte _fast_forward;
00051
00052 extern bool _left_button_down;
00053 extern bool _left_button_clicked;
00054 extern bool _right_button_down;
00055 extern bool _right_button_clicked;
00056
00057 extern DrawPixelInfo _screen;
00058 extern bool _screen_disable_anim;
00059
00060 extern int _pal_first_dirty;
00061 extern int _pal_count_dirty;
00062 extern int _num_resolutions;
00063 extern uint16 _resolutions[32][2];
00064 extern uint16 _cur_resolution[2];
00065 extern Colour _cur_palette[256];
00066
00067 void HandleKeypress(uint32 key);
00068 void HandleCtrlChanged();
00069 void HandleMouseEvents();
00070 void CSleep(int milliseconds);
00071 void UpdateWindows();
00072
00073 void DrawChatMessage();
00074 void DrawMouseCursor();
00075 void ScreenSizeChanged();
00076 void HandleExitGameRequest();
00077 void GameSizeChanged();
00078 void UndrawMouseCursor();
00079
00080 void RedrawScreenRect(int left, int top, int right, int bottom);
00081 void GfxScroll(int left, int top, int width, int height, int xo, int yo);
00082
00083 void DrawSprite(SpriteID img, SpriteID pal, int x, int y, const SubSprite *sub = NULL);
00084
00085 int DrawStringCentered(int x, int y, StringID str, uint16 color);
00086 int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, uint16 color);
00087 int DoDrawStringCentered(int x, int y, const char *str, uint16 color);
00088
00089 int DrawString(int x, int y, StringID str, uint16 color);
00090 int DrawStringTruncated(int x, int y, StringID str, uint16 color, uint maxw);
00091
00092 int DoDrawString(const char *string, int x, int y, uint16 color);
00093 int DoDrawStringTruncated(const char *str, int x, int y, uint16 color, uint maxw);
00094
00095 void DrawStringCenterUnderline(int x, int y, StringID str, uint16 color);
00096 void DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, uint16 color);
00097
00098 int DrawStringRightAligned(int x, int y, StringID str, uint16 color);
00099 void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw);
00100 void DrawStringRightAlignedUnderline(int x, int y, StringID str, uint16 color);
00101
00102 void GfxFillRect(int left, int top, int right, int bottom, int color);
00103 void GfxDrawLine(int left, int top, int right, int bottom, int color);
00104 void DrawBox(int x, int y, int dx1, int dy1, int dx2, int dy2, int dx3, int dy3);
00105
00106 Dimension GetStringBoundingBox(const char *str);
00107 uint32 FormatStringLinebreaks(char *str, int maxw);
00108 void LoadStringWidthTable();
00109 void DrawStringMultiCenter(int x, int y, StringID str, int maxw);
00110 uint DrawStringMultiLine(int x, int y, StringID str, int maxw, int maxh = -1);
00111
00117 void DrawDirtyBlocks();
00118
00124 void SetDirtyBlocks(int left, int top, int right, int bottom);
00125
00131 void MarkWholeScreenDirty();
00132
00133 void GfxInitPalettes();
00134
00135 bool FillDrawPixelInfo(DrawPixelInfo* n, int left, int top, int width, int height);
00136
00137
00138 void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
00139
00140 void SetMouseCursor(SpriteID sprite, SpriteID pal);
00141 void SetAnimatedMouseCursor(const AnimCursor *table);
00142 void CursorTick();
00143 void DrawMouseCursor();
00144 void ScreenSizeChanged();
00145 void UndrawMouseCursor();
00146 bool ChangeResInGame(int w, int h);
00147 void SortResolutions(int count);
00148 bool ToggleFullScreen(bool fs);
00149
00150
00151 #define ASCII_LETTERSTART 32
00152 extern FontSize _cur_fontsize;
00153
00154 byte GetCharacterWidth(FontSize size, uint32 key);
00155
00156 static inline byte GetCharacterHeight(FontSize size)
00157 {
00158 switch (size) {
00159 default: NOT_REACHED();
00160 case FS_NORMAL: return 10;
00161 case FS_SMALL: return 6;
00162 case FS_LARGE: return 18;
00163 }
00164 }
00165
00166 extern DrawPixelInfo *_cur_dpi;
00167
00172 extern byte _colour_gradient[16][8];
00173
00174 extern bool _use_dos_palette;
00175
00176 #endif