Skip to content

Commit

Permalink
LOVE 0.10.1 support
Browse files Browse the repository at this point in the history
A brief list of changes:

- Drawing methods in 0.9 got simplified - e.g. `draw` instead of `drawq`
- Threads share variables through "channels", there's no `set` or `get`
  anymore
- Seems like GIF support was dropped (algnough there's no mention in
  LOVE's documentation), so the icon was converted to PNG
- Non-PO2 shader support is guaranteed now, checks removed
- Mouse clicks now emit numbers for buttons instead of strings
- Mouse wheel events got their own callback now, giving the change in
  x/y (we're only using the vertical wheel currently)
- Added a .gitignore
  • Loading branch information
tzvetkoff committed Apr 26, 2016
1 parent b1412a0 commit 1b402cb
Show file tree
Hide file tree
Showing 32 changed files with 260 additions and 198 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
._.*
Thumbs.db
2 changes: 1 addition & 1 deletion blockdebris.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ function blockdebris:update(dt)
end

function blockdebris:draw()
love.graphics.drawq(blockdebrisimage, blockdebrisquads[spriteset][self.frame], math.floor((self.x-xscroll)*16*scale), math.floor((self.y-.5)*16*scale), 0, scale, scale, 4, 4)
love.graphics.draw(blockdebrisimage, blockdebrisquads[spriteset][self.frame], math.floor((self.x-xscroll)*16*scale), math.floor((self.y-.5)*16*scale), 0, scale, scale, 4, 4)
end
2 changes: 1 addition & 1 deletion bowser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function bowser:draw()
--just for the hammers
if not self.fall and not self.backwards then
if self.hammertimer > self.hammertime - bowserhammerdrawtime then
love.graphics.drawq(hammerimg, hammerquad[spriteset][1], math.floor((self.x-xscroll)*16*scale), (self.y-.5-11/16)*16*scale, 0, scale, scale)
love.graphics.draw(hammerimg, hammerquad[spriteset][1], math.floor((self.x-xscroll)*16*scale), (self.y-.5-11/16)*16*scale, 0, scale, scale)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion conf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ function love.conf(t)
t.console = false
--t.screen = false
t.modules.physics = false
t.version = "0.8.0"
t.version = "0.10.1"
end
78 changes: 40 additions & 38 deletions editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ function editor_update(dt)
return
end

if love.mouse.isDown("l") and allowdrag then
if love.mouse.isDown(1) and allowdrag then
local x, y = love.mouse.getPosition()
placetile(x, y)
end
elseif editorstate == "main" then
if love.mouse.isDown("l") then
if love.mouse.isDown(1) then
local mousex, mousey = love.mouse.getPosition()
if mousey >= minimapy*scale and mousey < (minimapy+34)*scale then
if mousex >= minimapx*scale and mousex < (minimapx+394)*scale then
Expand Down Expand Up @@ -218,15 +218,15 @@ function editor_draw()
if inmap(x, y+1) then
love.graphics.setColor(255, 255, 255, 200)
if editentities == false then
love.graphics.drawq(tilequads[currenttile].image, tilequads[currenttile].quad, math.floor((x-splitxscroll[1]-1)*16*scale), ((y-1)*16+8)*scale, 0, scale, scale)
love.graphics.draw(tilequads[currenttile].image, tilequads[currenttile].quad, math.floor((x-splitxscroll[1]-1)*16*scale), ((y-1)*16+8)*scale, 0, scale, scale)
else
love.graphics.drawq(entityquads[currenttile].image, entityquads[currenttile].quad, math.floor((x-splitxscroll[1]-1)*16*scale), ((y-1)*16+8)*scale, 0, scale, scale)
love.graphics.draw(entityquads[currenttile].image, entityquads[currenttile].quad, math.floor((x-splitxscroll[1]-1)*16*scale), ((y-1)*16+8)*scale, 0, scale, scale)
end
end
end

if editorstate == "linktool" and editorstate ~= "portalgun" then
if linktoolX and love.mouse.isDown("l") then
if linktoolX and love.mouse.isDown(1) then
love.graphics.line(math.floor((linktoolX-xscroll-.5)*16*scale), math.floor((linktoolY-1)*16*scale), mousex, mousey)
end

Expand All @@ -247,17 +247,17 @@ function editor_draw()
local r = map[x][y]
local drawline = false

if tablecontains(r, "link") and cox == x and coy == y and not love.mouse.isDown("l") then
if tablecontains(r, "link") and cox == x and coy == y and not love.mouse.isDown(1) then
love.graphics.setColor(0, 255, 0, 255)
drawline = true
elseif tablecontains(r, "link") then
love.graphics.setColor(150, 255, 150, 100)
drawline = true
elseif tablecontains(outputsi, map[x][y][2]) and cox == x and coy == y and linktoolX and love.mouse.isDown("l") then
elseif tablecontains(outputsi, map[x][y][2]) and cox == x and coy == y and linktoolX and love.mouse.isDown(1) then
love.graphics.setColor(255, 255, 0, 255)
elseif tablecontains(outputsi, map[x][y][2]) then
love.graphics.setColor(255, 255, 150, 150)
elseif cox == x and coy == y and not love.mouse.isDown("l") then
elseif cox == x and coy == y and not love.mouse.isDown(1) then
love.graphics.setColor(255, 0, 0, 255)
else
love.graphics.setColor(255, 150, 150, 150)
Expand Down Expand Up @@ -314,11 +314,11 @@ function editor_draw()

if editentities == false then
for i = 1, tilelistcount+1 do
love.graphics.drawq(tilequads[i+tileliststart-1].image, tilequads[i+tileliststart-1].quad, math.mod((i-1), 22)*17*scale+5*scale, math.floor((i-1)/22)*17*scale+38*scale-tilesoffset, 0, scale, scale)
love.graphics.draw(tilequads[i+tileliststart-1].image, tilequads[i+tileliststart-1].quad, math.mod((i-1), 22)*17*scale+5*scale, math.floor((i-1)/22)*17*scale+38*scale-tilesoffset, 0, scale, scale)
end
else
for i = 1, entitiescount do
love.graphics.drawq(entityquads[i].image, entityquads[i].quad, math.mod((i-1), 22)*17*scale+5*scale, math.floor((i-1)/22)*17*scale+38*scale-tilesoffset, 0, scale, scale)
love.graphics.draw(entityquads[i].image, entityquads[i].quad, math.mod((i-1), 22)*17*scale+5*scale, math.floor((i-1)/22)*17*scale+38*scale-tilesoffset, 0, scale, scale)
end
end

Expand Down Expand Up @@ -817,7 +817,7 @@ function editor_mousepressed(x, y, button)
return
end

if button == "l" then
if button == 1 then
if editormenuopen == false then
if editorstate == "linktool" then
local tileX, tileY = getMouseTile(x, y+8*scale)
Expand Down Expand Up @@ -857,7 +857,7 @@ function editor_mousepressed(x, y, button)
end
end
end
elseif button == "m" then
elseif button == 3 then
local cox, coy = getMouseTile(x, y+8*scale)
if inmap(cox, coy) == false then
return
Expand All @@ -866,29 +866,7 @@ function editor_mousepressed(x, y, button)
tilesall()
currenttile = map[cox][coy][1]

elseif button == "wu" then
if editormenuopen then
else
if currenttile > 1 then
currenttile = currenttile - 1
end
end

elseif button == "wd" then
if editormenuopen then
else
if editentities then
if currenttile < #entitylist then
currenttile = currenttile + 1
end
else
if currenttile < smbtilecount+portaltilecount+customtilecount then
currenttile = currenttile + 1
end
end
end

elseif button == "r" then
elseif button == 2 then
if editormenuopen == false then
local tileX, tileY = getMouseTile(x, y+8*scale)
if inmap(tileX, tileY) == false then
Expand Down Expand Up @@ -951,14 +929,38 @@ function editor_mousepressed(x, y, button)
end
end

function editor_wheelmoved(x, y)
if y > 0 then
if editormenuopen then
else
if currenttile > 1 then
currenttile = currenttile - 1
end
end
elseif y < 0 then
if editormenuopen then
else
if editentities then
if currenttile < #entitylist then
currenttile = currenttile + 1
end
else
if currenttile < smbtilecount+portaltilecount+customtilecount then
currenttile = currenttile + 1
end
end
end
end
end

function rightclickmenuclick(i)
if i > 1 then
map[rightclickmenucox][rightclickmenucoy][3] = rightclickvalues[rightclickmenutile][i]
end
end

function editor_mousereleased(x, y, button)
if button == "l" then
if button == 1 then
guirepeattimer = 0
minimapdragging = false
if editorstate == "linktool" then
Expand Down Expand Up @@ -1176,8 +1178,8 @@ function savesettings()
s = s .. "lives=" .. mariolivecount .. "\n"
end

love.filesystem.mkdir( "mappacks" )
love.filesystem.mkdir( "mappacks/" .. mappack )
love.filesystem.createDirectory( "mappacks" )
love.filesystem.createDirectory( "mappacks/" .. mappack )

love.filesystem.write("mappacks/" .. mappack .. "/settings.txt", s)
end
Expand Down
2 changes: 1 addition & 1 deletion firework.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ function fireworkboom:draw()
frame = 7
end

love.graphics.drawq(fireballimg, fireballquad[frame], math.floor((self.x-xscroll)*16*scale), (self.y-0.5)*16*scale, 0, scale, scale, 8, 8)
love.graphics.draw(fireballimg, fireballquad[frame], math.floor((self.x-xscroll)*16*scale), (self.y-0.5)*16*scale, 0, scale, scale, 8, 8)
end
2 changes: 1 addition & 1 deletion flower.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ end
function flower:draw()
if self.uptimer < mushroomtime and not self.destroy then
--Draw it coming out of the block.
love.graphics.drawq(self.graphic, self.quad, math.floor(((self.x-xscroll)*16+self.offsetX)*scale), math.floor((self.y*16-self.offsetY)*scale), 0, scale, scale, self.quadcenterX, self.quadcenterY)
love.graphics.draw(self.graphic, self.quad, math.floor(((self.x-xscroll)*16+self.offsetX)*scale), math.floor((self.y*16-self.offsetY)*scale), 0, scale, scale, self.quadcenterX, self.quadcenterY)
end
end

Expand Down
Loading

0 comments on commit 1b402cb

Please sign in to comment.