Skip to content

Commit

Permalink
Ported to 11.1
Browse files Browse the repository at this point in the history
Changed all colors to new color range 0-1
Added newVideo argument settings.
Replaced :rewind with :seek(0)
  • Loading branch information
slowb33 committed Oct 22, 2018
1 parent 7da9aff commit 478a67d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion examples/011_animation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions examples/018_physics_fire_at.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ 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
love.graphics.circle("fill", v.x, v.y, 4,4)
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)
Expand Down
8 changes: 4 additions & 4 deletions examples/video_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions list.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 5 additions & 4 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions viewcode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 478a67d

Please sign in to comment.