about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--help.lua66
-rw-r--r--main.lua2
-rw-r--r--text.lua10
3 files changed, 39 insertions, 39 deletions
diff --git a/help.lua b/help.lua
index f979b2f..7b56835 100644
--- a/help.lua
+++ b/help.lua
@@ -2,51 +2,51 @@ function draw_help_without_mouse_pressed(drawing)
   love.graphics.setColor(0,0.5,0)
   local y = drawing.y+10
   love.graphics.print("Things you can do:", 16+30,y, 0, Zoom)
-  y = y+15*Zoom
+  y = y + math.floor(15*Zoom)
   love.graphics.print("* Press the mouse button to start drawing a "..current_shape(), 16+30,y, 0, Zoom)
-  y = y+15*Zoom
+  y = y + math.floor(15*Zoom)
   love.graphics.print("* Hover on a point and press 'ctrl+v' to start moving it,", 16+30,y, 0, Zoom)
-  y = y+15*Zoom
+  y = y + math.floor(15*Zoom)
   love.graphics.print("then press the mouse button to finish", 16+30+bullet_indent(),y, 0, Zoom)
-  y = y+15*Zoom
+  y = y + math.floor(15*Zoom)
   love.graphics.print("* Hover on a point or shape and press 'ctrl+d' to delete it", 16+30,y, 0, Zoom)
