00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "gui/components/cursor.h"
00019
00020 void cursor::cursor_init()
00021 {
00022 no_times = 0;
00023 x = 400;
00024 y = 300;
00025 state = HIDDEN;
00026 }
00027
00028 void cursor::setCursor(POINT pt)
00029 {
00030 erase();
00031 x = pt.x;
00032 y = pt.y;
00033 }
00034
00035 void cursor::erase()
00036 {
00037 if(state == VISIBLE)
00038 {
00039 line(x,y,x,y+CURSOR_HEIGHT,0xFFFF);
00040 mvMini2Svga(x,y,1,CURSOR_HEIGHT);
00041 }
00042 }
00043
00044 POINT cursor::getCursor()
00045 {
00046 POINT pt;
00047 pt.x = x;
00048 pt.y = y;
00049 return pt;
00050 }
00051
00052
00053 void cursor::show()
00054 {
00055 state = VISIBLE;
00056 paint();
00057 }
00058
00059 void cursor::hide()
00060 {
00061 erase();
00062 state = HIDDEN;
00063 }
00064
00065 void cursor::paint()
00066 {
00067 if(!graphics)
00068 return;
00069
00070 if(state == VISIBLE)
00071 {
00072 if(no_times < 20)
00073 {
00074 line(x,y,x,y+CURSOR_HEIGHT,0x0);
00075 no_times++;
00076 }
00077 else if(no_times < 23)
00078 {
00079 line(x,y,x,y+CURSOR_HEIGHT,0xFFFF);
00080 no_times++;
00081 }
00082 else
00083 no_times = 0;
00084
00085 mvMini2Svga(x,y,1,CURSOR_HEIGHT);
00086 }
00087
00088 }
00089