shadow fix wip
This commit is contained in:
parent
31df5be882
commit
f94c6fa9f5
@ -3,7 +3,7 @@ function love.conf(t)
|
||||
--t.title = "Thompson Was a Clone"
|
||||
--t.author = "Guard13007"
|
||||
t.version = "0.9.1"
|
||||
t.console = false
|
||||
t.console = true --change for release!!
|
||||
|
||||
t.window.title = "Thompson Was a Clone"
|
||||
--t.window.icon = nil
|
||||
@ -13,7 +13,7 @@ function love.conf(t)
|
||||
t.window.resizable = false
|
||||
t.window.fullscreen = false
|
||||
|
||||
--t.window.vsync = false
|
||||
t.window.vsync = true --may change?
|
||||
t.window.fsaa = 0
|
||||
t.window.display = 1
|
||||
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()
|
||||
love.graphics.setBackgroundColor(35, 65, 85)
|
||||
|
||||
local LightWorld = require "lib.light_world"
|
||||
lightWorld = LightWorld({
|
||||
drawBackground = drawBackground,
|
||||
drawForground = drawForground,
|
||||
ambient = {55, 55, 55}
|
||||
drawForground = drawForeground,
|
||||
ambient = {60, 60, 60}
|
||||
})
|
||||
|
||||
--box = lightWorld:newBox() ??
|
||||
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)
|
||||
thompson = lightWorld:newRectangle(100, 100, 17, 27)
|
||||
lightWorld:newRectangle(700, 300, 10, 20)
|
||||
lightWorld:newRectangle(200,5,5,5)
|
||||
light = lightWorld:newLight(love.graphics.getWidth() / 2, love.graphics.getHeight() / 2, 255, 150, 100, 600) --x,y,r,g,b,radius
|
||||
|
||||
bgColor = {35, 65, 85}
|
||||
|
||||
thompson = {
|
||||
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
|
||||
|
||||
function love.update()
|
||||
love.window.setTitle("Thompson Was a Clone (FPS:" .. love.timer.getFPS() .. ")")
|
||||
function love.update(dt)
|
||||
love.window.setTitle("Thompson Was a Clone (FPS:" .. love.timer.getFPS() .. ")") --for testing purposes only
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
lightWorld:draw(0, 0, 1)
|
||||
--[[love.graphics.push()
|
||||
love.graphics.translate(0, 0)
|
||||
love.graphics.scale(1)
|
||||
lightWorld:draw(0, 0, 1)
|
||||
love.graphics.pop()]]
|
||||
--drawBackground()
|
||||
--drawForeground()
|
||||
end
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user