-  y = y+15*Zoom
-  y = y+15*Zoom
+  y = y + math.floor(15*Zoom)
+  y = y + math.floor(15*Zoom)
   if Current_drawing_mode ~= 'freehand' then
     love.graphics.print("* Press 'ctrl+f' to switch to drawing freehand strokes", 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   end
   if Current_drawing_mode ~= 'line' then
     love.graphics.print("* Press 'ctrl+l' to switch to drawing lines", 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   end
   if Current_drawing_mode ~= 'manhattan' then
     love.graphics.print("* Press 'ctrl+m' to switch to drawing horizontal/vertical lines", 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   end
   if Current_drawing_mode ~= 'circle' then
     love.graphics.print("* Press 'ctrl+c' to switch to drawing circles/arcs", 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   end
   if Current_drawing_mode ~= 'polygon' then
     love.graphics.print("* Press 'ctrl+g' to switch to drawing polygons", 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   end
   if Current_drawing_mode ~= 'rectangle' then
     love.graphics.print("* Press 'ctrl+r' to switch to drawing rectangles", 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   end
   if Current_drawing_mode ~= 'square' then
     love.graphics.print("* Press 'ctrl+s' to switch to drawing squares", 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   end
   love.graphics.print("* Press 'ctrl+=' or 'ctrl+-' to Zoom in or out", 16+30,y, 0, Zoom)
-  y = y+15*Zoom
+  y = y + math.floor(15*Zoom)
   love.graphics.print("* Press 'ctrl+0' to reset Zoom", 16+30,y, 0, Zoom)
-  y = y+15*Zoom
-  y = y+15*Zoom
+  y = y + math.floor(15*Zoom)
+  y = y + math.floor(15*Zoom)
   love.graphics.print("Hit 'esc' now to hide this message", 16+30,y, 0, Zoom)
-  y = y+15*Zoom
+  y = y + math.floor(15*Zoom)
   love.graphics.setColor(0,0.5,0, 0.1)
   love.graphics.rectangle('fill', 16,drawing.y, Drawing_width, math.max(Drawing.pixels(drawing.h),y-drawing.y))
 end
@@ -55,56 +55,56 @@ function draw_help_with_mouse_pressed(drawing)
   love.graphics.setColor(0,0.5,0)
   local y = drawing.y+10
   love.graphics.print("You're currently drawing a "..current_shape(drawing.pending), 16+30,y, 0, Zoom)
-  y = y+15*Zoom
+  y = y + math.floor(15*Zoom)
   love.graphics.print('Things you can do now:', 16+30,y, 0, Zoom)
-  y = y+15*Zoom
+  y = y + math.floor(15*Zoom)
   if Current_drawing_mode == 'freehand' then
     love.graphics.print('* Release the mouse button to finish drawing the stroke', 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   elseif Current_drawing_mode == 'line' or Current_drawing_mode == 'manhattan' then
     love.graphics.print('* Release the mouse button to finish drawing the line', 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   elseif Current_drawing_mode == 'circle' then
     if drawing.pending.mode == 'circle' then
       love.graphics.print('* Release the mouse button to finish drawing the circle', 16+30,y, 0, Zoom)
-      y = y+15*Zoom
+      y = y + math.floor(15*Zoom)
       love.graphics.print("* Press 'a' to draw just an arc of a circle", 16+30,y, 0, Zoom)
     else
       love.graphics.print('* Release the mouse button to finish drawing the arc', 16+30,y, 0, Zoom)
     end
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   elseif Current_drawing_mode == 'polygon' then
     love.graphics.print('* Release the mouse button to finish drawing the polygon', 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
     love.graphics.print("* Press 'p' to add a vertex to the polygon", 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   end
   love.graphics.print("* Press 'esc' then release the mouse button to cancel the current shape", 16+30,y, 0, Zoom)
-  y = y+15*Zoom
-  y = y+15*Zoom
+  y = y + math.floor(15*Zoom)
+  y = y + math.floor(15*Zoom)
   if Current_drawing_mode ~= 'line' then
     love.graphics.print("* Press 'l' to switch to drawing lines", 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   end
   if Current_drawing_mode ~= 'manhattan' then
     love.graphics.print("* Press 'm' to switch to drawing horizontal/vertical lines", 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   end
   if Current_drawing_mode ~= 'circle' then
     love.graphics.print("* Press 'c' to switch to drawing circles/arcs", 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   end
   if Current_drawing_mode ~= 'polygon' then
     love.graphics.print("* Press 'g' to switch to drawing polygons", 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   end
   if Current_drawing_mode ~= 'rectangle' then
     love.graphics.print("* Press 'g' to switch to drawing rectangles", 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   end
   if Current_drawing_mode ~= 'square' then
     love.graphics.print("* Press 'g' to switch to drawing squares", 16+30,y, 0, Zoom)
-    y = y+15*Zoom
+    y = y + math.floor(15*Zoom)
   end
   love.graphics.setColor(0,0.5,0, 0.1)
   love.graphics.rectangle('fill', 16,drawing.y, Drawing_width, math.max(Drawing.pixels(drawing.h),y-drawing.y))
diff --git a/main.lua b/main.lua
index 0856221..ab692e7 100644
--- a/main.lua
+++ b/main.lua
@@ -182,7 +182,7 @@ function keychord_pressed(chord)
     local y = Screen_height
     while y >= 0 do
       if Screen_top_line == 1 then break end
-      y = y - 15*Zoom
+      y = y - math.floor(15*Zoom)
       if Lines[Screen_top_line].mode == 'drawing' then
         y = y - Drawing.pixels(Lines[Screen_top_line].h)
       end
diff --git a/text.lua b/text.lua
index 1b78251..bd51971 100644
--- a/text.lua
+++ b/text.lua
@@ -181,14 +181,14 @@ function Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necess
 end
 
 function Text.scroll_up_while_cursor_on_screen()
-  local y = Screen_height - 15*Zoom -- for Cursor_line
+  local y = Screen_height - math.floor(15*Zoom) -- for Cursor_line
   while true do
     if Screen_top_line == 1 then break end
-    y = y - 15*Zoom
+    y = y - math.floor(15*Zoom)
     if Lines[Screen_top_line].mode == 'drawing' then
       y = y - Drawing.pixels(Lines[Screen_top_line].h)
     end
-    if y < 15*Zoom then
+    if y < math.floor(15*Zoom) then
       break
     end
     Screen_top_line = Screen_top_line - 1
@@ -197,7 +197,7 @@ end
 
 function Text.in_line(line, x,y)
   if line.y == nil then return false end  -- outside current page
-  return x >= 16 and y >= line.y and y < line.y+15*Zoom
+  return x >= 16 and y >= line.y and y < line.y + math.floor(15*Zoom)
 end
 
 function Text.move_cursor(line_index, line, x)
@@ -246,7 +246,7 @@ end
 function Text.cursor_x(line_data, cursor_pos)
   local line_before_cursor = line_data:sub(1, cursor_pos-1)
   local text_before_cursor = love.graphics.newText(love.graphics.getFont(), line_before_cursor)
-  return 25+text_before_cursor:getWidth()*Zoom
+  return 25 + math.floor(text_before_cursor:getWidth()*Zoom)
 end
 
 return Text
v>
77f59786 ^
3201b163 ^
ffcd934f ^
3201b163 ^


1d3d94aa ^




7c5c70fd ^


7c5c70fd ^
0268e3c3 ^
7c5c70fd ^

227f75db ^


7c5c70fd ^


cfdbb9d6 ^

4700f3e5 ^
cfdbb9d6 ^
4700f3e5 ^
cfdbb9d6 ^
3201b163 ^


fa10678e ^



a923ead7 ^
a78cfb7e ^







a78cfb7e ^






a396b3a0 ^



b5393406 ^
ddf828fb ^
fd04cd6f ^
ddf828fb ^



7c5c70fd ^
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132