Almost working from 1st try
This commit is contained in:
commit
c6547c1121
8 changed files with 297 additions and 0 deletions
33
main.lua
Normal file
33
main.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue