-
Notifications
You must be signed in to change notification settings - Fork 119
/
create.edl
51 lines (42 loc) · 1.66 KB
/
create.edl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
spr = sprite_add("CommandLine/testing/data/sprite.png", 4, false, false, 16, 10);
spr2 = sprite_duplicate(spr);
vertex_format_begin();
vertex_format_add_position();
vertex_format_add_color();
vf_pos_col = vertex_format_end();
dx = 70, dy = 20;
vb_diamond = vertex_create_buffer();
vertex_begin(vb_diamond,vf_pos_col);
vertex_position(vb_diamond, dx, dy-20);
vertex_color(vb_diamond, c_red, 1);
vertex_position(vb_diamond, dx-20, dy);
vertex_color(vb_diamond, c_green, 0.5);
vertex_position(vb_diamond, dx+20, dy);
vertex_color(vb_diamond, c_blue, 0.5);
vertex_position(vb_diamond, dx, dy+20);
vertex_color(vb_diamond, c_red, 1);
vertex_end(vb_diamond);
vertex_freeze(vb_diamond);
surf_test = surface_create(32,32);
surf_dup = surface_create(32,32);
surface_set_target(surf_test);
draw_set_color(c_red);
draw_rectangle(0,0,16,16,false);
draw_set_color(c_green);
draw_rectangle(0,16,16,32,false);
draw_set_color(c_yellow);
draw_rectangle(16,0,32,32,false);
surface_reset_target();
surf_spr = sprite_create_from_surface(surf_test,0,0,32,32,false,false,false,0,0);
surf_back = background_create_from_surface(surf_test,0,0,32,32,false,false);
surface_copy_part(surf_dup,0,0,surf_test,8,8,16,16);
surface_copy_part(surf_dup,0,16,surf_test,8,8,16,16);
surface_copy_part(surf_dup,16,0,surf_test,8,8,16,16);
surface_copy_part(surf_dup,16,16,surf_test,8,8,16,16);
surface_set_target(surf_dup);
draw_set_color(c_blue);
draw_rectangle(8,8,24,24,false);
surface_reset_target();
gtest_expect_eq(surface_getpixel(surf_dup,2,2),c_red);
gtest_expect_eq(surface_getpixel(surf_dup,2,10),c_green);
gtest_expect_eq(surface_getpixel(surf_dup,16,16),c_blue);