Virtual U.org
Get Personal Training on VU Today
    
Top shadow
 
 register/help
User Name:

Password:

OMOUSECR.H Source File
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

OMOUSECR.H

Go to the documentation of this file.
00001 //Filename    : OMOUSECR.H
00002 //Description : Header file of Object Cursor resource
00003 
00004 #ifndef __OMOUSECR_H
00005 #define __OMOUSECR_H
00006 
00007 #include <ORESDB.H>
00008 #include <OBLOB2W.H>
00009 
00010 // ------------ Define constant -------- //
00011 
00012 #define MAX_VGA_WIDTH 800
00013 #define MAX_VGA_HEIGHT 600
00014 
00015 //------------ Define cursor id. ----------//
00016 
00017 enum {
00018     CURSOR_NORMAL=1,
00019     CURSOR_NORMAL_DOWN,                             // when the normal cursor is clicked on something
00020     CURSOR_WAITING,
00021 };
00022 
00023 //------------ Define struct CursorRec ---------------//
00024 
00026 struct CursorRec {
00027     enum { HOT_SPOT_LEN=3, FILE_NAME_LEN=8, BITMAP_PTR_LEN=4 };
00028 
00029     char file_name[FILE_NAME_LEN];
00030 
00031     char hot_spot_x[HOT_SPOT_LEN];
00032     char hot_spot_y[HOT_SPOT_LEN];
00033 
00034     char bitmap_ptr[BITMAP_PTR_LEN];
00035 };
00036 
00037 //------------- Define struct CursorInfo --------------//
00038 
00040 struct CursorInfo {
00041     short hot_spot_x;
00042     short hot_spot_y;
00043 
00044     char* bitmap_ptr;
00045 };
00046 
00047 //--------- Define class MouseCursor --------//
00048 
00049 class Blob2DW;
00050 class VgaBuf;
00051 
00054 class MouseCursor {
00055 public:
00056     char  init_flag;
00057     char  hide_all_flag;
00058     char  hide_area_flag;
00059 
00060     short cur_icon;
00061 
00062     int   hide_x1, hide_y1, hide_x2, hide_y2;
00063     int   cur_x1, cur_y1, cur_x2, cur_y2;
00064 
00065     int hot_spot_x, hot_spot_y;
00066 
00067     int   icon_width;
00068     int   icon_height;
00069 
00070     char  cursor_shown;                           // whether the cursor has been shown on the screen
00071     char  processing_flag;                        // whether process() is being run or not, prevent nested call by interrupt
00072     char  wait_mode_count;                        // allow nested wait cursor
00073 
00074     char  *icon_ptr, *icon_data_ptr;
00075     Blob2DW *save_scr, *save_back_scr, *merge_buf;
00076 
00077     //------- nation selection frame --------//
00078 
00079     char  frame_flag;                             // whether nation selection frame is on
00080     char  frame_shown;
00081 
00082     int frame_x1, frame_y1, frame_x2, frame_y2;
00083     int frame_origin_x, frame_origin_y;
00084     int frame_border_x1, frame_border_y1, frame_border_x2, frame_border_y2;
00085 
00086     short frame_top_save_scr[MAX_VGA_WIDTH+2];    // for saving the nation selection frame
00087     short frame_bottom_save_scr[MAX_VGA_WIDTH+2]; // +4 is for the width & height info
00088     short frame_left_save_scr[MAX_VGA_HEIGHT+2];
00089     short frame_right_save_scr[MAX_VGA_HEIGHT+2];
00090 
00091     //------- cursor bitmap resource --------//
00092 
00093 private:
00094     short      cursor_count;
00095     CursorInfo*  cursor_info_array;
00096 
00097     ResourceDb   res_bitmap;
00098 
00099 public:
00100     MouseCursor();
00101     ~MouseCursor();
00102 
00103     void  init();
00104     void  deinit();
00105 
00106     void  set_icon(int);
00107     void  set_frame(char,char=0);
00108     void  set_frame_border(int,int,int,int);
00109 
00110     void  process(int,int);
00111     void  disp_back_buf(int,int,int,int);
00112 
00113     // ####### begin Gilbert 18/8 ########//
00114     int get_icon()        { return cur_icon; }
00115     void  restore_icon(int);
00116     // ####### end Gilbert 18/8 ########//
00117 
00118 private:
00119     void  process_frame(int,int);
00120     void  disp_frame(VgaBuf*);
00121     int is_touch(int,int,int,int);
00122 
00123     void  load_cursor_info();
00124 };
00125 
00126 extern MouseCursor mouse_cursor;
00127 
00128 //----------------------------------------------//
00129 #endif

Generated on Fri Aug 23 01:38:07 2002 for VirtualU by doxygen1.2.17