mirror of
https://github.com/usysrc/LICK.git
synced 2024-11-16 09:34:22 +00:00
copied new LICK folder
This commit is contained in:
parent
d407dfe1b0
commit
12b4dce5f7
@ -1,17 +1,9 @@
|
||||
-- hlpr libary: it's not about nice coding, ist about fast and easy coding
|
||||
-- by Rukano and Headchant, 2011
|
||||
pi = math.pi
|
||||
|
||||
setColor = love.graphics.setColor
|
||||
rectangle = love.graphics.rectangle
|
||||
getWidth = love.graphics.getWidth
|
||||
getHeight = love.graphics.getHeight
|
||||
push = love.graphics.push
|
||||
pop = love.graphics.pop
|
||||
translate = love.graphics.translate
|
||||
rotate = love.graphics.rotate
|
||||
scale = love.graphics.scale
|
||||
circle = love.graphics.circle
|
||||
|
||||
-- global math
|
||||
pi = math.pi
|
||||
sin = math.sin
|
||||
deg = math.deg
|
||||
rad = math.rad
|
||||
@ -19,6 +11,74 @@ rad = math.rad
|
||||
|
||||
require "LICK/lib/color"
|
||||
|
||||
-- syntax shortcuts
|
||||
checkMode = love.graphics.checkMode
|
||||
circle = love.graphics.circle
|
||||
clear = love.graphics.clear
|
||||
draw = love.graphics.draw
|
||||
drawq = love.graphics.drawq
|
||||
getBackgroundColor = love.graphics.getBackgroundColor
|
||||
getBlendMode = love.graphics.getBlendMode
|
||||
getCaption =love.graphics.getCaption
|
||||
getColor = love.graphics.getColor
|
||||
getColorMode = love.graphics.getColorMode
|
||||
getFont = love.graphics.getFont
|
||||
getHeight = love.graphics.getHeight
|
||||
getLineStipple = love.graphics.getLineStipple
|
||||
getLineStyle = love.graphics.getLineStyle
|
||||
getLineWidth = love.graphics.getLineWidth
|
||||
getMaxPointSize = love.graphics.getMaxPointSize
|
||||
getModes = love.graphics.getModes
|
||||
getPointSize = love.graphics.getPointSize
|
||||
getPointStyle = love.graphics.getPointStyle
|
||||
getScissor = love.graphics.getScissor
|
||||
getWidth = love.graphics.getWidth
|
||||
isCreated = love.graphics.isCreated
|
||||
line = love.graphics.line
|
||||
newFont = love.graphics.newFont
|
||||
newFrameBuffer = love.graphics.newFramebuffer
|
||||
newImage = love.graphics.newImage
|
||||
newImageFont = love.graphics.newImageFont
|
||||
newParticleSystem = love.graphics.newParticleSystem
|
||||
newQuad = love.graphics.newQuad
|
||||
newScreenshot = love.graphics.newScreenshot
|
||||
newSpriteBatch = love.graphics.newSpriteBatch
|
||||
point = love.graphics.point
|
||||
polygon = love.graphics.polygon
|
||||
pop = love.graphics.pop
|
||||
present = love.graphics.present
|
||||
print = love.graphics.print
|
||||
printf = love.graphics.printf
|
||||
push = love.graphics.push
|
||||
quad = love.graphics.quad
|
||||
rectagle = love.graphics.rectangle
|
||||
reset = love.graphics.reset
|
||||
rotate = love.graphics.rotate
|
||||
scale = love.graphics.scale
|
||||
setBackgroundColor = love.graphics.setBackgroundColor
|
||||
setBlendMode = love.graphics.setBlendMode
|
||||
setCaption = love.graphics.setCaption
|
||||
setColor = love.graphics.setColor
|
||||
setColorMode = love.graphics.setColorMode
|
||||
setFont = love.graphics.setFont
|
||||
setIcon = love.graphics.setIcon
|
||||
setLine = love.graphics.setLine
|
||||
setLineStipple = love.graphics.setLineStipple
|
||||
setLineStyle = love.graphics.setLineStyle
|
||||
setLineWidth = love.graphics.setLineWidth
|
||||
setMode = love.graphics.setMode
|
||||
setPoint = love.graphics.setPoint
|
||||
setPointSize = love.graphics.setPointSize
|
||||
setPointStyle = love.graphics.setPointStyle
|
||||
setRenderTarget = love.graphics.setRenderTarget
|
||||
setScissor = love.graphics.setScissor
|
||||
toggleFullscreen = love.graphics.toggleFullscreen
|
||||
translate = love.graphics.translate
|
||||
triangle = love.graphics.triangle
|
||||
|
||||
|
||||
|
||||
|
||||
module(...,package.seeall)
|
||||
|
||||
|
||||
@ -38,7 +98,7 @@ function color(r, g,b,a)
|
||||
return color
|
||||
end
|
||||
|
||||
-- clip withing range (by redlock)
|
||||
-- clip withing range
|
||||
function clip(n,min,max)
|
||||
return math.min(math.max(n, min or -math.huge), max or math.huge)
|
||||
end
|
||||
|
@ -101,7 +101,7 @@ function SCSynth:free()
|
||||
"i",
|
||||
self.nodeid,
|
||||
"i",
|
||||
0,
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,18 +194,82 @@ end
|
||||
|
||||
|
||||
|
||||
----------------------------------------
|
||||
-- Experimental Objects
|
||||
----------------------------------------
|
||||
|
||||
|
||||
--[[
|
||||
LINE
|
||||
--]]
|
||||
-- @Line: draw a line
|
||||
Line = Class(function(self, x, y, tx, ty)
|
||||
self.tx = tx or 0
|
||||
self.ty = ty or 0
|
||||
-- call constructor of Drawable
|
||||
Drawable.construct()
|
||||
Line = Class(function(self, x, y, tx, ty, color) -- wats the dealio for polylines?
|
||||
self.x = x or 0
|
||||
self.y = y or 0
|
||||
self.tx = tx or 0
|
||||
self.ty = ty or 0
|
||||
-- call constructor of Drawable
|
||||
Drawable.construct(self, x, y, color)
|
||||
|
||||
end)
|
||||
Line:inherit(Object)
|
||||
end)
|
||||
Line:inherit(Drawable)
|
||||
-- TODO: FIX the :set("key", value) ... dunno how it works..!
|
||||
|
||||
-- #draw the line
|
||||
function Line:draw(width, style)
|
||||
local width=width or 1
|
||||
if style ~= "smooth" and style ~= "rough" then
|
||||
style = "smooth"
|
||||
end
|
||||
love.graphics.setLine(width, style)
|
||||
love.graphics.setColor(unpack(self.color))
|
||||
love.graphics.line(self.position.x, self.position.y, self.tx, self.ty)
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
IMAGE
|
||||
--]]
|
||||
-- @Image: Image from file
|
||||
Image = Class(function(self, file, x, y, color, size, orientation)
|
||||
self.image = love.graphics.newImage(file)
|
||||
-- put positions, size, orientation...
|
||||
|
||||
-- call constructor of Drawable
|
||||
Drawable.construct(self,x,y,color)
|
||||
end)
|
||||
Image:inherit(Drawable)
|
||||
|
||||
-- #draw the image
|
||||
function Image:draw()
|
||||
love.graphics.setColor(unpack(self.color))
|
||||
love.graphics.draw(self.image, self.position.x, self.position.y)
|
||||
end
|
||||
|
||||
--[[
|
||||
POINT
|
||||
--]]
|
||||
-- @Point
|
||||
Point = Class(function(self, x, y, color, size, style)
|
||||
local color=color or ""
|
||||
local size=size or 1
|
||||
local style=style or "smooth"
|
||||
|
||||
-- should this be here? or in the constructor?
|
||||
self.size = size
|
||||
self.style = style
|
||||
|
||||
-- call constructor of Drawable
|
||||
Drawable.construct(self,x,y,color)
|
||||
end)
|
||||
Point:inherit(Drawable)
|
||||
|
||||
-- #draw the point
|
||||
function Point:draw()
|
||||
love.graphics.setColor(unpack(self.color))
|
||||
love.graphics.setPoint(self.size, self.style)
|
||||
love.graphics.point(self.position.x, self.position.y)
|
||||
end
|
||||
|
||||
|
||||
-- EXAMPLE:
|
||||
|
@ -1,17 +1,9 @@
|
||||
-- hlpr libary: it's not about nice coding, ist about fast and easy coding
|
||||
-- by Rukano and Headchant, 2011
|
||||
pi = math.pi
|
||||
|
||||
setColor = love.graphics.setColor
|
||||
rectangle = love.graphics.rectangle
|
||||
getWidth = love.graphics.getWidth
|
||||
getHeight = love.graphics.getHeight
|
||||
push = love.graphics.push
|
||||
pop = love.graphics.pop
|
||||
translate = love.graphics.translate
|
||||
rotate = love.graphics.rotate
|
||||
scale = love.graphics.scale
|
||||
circle = love.graphics.circle
|
||||
|
||||
-- global math
|
||||
pi = math.pi
|
||||
sin = math.sin
|
||||
deg = math.deg
|
||||
rad = math.rad
|
||||
@ -19,6 +11,74 @@ rad = math.rad
|
||||
|
||||
require "LICK/lib/color"
|
||||
|
||||
-- syntax shortcuts
|
||||
checkMode = love.graphics.checkMode
|
||||
circle = love.graphics.circle
|
||||
clear = love.graphics.clear
|
||||
draw = love.graphics.draw
|
||||
drawq = love.graphics.drawq
|
||||
getBackgroundColor = love.graphics.getBackgroundColor
|
||||
getBlendMode = love.graphics.getBlendMode
|
||||
getCaption =love.graphics.getCaption
|
||||
getColor = love.graphics.getColor
|
||||
getColorMode = love.graphics.getColorMode
|
||||
getFont = love.graphics.getFont
|
||||
getHeight = love.graphics.getHeight
|
||||
getLineStipple = love.graphics.getLineStipple
|
||||
getLineStyle = love.graphics.getLineStyle
|
||||
getLineWidth = love.graphics.getLineWidth
|
||||
getMaxPointSize = love.graphics.getMaxPointSize
|
||||
getModes = love.graphics.getModes
|
||||
getPointSize = love.graphics.getPointSize
|
||||
getPointStyle = love.graphics.getPointStyle
|
||||
getScissor = love.graphics.getScissor
|
||||
getWidth = love.graphics.getWidth
|
||||
isCreated = love.graphics.isCreated
|
||||
line = love.graphics.line
|
||||
newFont = love.graphics.newFont
|
||||
newFrameBuffer = love.graphics.newFramebuffer
|
||||
newImage = love.graphics.newImage
|
||||
newImageFont = love.graphics.newImageFont
|
||||
newParticleSystem = love.graphics.newParticleSystem
|
||||
newQuad = love.graphics.newQuad
|
||||
newScreenshot = love.graphics.newScreenshot
|
||||
newSpriteBatch = love.graphics.newSpriteBatch
|
||||
point = love.graphics.point
|
||||
polygon = love.graphics.polygon
|
||||
pop = love.graphics.pop
|
||||
present = love.graphics.present
|
||||
print = love.graphics.print
|
||||
printf = love.graphics.printf
|
||||
push = love.graphics.push
|
||||
quad = love.graphics.quad
|
||||
rectagle = love.graphics.rectangle
|
||||
reset = love.graphics.reset
|
||||
rotate = love.graphics.rotate
|
||||
scale = love.graphics.scale
|
||||
setBackgroundColor = love.graphics.setBackgroundColor
|
||||
setBlendMode = love.graphics.setBlendMode
|
||||
setCaption = love.graphics.setCaption
|
||||
setColor = love.graphics.setColor
|
||||
setColorMode = love.graphics.setColorMode
|
||||
setFont = love.graphics.setFont
|
||||
setIcon = love.graphics.setIcon
|
||||
setLine = love.graphics.setLine
|
||||
setLineStipple = love.graphics.setLineStipple
|
||||
setLineStyle = love.graphics.setLineStyle
|
||||
setLineWidth = love.graphics.setLineWidth
|
||||
setMode = love.graphics.setMode
|
||||
setPoint = love.graphics.setPoint
|
||||
setPointSize = love.graphics.setPointSize
|
||||
setPointStyle = love.graphics.setPointStyle
|
||||
setRenderTarget = love.graphics.setRenderTarget
|
||||
setScissor = love.graphics.setScissor
|
||||
toggleFullscreen = love.graphics.toggleFullscreen
|
||||
translate = love.graphics.translate
|
||||
triangle = love.graphics.triangle
|
||||
|
||||
|
||||
|
||||
|
||||
module(...,package.seeall)
|
||||
|
||||
|
||||
@ -38,7 +98,7 @@ function color(r, g,b,a)
|
||||
return color
|
||||
end
|
||||
|
||||
-- clip withing range (by redlock)
|
||||
-- clip withing range
|
||||
function clip(n,min,max)
|
||||
return math.min(math.max(n, min or -math.huge), max or math.huge)
|
||||
end
|
||||
|
@ -101,7 +101,7 @@ function SCSynth:free()
|
||||
"i",
|
||||
self.nodeid,
|
||||
"i",
|
||||
0,
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,18 +194,82 @@ end
|
||||
|
||||
|
||||
|
||||
----------------------------------------
|
||||
-- Experimental Objects
|
||||
----------------------------------------
|
||||
|
||||
|
||||
--[[
|
||||
LINE
|
||||
--]]
|
||||
-- @Line: draw a line
|
||||
Line = Class(function(self, x, y, tx, ty)
|
||||
self.tx = tx or 0
|
||||
self.ty = ty or 0
|
||||
-- call constructor of Drawable
|
||||
Drawable.construct()
|
||||
Line = Class(function(self, x, y, tx, ty, color) -- wats the dealio for polylines?
|
||||
self.x = x or 0
|
||||
self.y = y or 0
|
||||
self.tx = tx or 0
|
||||
self.ty = ty or 0
|
||||
-- call constructor of Drawable
|
||||
Drawable.construct(self, x, y, color)
|
||||
|
||||
end)
|
||||
Line:inherit(Object)
|
||||
end)
|
||||
Line:inherit(Drawable)
|
||||
-- TODO: FIX the :set("key", value) ... dunno how it works..!
|
||||
|
||||
-- #draw the line
|
||||
function Line:draw(width, style)
|
||||
local width=width or 1
|
||||
if style ~= "smooth" and style ~= "rough" then
|
||||
style = "smooth"
|
||||
end
|
||||
love.graphics.setLine(width, style)
|
||||
love.graphics.setColor(unpack(self.color))
|
||||
love.graphics.line(self.position.x, self.position.y, self.tx, self.ty)
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
IMAGE
|
||||
--]]
|
||||
-- @Image: Image from file
|
||||
Image = Class(function(self, file, x, y, color, size, orientation)
|
||||
self.image = love.graphics.newImage(file)
|
||||
-- put positions, size, orientation...
|
||||
|
||||
-- call constructor of Drawable
|
||||
Drawable.construct(self,x,y,color)
|
||||
end)
|
||||
Image:inherit(Drawable)
|
||||
|
||||
-- #draw the image
|
||||
function Image:draw()
|
||||
love.graphics.setColor(unpack(self.color))
|
||||
love.graphics.draw(self.image, self.position.x, self.position.y)
|
||||
end
|
||||
|
||||
--[[
|
||||
POINT
|
||||
--]]
|
||||
-- @Point
|
||||
Point = Class(function(self, x, y, color, size, style)
|
||||
local color=color or ""
|
||||
local size=size or 1
|
||||
local style=style or "smooth"
|
||||
|
||||
-- should this be here? or in the constructor?
|
||||
self.size = size
|
||||
self.style = style
|
||||
|
||||
-- call constructor of Drawable
|
||||
Drawable.construct(self,x,y,color)
|
||||
end)
|
||||
Point:inherit(Drawable)
|
||||
|
||||
-- #draw the point
|
||||
function Point:draw()
|
||||
love.graphics.setColor(unpack(self.color))
|
||||
love.graphics.setPoint(self.size, self.style)
|
||||
love.graphics.point(self.position.x, self.position.y)
|
||||
end
|
||||
|
||||
|
||||
-- EXAMPLE:
|
||||
|
Loading…
Reference in New Issue
Block a user