Subversion Repositories Kolibri OS

Rev

Rev 5573 | Rev 5576 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5573 Rev 5575
Line 3... Line 3...
3
#startaddress 0
3
#startaddress 0
4
#code32 TRUE
4
#code32 TRUE
Line 5... Line 5...
5
 
5
 
6
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
6
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
7
dword  os_version   = 0x00000001;
7
dword  os_version   = 0x00000001;
8
dword  start_addr   = #main;
8
dword  start_addr   = #load_init_main;
9
dword  final_addr   = #stop+32;
9
dword  final_addr   = #stop+32;
10
dword  alloc_mem    = MEMSIZE;
10
dword  alloc_mem    = MEMSIZE;
11
dword  x86esp_reg   = MEMSIZE;
11
dword  x86esp_reg   = MEMSIZE;
12
dword  I_Param      = #param;
12
dword  I_Param      = #param;
Line 31... Line 31...
31
#define BT_DEL      0x80000000
31
#define BT_DEL      0x80000000
32
#define BT_HIDE     0x40000000
32
#define BT_HIDE     0x40000000
33
#define BT_NOFRAME  0x20000000
33
#define BT_NOFRAME  0x20000000
Line 34... Line 34...
34
 
34
 
35
//Button mouse
35
//Button mouse
36
#define MOUSE_LEFT 100b
36
#define MOUSE_LEFT 001b
37
#define MOUSE_RIGHT 001b
37
#define MOUSE_RIGHT 010b
Line 38... Line 38...
38
#define MOUSE_CENTER 010b
38
#define MOUSE_CENTER 100b
39
 
39
 
40
//ASCII KEYS
40
//ASCII KEYS
41
#define ASCII_KEY_BS    008
41
#define ASCII_KEY_BS    008
Line 73... Line 73...
73
 *  key - keycode button
73
 *  key - keycode button
74
 *  tmp - time keycode 
74
 *  tmp - time keycode 
75
 *  down - key event press
75
 *  down - key event press
76
 *  up - key release events
76
 *  up - key release events
77
 *  move - event mouse movements
77
 *  move - event mouse movements
-
 
78
 *  click - when clicked
-
 
79
 *  dblclick - double-click the default 50 ms
78
 */
80
 */
-
 
81
 
-
 
82
dword __TMP_TIME,MOUSE_TIME;
79
:struct mouse
83
:struct mouse
80
{
84
{
81
	signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,hor,vert,down,up,move;
85
	signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick;
82
	void get();
86
	void get();
83
};
87
};
Line 84... Line 88...
84
 
88
 
85
//get new attributes mouse
89
//get new attributes mouse
Line 112... Line 116...
112
	
116
	
113
	//when you release the mouse button
117
	//when you release the mouse button
114
	if((down)&&!(key)){
118
	if((down)&&!(key)){
115
		up = true;
119
		up = true;
116
		down = false;
-
 
-
 
120
		down = false;
-
 
121
		if(!move) click = true;
-
 
122
		__TMP_TIME = GetStartTime();
-
 
123
		if(__TMP_TIME-tmp_time<=MOUSE_TIME) dblclick = true;
117
		
124
		tmp_time = __TMP_TIME;
118
		//returns the key code
125
		//returns the key code
119
		key = tmp;
126
		key = tmp;
120
		lkm = 1&tmp;
127
		lkm = 1&tmp;
121
		pkm = 2&tmp;
128
		pkm = 2&tmp;
Line 125... Line 132...
125
	}
132
	}
Line 126... Line 133...
126
	
133
	
127
	//when you press the mouse button
134
	//when you press the mouse button
128
	else {
135
	else {
-
 
136
		up = false;
-
 
137
		click = false;
-
 
138
		dblclick = false;
-
 
139
		if(key)
129
		up = false;
140
		{
-
 
141
			down = true;
-
 
142
			tmp = key;
130
		if(key) down = true;
143
		}
131
		else down = false;
-
 
132
		if(down) tmp = key;
144
		else down = false;
133
		if((xx!=x)||(yy!=y)){
145
		if((xx!=x)||(yy!=y)){
134
			move = true;
146
			move = true;
135
			xx = x;
147
			xx = x;
136
			yy = y;
148
			yy = y;
Line 649... Line 661...
649
{
661
{
650
	$mov eax,26
662
	$mov eax,26
651
	$mov ebx,9
663
	$mov ebx,9
652
	$int 0x40
664
	$int 0x40
653
}
665
}
654
>
666
 
-
 
667
dword __generator;  // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
-
 
668
 
-
 
669
//The initialization of the initial data before running
-
 
670
void load_init_main()
-
 
671
{
-
 
672
	MOUSE_TIME = 50; //Default 50 ms.
-
 
673
	__generator = GetStartTime();
-
 
674
	main();
-
 
675
}
-
 
676
>
655
>
677
>