mirror of
https://github.com/usysrc/LICK.git
synced 2024-11-16 09:34:22 +00:00
new classes from rukano, see docs
This commit is contained in:
parent
c7e0435862
commit
37928569ba
1
LICK/lib/docs/classes/Image.html
Normal file
1
LICK/lib/docs/classes/Image.html
Normal file
@ -0,0 +1 @@
|
||||
<HTML><HEAD><TITLE>Image</TITLE><style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #9d1c12}p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}span.s1 {font: 18.0px Helvetica}span.s2 {color: #0026b4}span.Apple-tab-span {white-space:pre}</style></HEAD><BODY><h3>Image Image from file</h3><h4> function(self, file, x, y, color, size, orientation)</h4> <i> Constructor</i><h4> draw()</h4> draw the image<br></BODY></HTML>
|
@ -1 +1 @@
|
||||
<HTML><HEAD><TITLE>Line</TITLE><style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #9d1c12}p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}span.s1 {font: 18.0px Helvetica}span.s2 {color: #0026b4}span.Apple-tab-span {white-space:pre}</style></HEAD><BODY><h3>Line draw a line</h3><h4> function(self, x, y, tx, ty)</h4> <i> Constructor</i></BODY></HTML>
|
||||
<HTML><HEAD><TITLE>Line</TITLE><style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #9d1c12}p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}span.s1 {font: 18.0px Helvetica}span.s2 {color: #0026b4}span.Apple-tab-span {white-space:pre}</style></HEAD><BODY><h3>Line draw a line</h3><h4> function(self, x, y, tx, ty, color) -- wats the dealio for polylines?</h4> <i> Constructor</i><h4> draw(width, style)</h4> draw the line<br></BODY></HTML>
|
1
LICK/lib/docs/classes/Point.html
Normal file
1
LICK/lib/docs/classes/Point.html
Normal file
@ -0,0 +1 @@
|
||||
<HTML><HEAD><TITLE>Point</TITLE><style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #9d1c12}p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}span.s1 {font: 18.0px Helvetica}span.s2 {color: #0026b4}span.Apple-tab-span {white-space:pre}</style></HEAD><BODY><h3>Point is a point</h3><h4> function(self, x, y, color, size, style)</h4> <i> Constructor</i><h4> draw()</h4> draw the point<br></BODY></HTML>
|
1
LICK/lib/docs/classes/Polygon.html
Normal file
1
LICK/lib/docs/classes/Polygon.html
Normal file
@ -0,0 +1 @@
|
||||
<HTML><HEAD><TITLE>Polygon</TITLE><style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #9d1c12}p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}span.s1 {font: 18.0px Helvetica}span.s2 {color: #0026b4}span.Apple-tab-span {white-space:pre}</style></HEAD><BODY><h3>Polygon some vertice stuff</h3><h4> function(self, vertices, color, style)</h4> <i> Constructor</i><h4> draw(style)</h4> draw the polygon<br></BODY></HTML>
|
1
LICK/lib/docs/classes/Rect.html
Normal file
1
LICK/lib/docs/classes/Rect.html
Normal file
@ -0,0 +1 @@
|
||||
<HTML><HEAD><TITLE>Rect</TITLE><style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #9d1c12}p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}span.s1 {font: 18.0px Helvetica}span.s2 {color: #0026b4}span.Apple-tab-span {white-space:pre}</style></HEAD><BODY><h3>Rect is a rectangle</h3><h4> function(self, x, y, width, height, color, style)</h4> <i> Constructor</i><h4> draw(style)</h4> draw the rectangle<br></BODY></HTML>
|
1
LICK/lib/docs/classes/Sequencer.html
Normal file
1
LICK/lib/docs/classes/Sequencer.html
Normal file
@ -0,0 +1 @@
|
||||
<HTML><HEAD><TITLE>Sequencer</TITLE><style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #9d1c12}p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}span.s1 {font: 18.0px Helvetica}span.s2 {color: #0026b4}span.Apple-tab-span {white-space:pre}</style></HEAD><BODY><h3>Sequencer a simple Sequencer with callback functions on every beat, bar or phrase</h3><h4> function(self,bpm, timeSig, phraseLength)</h4> <i> Constructor</i><h4> update(dt)</h4> counts the time and calls the appropriate functions<br></BODY></HTML>
|
1
LICK/lib/docs/classes/Text.html
Normal file
1
LICK/lib/docs/classes/Text.html
Normal file
@ -0,0 +1 @@
|
||||
<HTML><HEAD><TITLE>Text</TITLE><style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #9d1c12}p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}span.s1 {font: 18.0px Helvetica}span.s2 {color: #0026b4}span.Apple-tab-span {white-space:pre}</style></HEAD><BODY><h3>Text characters</h3><h4> function(self, x, y, text, rotation, scaleX, scaleY)</h4> <i> Constructor</i><h4> draw(text)</h4> display text on screen<br></BODY></HTML>
|
1
LICK/lib/docs/classes/Triangle.html
Normal file
1
LICK/lib/docs/classes/Triangle.html
Normal file
@ -0,0 +1 @@
|
||||
<HTML><HEAD><TITLE>Triangle</TITLE><style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #9d1c12}p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}span.s1 {font: 18.0px Helvetica}span.s2 {color: #0026b4}span.Apple-tab-span {white-space:pre}</style></HEAD><BODY><h3>Triangle has three sides</h3><h4> function(self, vertices, color, style)</h4> <i> Constructor</i><h4> draw(style)</h4> draw the triangle<br></BODY></HTML>
|
@ -32,6 +32,7 @@ local upack = vstruct.unpack
|
||||
|
||||
osc.client = {}
|
||||
osc.client.host = "localhost"
|
||||
osc.client.ip = nil
|
||||
osc.client.port = 57110
|
||||
osc.client.timeout = 0
|
||||
|
||||
@ -43,7 +44,7 @@ IMMEDIATE = string.rep('0', 31) .. '1'
|
||||
|
||||
|
||||
function osc.client:send( data )
|
||||
local ip, port = assert(socket.dns.toip(osc.client.host)), osc.client.port
|
||||
local ip, port = osc.client.ip or assert(socket.dns.toip(osc.client.host)), osc.client.port
|
||||
-- create a new UDP object
|
||||
local udp = assert(socket.udp())
|
||||
udp:settimeout(0)
|
||||
|
@ -178,7 +178,6 @@ end
|
||||
Circle = Class(function(self, x, y, r, s, color)
|
||||
self.r = r or 10
|
||||
self.s = s or 16
|
||||
self.color = color
|
||||
-- call constructor of Drawable
|
||||
Drawable.construct(self,x,y,color)
|
||||
end)
|
||||
@ -252,7 +251,7 @@ end
|
||||
--[[
|
||||
POINT
|
||||
--]]
|
||||
-- @Point
|
||||
-- @Point: is a point
|
||||
Point = Class(function(self, x, y, color, size, style)
|
||||
local color=color or ""
|
||||
local size=size or 1
|
||||
@ -279,7 +278,7 @@ end
|
||||
--[[
|
||||
Sequencer
|
||||
--]]
|
||||
|
||||
--@Sequencer: a simple Sequencer with callback functions on every beat, bar or phrase
|
||||
Sequencer = Class(function(self,bpm, timeSig, phraseLength)
|
||||
self.timer = 0
|
||||
self.frame = 0
|
||||
@ -299,6 +298,7 @@ Sequencer = Class(function(self,bpm, timeSig, phraseLength)
|
||||
end)
|
||||
Sequencer:inherit(Object)
|
||||
|
||||
-- #counts the time and calls the appropriate functions
|
||||
function Sequencer:update(dt)
|
||||
self.timer = self.timer + dt
|
||||
self.frame = self.frame + 1
|
||||
@ -319,9 +319,134 @@ function Sequencer:update(dt)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--[[
|
||||
POLYGON
|
||||
--]]
|
||||
-- @Polygon: some vertice stuff
|
||||
Polygon = Class(function(self, vertices, color, style)
|
||||
local color=color or {255,255,255,255}
|
||||
|
||||
self.style = style or "line"
|
||||
|
||||
-- todo: ask for odd/even number of table
|
||||
if type(vertices) ~= "table" then
|
||||
print("vertices has to be a even table!")
|
||||
end
|
||||
|
||||
self.vertices = vertices
|
||||
|
||||
-- first vertice = x, y
|
||||
local x=vertices[1]
|
||||
local y=vertices[2]
|
||||
|
||||
-- TODO: compute center
|
||||
|
||||
-- call constructor of Drawable
|
||||
Drawable.construct(self,x,y,color)
|
||||
end)
|
||||
Polygon:inherit(Drawable)
|
||||
|
||||
-- #draw the polygon
|
||||
function Polygon:draw(style)
|
||||
local style=style or self.style
|
||||
love.graphics.setColor(unpack(self.color))
|
||||
love.graphics.polygon(style, self.vertices)
|
||||
end
|
||||
|
||||
--[[
|
||||
RECT
|
||||
--]]
|
||||
-- @Rect: is a rectangle
|
||||
Rect = Class(function(self, x, y, width, height, color, style)
|
||||
local color=color or {255,255,255,255}
|
||||
self.style = style or "line"
|
||||
self.width = width
|
||||
self.height = height
|
||||
|
||||
-- TODO: compute center
|
||||
|
||||
-- call constructor of Drawable
|
||||
Drawable.construct(self,x,y,color)
|
||||
end)
|
||||
Rect:inherit(Drawable)
|
||||
|
||||
-- #draw the rectangle
|
||||
function Rect:draw(style)
|
||||
local style=style or self.style
|
||||
love.graphics.setColor(unpack(self.color))
|
||||
love.graphics.rectangle(style, self.position.x, self.position.y, self.width, self.height)
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
TRIANGLE
|
||||
--]]
|
||||
-- @Triangle: has three sides
|
||||
Triangle = Class(function(self, vertices, color, style)
|
||||
local color=color or {255,255,255,255}
|
||||
self.style = style or "line"
|
||||
|
||||
-- todo: ask for 6 number of table
|
||||
if type(vertices) ~= "table" then
|
||||
print("vertices has to be a even table!")
|
||||
end
|
||||
|
||||
self.vertices = vertices
|
||||
|
||||
-- first vertice = x, y
|
||||
local x=vertices[1]
|
||||
local y=vertices[2]
|
||||
|
||||
-- TODO: compute center
|
||||
|
||||
-- call constructor of Drawable
|
||||
Drawable.construct(self,x,y,color)
|
||||
end)
|
||||
Triangle:inherit(Drawable)
|
||||
|
||||
-- #draw the triangle
|
||||
function Triangle:draw(style)
|
||||
local style=style or self.style
|
||||
love.graphics.setColor(unpack(self.color))
|
||||
love.graphics.triangle(style, unpack(self.vertices))
|
||||
end
|
||||
|
||||
--[[
|
||||
TEXT
|
||||
--]]
|
||||
-- @Text: characters
|
||||
Text = Class(function(self, x, y, text, rotation, scaleX, scaleY)
|
||||
local color=color or {255,255,255,255}
|
||||
self.text=text or "LICK WITH LOVE"
|
||||
self.rotation=rotation or 0
|
||||
self.scaleX = scaleX or 1
|
||||
self.scaleY = scaleY or 1
|
||||
self.font = "implement fonts?..."
|
||||
|
||||
-- TODO: compute center
|
||||
|
||||
-- call constructor of Drawable
|
||||
Drawable.construct(self,x,y,color)
|
||||
end)
|
||||
Text:inherit(Drawable)
|
||||
|
||||
-- #display text on screen
|
||||
function Text:draw(text)
|
||||
local text = text or self.text
|
||||
love.graphics.setColor(unpack(self.color))
|
||||
love.graphics.print(
|
||||
text,
|
||||
self.position.x,
|
||||
self.position.y,
|
||||
self.rotationr,
|
||||
self.scaleX,
|
||||
self.scaleY
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
-- EXAMPLE:
|
||||
-- (put in love.load):
|
||||
-- coco = Circle(300,300)
|
||||
|
Loading…
Reference in New Issue
Block a user