shadow fix wip
This commit is contained in:
@@ -3,7 +3,7 @@ function love.conf(t)
|
|||||||
--t.title = "Thompson Was a Clone"
|
--t.title = "Thompson Was a Clone"
|
||||||
--t.author = "Guard13007"
|
--t.author = "Guard13007"
|
||||||
t.version = "0.9.1"
|
t.version = "0.9.1"
|
||||||
t.console = false
|
t.console = true --change for release!!
|
||||||
|
|
||||||
t.window.title = "Thompson Was a Clone"
|
t.window.title = "Thompson Was a Clone"
|
||||||
--t.window.icon = nil
|
--t.window.icon = nil
|
||||||
@@ -13,7 +13,7 @@ function love.conf(t)
|
|||||||
t.window.resizable = false
|
t.window.resizable = false
|
||||||
t.window.fullscreen = false
|
t.window.fullscreen = false
|
||||||
|
|
||||||
--t.window.vsync = false
|
t.window.vsync = true --may change?
|
||||||
t.window.fsaa = 0
|
t.window.fsaa = 0
|
||||||
t.window.display = 1
|
t.window.display = 1
|
||||||
t.window.highdpi = false
|
t.window.highdpi = false
|
||||||
|
89
src/main.lua
89
src/main.lua
@@ -1,43 +1,72 @@
|
|||||||
function drawBackground()
|
|
||||||
--love.graphics.setColor(48, 156, 225)
|
|
||||||
--love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
|
|
||||||
|
|
||||||
love.graphics.setColor(35, 65, 85)
|
|
||||||
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
|
|
||||||
end
|
|
||||||
|
|
||||||
function drawForground()
|
|
||||||
love.graphics.setColor(255, 0, 0) --red
|
|
||||||
love.graphics.rectangle("fill", 10, 10, 17, 27) --x,y,width,height
|
|
||||||
end
|
|
||||||
|
|
||||||
function love.load()
|
function love.load()
|
||||||
love.graphics.setBackgroundColor(35, 65, 85)
|
|
||||||
|
|
||||||
local LightWorld = require "lib.light_world"
|
local LightWorld = require "lib.light_world"
|
||||||
lightWorld = LightWorld({
|
lightWorld = LightWorld({
|
||||||
drawBackground = drawBackground,
|
drawBackground = drawBackground,
|
||||||
drawForground = drawForground,
|
drawForground = drawForeground,
|
||||||
ambient = {55, 55, 55}
|
ambient = {60, 60, 60}
|
||||||
})
|
})
|
||||||
|
|
||||||
--box = lightWorld:newBox() ??
|
light = lightWorld:newLight(love.graphics.getWidth() / 2, love.graphics.getHeight() / 2, 255, 150, 100, 600) --x,y,r,g,b,radius
|
||||||
light = lightWorld:newLight(love.graphics.getWidth() / 2, love.graphics.getHeight() / 2, 255, 150, 100, 600) -- I don't know what any of these values do
|
|
||||||
--thompson = lightWorld:newRectangle(100, 100, 255, 0, 0, 17, 27)
|
bgColor = {35, 65, 85}
|
||||||
thompson = lightWorld:newRectangle(100, 100, 17, 27)
|
|
||||||
lightWorld:newRectangle(700, 300, 10, 20)
|
thompson = {
|
||||||
lightWorld:newRectangle(200,5,5,5)
|
color = {255, 0, 0},
|
||||||
|
--[[x = 50,
|
||||||
|
y = 50,
|
||||||
|
w = 17,
|
||||||
|
h = 27]]
|
||||||
|
x = 500,
|
||||||
|
y = 50,
|
||||||
|
w = 170,
|
||||||
|
h = 27
|
||||||
|
}
|
||||||
|
thompson.shadow = lightWorld:newRectangle(thompson.x + thompson.w / 2, thompson.y + thompson.h / 2, thompson.w, thompson.h)
|
||||||
|
-- work arounds for broken constructor
|
||||||
|
thompson.shadow.ox = thompson.w / 2--* 2--/ 2
|
||||||
|
thompson.shadow.oy = thompson.h / 2--* 2--/ 2
|
||||||
|
thompson.shadow.width = thompson.w
|
||||||
|
thompson.shadow.height = thompson.h
|
||||||
|
thompson.shadow.data = {
|
||||||
|
--8 values, 4 x/y pairs, start at top left, clockwise
|
||||||
|
thompson.x,
|
||||||
|
thompson.y,
|
||||||
|
thompson.x + thompson.w,
|
||||||
|
thompson.y,
|
||||||
|
thompson.x + thompson.w,
|
||||||
|
thompson.y + thompson.h,
|
||||||
|
thompson.x,
|
||||||
|
thompson.y + thompson.h
|
||||||
|
}
|
||||||
|
|
||||||
|
-- temp logging for attempt to resolve issues
|
||||||
|
for k,v in pairs(thompson.shadow) do
|
||||||
|
print(k.."="..tostring(v))
|
||||||
|
end
|
||||||
|
for k,v in pairs(thompson.shadow.data) do
|
||||||
|
print(k.."="..tostring(v))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.update()
|
function love.update(dt)
|
||||||
love.window.setTitle("Thompson Was a Clone (FPS:" .. love.timer.getFPS() .. ")")
|
love.window.setTitle("Thompson Was a Clone (FPS:" .. love.timer.getFPS() .. ")") --for testing purposes only
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.draw()
|
function love.draw()
|
||||||
lightWorld:draw(0, 0, 1)
|
lightWorld:draw(0, 0, 1)
|
||||||
--[[love.graphics.push()
|
--drawBackground()
|
||||||
love.graphics.translate(0, 0)
|
--drawForeground()
|
||||||
love.graphics.scale(1)
|
end
|
||||||
lightWorld:draw(0, 0, 1)
|
|
||||||
love.graphics.pop()]]
|
function drawBackground()
|
||||||
|
love.graphics.setColor(bgColor)
|
||||||
|
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
|
||||||
|
end
|
||||||
|
|
||||||
|
function drawForeground()
|
||||||
|
love.graphics.setColor(thompson.color)
|
||||||
|
love.graphics.rectangle("fill", thompson.x, thompson.y, thompson.w, thompson.h)
|
||||||
|
--[[
|
||||||
|
love.graphics.setColor(255, 0, 0) --red
|
||||||
|
love.graphics.rectangle("fill", 10, 10, 17, 27) --x,y,width,height]]
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user