Rev 7660 | Rev 7759 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7660 | Rev 7661 | ||
---|---|---|---|
1 | #ifndef INCLUDE_GUI_H |
1 | #ifndef INCLUDE_GUI_H |
2 | #define INCLUDE_GUI_H |
2 | #define INCLUDE_GUI_H |
3 | 3 | ||
4 | #ifndef INCLUDE_KOLIBRI_H |
4 | #ifndef INCLUDE_KOLIBRI_H |
5 | #include "../lib/kolibri.h" |
5 | #include "../lib/kolibri.h" |
6 | #endif |
6 | #endif |
7 | 7 | ||
8 | #ifndef INCLUDE_STRING_H |
8 | #ifndef INCLUDE_STRING_H |
9 | #include "../lib/strings.h" |
9 | #include "../lib/strings.h" |
10 | #endif |
10 | #endif |
11 | 11 | ||
12 | #ifndef INCLUDE_RGB_H |
12 | #ifndef INCLUDE_RGB_H |
13 | #include "../lib/patterns/rgb.h" |
13 | #include "../lib/patterns/rgb.h" |
14 | #endif |
14 | #endif |
15 | 15 | ||
16 | #ifndef INCLUDE_MATH_H |
16 | #ifndef INCLUDE_MATH_H |
17 | #include "../lib/math.h" |
17 | #include "../lib/math.h" |
18 | #endif |
18 | #endif |
19 | 19 | ||
20 | #include "../lib/gui/tabs.h" |
20 | #include "../lib/gui/tabs.h" |
21 | #include "../lib/gui/sensor.h" |
21 | #include "../lib/gui/sensor.h" |
22 | #include "../lib/gui/more_less_box.h" |
22 | #include "../lib/gui/more_less_box.h" |
23 | 23 | ||
24 | #ifndef INCLUDE_CHECKBOX |
24 | #ifndef INCLUDE_CHECKBOX |
25 | #include "../lib/gui/checkbox.h" |
25 | #include "../lib/gui/checkbox.h" |
26 | #endif |
26 | #endif |
27 | 27 | ||
28 | #include "../lib/gui/child_window.h" |
28 | #include "../lib/gui/child_window.h" |
29 | #include "../lib/gui/text_view_area.h" |
29 | #include "../lib/gui/text_view_area.h" |
30 | 30 | ||
31 | #ifndef INCLUDE_MENU_H |
31 | #ifndef INCLUDE_MENU_H |
32 | #include "../lib/gui/menu.h" |
32 | #include "../lib/gui/menu.h" |
33 | #endif |
33 | #endif |
34 | 34 | ||
35 | :int last_free_button_id = 1000; |
35 | :int last_free_button_id = 1000; |
36 | :int GetFreeButtonId() |
36 | :int GetFreeButtonId() |
37 | { |
37 | { |
38 | last_free_button_id++; |
38 | last_free_button_id++; |
39 | return last_free_button_id; |
39 | return last_free_button_id; |
40 | } |
40 | } |
41 | 41 | ||
42 | :void DrawRectangle(dword x,y,w,h,color1) |
42 | :void DrawRectangle(dword x,y,w,h,color1) |
43 | { |
43 | { |
- | 44 | DrawRectangle3D(x,y,w,h,color1,color1); |
|
- | 45 | /* |
|
44 | DrawBar(x,y,w,1,color1); |
46 | DrawBar(x,y,w,1,color1); |
45 | DrawBar(x,y+h,w,1,color1); |
47 | DrawBar(x,y+h,w,1,color1); |
46 | DrawBar(x,y,1,h,color1); |
48 | DrawBar(x,y,1,h,color1); |
47 | DrawBar(x+w,y,1,h+1,color1); |
49 | DrawBar(x+w,y,1,h+1,color1); |
- | 50 | */ |
|
48 | } |
51 | } |
49 | 52 | ||
50 | :void DrawWideRectangle(dword x,y,w,h,boder,color1) |
53 | :void DrawWideRectangle(dword x,y,w,h,boder,color1) |
51 | { |
54 | { |
52 | DrawBar(x, y, w, boder, color1); |
55 | DrawBar(x, y, w, boder, color1); |
53 | DrawBar(x, y+h-boder, w, boder, color1); |
56 | DrawBar(x, y+h-boder, w, boder, color1); |
54 | DrawBar(x, y+boder, boder, h-boder-boder, color1); |
57 | DrawBar(x, y+boder, boder, h-boder-boder, color1); |
55 | DrawBar(x+w-boder, y+boder, boder, h-boder-boder, color1); |
58 | DrawBar(x+w-boder, y+boder, boder, h-boder-boder, color1); |
56 | } |
59 | } |
57 | 60 | ||
58 | :void DrawRectangle3D(dword x,y,w,h,color1,color2) |
61 | :void DrawRectangle3D(dword x,y,w,h,color1,color2) |
59 | { |
62 | { |
60 | DrawBar(x,y,w+1,1,color1); |
63 | DrawBar(x,y,w+1,1,color1); |
61 | DrawBar(x,y+1,1,h-1,color1); |
64 | DrawBar(x,y+1,1,h-1,color1); |
62 | DrawBar(x+w,y+1,1,h,color2); |
65 | DrawBar(x+w,y+1,1,h,color2); |
63 | DrawBar(x,y+h,w,1,color2); |
66 | DrawBar(x,y+h,w,1,color2); |
64 | } |
67 | } |
65 | 68 | ||
66 | :void DrawCaptButton(dword x,y,w,h,id,color_b, color_t,text) |
69 | :void DrawCaptButton(dword x,y,w,h,id,color_b, color_t,text) |
67 | { |
70 | { |
68 | dword tx = -strlen(text)*8+w/2+x; |
71 | dword tx = -strlen(text)*8+w/2+x; |
69 | dword ty = h/2-7+y; |
72 | dword ty = h/2-7+y; |
70 | 73 | ||
71 | if (id>0) DefineButton(x,y,w,h,id,color_b); |
74 | if (id>0) DefineButton(x,y,w,h,id,color_b); |
72 | WriteText(tx+1,ty+1,0x90,MixColors(color_b,0,230),text); |
75 | WriteText(tx+1,ty+1,0x90,MixColors(color_b,0,230),text); |
73 | WriteText(tx,ty,0x90,color_t,text); |
76 | WriteText(tx,ty,0x90,color_t,text); |
74 | } |
77 | } |
75 | 78 | ||
76 | :int active_button_id = 0; |
79 | :int active_button_id = 0; |
77 | :int DrawStandartCaptButton(dword x, y, id, text) |
80 | :int DrawStandartCaptButton(dword x, y, id, text) |
78 | { |
81 | { |
79 | #define padding_v 5 |
82 | #define padding_v 5 |
80 | #define padding_h 15 |
83 | #define padding_h 15 |
81 | #define right_margin 12 |
84 | #define right_margin 12 |
82 | #define h padding_v + padding_v + 16 //16 font height |
85 | #define h padding_v + padding_v + 16 //16 font height |
83 | int tx = x + padding_h; |
86 | int tx = x + padding_h; |
84 | int ty = y + padding_v+1; |
87 | int ty = y + padding_v+1; |
85 | int tw = strlen(text)*8; |
88 | int tw = strlen(text)*8; |
86 | int w = tw + padding_h + padding_h; |
89 | int w = tw + padding_h + padding_h; |
87 | unsigned darker_color = MixColors(system.color.work_button,0,230); |
90 | unsigned darker_color = MixColors(system.color.work_button,0,230); |
88 | 91 | ||
89 | 92 | ||
90 | if (id>0) DefineButton(x,y,w,h,id,system.color.work_button); |
93 | if (id>0) DefineButton(x,y,w,h,id,system.color.work_button); |
91 | 94 | ||
92 | WriteText(tx+1,ty+1,0x90,darker_color,text); |
95 | WriteText(tx+1,ty+1,0x90,darker_color,text); |
93 | WriteText(tx,ty,0x90,system.color.work_button_text,text); |
96 | WriteText(tx,ty,0x90,system.color.work_button_text,text); |
94 | 97 | ||
95 | if (active_button_id==id) { |
98 | if (active_button_id==id) { |
96 | DrawBar(tx,ty+15,tw,1, darker_color); |
99 | DrawBar(tx,ty+15,tw,1, darker_color); |
97 | DrawBar(tx,ty+14,tw,1, system.color.work_button_text); |
100 | DrawBar(tx,ty+14,tw,1, system.color.work_button_text); |
98 | } |
101 | } |
99 | 102 | ||
100 | return w + right_margin; |
103 | return w + right_margin; |
101 | } |
104 | } |
102 | 105 | ||
103 | /* UNSTABLE |
106 | /* UNSTABLE |
104 | :unsigned LightenDarkenColor(dword color, amt) { |
107 | :unsigned LightenDarkenColor(dword color, amt) { |
105 | dword r = color >> 16 + amt << 16; |
108 | dword r = color >> 16 + amt << 16; |
106 | dword b = color >> 8 & 0x00FF + amt << 8; |
109 | dword b = color >> 8 & 0x00FF + amt << 8; |
107 | dword g = color & 0x0000FF + amt; |
110 | dword g = color & 0x0000FF + amt; |
108 | return g | b | r ; |
111 | return g | b | r ; |
109 | } |
112 | } |
110 | */ |
113 | */ |
111 | 114 | ||
112 | :void ActiveButtonSwitch(int min, max) |
115 | :void ActiveButtonSwitch(int min, max) |
113 | { |
116 | { |
114 | active_button_id++; |
117 | active_button_id++; |
115 | if (active_button_id>max) || (active_button_id |
118 | if (active_button_id>max) || (active_button_id |
116 | } |
119 | } |
117 | 120 | ||
118 | :void WriteTextCenter(dword x,y,w,color_t,text) |
121 | :void WriteTextCenter(dword x,y,w,color_t,text) |
119 | { |
122 | { |
120 | WriteText(-strlen(text)*6+w/2+x+1,y,0x80,color_t,text); |
123 | WriteText(-strlen(text)*6+w/2+x+1,y,0x80,color_t,text); |
121 | } |
124 | } |
122 | 125 | ||
123 | :void DrawCircle(int x, y, r, color) |
126 | :void DrawCircle(int x, y, r, color) |
124 | { |
127 | { |
125 | int i; |
128 | int i; |
126 | float px=0, py=r, ii = r * 3.1415926 * 2; |
129 | float px=0, py=r, ii = r * 3.1415926 * 2; |
127 | FOR (i = 0; i < ii; i++) |
130 | FOR (i = 0; i < ii; i++) |
128 | { |
131 | { |
129 | PutPixel(px + x, y - py, color); |
132 | PutPixel(px + x, y - py, color); |
130 | px = py / r + px; |
133 | px = py / r + px; |
131 | py = -px / r + py; |
134 | py = -px / r + py; |
132 | } |
135 | } |
133 | } |
136 | } |
134 | 137 | ||
135 | :void DrawEditBox(dword edit_box_pointer) |
138 | :void DrawEditBox(dword edit_box_pointer) |
136 | { |
139 | { |
137 | dword x,y,w,h,bg,t; |
140 | dword x,y,w,h,bg,t; |
138 | ESI = edit_box_pointer; |
141 | ESI = edit_box_pointer; |
139 | x = ESI.edit_box.left; |
142 | x = ESI.edit_box.left; |
140 | y = ESI.edit_box.top; |
143 | y = ESI.edit_box.top; |
141 | w = ESI.edit_box.width+1; |
144 | w = ESI.edit_box.width+1; |
142 | h = 22; |
145 | h = 22; |
143 | if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff; |
146 | if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff; |
144 | edit_box_draw stdcall (edit_box_pointer); |
147 | edit_box_draw stdcall (edit_box_pointer); |
145 | DrawRectangle3D(x-1, y-1, w+1, h+1, 0xE7E7E7, bg); |
148 | DrawRectangle3D(x-1, y-1, w+1, h+1, 0xE7E7E7, bg); |
146 | DrawRectangle(x-2, y-2, w+3, h+3, system.color.work_graph); |
149 | DrawRectangle(x-2, y-2, w+3, h+3, system.color.work_graph); |
147 | DrawRectangle3D(x-3, y-3, w+5, h+5, system.color.work_dark, system.color.work_light); |
150 | DrawRectangle3D(x-3, y-3, w+5, h+5, system.color.work_dark, system.color.work_light); |
148 | } |
151 | } |
149 | 152 | ||
150 | #define DOT_W 37 |
153 | #define DOT_W 37 |
151 | :void DrawFileBox(dword edit_box_pointer, title, btn) |
154 | :void DrawFileBox(dword edit_box_pointer, title, btn) |
152 | { |
155 | { |
153 | dword x,y,w,h,bg,t; |
156 | dword x,y,w,h,bg,t; |
154 | ESI = edit_box_pointer; |
157 | ESI = edit_box_pointer; |
155 | x = ESI.edit_box.left; |
158 | x = ESI.edit_box.left; |
156 | y = ESI.edit_box.top; |
159 | y = ESI.edit_box.top; |
157 | w = ESI.edit_box.width+1; |
160 | w = ESI.edit_box.width+1; |
158 | h = 22; |
161 | h = 22; |
159 | 162 | ||
160 | if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff; |
163 | if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff; |
161 | edit_box_draw stdcall (edit_box_pointer); |
164 | edit_box_draw stdcall (edit_box_pointer); |
162 | DrawRectangle3D(x-1, y-1, w+1, h+1, 0xE7E7E7, bg); |
165 | DrawRectangle3D(x-1, y-1, w+1, h+1, 0xE7E7E7, bg); |
163 | DrawRectangle(x-2, y-2, w+3, h+3, system.color.work_graph); |
166 | DrawRectangle(x-2, y-2, w+3, h+3, system.color.work_graph); |
164 | DrawRectangle3D(x-3, y-3, w+DOT_W+5, h+5, system.color.work_dark, system.color.work_light); |
167 | DrawRectangle3D(x-3, y-3, w+DOT_W+5, h+5, system.color.work_dark, system.color.work_light); |
165 | 168 | ||
166 | WriteText(x-2, y-19, 0x90, system.color.work_text, title); |
169 | WriteText(x-2, y-19, 0x90, system.color.work_text, title); |
167 | DrawCaptButton(x+w+1, y-2, DOT_W, h+3, btn, system.color.work_button, system.color.work_button_text, "..."); |
170 | DrawCaptButton(x+w+1, y-2, DOT_W, h+3, btn, system.color.work_button, system.color.work_button_text, "..."); |
168 | } |
171 | } |
169 | 172 | ||
170 | :void DrawEditBoxPos(dword x,y, edit_box_pointer) |
173 | :void DrawEditBoxPos(dword x,y, edit_box_pointer) |
171 | { |
174 | { |
172 | ESI = edit_box_pointer; |
175 | ESI = edit_box_pointer; |
173 | ESI.edit_box.left = x; |
176 | ESI.edit_box.left = x; |
174 | ESI.edit_box.top = y; |
177 | ESI.edit_box.top = y; |
175 | DrawEditBox(dword edit_box_pointer); |
178 | DrawEditBox(dword edit_box_pointer); |
176 | } |
179 | } |
177 | 180 | ||
178 | :void DrawProgressBar(dword st_x, st_y, st_w, st_h, col_fon, col_border, col_fill, col_text, progress_percent) |
181 | :void DrawProgressBar(dword st_x, st_y, st_w, st_h, col_fon, col_border, col_fill, col_text, progress_percent) |
179 | { |
182 | { |
180 | int progress_w; |
183 | int progress_w; |
181 | static int fill_old; |
184 | static int fill_old; |
182 | 185 | ||
183 | //if (progress_percent<=0) {DrawBar(st_x,st_y, st_x + st_w + fill_old + 15,st_h+1, col_fon); fill_old=0; return;} |
186 | //if (progress_percent<=0) {DrawBar(st_x,st_y, st_x + st_w + fill_old + 15,st_h+1, col_fon); fill_old=0; return;} |
184 | if (progress_percent<=0) || (progress_percent>=100) return; |
187 | if (progress_percent<=0) || (progress_percent>=100) return; |
185 | 188 | ||
186 | DrawRectangle(st_x, st_y, st_w,st_h, col_border); |
189 | DrawRectangle(st_x, st_y, st_w,st_h, col_border); |
187 | DrawRectangle3D(st_x+1, st_y+1, st_w-2,st_h-2, 0xFFFfff, 0xFFFfff); |
190 | DrawRectangle3D(st_x+1, st_y+1, st_w-2,st_h-2, 0xFFFfff, 0xFFFfff); |
188 | 191 | ||
189 | if (progress_percent>0) && (progress_percent<=100) |
192 | if (progress_percent>0) && (progress_percent<=100) |
190 | { |
193 | { |
191 | progress_w = st_w - 3 * progress_percent / 100; |
194 | progress_w = st_w - 3 * progress_percent / 100; |
192 | DrawBar(st_x+2, st_y+2, progress_w, st_h-3, col_fill); |
195 | DrawBar(st_x+2, st_y+2, progress_w, st_h-3, col_fill); |
193 | DrawBar(st_x+2+progress_w, st_y+2, st_w-progress_w-3, st_h-3, 0xFFFfff); |
196 | DrawBar(st_x+2+progress_w, st_y+2, st_w-progress_w-3, st_h-3, 0xFFFfff); |
194 | } |
197 | } |
195 | } |
198 | } |
196 | 199 | ||
197 | :void DrawLink(dword x,y,font_type,btn_id, inscription) |
200 | :void DrawLink(dword x,y,font_type,btn_id, inscription) |
198 | { |
201 | { |
199 | int w; |
202 | int w; |
200 | WriteText(x,y,font_type,0x4E00E7,inscription); |
203 | WriteText(x,y,font_type,0x4E00E7,inscription); |
201 | if (font_type==0x80) w = strlen(inscription)*6; else w = strlen(inscription)*8; |
204 | if (font_type==0x80) w = strlen(inscription)*6; else w = strlen(inscription)*8; |
202 | DefineButton(x-1,y-1,w,10,btn_id+BT_HIDE,0); |
205 | DefineButton(x-1,y-1,w,10,btn_id+BT_HIDE,0); |
203 | DrawBar(x,y+8,w,1,0x4E00E7); |
206 | DrawBar(x,y+8,w,1,0x4E00E7); |
204 | } |
207 | } |
205 | 208 | ||
206 | :void PutShadow(dword x,y,w,h,skinned,strength) |
209 | :void PutShadow(dword x,y,w,h,skinned,strength) |
207 | { |
210 | { |
208 | proc_info wForm; |
211 | proc_info wForm; |
209 | dword shadow_buf, skin_height; |
212 | dword shadow_buf, skin_height; |
210 | shadow_buf = mem_Alloc(w*h*3); |
213 | shadow_buf = mem_Alloc(w*h*3); |
211 | GetProcessInfo(#wForm, SelfInfo); |
214 | GetProcessInfo(#wForm, SelfInfo); |
212 | CopyScreen(shadow_buf, 5*skinned+x+wForm.left, GetSkinHeight()*skinned+y+wForm.top, w, h); |
215 | CopyScreen(shadow_buf, 5*skinned+x+wForm.left, GetSkinHeight()*skinned+y+wForm.top, w, h); |
213 | ShadowImage(shadow_buf, w, h, strength); |
216 | ShadowImage(shadow_buf, w, h, strength); |
214 | _PutImage(x,y,w,h,shadow_buf); |
217 | _PutImage(x,y,w,h,shadow_buf); |
215 | mem_Free(shadow_buf); |
218 | mem_Free(shadow_buf); |
216 | } |
219 | } |
217 | 220 | ||
218 | :void DrawPopup(dword x,y,w,h,skinned, col_work,col_border) |
221 | :void DrawPopup(dword x,y,w,h,skinned, col_work,col_border) |
219 | { |
222 | { |
220 | DrawRectangle(x,y,w,h,col_border); |
223 | DrawRectangle(x,y,w,h,col_border); |
221 | DrawBar(x+1,y+1,w-1,1,0xFFFfff); |
224 | DrawBar(x+1,y+1,w-1,1,0xFFFfff); |
222 | DrawBar(x+1,y+2,1,h-2,0xFFFfff); |
225 | DrawBar(x+1,y+2,1,h-2,0xFFFfff); |
223 | if (col_work!=-1) DrawBar(x+2,y+2,w-2,h-2,col_work); |
226 | if (col_work!=-1) DrawBar(x+2,y+2,w-2,h-2,col_work); |
224 | DrawPopupShadow(x,y,w,h-1,skinned); |
227 | DrawPopupShadow(x,y,w,h-1,skinned); |
225 | } |
228 | } |
226 | 229 | ||
227 | :void DrawPopupShadow(dword x,y,w,h,skinned) |
230 | :void DrawPopupShadow(dword x,y,w,h,skinned) |
228 | { |
231 | { |
229 | PutShadow(w+x+1,y,1,h+2,skinned,2); |
232 | PutShadow(w+x+1,y,1,h+2,skinned,2); |
230 | PutShadow(w+x+2,y+1,1,h+2,skinned,1); |
233 | PutShadow(w+x+2,y+1,1,h+2,skinned,1); |
231 | PutShadow(x,y+h+2,w+2,1,skinned,2); |
234 | PutShadow(x,y+h+2,w+2,1,skinned,2); |
232 | PutShadow(x+1,y+h+3,w+1,1,skinned,1); |
235 | PutShadow(x+1,y+h+3,w+1,1,skinned,1); |
233 | } |
236 | } |
234 | 237 | ||
235 | :dword GrayScaleImage(dword color_image, w, h) |
238 | :dword GrayScaleImage(dword color_image, w, h) |
236 | { |
239 | { |
237 | dword i,gray,to,rr,gg,bb; |
240 | dword i,gray,to,rr,gg,bb; |
238 | to = w*h*3 + color_image; |
241 | to = w*h*3 + color_image; |
239 | for (i = color_image; i < to; i+=3) |
242 | for (i = color_image; i < to; i+=3) |
240 | { |
243 | { |
241 | rr = DSBYTE[i]; |
244 | rr = DSBYTE[i]; |
242 | gg = DSBYTE[i+1]; |
245 | gg = DSBYTE[i+1]; |
243 | bb = DSBYTE[i+2]; |
246 | bb = DSBYTE[i+2]; |
244 | gray = rr*rr; |
247 | gray = rr*rr; |
245 | gray += gg*gg; |
248 | gray += gg*gg; |
246 | gray += bb*bb; |
249 | gray += bb*bb; |
247 | gray = sqrt(gray) / 3; |
250 | gray = sqrt(gray) / 3; |
248 | DSBYTE[i] = DSBYTE[i+1] = DSBYTE[i+2] = gray; |
251 | DSBYTE[i] = DSBYTE[i+1] = DSBYTE[i+2] = gray; |
249 | } |
252 | } |
250 | return gray; |
253 | return gray; |
251 | } |
254 | } |
252 | 255 | ||
253 | :void ShadowImage(dword color_image, w, h, strength) |
256 | :void ShadowImage(dword color_image, w, h, strength) |
254 | { |
257 | { |
255 | dword col, to; |
258 | dword col, to; |
256 | strength = 10 - strength; |
259 | strength = 10 - strength; |
257 | to = w*h*3 + color_image; |
260 | to = w*h*3 + color_image; |
258 | for ( ; color_image < to; color_image++) |
261 | for ( ; color_image < to; color_image++) |
259 | { |
262 | { |
260 | col = strength * DSBYTE[color_image] / 10; |
263 | col = strength * DSBYTE[color_image] / 10; |
261 | DSBYTE[color_image] = col; |
264 | DSBYTE[color_image] = col; |
262 | } |
265 | } |
263 | } |
266 | } |
264 | 267 | ||
265 | :void WriteTextLines(dword x,y,byte fontType, dword color, text_pointer, line_h) |
268 | :void WriteTextLines(dword x,y,byte fontType, dword color, text_pointer, line_h) |
266 | { |
269 | { |
267 | dword next_word_pointer = strchr(text_pointer, '\n'); |
270 | dword next_word_pointer = strchr(text_pointer, '\n'); |
268 | if (next_word_pointer) WriteTextLines(dword x, y+line_h, byte fontType, dword color, next_word_pointer+2, line_h); |
271 | if (next_word_pointer) WriteTextLines(dword x, y+line_h, byte fontType, dword color, next_word_pointer+2, line_h); |
269 | ESBYTE[next_word_pointer] = NULL; |
272 | ESBYTE[next_word_pointer] = NULL; |
270 | WriteText(dword x, y, byte fontType, dword color, text_pointer); |
273 | WriteText(dword x, y, byte fontType, dword color, text_pointer); |
271 | ESBYTE[next_word_pointer] = '\n'; |
274 | ESBYTE[next_word_pointer] = '\n'; |
272 | } |
275 | } |
273 | 276 | ||
274 | //this function increase falue and return it |
277 | //this function increase falue and return it |
275 | //useful for list of controls which goes one after one |
278 | //useful for list of controls which goes one after one |
276 | :struct incn |
279 | :struct incn |
277 | { |
280 | { |
278 | dword n; |
281 | dword n; |
279 | dword inc(dword _addition); |
282 | dword inc(dword _addition); |
280 | }; |
283 | }; |
281 | 284 | ||
282 | :dword incn::inc(dword _addition) |
285 | :dword incn::inc(dword _addition) |
283 | { |
286 | { |
284 | n+=_addition; |
287 | n+=_addition; |
285 | return n; |
288 | return n; |
286 | } |
289 | } |
287 | 290 | ||
288 | //block with hover |
291 | //block with hover |
289 | struct block { |
292 | struct block { |
290 | int x,y,w,h; |
293 | int x,y,w,h; |
291 | bool hovered(); |
294 | bool hovered(); |
292 | void set_size(); |
295 | void set_size(); |
293 | }; |
296 | }; |
294 | 297 | ||
295 | :bool block::hovered() { |
298 | :bool block::hovered() { |
296 | if ((mouse.x>=x) && (mouse.y>=y) |
299 | if ((mouse.x>=x) && (mouse.y>=y) |
297 | && (mouse.y<=y+h) && (mouse.x<=x+w)) |
300 | && (mouse.y<=y+h) && (mouse.x<=x+w)) |
298 | return true; |
301 | return true; |
299 | return false; |
302 | return false; |
300 | } |
303 | } |
301 | 304 | ||
302 | :void block::set_size(dword _x, _y, _w, _h) |
305 | :void block::set_size(dword _x, _y, _w, _h) |
303 | { |
306 | { |
304 | x=_x; |
307 | x=_x; |
305 | y=_y; |
308 | y=_y; |
306 | w=_w; |
309 | w=_w; |
307 | h=_h; |
310 | h=_h; |
308 | } |
311 | } |
309 | 312 | ||
310 | 313 | ||
311 | 314 | ||
312 | 315 | ||
313 | 316 | ||
314 | #endif=x+w))>=y+h)>>>=100) |
317 | #endif=x+w))>=y+h)>>>=100) |
315 | >=0)>=0)>>><>><> |
318 | >=0)>=0)>>><>><> |