Just thought I'd post this here in case it's somehow useful, an untested script for making some things work in 0.9.0:
Code: Select all
math.randomseed(os.time())
math.random()
math.random()
love.filesystem.mkdir = love.filesystem.createDirectory
love.filesystem.enumerate = love.filesystem.getDirectoryItems
if love.audio then
love.audio._newSource = love.audio.newSource
love.audio.newSource = function(a, b)
local s
if b == 'static' then
s = love.audio._newSource(a, 'static')
else
s = love.audio._newSource(a)
end
local mt = getmetatable(s)
mt.__index.setDistance = s.setAttenuationDistances
mt.__index.getDistance = s.getAttenuationDistances
return s
end
end
if love.mouse then
love.mouse.setGrab = love.mouse.setGrabbed
end
if love.timer then
love.timer.getMicroTime = love.timer.getTime
end
if love.graphics then
love.graphics.checkMode = function(width, height, fullscreen)
if fullscreen == false then
return true
else
for i, v in ipairs(love.window.getFullscreenModes()) do
if width == v.width and height == v.height then
return true
end
end
return false
end
end
love.graphics.toggleFullscreen = function()
return love.window.setFullscreen(not love.window.getFullscreen())
end
love.graphics.setLine = function(a, b)
love.graphics.setLineWidth(a)
love.graphics.setLineStyle(b or 'smooth')
end
love.graphics.setPoint = function(a, b)
love.graphics.setPointSize(a)
love.graphics.setPointHeight(b)
end
love.graphics.setMode = function ( width, height, fullscreen, vsync, fsaa )
local flags = {}
if fullscreen ~= nil then
flags.fullscreen = fullscreen
end
if vsync ~= nil then
flags.vsync = vsync
end
if fsaa ~= nil then
flags.fsaa = fsaa
end
love.window.setMode(width, height, flags)
end
love.graphics.setIcon = function(a)
if a:type() == 'Image' then
a = a:getData()
end
love.window.setIcon(a)
end
love.graphics._isSupported = love.graphics.isSupported
function love.graphics.isSupported(...)
local t = {...}
for k, v in pairs(t) do
if v == 'pixeleffect' then
t[k] = 'shader'
end
end
love.graphics._isSupported(unpack(t))
end
love.graphics.getMode = function()
local w, h, flags = love.window.getMode()
return w, h, flags.fullscreen, flags.vsync, flags.fsaa
end
love.graphics.newPixelEffect = function(a) return love.graphics.newShader(a) end
love.graphics.setPixelEffect = love.graphics.setShader
love.graphics.getPixelEffect = love.graphics.getShader
love.graphics.getModes = love.window.getFullscreenModes
love.graphics.quad = love.graphics.polygon
love.graphics.triangle = love.graphics.polygon
love.graphics.newStencil = function(a) return a end
love.graphics.setCaption = love.window.setTitle
love.graphics.getCaption = love.window.getTitle
love.graphics.hasFocus = love.window.hasFocus
love.graphics.isCreated = love.window.isCreated
love.graphics.setDefaultImageFilter = love.graphics.setDefaultFilter
love.graphics._newParticleSystem = love.graphics.newParticleSystem
love.graphics.newParticleSystem = function(...)
local ps = love.graphics._newParticleSystem(...)
local mt = getmetatable(ps)
local sizevariation = mt.__index.setSizeVariation
mt.__index.setSizeVariation = function(self, min, max)
if max then
sizevariation(self, math.min(math.max(min, 0), 1), math.min(math.max(max, 0), 1))
else
sizevariation(self, math.min(math.max(min, 0), 1))
end
end
mt.__index.setSprite = ps.setImage
mt.__index.setGravity = ps.setLinearAcceleration
mt.__index.setLifetime = ps.setEmitterLifetime
mt.__index.setParticleLife = ps.setParticleLifetime
mt.__index.count = ps.getCount
mt.__index.isEmpty = function() return ps.count(ps) == 0 end
mt.__index.setGravity = function(self, min, max) self:setLinearAcceleration(0, min, 0, max) end
--mt.__index.isFull = function() return false end
return ps
end
love.graphics._newQuad = love.graphics.newQuad
love.graphics.newQuad = function(x, y, width, height, sw, sh)
local quad = love.graphics._newQuad(x, y, width, height, sw, sh)
return {sw, sh, quad, flip = function(self, h, v)
if h then
local x, y, w, h = self[3]:getViewport()
x = -x-w
self[1] = -self[1]
self[3]:setViewport(x, y, w, h, self[1], self[2])
end
if v then
local x, y, w, h = self[3]:getViewport()
y = -y-h
self[2] = -self[2]
self[3]:setViewport(x, y, w, h, self[1], self[2])
end
end,
setViewport = function(self, x, y, w, h) self[3]:setViewport(x, y, w, h) end,
getViewport = function(self) return self[3]:getViewport() end
}
end
love.graphics.drawq = function(image, quad, ...)
love.graphics.draw(image, quad[3], ...)
end
love.graphics._newSpriteBatch = love.graphics.newSpriteBatch
love.graphics.newSpriteBatch = function(...)
local sb = love.graphics._newSpriteBatch(...)
local mt = getmetatable(sb)
mt.__index.addq = function(self, quad, x, y, r, sx, sy, ox, oy, kx, ky)
self.add(self, quad[3], x, y, r, sx, sy, ox, oy, kx, ky)
end
mt.__index.setq = function(self, id, quad, x, y, r, sx, sy, ox, oy, kx, ky)
self.set(self, id, quad[3], x, y, r, sx, sy, ox, oy, kx, ky)
end
return sb
end
end
if love.joystick then
love.joystick.getNumJoysticks = love.joystick.getJoystickCount
local __joysticks = love.joystick.getJoysticks()
love.joystick.isDown = function(i) if __joysticks[i] then return __joysticks[i]:isDown() else return false end end
love.joystick.getAxes = function(i) if __joysticks[i] then return __joysticks[i]:getAxes() else return 0 end end
love.joystick.getAxis = function(i) if __joysticks[i] then return __joysticks[i]:getAxis() else return 0 end end
love.joystick.getHat = function(i) if __joysticks[i] then return __joysticks[i]:getHat() end end
love.joystick.getName = function(i) if __joysticks[i] then return __joysticks[i]:getName() end end
love.joystick.getNumAxes = function(i) if __joysticks[i] then return __joysticks[i]:getNumAxes() else return 0 end end
love.joystick.getNumButtons = function(i) if __joysticks[i] then return __joysticks[i]:getNumButtons() else return 0 end end
love.joystick.getNumHats = function(i) if __joysticks[i] then return __joysticks[i]:getNumHats() else return 0 end end
--love.joystick.isOpen = function() return true end
--love.joystick.open = function() end
--love.joystick.close = function() end
end
--love.graphics.setColorMode = function() end