1 |
if live_call() |
2 |
return global.live_result; |
3 |
if (event_fade_in == true && draw_alpha < 1) |
4 |
draw_alpha += 0.1 |
5 |
else |
6 |
{ |
7 |
if audio_is_paused(mus) |
8 |
audio_resume_sound(mus) |
9 |
event_fade_in = false |
10 |
} |
11 |
if (event_fade_out == true) |
12 |
{ |
13 |
if (draw_alpha > 0) |
14 |
draw_alpha -= 0.1 |
15 |
else |
16 |
{ |
17 |
event_fade_out = false |
18 |
instance_destroy(obj_crayon) |
19 |
instance_destroy(obj_crayon_box) |
20 |
instance_destroy(obj_crayon_indicator) |
21 |
instance_destroy() |
22 |
} |
23 |
return; |
24 |
} |
25 |
var h_mouse = global.right_key - global.left_key |
26 |
var v_mouse = global.down_key - global.up_key |
27 |
var cursor_speed = 4 |
28 |
if (window_get_fullscreen() == true) |
29 |
cursor_speed = 8 |
30 |
if (h_mouse != 0 || v_mouse != 0) |
31 |
window_mouse_set((window_mouse_get_x() + h_mouse * cursor_speed), (window_mouse_get_y() + v_mouse * cursor_speed)) |
32 |
cursor_x = mouse_x |
33 |
cursor_y = mouse_y |
34 |
cursor_x -= view_x |
35 |
cursor_y -= view_y |
36 |
if (mouse_check_button(mb_left) || keyboard_multicheck(0)) |
37 |
cursor_click = true |
38 |
else |
39 |
cursor_click = false |
40 |
if (cursor_click == true) |
41 |
{ |
42 |
if (cursor_click_noloop == false && point_in_rectangle(cursor_x, cursor_y, obj_crayon_indicator.bbox_left, obj_crayon_indicator.bbox_top, obj_crayon_indicator.bbox_right, obj_crayon_indicator.bbox_bottom)) |
43 |
{ |
44 |
if (brush_size_current == brush_size_normal) |
45 |
brush_size_current = brush_size_large |
46 |
else |
47 |
brush_size_current = brush_size_normal |
48 |
} |
49 |
var cursor_x_target = cursor_x |
50 |
var cursor_y_target = cursor_y |
51 |
if (abs(cursor_x_last - cursor_x) > brush_size_current || abs(cursor_y_last - cursor_y) > brush_size_current) |
52 |
{ |
53 |
cursor_x = cursor_x_last |
54 |
cursor_y = cursor_y_last |
55 |
} |
56 |
do |
57 |
{ |
58 |
if (cursor_x > id_xx && cursor_x < (id_xx + ds_grid_width(drawing_grid)) && cursor_y > id_yy && cursor_y < (id_yy + ds_grid_height(drawing_grid))) |
59 |
{ |
60 |
for (var j = (-brush_size_normal); j < brush_size_current; j++) |
61 |
{ |
62 |
for (var i = (-brush_size_normal); i < brush_size_current; i++) |
63 |
ds_grid_set(drawing_grid, (cursor_x - id_xx + i), (cursor_y - id_yy + j), crayon_selected) |
64 |
} |
65 |
} |
66 |
if (cursor_x != cursor_x_target) |
67 |
cursor_x += sign(cursor_x_target - cursor_x) |
68 |
if (cursor_y != cursor_y_target) |
69 |
cursor_y += sign(cursor_y_target - cursor_y) |
70 |
} until (cursor_x == cursor_x_target && cursor_y == cursor_y_target); |
71 |
} |
72 |
for (i = 0; i < array_length(button_x); i++) |
73 |
{ |
74 |
if point_in_rectangle(cursor_x, cursor_y, button_x[i], button_y[i], (button_x[i] + button_width), (button_y[i] + button_height)) |
75 |
{ |
76 |
if (button_highlight[i] == false) |
77 |
{ |
78 |
audio_play_sound(snd_mainmenu_select, 1, 0) |
79 |
button_highlight[i] = true |
80 |
} |
81 |
if (cursor_click && cursor_click_noloop == false) |
82 |
event_user(i) |
83 |
} |
84 |
else |
85 |
button_highlight[i] = false |
86 |
} |
87 |
cursor_x_last = cursor_x |
88 |
cursor_y_last = cursor_y |
89 |
if cursor_click |
90 |
cursor_click_noloop = true |
91 |
else |
92 |
cursor_click_noloop = false |