148 lines
7.1 KiB
Lua
148 lines
7.1 KiB
Lua
function draw_help_without_mouse_pressed(editor, drawing_index)
|
|
local drawing = editor.lines[drawing_index]
|
|
local starty = Text.starty(editor, drawing_index)
|
|
App.color(Help_color)
|
|
local y = starty+10
|
|
love.graphics.print("Things you can do:", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
love.graphics.print("* Press the mouse button to start drawing a "..current_shape(editor), editor.left+30,y)
|
|
y = y + editor.line_height
|
|
love.graphics.print("* Hover on a point and press 'ctrl+u' to pick it up and start moving it,", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
love.graphics.print("then press the mouse button to drop it", editor.left+30+editor.font:getWidth('* '),y)
|
|
y = y + editor.line_height
|
|
love.graphics.print("* Hover on a point and press 'ctrl+n', type a name, then press 'enter'", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
love.graphics.print("* Hover on a point or shape and press 'ctrl+d' to delete it", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
if editor.current_drawing_mode ~= 'freehand' then
|
|
love.graphics.print("* Press 'ctrl+p' to switch to drawing freehand strokes", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
end
|
|
if editor.current_drawing_mode ~= 'line' then
|
|
love.graphics.print("* Press 'ctrl+l' to switch to drawing lines", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
end
|
|
if editor.current_drawing_mode ~= 'manhattan' then
|
|
love.graphics.print("* Press 'ctrl+m' to switch to drawing horizontal/vertical lines", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
end
|
|
if editor.current_drawing_mode ~= 'circle' then
|
|
love.graphics.print("* Press 'ctrl+o' to switch to drawing circles/arcs", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
end
|
|
if editor.current_drawing_mode ~= 'polygon' then
|
|
love.graphics.print("* Press 'ctrl+g' to switch to drawing polygons", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
end
|
|
if editor.current_drawing_mode ~= 'rectangle' then
|
|
love.graphics.print("* Press 'ctrl+r' to switch to drawing rectangles", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
end
|
|
if editor.current_drawing_mode ~= 'square' then
|
|
love.graphics.print("* Press 'ctrl+s' to switch to drawing squares", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
end
|
|
love.graphics.print("* Press 'ctrl+=' or 'ctrl+-' to zoom in or out, ctrl+0 to reset zoom", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
love.graphics.print("Press 'esc' now to hide this message", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
App.color(Help_background_color)
|
|
love.graphics.rectangle('fill', editor.left,starty, editor.width, math.max(Drawing.pixels(drawing.h, editor.width),y-starty))
|
|
end
|
|
|
|
function draw_help_with_mouse_pressed(editor, drawing_index)
|
|
local drawing = editor.lines[drawing_index]
|
|
local starty = Text.starty(editor, drawing_index)
|
|
App.color(Help_color)
|
|
local y = starty+10
|
|
love.graphics.print("You're currently drawing a "..current_shape(editor, drawing.pending), editor.left+30,y)
|
|
y = y + editor.line_height
|
|
love.graphics.print('Things you can do now:', editor.left+30,y)
|
|
y = y + editor.line_height
|
|
if editor.current_drawing_mode == 'freehand' then
|
|
love.graphics.print('* Release the mouse button to finish drawing the stroke', editor.left+30,y)
|
|
y = y + editor.line_height
|
|
elseif editor.current_drawing_mode == 'line' or editor.current_drawing_mode == 'manhattan' then
|
|
love.graphics.print('* Release the mouse button to finish drawing the line', editor.left+30,y)
|
|
y = y + editor.line_height
|
|
elseif editor.current_drawing_mode == 'circle' then
|
|
if drawing.pending.mode == 'circle' then
|
|
love.graphics.print('* Release the mouse button to finish drawing the circle', editor.left+30,y)
|
|
y = y + editor.line_height
|
|
love.graphics.print("* Press 'a' to draw just an arc of a circle", editor.left+30,y)
|
|
else
|
|
love.graphics.print('* Release the mouse button to finish drawing the arc', editor.left+30,y)
|
|
end
|
|
y = y + editor.line_height
|
|
elseif editor.current_drawing_mode == 'polygon' then
|
|
love.graphics.print('* Release the mouse button to finish drawing the polygon', editor.left+30,y)
|
|
y = y + editor.line_height
|
|
love.graphics.print("* Press 'p' to add a vertex to the polygon", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
elseif editor.current_drawing_mode == 'rectangle' then
|
|
if #drawing.pending.vertices < 2 then
|
|
love.graphics.print("* Press 'p' to add a vertex to the rectangle", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
else
|
|
love.graphics.print('* Release the mouse button to finish drawing the rectangle', editor.left+30,y)
|
|
y = y + editor.line_height
|
|
love.graphics.print("* Press 'p' to replace the second vertex of the rectangle", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
end
|
|
elseif editor.current_drawing_mode == 'square' then
|
|
if #drawing.pending.vertices < 2 then
|
|
love.graphics.print("* Press 'p' to add a vertex to the square", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
else
|
|
love.graphics.print('* Release the mouse button to finish drawing the square', editor.left+30,y)
|
|
y = y + editor.line_height
|
|
love.graphics.print("* Press 'p' to replace the second vertex of the square", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
end
|
|
end
|
|
love.graphics.print("* Press 'esc' then release the mouse button to cancel the current shape", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
y = y + editor.line_height
|
|
if editor.current_drawing_mode ~= 'line' then
|
|
love.graphics.print("* Press 'l' to switch to drawing lines", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
end
|
|
if editor.current_drawing_mode ~= 'manhattan' then
|
|
love.graphics.print("* Press 'm' to switch to drawing horizontal/vertical lines", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
end
|
|
if editor.current_drawing_mode ~= 'circle' then
|
|
love.graphics.print("* Press 'o' to switch to drawing circles/arcs", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
end
|
|
if editor.current_drawing_mode ~= 'polygon' then
|
|
love.graphics.print("* Press 'g' to switch to drawing polygons", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
end
|
|
if editor.current_drawing_mode ~= 'rectangle' then
|
|
love.graphics.print("* Press 'r' to switch to drawing rectangles", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
end
|
|
if editor.current_drawing_mode ~= 'square' then
|
|
love.graphics.print("* Press 's' to switch to drawing squares", editor.left+30,y)
|
|
y = y + editor.line_height
|
|
end
|
|
App.color(Help_background_color)
|
|
love.graphics.rectangle('fill', editor.left,starty, editor.width, math.max(Drawing.pixels(drawing.h, editor.width),y-starty))
|
|
end
|
|
|
|
function current_shape(editor, shape)
|
|
if editor.current_drawing_mode == 'freehand' then
|
|
return 'freehand stroke'
|
|
elseif editor.current_drawing_mode == 'line' then
|
|
return 'straight line'
|
|
elseif editor.current_drawing_mode == 'manhattan' then
|
|
return 'horizontal/vertical line'
|
|
elseif editor.current_drawing_mode == 'circle' and shape and shape.start_angle then
|
|
return 'arc'
|
|
else
|
|
return editor.current_drawing_mode
|
|
end
|
|
end
|