mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-24 20:24:19 +00:00
Add MIT License.
This commit is contained in:
parent
efb7ab918b
commit
1fbc9b0902
21
license.txt
Normal file
21
license.txt
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Marcus Ihde
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -334,6 +334,10 @@ function love.light.newWorld()
|
||||
o.setPoints = function(n, ...)
|
||||
o.poly[n].data = {...}
|
||||
end
|
||||
-- get polygon count
|
||||
o.getObjectCount = function()
|
||||
return #o.poly + #o.circle
|
||||
end
|
||||
-- get circle count
|
||||
o.getCircleCount = function()
|
||||
return #o.circle
|
||||
|
40
main_example.lua
Normal file
40
main_example.lua
Normal file
@ -0,0 +1,40 @@
|
||||
require "light"
|
||||
|
||||
function love.load()
|
||||
-- create light world
|
||||
lightWorld = love.light.newWorld()
|
||||
lightWorld.setAmbientColor(15, 15, 31)
|
||||
|
||||
-- create light
|
||||
lightMouse = lightWorld.newLight(0, 0, 255, 127, 63, 300)
|
||||
lightMouse.setGlowStrength(0.3)
|
||||
|
||||
-- create shadow bodys
|
||||
circleTest = lightWorld.newCircle(256, 256, 32)
|
||||
rectangleTest = lightWorld.newRectangle(512, 512, 64, 64)
|
||||
end
|
||||
|
||||
function love.update(dt)
|
||||
love.window.setTitle("Light vs. Shadow Engine (FPS:" .. love.timer.getFPS() .. ")")
|
||||
lightMouse.setPosition(love.mouse.getX(), love.mouse.getY())
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
-- update lightmap (doesn't need deltatime)
|
||||
lightWorld.update()
|
||||
|
||||
-- draw background
|
||||
love.graphics.setColor(255, 255, 255)
|
||||
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
|
||||
|
||||
-- draw lightmap shadows
|
||||
lightWorld.drawShadow()
|
||||
|
||||
-- draw scene objects
|
||||
love.graphics.setColor(63, 255, 127)
|
||||
love.graphics.circle("fill", circleTest.getX(), circleTest.getY(), circleTest.getRadius())
|
||||
love.graphics.polygon("fill", rectangleTest.getPoints())
|
||||
|
||||
-- draw lightmap shine
|
||||
lightWorld.drawShine()
|
||||
end
|
Loading…
Reference in New Issue
Block a user