diff -ruN a/compat.lua b/compat.lua --- /dev/null +++ b/compat.lua @@ -0,0 +1,27 @@ +-- Shims so this LOVE 0.10.2 game runs on LOVE 11.x (added by the fredygames port). +-- +-- * love.graphics.setColor took 0-255 components in 0.10; LOVE 11 takes 0-1. Every call in this game +-- still uses 0-255, so setColor is wrapped to divide by 255 (it accepts both the r, g, b, a form and +-- a table). +-- * love.filesystem.isFile/isDirectory/exists were removed in 11 in favour of getInfo. + +local setColor = love.graphics.setColor +function love.graphics.setColor(r, g, b, a) + if type(r) == 'table' then + r, g, b, a = r[1], r[2], r[3], r[4] + end + setColor(r / 255, g / 255, b / 255, (a or 255) / 255) +end + +local fs = love.filesystem +function fs.isFile(path) + local info = fs.getInfo(path) + return info ~= nil and info.type == 'file' +end +function fs.isDirectory(path) + local info = fs.getInfo(path) + return info ~= nil and info.type == 'directory' +end +function fs.exists(path) + return fs.getInfo(path) ~= nil +end diff -ruN a/conf.lua b/conf.lua --- a/conf.lua +++ b/conf.lua @@ -1,6 +1,6 @@ function love.conf(t) t.title = "Lunar Depot 38" - t.version = "0.10.2" + t.version = "11.5" t.window.width = 800 t.window.height = 600 t.window.resizable = false diff -ruN a/klinklang/scenes/dead.lua b/klinklang/scenes/dead.lua --- a/klinklang/scenes/dead.lua +++ b/klinklang/scenes/dead.lua @@ -51,7 +51,7 @@ love.graphics.draw(line1, (w - line1:getWidth()) / 2, h / 2 - line_height * 1.5) local line2 = love.graphics.newText(m5x7) - line2:set{{255, 255, 255}, "press ", {52, 52, 52}, "R", {255, 255, 255}, " to restart"} + line2:set{{1, 1, 1}, "press ", {52 / 255, 52 / 255, 52 / 255}, "R", {1, 1, 1}, " to restart"} local prefixlen = m5x7:getWidth("press ") local keylen = m5x7:getWidth("R") local quad = love.graphics.newQuad(384, 0, 32, 32, p8_spritesheet:getDimensions()) @@ -60,7 +60,7 @@ love.graphics.draw(line2, (w - line2:getWidth()) / 2, h / 2 - line_height / 2) if worldscene.player.ptrs.savepoint then - line2:set{{255, 255, 255}, "press ", {52, 52, 52}, "E", {255, 255, 255}, " to resurrect"} + line2:set{{1, 1, 1}, "press ", {52 / 255, 52 / 255, 52 / 255}, "E", {1, 1, 1}, " to resurrect"} local keylen = m5x7:getWidth("E") local quad = love.graphics.newQuad(384, 0, 32, 32, p8_spritesheet:getDimensions()) love.graphics.setColor(255, 255, 255) diff -ruN a/klinklang/scenes/world.lua b/klinklang/scenes/world.lua --- a/klinklang/scenes/world.lua +++ b/klinklang/scenes/world.lua @@ -369,7 +369,10 @@ end function WorldScene:_draw_final_canvas() + -- LOVE 11 wants canvases drawn with premultiplied alpha + love.graphics.setBlendMode('alpha', 'premultiplied') love.graphics.draw(self.canvas, 0, 0, 0, self.scale, self.scale) + love.graphics.setBlendMode('alpha') end function WorldScene:_draw_actors(actors) diff -ruN a/ld38/scenes/transition.lua b/ld38/scenes/transition.lua --- a/ld38/scenes/transition.lua +++ b/ld38/scenes/transition.lua @@ -56,7 +56,9 @@ function TransitionScene:draw() self.wrapped:draw() + love.graphics.setBlendMode('alpha', 'premultiplied') love.graphics.draw(self.canvas, self.x, self.y) + love.graphics.setBlendMode('alpha') end diff -ruN a/ld38/scenes/world.lua b/ld38/scenes/world.lua --- a/ld38/scenes/world.lua +++ b/ld38/scenes/world.lua @@ -193,7 +193,7 @@ // sky_exclusion -- exclusion (difference squared) // doesn't get parallax since it's just a solid color, no texture next_pixel = Texel(sky_exclusion, new_coords); - next_pixel = vec4(pixel.rgb + next_pixel.rgb - 2 * pixel.rgb * next_pixel.rgb, next_pixel.a); + next_pixel = vec4(pixel.rgb + next_pixel.rgb - 2.0 * pixel.rgb * next_pixel.rgb, next_pixel.a); pixel = blend_normal(pixel, next_pixel); // big_stars -- soft light @@ -230,7 +230,7 @@ vec4 effect(vec4 color, Image texture, vec2 tex_coords, vec2 screen_coords) { vec4 tex_color = Texel(texture, tex_coords); - float gray = (tex_color.r + tex_color.g + tex_color.b) / 3; + float gray = (tex_color.r + tex_color.g + tex_color.b) / 3.0; vec3 desaturated = mix(tex_color.rgb, vec3(gray), amount); return vec4(desaturated, tex_color.a) * color; } diff -ruN a/main.lua b/main.lua --- a/main.lua +++ b/main.lua @@ -1,3 +1,5 @@ +require 'compat' + local utf8 = require 'utf8' local baton = require 'vendor.baton' @@ -186,8 +188,6 @@ m5x7small = love.graphics.newFont('assets/fonts/glip.ttf', 16) glipfontbig = love.graphics.newFont('assets/fonts/glip.ttf', 72) - love.joystick.loadGamepadMappings("vendor/gamecontrollerdb.txt") - -- FIXME things i would like to have here: -- - cleverly scale axis inputs like that other thing, and limit them to a circular range as well? -- - use scancodes by default!!! the examples use keys