MOUSE.H (5815B)
1 // 2 // Copyright 2020 Electronic Arts Inc. 3 // 4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 5 // software: you can redistribute it and/or modify it under the terms of 6 // the GNU General Public License as published by the Free Software Foundation, 7 // either version 3 of the License, or (at your option) any later version. 8 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 /*********************************************************************************************** 17 * * 18 * Project Name : Westwood 32 Bit Library * 19 * * 20 * File Name : MOUSE.H * 21 * * 22 * Programmer : Philip W. Gorrow * 23 * * 24 * Start Date : 12/12/95 * 25 * * 26 * Last Update : December 12, 1995 [PWG] * 27 * * 28 *---------------------------------------------------------------------------------------------* 29 * Functions: * 30 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 31 32 #ifndef WW_MOUSE_H 33 #define WW_MOUSE_H 34 35 #include <gbuffer.h> 36 37 class WWMouseClass { 38 public: 39 WWMouseClass(GraphicViewPortClass *scr, int mouse_max_width, int mouse_max_height); 40 ~WWMouseClass(); 41 void *Set_Cursor(int xhotspot, int yhotspot, void *cursor); 42 void Process_Mouse(void); 43 void Hide_Mouse(void); 44 void Show_Mouse(void); 45 void Conditional_Hide_Mouse(int x1, int y1, int x2, int y2); 46 void Conditional_Show_Mouse(void); 47 int Get_Mouse_State(void); 48 int Get_Mouse_X(void); 49 int Get_Mouse_Y(void); 50 void Get_Mouse_XY(int &x, int &y); 51 // 52 // The following two routines can be used to render the mouse onto a graphicbuffer 53 // other than the hidpage. 54 // 55 void Draw_Mouse(GraphicViewPortClass *scr); 56 void Erase_Mouse(GraphicViewPortClass *scr, int forced = FALSE); 57 58 void Block_Mouse(GraphicBufferClass *buffer); 59 void Unblock_Mouse(GraphicBufferClass *buffer); 60 void Set_Cursor_Clip(void); 61 void Clear_Cursor_Clip(void); 62 63 private: 64 enum { 65 CONDHIDE = 1, 66 CONDHIDDEN = 2, 67 }; 68 void Low_Hide_Mouse(void); 69 void Low_Show_Mouse(int x, int y); 70 71 char *MouseCursor; // pointer to the mouse cursor in memory 72 int MouseXHot; // X hot spot of the current mouse cursor 73 int MouseYHot; // Y hot spot of the current mouse cursor 74 int CursorWidth; // width of the mouse cursor in pixels 75 int CursorHeight; // height of the mouse cursor in pixels 76 77 char *MouseBuffer; // pointer to background buffer in memory 78 int MouseBuffX; // pixel x mouse buffer was preserved at 79 int MouseBuffY; // pixel y mouse buffer was preserved at 80 int MaxWidth; // maximum width of mouse background buffer 81 int MaxHeight; // maximum height of mouse background buffer 82 83 int MouseCXLeft; // left x pos if conditional hide mouse in effect 84 int MouseCYUpper; // upper y pos if conditional hide mouse in effect 85 int MouseCXRight; // right x pos if conditional hide mouse in effect 86 int MouseCYLower; // lower y pos if conditional hide mouse in effect 87 char MCFlags; // conditional hide mouse flags 88 char MCCount; // nesting count for conditional hide mouse 89 90 GraphicViewPortClass *Screen; // pointer to the surface mouse was init'd with 91 char * PrevCursor; // pointer to previous cursor shape 92 int MouseUpdate; 93 int State; 94 95 char *EraseBuffer; // Buffer which holds background to restore to hidden page 96 int EraseBuffX; // X position of the hidden page background 97 int EraseBuffY; // Y position of the hidden page background 98 int EraseBuffHotX; // X position of the hidden page background 99 int EraseBuffHotY; // Y position of the hidden page background 100 101 int EraseFlags; // Records whether mutex has been released 102 103 CRITICAL_SECTION MouseCriticalSection; // Control for mouse re-enterancy 104 unsigned TimerHandle; 105 106 }; 107 108 extern "C" { 109 void __cdecl Mouse_Shadow_Buffer(void *thisptr, GraphicViewPortClass *srcdst, void *buffer, int x, int y, int hotx, int hoty, int store); 110 void __cdecl Draw_Mouse(void *thisptr, GraphicViewPortClass *srcdst, int x, int y); 111 void * __cdecl ASM_Set_Mouse_Cursor(void * thisptr, int hotspotx, int hotspoty, VOID *cursor); 112 }; 113 114 void Hide_Mouse(void); 115 void Show_Mouse(void); 116 void Conditional_Hide_Mouse(int x1, int y1, int x2, int y2); 117 void Conditional_Show_Mouse(void); 118 int Get_Mouse_State(void); 119 void *Set_Mouse_Cursor(int hotx, int hoty, void *cursor); 120 int Get_Mouse_X(void); 121 int Get_Mouse_Y(void); 122 123 #endif