Am also a total newbie to lua scripting ( about 6 months ).
Also sorry for the bad code formatting in this post, cant seem to figure out how to properly copy-paste my code unto here!
Im having a hard time figuring out how to scale up my project to window size.
I´ve been working on a small game for a while and have always intended to run it in a 256x256px window but thought that it would look nicer to run fullscreen and scale it up by using nearest neighbour interpolation, for that lofi look.
Now I´ve tried using love.graphics.scale to blow up the coord system and all that but cant seem to figure it out, I´ve also been considering using a camera library for this, like kikitos gamera or hump.camera. My main problem is figuring out how to wrap my draw functions correctly for this to work, i´ve been using https://github.com/tanema/light_world.lua for lighting and this bad boy is reacting very badly to my attempts to implement scaling or camera modules. Guess I should implement camera and scaling stuff earlier in development BEFORE he project is cluttered with mediocre code!
Anyway..
Heres how my draw functions look:
First i have a ghetto gamestate engine that draws the appropriate stuff for the occasion:
Code: Select all
function gamestate.draw(a)
if a == "1"
then
lightWorld:draw(function()
chunkDraw()
enemy.draw()
items.draw()
player_draw()
ChunkDrawExtras()
end)
Code: Select all
function love.draw()
gamestate.draw(currentState)
end
Code: Select all
-- Under love.draw() in main.lua
cam:draw(function(l,t,w,h)
gamestate.draw(currentState)
end)
Code: Select all
function gamestate.draw(a)
if a == "1"
then
cam:draw(function(l,t,w,h)
lightWorld:draw(function()
chunkDraw()
enemy.draw()
items.draw()
player_draw()
chunkDrawExtras()
end)
end)
Also tried to love.graphics.push() and scale everything with love.graphics.scale and then pop it before drawing ui...
Hope this made any sort of sense.. Because it doesnt make sense to me!
Cheers!