From 478a67d40c615cc71868188be2241dd31ab50a6d Mon Sep 17 00:00:00 2001 From: slowb33 <43762999+slowb33@users.noreply.github.com> Date: Mon, 22 Oct 2018 22:32:45 +0200 Subject: [PATCH] Ported to 11.1 Changed all colors to new color range 0-1 Added newVideo argument settings. Replaced :rewind with :seek(0) --- examples/011_animation.lua | 2 +- examples/018_physics_fire_at.lua | 4 ++-- examples/video_test.lua | 8 ++++---- list.lua | 8 ++++---- main.lua | 9 +++++---- viewcode.lua | 6 +++--- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/examples/011_animation.lua b/examples/011_animation.lua index 45e91c0..09b8fb6 100644 --- a/examples/011_animation.lua +++ b/examples/011_animation.lua @@ -21,7 +21,7 @@ end function love.load() -- Set a lovely pink background color. - love.graphics.setBackgroundColor(246, 198, 222) + love.graphics.setBackgroundColor(246*(1/255), 198*(1/255), 222*(1/255)) -- Load the source of the animation. img = newImagePO2("assets/anim-boogie.png") diff --git a/examples/018_physics_fire_at.lua b/examples/018_physics_fire_at.lua index 845ed40..4bb49a2 100644 --- a/examples/018_physics_fire_at.lua +++ b/examples/018_physics_fire_at.lua @@ -12,7 +12,7 @@ end function love.draw() --Sets the color to red and draws the "bullets". - love.graphics.setColor(255, 0, 0) + love.graphics.setColor(1, 0, 0) --This loops the whole table to get every bullet. Consider v being the bullet. for i,v in pairs(bullets) do @@ -20,7 +20,7 @@ function love.draw() end --Sets the color to white and draws the "player" and writes instructions. - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.print("Left click to fire towards the mouse.", 50, 50) love.graphics.rectangle("line", StartPos.x, StartPos.y, StartPos.width, StartPos.height) diff --git a/examples/video_test.lua b/examples/video_test.lua index 9c2c701..31a49c4 100644 --- a/examples/video_test.lua +++ b/examples/video_test.lua @@ -5,11 +5,11 @@ function love.load() love.graphics.setFont(love.graphics.newFont(11)) -- Load the video from a file, with audio - video = love.graphics.newVideo( "assets/HA-1112-M1LBuchon_flyby.ogg", true ) + video = love.graphics.newVideo( "assets/HA-1112-M1LBuchon_flyby.ogg", {true} ) -- Get video height videoheight = video:getHeight() - --Lower the volume - video:getSource():setVolume(0.15) + --Lower the volume + video:getSource():setVolume(0.15) -- Start playing it video:play() end @@ -22,7 +22,7 @@ function love.draw() -- If the video is not playing or left button is clicked if not video:isPlaying() or love.mouse.isDown(1) then -- Rewind to the start - video:rewind() + video:seek(0) -- And play video:play() end diff --git a/list.lua b/list.lua index 3f63c9e..7f3b30e 100644 --- a/list.lua +++ b/list.lua @@ -29,10 +29,10 @@ function List:new(x, y, w, h) o.bar = { size = 20, pos = 0, maxpos = 0, width = 15, lock = nil} o.colors = {} - o.colors.normal = {bg = {48, 156, 225}, fg = {197, 232, 255}} - o.colors.hover = {bg = {72, 131, 168}, fg = {255, 255, 255}} - o.windowcolor = {48, 156, 225} - o.bordercolor = {72, 131, 168} + o.colors.normal = {bg = {48*(1/255), 156*(1/255), 225*(1/255)}, fg = {197*(1/255), 232*(1/255), 255*(1/255)}} + o.colors.hover = {bg = {72*(1/255), 131*(1/255), 168*(1/255)}, fg = {255*(1/255), 255*(1/255), 255*(1/255)}} + o.windowcolor = {48*(1/255), 156*(1/255), 225*(1/255)} + o.bordercolor = {72*(1/255), 131*(1/255), 168*(1/255)} return o end diff --git a/main.lua b/main.lua index d2fc968..657414b 100644 --- a/main.lua +++ b/main.lua @@ -70,9 +70,9 @@ function exf.update(dt) end function exf.draw() - love.graphics.setBackgroundColor(54, 172, 248) + love.graphics.setBackgroundColor(54*(1/255), 172*(1/255), 248*(1/255)) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.setFont(exf.bigfont) love.graphics.print("Example Browser", 20, 20) love.graphics.print("Usage:", 20, 500) @@ -128,7 +128,8 @@ function exf.intable(t, e) end function exf.run(file, title, ...) - if not love.filesystem.exists(file) then + -- if not love.filesystem.exists(file) then + if not love.filesystem.getInfo(file) then print("Could not load file .. " .. file) return end @@ -171,7 +172,7 @@ end function exf.clear() love.graphics.setBackgroundColor(0, 0, 0) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.setLineWidth(1) love.graphics.setLineStyle("smooth") love.graphics.setBlendMode("alpha") diff --git a/viewcode.lua b/viewcode.lua index 569105a..548c5de 100644 --- a/viewcode.lua +++ b/viewcode.lua @@ -5,8 +5,8 @@ function love.load() parsed = {} fontheight = love.graphics.getFont():getHeight() - local colors = {keyword = {0,0,255}, string = {128,128,128}, comment = {0,128,0}, - number = {255,128,0} , iden = {0,0,0}, default = {0,0,128}, line={255,0,0}} + local colors = {keyword = {0,0,1}, string = {0.5,0.5,0.5}, comment = {0,0.5,0}, + number = {1,0.5,0} , iden = {0,0,0}, default = {0,0,0.5}, line={1,0,0}} local contents = love.filesystem.read(filename, 4096) if not contents then @@ -29,7 +29,7 @@ end offy=0 function love.draw() love.graphics.translate(0,offy) - love.graphics.setBackgroundColor({255, 255, 255}) + love.graphics.setBackgroundColor({1, 1, 1}) love.graphics.print(parsed, 10, 20) end