initial commit
This commit is contained in:
33
main.lua
Normal file
33
main.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
function love.load()
|
||||
--target height/width
|
||||
_default_width = 480
|
||||
_default_height = 272
|
||||
-- window settings
|
||||
love.window.setMode(_default_width, _default_height, {resizable=true})
|
||||
--load images
|
||||
love.graphics.setDefaultFilter("nearest", "nearest") --fixes scaling; must be done before image loads remove if you want aliasing on scaling
|
||||
imp = love.graphics.newImage("assets/images/imp.png")
|
||||
--setup canvas
|
||||
canvas = love.graphics.newCanvas(_default_width, _default_height)
|
||||
end
|
||||
|
||||
function love.update()
|
||||
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
--draws should happen in here
|
||||
love.graphics.setCanvas(canvas)
|
||||
love.graphics.clear(0, 0, 0, 0)
|
||||
love.graphics.setBlendMode("alpha")
|
||||
love.graphics.print("Hello World", 100, 100)
|
||||
love.graphics.draw(imp, 50,50)
|
||||
love.graphics.setCanvas()
|
||||
--get canvas scale
|
||||
local w_width, w_height = love.graphics.getDimensions()
|
||||
local s_width = w_width / _default_width
|
||||
local s_height = w_height / _default_height
|
||||
local scale = math.min(s_width, s_height);
|
||||
love.graphics.setBlendMode("alpha", "premultiplied")
|
||||
love.graphics.draw(canvas,0,0,0, scale, scale)
|
||||
end
|
||||
Reference in New Issue
Block a user