33 lines
976 B
Lua
33 lines
976 B
Lua
require 'point'
|
|
require 'gridpoint'
|
|
require 'mouse'
|
|
require 'mechanism'
|
|
require 'port'
|
|
|
|
function love.load()
|
|
Screenw, Screenh = love.window.getMode()
|
|
Gridw, Gridh = Screenw / Config.cellSize, Screenh / Config.cellSize
|
|
local port = Port:new( GridPoint:new(-1, 0), PortRotation.left, { 0.8, 0.8, 0, 1 } )
|
|
Mecha1 = Mechanism:new( GridPoint:new(5, 5), GridPoint:new(3, 3), { port }, {0.5, 0.5, 0.5, 1} )
|
|
end
|
|
|
|
function love.update( dt )
|
|
dt = dt
|
|
Mouse:update()
|
|
end
|
|
|
|
function love.draw()
|
|
for i = 1, Gridw do
|
|
love.graphics.line( i * Config.cellSize, 0, i * Config.cellSize, Screenh )
|
|
end
|
|
for j = 1, Gridh do
|
|
love.graphics.line( 0, j * Config.cellSize, Screenw, j * Config.cellSize )
|
|
end
|
|
local mx, my = Mouse.point:globalCoords()
|
|
mx = mx - Config.cellSize / 2
|
|
my = my - Config.cellSize / 2
|
|
local mh, mw = Config.cellSize, Config.cellSize
|
|
love.graphics.rectangle("fill", mx, my, mh, mw)
|
|
|
|
Mecha1:draw()
|
|
end
|