1 function draw_help_without_mouse_pressed(State
, drawing_index
)
2 local drawing
= State
.lines
[drawing_index
]
3 local line_cache
= State
.line_cache
[drawing_index
]
5 local y
= line_cache
.starty
+10
6 love
.graphics
.print("Things you can do:", State
.left
+30,y
)
7 y
= y
+ State
.line_height
8 love
.graphics
.print("* Press the mouse button to start drawing a "..current_shape(State
), State
.left
+30,y
)
9 y
= y
+ State
.line_height
10 love
.graphics
.print("* Hover on a point and press 'ctrl+u' to pick it up and start moving it,", State
.left
+30,y
)
11 y
= y
+ State
.line_height
12 love
.graphics
.print("then press the mouse button to drop it", State
.left
+30+State
.font
:getWidth('* '),y
)
13 y
= y
+ State
.line_height
14 love
.graphics
.print("* Hover on a point and press 'ctrl+n', type a name, then press 'enter'", State
.left
+30,y
)
15 y
= y
+ State
.line_height
16 love
.graphics
.print("* Hover on a point or shape and press 'ctrl+d' to delete it", State
.left
+30,y
)
17 y
= y
+ State
.line_height
18 if State
.current_drawing_mode
~= 'freehand' then
19 love
.graphics
.print("* Press 'ctrl+p' to switch to drawing freehand strokes", State
.left
+30,y
)
20 y
= y
+ State
.line_height
22 if State
.current_drawing_mode
~= 'line' then
23 love
.graphics
.print("* Press 'ctrl+l' to switch to drawing lines", State
.left
+30,y
)
24 y
= y
+ State
.line_height
26 if State
.current_drawing_mode
~= 'manhattan' then
27 love
.graphics
.print("* Press 'ctrl+m' to switch to drawing horizontal/vertical lines", State
.left
+30,y
)
28 y
= y
+ State
.line_height
30 if State
.current_drawing_mode
~= 'circle' then
31 love
.graphics
.print("* Press 'ctrl+o' to switch to drawing circles/arcs", State
.left
+30,y
)
32 y
= y
+ State
.line_height
34 if State
.current_drawing_mode
~= 'polygon' then
35 love
.graphics
.print("* Press 'ctrl+g' to switch to drawing polygons", State
.left
+30,y
)
36 y
= y
+ State
.line_height
38 if State
.current_drawing_mode
~= 'rectangle' then
39 love
.graphics
.print("* Press 'ctrl+r' to switch to drawing rectangles", State
.left
+30,y
)
40 y
= y
+ State
.line_height
42 if State
.current_drawing_mode
~= 'square' then
43 love
.graphics
.print("* Press 'ctrl+s' to switch to drawing squares", State
.left
+30,y
)
44 y
= y
+ State
.line_height
46 love
.graphics
.print("* Press 'ctrl+=' or 'ctrl+-' to zoom in or out, ctrl+0 to reset zoom", State
.left
+30,y
)
47 y
= y
+ State
.line_height
48 love
.graphics
.print("Press 'esc' now to hide this message", State
.left
+30,y
)
49 y
= y
+ State
.line_height
50 App
.color(Help_background_color
)
51 love
.graphics
.rectangle('fill', State
.left
,line_cache
.starty
, State
.width
, math
.max(Drawing
.pixels(drawing
.h
, State
.width
),y
-line_cache
.starty
))
54 function draw_help_with_mouse_pressed(State
, drawing_index
)
55 local drawing
= State
.lines
[drawing_index
]
56 local line_cache
= State
.line_cache
[drawing_index
]
58 local y
= line_cache
.starty
+10
59 love
.graphics
.print("You're currently drawing a "..current_shape(State
, drawing
.pending
), State
.left
+30,y
)
60 y
= y
+ State
.line_height
61 love
.graphics
.print('Things you can do now:', State
.left
+30,y
)
62 y
= y
+ State
.line_height
63 if State
.current_drawing_mode
== 'freehand' then
64 love
.graphics
.print('* Release the mouse button to finish drawing the stroke', State
.left
+30,y
)
65 y
= y
+ State
.line_height
66 elseif State
.current_drawing_mode
== 'line' or State
.current_drawing_mode
== 'manhattan' then
67 love
.graphics
.print('* Release the mouse button to finish drawing the line', State
.left
+30,y
)
68 y
= y
+ State
.line_height
69 elseif State
.current_drawing_mode
== 'circle' then
70 if drawing
.pending
.mode
== 'circle' then
71 love
.graphics
.print('* Release the mouse button to finish drawing the circle', State
.left
+30,y
)
72 y
= y
+ State
.line_height
73 love
.graphics
.print("* Press 'a' to draw just an arc of a circle", State
.left
+30,y
)
75 love
.graphics
.print('* Release the mouse button to finish drawing the arc', State
.left
+30,y
)
77 y
= y
+ State
.line_height
78 elseif State
.current_drawing_mode
== 'polygon' then
79 love
.graphics
.print('* Release the mouse button to finish drawing the polygon', State
.left
+30,y
)
80 y
= y
+ State
.line_height
81 love
.graphics
.print("* Press 'p' to add a vertex to the polygon", State
.left
+30,y
)
82 y
= y
+ State
.line_height
83 elseif State
.current_drawing_mode
== 'rectangle' then
84 if #drawing
.pending
.vertices
< 2 then
85 love
.graphics
.print("* Press 'p' to add a vertex to the rectangle", State
.left
+30,y
)
86 y
= y
+ State
.line_height
88 love
.graphics
.print('* Release the mouse button to finish drawing the rectangle', State
.left
+30,y
)
89 y
= y
+ State
.line_height
90 love
.graphics
.print("* Press 'p' to replace the second vertex of the rectangle", State
.left
+30,y
)
91 y
= y
+ State
.line_height
93 elseif State
.current_drawing_mode
== 'square' then
94 if #drawing
.pending
.vertices
< 2 then
95 love
.graphics
.print("* Press 'p' to add a vertex to the square", State
.left
+30,y
)
96 y
= y
+ State
.line_height
98 love
.graphics
.print('* Release the mouse button to finish drawing the square', State
.left
+30,y
)
99 y
= y
+ State
.line_height
100 love
.graphics
.print("* Press 'p' to replace the second vertex of the square", State
.left
+30,y
)
101 y
= y
+ State
.line_height
104 love
.graphics
.print("* Press 'esc' then release the mouse button to cancel the current shape", State
.left
+30,y
)
105 y
= y
+ State
.line_height
106 y
= y
+ State
.line_height
107 if State
.current_drawing_mode
~= 'line' then
108 love
.graphics
.print("* Press 'l' to switch to drawing lines", State
.left
+30,y
)
109 y
= y
+ State
.line_height
111 if State
.current_drawing_mode
~= 'manhattan' then
112 love
.graphics
.print("* Press 'm' to switch to drawing horizontal/vertical lines", State
.left
+30,y
)
113 y
= y
+ State
.line_height
115 if State
.current_drawing_mode
~= 'circle' then
116 love
.graphics
.print("* Press 'o' to switch to drawing circles/arcs", State
.left
+30,y
)
117 y
= y
+ State
.line_height
119 if State
.current_drawing_mode
~= 'polygon' then
120 love
.graphics
.print("* Press 'g' to switch to drawing polygons", State
.left
+30,y
)
121 y
= y
+ State
.line_height
123 if State
.current_drawing_mode
~= 'rectangle' then
124 love
.graphics
.print("* Press 'r' to switch to drawing rectangles", State
.left
+30,y
)
125 y
= y
+ State
.line_height
127 if State
.current_drawing_mode
~= 'square' then
128 love
.graphics
.print("* Press 's' to switch to drawing squares", State
.left
+30,y
)
129 y
= y
+ State
.line_height
131 App
.color(Help_background_color
)
132 love
.graphics
.rectangle('fill', State
.left
,line_cache
.starty
, State
.width
, math
.max(Drawing
.pixels(drawing
.h
, State
.width
),y
-line_cache
.starty
))
135 function current_shape(State
, shape
)
136 if State
.current_drawing_mode
== 'freehand' then
137 return 'freehand stroke'
138 elseif State
.current_drawing_mode
== 'line' then
139 return 'straight line'
140 elseif State
.current_drawing_mode
== 'manhattan' then
141 return 'horizontal/vertical line'
142 elseif State
.current_drawing_mode
== 'circle' and shape
and shape
.start_angle
then
145 return State
.current_drawing_mode