-- Love2d Polygon -- init function love.load() -- get window width and height wdw_w, wdw_h = love.graphics.getDimensions() end -- update function love.update(dt) end -- draw function love.draw() -- fill BG color love.graphics.setColor(0.1, 0.2, 0.4) love.graphics.rectangle("fill", 0, 0, wdw_w, wdw_h) -- draw polygon (fill) love.graphics.setColor(0, 1, 1) local x0, y0 = 250, 100 local x1, y1 = 350, 100 local x2, y2 = 500, 200 local x3, y3 = 100, 200 love.graphics.polygon("fill", x0, y0, x1, y1, x2, y2, x3, y3) -- draw polygon (line) love.graphics.setColor(1, 0, 0) local vertices = {250, 300, 350, 300, 500, 400, 100, 400} love.graphics.polygon("line", vertices) -- print FPS love.graphics.setColor(1, 1, 1) love.graphics.print("FPS: "..tostring(love.timer.getFPS()), 10, 10) end function love.keypressed(key, isrepeat) -- ESC to exit if key == "escape" then love.event.quit() end end