1 |
function background_create_gradient(argument0, argument1, argument2, argument3, argument4) //gml_Script_background_create_gradient |
2 |
{ |
3 |
var __w = argument0 |
4 |
var __h = argument1 |
5 |
var __col1 = argument2 |
6 |
var __col2 = argument3 |
7 |
var __kind = argument4 |
8 |
var __halfw = __w / 2 |
9 |
var __halfh = __h / 2 |
10 |
var __CompTempSurf = surface_create(__w, __h) |
11 |
if surface_exists(__CompTempSurf) |
12 |
{ |
13 |
surface_set_target(__CompTempSurf) |
14 |
switch __kind |
15 |
{ |
16 |
case 0: |
17 |
draw_rectangle_colour(0, 0, __w, __h, __col1, __col2, __col2, __col1, false) |
18 |
break |
19 |
case 1: |
20 |
draw_rectangle_colour(0, 0, __w, __h, __col2, __col2, __col1, __col1, false) |
21 |
break |
22 |
case 2: |
23 |
draw_primitive_begin(4) |
24 |
draw_vertex_colour(__halfw, __halfh, __col1, 1) |
25 |
draw_vertex_colour(0, __halfh, __col2, 1) |
26 |
draw_vertex_colour(0, 0, __col2, 1) |
27 |
draw_vertex_colour(__halfw, __halfh, __col1, 1) |
28 |
draw_vertex_colour(0, 0, __col2, 1) |
29 |
draw_vertex_colour(__halfw, 0, __col2, 1) |
30 |
draw_vertex_colour(__halfw, __halfh, __col1, 1) |
31 |
draw_vertex_colour(__halfw, 0, __col2, 1) |
32 |
draw_vertex_colour(__w, 0, __col2, 1) |
33 |
draw_vertex_colour(__halfw, __halfh, __col1, 1) |
34 |
draw_vertex_colour(__w, 0, __col2, 1) |
35 |
draw_vertex_colour(__w, __halfh, __col2, 1) |
36 |
draw_vertex_colour(__halfw, __halfh, __col1, 1) |
37 |
draw_vertex_colour(__w, __halfh, __col2, 1) |
38 |
draw_vertex_colour(__w, __h, __col2, 1) |
39 |
draw_vertex_colour(__halfw, __halfh, __col1, 1) |
40 |
draw_vertex_colour(__w, __h, __col2, 1) |
41 |
draw_vertex_colour(__halfw, __h, __col2, 1) |
42 |
draw_vertex_colour(__halfw, __halfh, __col1, 1) |
43 |
draw_vertex_colour(__halfw, __h, __col2, 1) |
44 |
draw_vertex_colour(0, __h, __col2, 1) |
45 |
draw_vertex_colour(__halfw, __halfh, __col1, 1) |
46 |
draw_vertex_colour(0, __h, __col2, 1) |
47 |
draw_vertex_colour(0, __halfh, __col2, 1) |
48 |
draw_primitive_end() |
49 |
break |
50 |
case 3: |
51 |
draw_clear(__col2) |
52 |
draw_ellipse_colour(0, 0, __w, __h, __col1, __col2, false) |
53 |
break |
54 |
case 4: |
55 |
draw_rectangle_colour(0, 0, __halfw, __h, __col2, __col1, __col1, __col2, false) |
56 |
draw_rectangle_colour(__halfw, 0, __w, __h, __col1, __col2, __col2, __col1, false) |
57 |
break |
58 |
case 5: |
59 |
draw_rectangle_colour(0, 0, __w, __halfh, __col2, __col2, __col1, __col1, false) |
60 |
draw_rectangle_colour(0, __halfh, __w, __h, __col1, __col1, __col2, __col2, false) |
61 |
break |
62 |
} |
63 |
|
64 |
surface_reset_target() |
65 |
var __sprid = sprite_create_from_surface(__CompTempSurf, 0, 0, __w, __h, false, false, 0, 0) |
66 |
surface_free(__CompTempSurf) |
67 |
return __sprid; |
68 |
} |
69 |
else |
70 |
return -1; |
71 |
} |