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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
b0VIM 8.1 7�,^+� � guyl guyl-HP-EliteBook-840-G1 ~guyl/Desktop/rust_things/metropolis/src/lib.rs utf-8
3210 #"! U tp
V
V * g h � y � u k h � \ H n � l ~ D � ��������t k ��������g � ��������[ H ��������m � ��������k ��������F ~ ad
u � � � � o _ < � � � � u M = 3 - + �
�
�
t
@
� � � � � [ O 0 � � � � q ) �
�
�
p
W
,
� � � � | ] F � � � � u Z 4 � � � � � a J " � � � � � ^ ? ( � � � � o _ < � � � � � k � � � \ 4 � � � � q a @ !
color, position: pt2, add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color, position: pt1, add_to_fill(Vertex { let color = CANVAS.fill_color; if CANVAS.fill { let pt4 = map([x4, y4], scale); let pt3 = map([x3, y3], scale); let pt2 = map([x2, y2], scale); let pt1 = map([x1, y1], scale); let scale = [CANVAS.size.0, CANVAS.size.1]; unsafe { pub fn quad(x1: u16, y1: u16, x2: u16, y2: u16, x3: u16, y3: u16, x4: u16, y4: u16) { ///recieves the x and y of the 4 points of the quad and creates it based on them } } } }); tex_coords:[0f32,0f32], color, position: pt1, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: pt3, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: pt3, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: pt2, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: pt2, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: pt1, add_to_stroke(Vertex { let color = CANVAS.color; if CANVAS.stroke { } }); tex_coords:[0f32,0f32], color, position: pt3, add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color, position: pt2, add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color, position: pt1, add_to_fill(Vertex { let color = CANVAS.fill_color; if CANVAS.fill { let pt3 = map([x3, y3], scale); let pt2 = map([x2, y2], scale); let pt1 = map([x1, y1], scale); let scale = [CANVAS.size.0, CANVAS.size.1]; unsafe { pub fn triangle(x1: u16, y1: u16, x2: u16, y2: u16, x3: u16, y3: u16) { ///recieves the x and y of the 3 points of the triangle and creates it based on them } } }); tex_coords:[0f32,0f32], color, position: fin, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: srt, add_to_stroke(Vertex { let color = CANVAS.color; let fin = map([x2, y2], scale); let srt = map([x, y], scale); let scale = [CANVAS.size.0, CANVAS.size.1]; unsafe { pub fn line(x: u16, y: u16, x2: u16, y2: u16) { ///line between them. ///recieves the x and y of the top point and then the x and the y of the bottom point and creates a } } } }); tex_coords:[0f32,0f32], color, position: t_l, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: b_l, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: b_l, add_to_stroke(Vertex { }); ad y � � � � q Z 2 " � � � � � n H % �
�
�
�
u
^
6
&
� � � � r S < � � � � s P 1 �
�
�
�
�
a
Q
.
� � � � � � U ) � � � ^ 0 � � � � m ] < � � � � w O ? � � � � � p Y 1 ! � � � � � m G $ � � � � t ] 5 % � � � � q R ; tex_coords:[0f32,0f32], color, position: b_r, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: t_r, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: t_r, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: t_l, add_to_stroke(Vertex { let color = CANVAS.color; if CANVAS.stroke { } }); tex_coords:[0f32,0f32], color, position: b_r, add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color, position: b_l, add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color, position: t_l, add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color, position: t_l, add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color, position: t_r, add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color, position: b_r, add_to_fill(Vertex { let color = CANVAS.fill_color; if CANVAS.fill { let b_l = map([x, y + width], scale); let t_r = map([x + width, y], scale); let b_r = map([x + width, y + width], scale); let t_l = map([x, y], scale); let scale = [CANVAS.size.0, CANVAS.size.1]; unsafe { pub fn square(x: u16, y: u16, width: u16) { ///recieves the x and y of the top spot and then the width of the sqaure you want built. } } } }); tex_coords:[0f32,0f32], color, position: t_l, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: b_l, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: b_l, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: b_r, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: b_r, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: t_r, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: t_r, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: t_l, add_to_stroke(Vertex { let color = CANVAS.color; if CANVAS.stroke { } }); tex_coords:[0f32,0f32], color, position: b_r, add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color, position: b_l, add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color, ad ( � h � � � � q I 9 � � � � � � _ < �
�
�
�
u
M
=
� � � � � j S + � � � � � g H 1 �
�
�
�
x
h
E
&
� � � � � d F � � R - � Y 2 � � � � i . � � � � � ` ' � � � y V � � � � � m H � t O � color: CANVAS.fill_color, position: map_circ([pt_x, pt_y], scale), add_to_fill(Vertex { let pty = y as f32 + ((an as f32 / 360.0) * 6.28).sin() * b as f32; let ptx = x as f32 + ((an as f32 / 360.0) * 6.28).cos() * a as f32; for an in (0..360).step_by(6) { let mut pt_y = y as f32; let mut pt_x = x as f32 + a as f32; if CANVAS.fill { } }); tex_coords:[0f32,0f32], color: CANVAS.color, position: map_circ([pt_x, pt_y], scale), add_to_stroke(Vertex { pt_y = y as f32 + 0.5; pt_x = x as f32 + a as f32 + 0.5; }); tex_coords:[0f32,0f32], color: CANVAS.color, position: map_circ([pt_x, pt_y], scale), add_to_stroke(Vertex { } pt_y = pty; pt_x = ptx; }); tex_coords:[0f32,0f32], color: CANVAS.color, position: map_circ([ptx, pty], scale), add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color: CANVAS.color, position: map_circ([pt_x, pt_y], scale), add_to_stroke(Vertex { let pty = y as f32 + ((an as f32 / 360.0) * 6.28).sin() * b as f32; let ptx = x as f32 + ((an as f32 / 360.0) * 6.28).cos() * a as f32; for an in (0..360).step_by(6) { let mut pt_y = y as f32; let mut pt_x = x as f32 + a as f32; if CANVAS.stroke && !(CANVAS.fill && CANVAS.color == CANVAS.fill_color) { let scale = [CANVAS.size.0, CANVAS.size.1]; unsafe { pub fn ellipse(x: u16, y: u16, a: u16, b: u16) { ///and creates it accordingly ///recieves the x and the y of the center of the ellipse and the width and height of the ellipse } } } }); tex_coords:[0f32,0f32], color, position: pt1, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: pt4, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: pt4, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: pt3, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: pt3, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: pt2, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: pt2, add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color, position: pt1, add_to_stroke(Vertex { let color = CANVAS.color; if CANVAS.stroke { } }); tex_coords:[0f32,0f32], color, position: pt4, add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color, position: pt3, add_to_fill(Vertex { }); tex_coords:[0f32,0f32], ad � \ � � � d 6 � � � b : &
�
�
�
�
\
4
$
� � � y O ' � � � c S I C A �
�
�
z
(
� � � Q � � � o C / � � x d H , � � � u e 5 � � � i Y O 6 � � _
� � z N : � � � l G � � � }); tex_coords:[0f32,0f32], color: CANVAS.fill_color, position: map_circ([x as f32, y as f32], scale), add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color: CANVAS.fill_color, position: map_circ([ptx, pty], scale), add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color: CANVAS.fill_color, position: map_circ([pt_x, pt_y], scale), add_to_fill(Vertex { let pty = y as f32 + ((a as f32 / 360.0) * 6.28).sin() * rad as f32; let ptx = x as f32 + ((a as f32 / 360.0) * 6.28).cos() * rad as f32; for a in (0..360).step_by(6) { let mut pt_y = y as f32; let mut pt_x = x as f32 + rad as f32; if CANVAS.fill { } }); tex_coords:[0f32,0f32], color: CANVAS.color, position: map_circ([pt_x, pt_y], scale), add_to_stroke(Vertex { pt_y = y as f32 + 0.5; pt_x = x as f32 + rad as f32 + 0.5; }); tex_coords:[0f32,0f32], color: CANVAS.color, position: map_circ([pt_x, pt_y], scale), add_to_stroke(Vertex { } pt_y = pty; pt_x = ptx; }); tex_coords:[0f32,0f32], color: CANVAS.color, position: map_circ([ptx, pty], scale), add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color: CANVAS.color, position: map_circ([pt_x, pt_y], scale), add_to_stroke(Vertex { let pty = y as f32 + ((a as f32 / 360.0) * 6.28).sin() * rad as f32; let ptx = x as f32 + ((a as f32 / 360.0) * 6.28).cos() * rad as f32; for a in (0..360).step_by(6) { let mut pt_y = y as f32; let mut pt_x = x as f32 + rad as f32; if CANVAS.stroke && !(CANVAS.fill && CANVAS.color == CANVAS.fill_color) { let scale = [CANVAS.size.0, CANVAS.size.1]; unsafe { pub fn circle(x: u16, y: u16, rad: u16) { ///recieves the x and y of the center of the circle and the radius and builds it with them. } } } }); tex_coords:[0f32,0f32], color: CANVAS.fill_color, position: map_circ([x as f32, y as f32], scale), add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color: CANVAS.fill_color, position: map_circ([pt_x, pt_y], scale), add_to_fill(Vertex { pt_y = y as f32 + 0.5; pt_x = x as f32 + a as f32 + 0.5; }); tex_coords:[0f32,0f32], color: CANVAS.fill_color, position: map_circ([pt_x, pt_y], scale), add_to_fill(Vertex { } pt_y = pty; pt_x = ptx; }); tex_coords:[0f32,0f32], color: CANVAS.fill_color, position: map_circ([x as f32, y as f32], scale), add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color: CANVAS.fill_color, position: map_circ([ptx, pty], scale), add_to_fill(Vertex { }); tex_coords:[0f32,0f32], ad � n � � � � ` 6 � � � � Q ' �
�
�
�
c
;
+
!
� � � k L - � � � � � : , �
�
�
�
�
{
<
6
4
� � � � i N 3 & � � � � n S 8 � � � � p W 5 ( � � � � � � � ~ | Z A - � � � _ . ! � � i D � k D � � � w < � tex_coords:[0f32,0f32], color: CANVAS.color, position: map_circ([ptx, pty], scale), add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color: CANVAS.color, position: map_circ([pt_x, pt_y], scale), add_to_stroke(Vertex { let pty = y as f32 + ((a as f32 / 360.0) * 6.28).sin() * rad as f32; let ptx = x as f32 + ((a as f32 / 360.0) * 6.28).cos() * rad as f32; for a in (0..deg + 6).step_by(6) { let mut pt_y = y as f32; let mut pt_x = x as f32 + rad as f32; if CANVAS.stroke && !(CANVAS.fill && CANVAS.color == CANVAS.fill_color) { let scale = [CANVAS.size.0, CANVAS.size.1]; unsafe { pub fn arc(x: u16, y: u16, rad: u16, deg: u16) { ///covered by the arc (360 degree arc is a full circle). ///create an arc from a circle, recieves the center of the circle and the radius and the degrees } } CANVAS.stroke = false; unsafe { pub fn noStroke() { #[allow(non_snake_case)] ///disables stroke on the canvas. } } CANVAS.fill = false; unsafe { pub fn noFill() { #[allow(non_snake_case)] ///disables fill on the canvas. } } CANVAS.stroke_weight = weight; unsafe { pub fn strokeWeight(weight: u8) { #[allow(non_snake_case)] ///sets the stroke weight(the width of lines and points } } CANVAS.background_color = mapping::map_colors([r, g, b, a]); unsafe { let a = color.get_a(); let b = color.get_b(); let g = color.get_g(); let r = color.get_r(); pub fn background(color: Color) { ///sets the background color(using the color struct). } } CANVAS.color = mapping::map_colors([r, g, b, a]); CANVAS.stroke = true; unsafe { let a = color.get_a(); let b = color.get_b(); let g = color.get_g(); let r = color.get_r(); pub fn stroke(color: Color) { ///the color. ///enables stroke and receives the color of the stroke(the struct color) and sets the stroke color to be } } CANVAS.fill_color = mapping::map_colors([r, g, b, a]); CANVAS.fill = true; unsafe { let a = color.get_a(); let b = color.get_b(); let g = color.get_g(); let r = color.get_r(); pub fn fill(color: Color) { ///the color. ///enables fill and receives the color of the fill(the struct color) and sets the fill color to be } } CANVAS.fill = fil; CANVAS.stroke = stro; circle(x, y, CANVAS.stroke_weight as u16); CANVAS.fill = true; CANVAS.stroke = false; let fil = CANVAS.fill; let stro = CANVAS.stroke; unsafe { pub fn point(x: u16, y: u16) { ///recieves the x and the y and makes a small circle in the spot(size depends on strokeWeight). } } } }); tex_coords:[0f32,0f32], color: CANVAS.fill_color, position: map_circ([x as f32, y as f32], scale), add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color: CANVAS.fill_color, position: map_circ([pt_x, pt_y], scale), add_to_fill(Vertex { pt_y = y as f32 + 0.5; pt_x = x as f32 + rad as f32 + 0.5; }); tex_coords:[0f32,0f32], color: CANVAS.fill_color, position: map_circ([pt_x, pt_y], scale), add_to_fill(Vertex { } pt_y = pty; pt_x = ptx; ad � l � � � � � � Q , � � S . �
�
�
�
^
#
� � � � K � � � � � � � � > % �
�
�
�
r
U
4
� � � � � v p n � � � � � i L / � � � � � � i � � � o L � � � � � � m T � � � u W : � � � � i = � � � � � � w K ? $ � � color: CANVAS.color, position: [x as f32,y as f32], add_to_text(Stext{ unsafe{ pub fn text(x:u16,y:u16,text:&'static str){ ///drawes a text of a certain color and locaion on the canvas } } } ptnxt = *pt; }); tex_coords:[0f32,0f32], color: CANVAS.color, position: mapf(*pt, scale), add_to_stroke(Vertex { }); tex_coords:[0f32,0f32], color: CANVAS.color, position: mapf(ptnxt, scale), add_to_stroke(Vertex { for pt in c.iter() { let mut ptnxt = c[0]; let scale = [CANVAS.size.0, CANVAS.size.1]; unsafe { let c = bezier_points(x1, y1, x2, y2, x3, y3, x4, y4); pub fn bezierCurveVertex(x1: i64, y1: i64, x2: i64, y2: i64, x3: i64, y3: i64, x4: i64, y4: i64) { #[allow(non_snake_case)] ///uses the cubic bezier curve algorithm in order to create a curve } } } }); tex_coords:[0f32,0f32], color: CANVAS.color, position: mapf(*pt, scale), add_to_stroke(Vertex { for pt in c.iter() { let scale = [CANVAS.size.0, CANVAS.size.1]; unsafe { let c = catmull_rom_chain(x1, y1, x2, y2, x3, y3, x4, y4); pub fn curveVertex(x1: i64, y1: i64, x2: i64, y2: i64, x3: i64, y3: i64, x4: i64, y4: i64) { #[allow(non_snake_case)] ///uses the catmull rom chain algorithm in order to create a curve } } ); ptvec[i + 3][1], ptvec[i + 3][0], ptvec[i + 2][1], ptvec[i + 2][0], ptvec[i + 1][1], ptvec[i + 1][0], ptvec[i][1], ptvec[i][0], bezierCurveVertex( for i in 0..(ptvec.len() - 3) { pub fn curve(ptvec: Vec<[i64; 2]>) { ///loopes over the array and uses curveVertex to create a catmull rom chain curve } } } ); ptvec[i + 3][1], ptvec[i + 3][0], ptvec[i + 2][1], ptvec[i + 2][0], ptvec[i + 1][1], ptvec[i + 1][0], ptvec[i][1], ptvec[i][0], bezierCurveVertex( if (i + 1) % 4 == 0 || i == 0 { for i in 0..(ptvec.len() - 3) { pub fn bezierCurve(ptvec: Vec<[i64; 2]>) { #[allow(non_snake_case)] ///loopes over the array and uses curveVertex to create a bezier curve } } } } pt_y = pty; pt_x = ptx; }); tex_coords:[0f32,0f32], color: CANVAS.fill_color, position: map_circ([x as f32, y as f32], scale), add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color: CANVAS.fill_color, position: map_circ([ptx, pty], scale), add_to_fill(Vertex { }); tex_coords:[0f32,0f32], color: CANVAS.fill_color, position: map_circ([pt_x, pt_y], scale), add_to_fill(Vertex { let pty = y as f32 + ((a as f32 / 360.0) * 6.28).sin() * rad as f32; let ptx = x as f32 + ((a as f32 / 360.0) * 6.28).cos() * rad as f32; for a in (0..deg + 6).step_by(6) { let mut pt_y = y as f32; let mut pt_x = x as f32 + rad as f32; if CANVAS.fill { } } pt_y = pty; pt_x = ptx; }); ad � � � � � � Z � � � T
�
�
�
N
� � � � G � � � � A �
�
�
�
;
� � � � G
:
� � h G
� � � l K � � � x � k � � � h G � Y M 0 � � ~ r U
� � 9 - � o i g e } } } TEXTURE = Some((self.image_data,self.dimensions)); println!("pos:{:?}\ntex:{:?}",FILL_VERTECIES.clone().unwrap()[0].position,FILL_VERTECIES.clone().unwrap()[0].tex_coords); }); tex_coords: map([x,(y+(self.dimensions.height() as u16))], scale), //tex_coords: map_tex(map([x,(y+(self.dimensions.height() as u16))], scale),imsize), color: CANVAS.color, position: map([x,y+(self.dimensions.height() as u16)], scale), add_to_fill(Vertex { }); tex_coords: map([x,y], scale), //tex_coords: map_tex(map([x,y], scale),imsize), color: CANVAS.color, position: map([x,y], scale), add_to_fill(Vertex { }); tex_coords: map([x+(self.dimensions.width() as u16),y+(self.dimensions.height() as u16)], scale), //tex_coords: map_tex(map([x+(self.dimensions.width() as u16),y+(self.dimensions.height() as u16)], scale),imsize), color: CANVAS.color, position: map([x+(self.dimensions.width() as u16),y+(self.dimensions.height() as u16)], scale), add_to_fill(Vertex { }); tex_coords: map([x+(self.dimensions.width() as u16),y+(self.dimensions.height() as u16)], scale), //tex_coords: map_tex(map([x+(self.dimensions.width() as u16),y+(self.dimensions.height() as u16)], scale),imsize), color: CANVAS.color, position: map([x+(self.dimensions.width() as u16),y+(self.dimensions.height() as u16)], scale), add_to_fill(Vertex { }); tex_coords: map([x+(self.dimensions.width() as u16),y], scale), //tex_coords: map_tex(map([x+(self.dimensions.width() as u16),y], scale),imsize), color: CANVAS.color, position: map([x+(self.dimensions.width() as u16),y], scale), add_to_fill(Vertex { }); tex_coords: map([x,y], scale), //tex_coords: map_tex(map([x,y], scale),imsize), color: CANVAS.color, position: map([x,y], color: text.color, tex_position: [uv_rect.min.x, uv_rect.max.y], position: [gl_rect.min.x, gl_rect.max.y], Vertex { }, color: text.color, tex_position: [uv_rect.max.x, uv_rect.max.y], position: [gl_rect.max.x, gl_rect.max.y], Vertex { }, color: text.color, tex_position: [uv_rect.max.x, uv_rect.min.y], position: [gl_rect.max.x, gl_rect.min.y], Vertex { }, color: text.color, tex_position: [uv_rect.max.x, uv_rect.min.y], position: [gl_rect.max.x, gl_rect.min.y], Vertex { }, color: text.color, tex_position: [uv_rect.min.x, uv_rect.min.y], position: [gl_rect.min.x, gl_rect.min.y], Vertex { }, color: text.color, tex_position: [uv_rect.min.x, uv_rect.max.y], position: [gl_rect.min.x, gl_rect.max.y], //