94 |
94 |
95 typedef struct Rect { |
95 typedef struct Rect { |
96 int left,top,right,bottom; |
96 int left,top,right,bottom; |
97 } Rect; |
97 } Rect; |
98 |
98 |
|
99 /** A single sprite of a list of animated cursors */ |
|
100 struct AnimCursor { |
|
101 static const CursorID LAST = MAX_UVALUE(CursorID); |
|
102 CursorID sprite; ///< Must be set to LAST_ANIM when it is the last sprite of the loop |
|
103 byte display_time; ///< Amount of ticks this sprite will be shown |
|
104 }; |
99 |
105 |
100 typedef struct CursorVars { |
106 typedef struct CursorVars { |
101 Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement |
107 Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement |
102 Point draw_pos, draw_size; ///< position and size bounding-box for drawing |
108 Point draw_pos, draw_size; ///< position and size bounding-box for drawing |
103 SpriteID sprite; ///< current image of cursor |
109 SpriteID sprite; ///< current image of cursor |
104 SpriteID pal; |
110 SpriteID pal; |
105 |
111 |
106 int wheel; ///< mouse wheel movement |
112 int wheel; ///< mouse wheel movement |
107 const CursorID *animate_list, *animate_cur; ///< in case of animated cursor, list of frames |
113 const AnimCursor *animate_list; ///< in case of animated cursor, list of frames |
108 uint animate_timeout; ///< current frame in list of animated cursor |
114 const AnimCursor *animate_cur; ///< in case of animated cursor, current frame |
|
115 uint animate_timeout; ///< in case of animated cursor, number of ticks to show the current cursor |
109 |
116 |
110 bool visible; ///< cursor is visible |
117 bool visible; ///< cursor is visible |
111 bool dirty; ///< the rect occupied by the mouse is dirty (redraw) |
118 bool dirty; ///< the rect occupied by the mouse is dirty (redraw) |
112 bool fix_at; ///< mouse is moving, but cursor is not (used for scrolling) |
119 bool fix_at; ///< mouse is moving, but cursor is not (used for scrolling) |
113 bool in_window; ///< mouse inside this window, determines drawing logic |
120 bool in_window; ///< mouse inside this window, determines drawing logic |
224 /* window.c */ |
231 /* window.c */ |
225 void DrawOverlappedWindowForAll(int left, int top, int right, int bottom); |
232 void DrawOverlappedWindowForAll(int left, int top, int right, int bottom); |
226 |
233 |
227 void SetMouseCursor(CursorID cursor); |
234 void SetMouseCursor(CursorID cursor); |
228 void SetMouseCursor(SpriteID sprite, SpriteID pal); |
235 void SetMouseCursor(SpriteID sprite, SpriteID pal); |
229 void SetAnimatedMouseCursor(const CursorID *table); |
236 void SetAnimatedMouseCursor(const AnimCursor *table); |
230 void CursorTick(void); |
237 void CursorTick(void); |
231 void DrawMouseCursor(void); |
238 void DrawMouseCursor(void); |
232 void ScreenSizeChanged(void); |
239 void ScreenSizeChanged(void); |
233 void UndrawMouseCursor(void); |
240 void UndrawMouseCursor(void); |
234 bool ChangeResInGame(int w, int h); |
241 bool ChangeResInGame(int w, int h); |