27 lines
1.2 KiB
Plaintext
27 lines
1.2 KiB
Plaintext
draw_ticks = function()
|
|
if App.fake_key_press then return end -- disable in tests
|
|
local old_font = love.graphics.getFont()
|
|
love.graphics.setFont(Ticks_font)
|
|
love.graphics.setColor(0.6,0.6,0.6)
|
|
-- x axis
|
|
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, Viewport.x+iscale(App.screen.width))
|
|
-- print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
|
|
for x=anchorlo,anchorhi,scale do
|
|
local vx = vx(x)
|
|
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
|
|
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
|
|
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
|
|
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
|
|
end
|
|
-- y axis
|
|
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, Viewport.y+iscale(App.screen.height))
|
|
-- print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
|
|
for y=anchorlo,anchorhi,scale do
|
|
local vy = vy(y)
|
|
love.graphics.line(0, vy, 5, vy)
|
|
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
|
|
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
|
|
love.graphics.print(('%2.0f'):format(y), App.screen.width-40, vy+2)
|
|
end
|
|
love.graphics.setFont(old_font)
|
|
end |