Merge template-live-editor
This commit is contained in:
commit
b138f1ff9b
1
0000-freewheeling-start
Normal file
1
0000-freewheeling-start
Normal file
|
@ -0,0 +1 @@
|
|||
This file contains no definition, but is used as a marker in the save dir to indicate all definitions have been copied from the repo to the save dir.
|
|
@ -1 +0,0 @@
|
|||
{"fw_parent":0,"on":1}
|
10
0002-Surface
10
0002-Surface
|
@ -1,10 +0,0 @@
|
|||
Surface = {
|
||||
{type='rect', x=50,y=50, width=20,height=80, r=1,g=0,b=0},
|
||||
{type='line', data={0,0, 0,600}},
|
||||
{type='line', data={0,0, 800,0}},
|
||||
{type='text', data='0', x=-20,y=-20},
|
||||
{type='circle', x=300,y=200, radius=40, r=1,g=0,b=1},
|
||||
{type='arc', x=0,y=0, radius=50, angle1=0, angle2=math.pi*2/3},
|
||||
{type='ellipse', x=100,y=100, radiusx=10, radiusy=50},
|
||||
{type='bezier', data={25,25, 25,125, 75,25, 125,25}},
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
{"on":1,"Surface":2,"fw_parent":1}
|
11
0003-Surface
11
0003-Surface
|
@ -1,11 +0,0 @@
|
|||
Surface = {
|
||||
-- test data
|
||||
{type='rect', x=50,y=50, width=20,height=80, r=1,g=0,b=0},
|
||||
{type='line', data={0,0, 0,600}},
|
||||
{type='line', data={0,0, 800,0}},
|
||||
{type='text', data='0', x=-20,y=-20},
|
||||
{type='circle', x=300,y=200, radius=40, r=1,g=0,b=1},
|
||||
{type='arc', x=0,y=0, radius=50, angle1=0, angle2=math.pi*2/3},
|
||||
{type='ellipse', x=100,y=100, radiusx=10, radiusy=50},
|
||||
{type='bezier', data={25,25, 25,125, 75,25, 125,25}},
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
{"on":1,"Surface":3,"fw_parent":2}
|
|
@ -1 +0,0 @@
|
|||
{"on.draw":4,"on":1,"Surface":3,"fw_parent":3}
|
50
0004-on.draw
50
0004-on.draw
|
@ -1,50 +0,0 @@
|
|||
on.draw = function()
|
||||
for _,obj in ipairs(Surface) do
|
||||
color(obj.r or 1, obj.g or 1, obj.b or 1)
|
||||
if obj.type == 'rect' then
|
||||
rect(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.width),scale(obj.height))
|
||||
elseif obj.type == 'line' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
end
|
||||
line(unpack(obj.zdata))
|
||||
elseif obj.type == 'circle' then
|
||||
circ(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
|
||||
elseif obj.type == 'arc' then
|
||||
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
|
||||
elseif obj.type == 'ellipse' then
|
||||
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
|
||||
elseif obj.type == 'text' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.text = love.graphics.newText(Font[scaled_fontsize], obj.data)
|
||||
end
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
elseif obj.type == 'bezier' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(zdata, vx(obj.data[i]))
|
||||
table.insert(zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
end
|
||||
line(unpack(obj.zdata))
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"Surface":3,"vx":5,"on.draw":4,"fw_parent":4,"on":1}
|
|
@ -1 +0,0 @@
|
|||
Viewport = {x=-50, y=-50, w=800,h=600, zoom=1.5}
|
|
@ -1 +0,0 @@
|
|||
{"Surface":3,"vx":5,"Viewport":6,"on.draw":4,"fw_parent":5,"on":1}
|
|
@ -1 +0,0 @@
|
|||
{"Surface":3,"vx":5,"on":1,"Viewport":6,"on.draw":4,"fw_parent":6,"scale":7}
|
|
@ -1 +0,0 @@
|
|||
{"on":1,"Surface":3,"vx":5,"vy":8,"Viewport":6,"on.draw":4,"fw_parent":7,"scale":7}
|
|
@ -1 +0,0 @@
|
|||
{"on":1,"Surface":3,"vx":5,"vy":8,"Viewport":6,"on.draw":9,"fw_parent":8,"scale":7}
|
50
0009-on.draw
50
0009-on.draw
|
@ -1,50 +0,0 @@
|
|||
on.draw = function()
|
||||
for _,obj in ipairs(Surface) do
|
||||
color(obj.r or 1, obj.g or 1, obj.b or 1)
|
||||
if obj.type == 'rectangle' then
|
||||
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.width),scale(obj.height))
|
||||
elseif obj.type == 'line' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'circle' then
|
||||
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
|
||||
elseif obj.type == 'arc' then
|
||||
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
|
||||
elseif obj.type == 'ellipse' then
|
||||
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
|
||||
elseif obj.type == 'text' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.text = love.graphics.newText(Font[scaled_fontsize], obj.data)
|
||||
end
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
elseif obj.type == 'bezier' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(zdata, vx(obj.data[i]))
|
||||
table.insert(zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"on":1,"Surface":3,"vx":5,"vy":8,"Viewport":6,"on.draw":10,"fw_parent":9,"scale":7}
|
50
0010-on.draw
50
0010-on.draw
|
@ -1,50 +0,0 @@
|
|||
on.draw = function()
|
||||
for _,obj in ipairs(Surface) do
|
||||
love.graphics.setColor(obj.r or 1, obj.g or 1, obj.b or 1)
|
||||
if obj.type == 'rectangle' then
|
||||
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.width),scale(obj.height))
|
||||
elseif obj.type == 'line' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'circle' then
|
||||
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
|
||||
elseif obj.type == 'arc' then
|
||||
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
|
||||
elseif obj.type == 'ellipse' then
|
||||
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
|
||||
elseif obj.type == 'text' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.text = love.graphics.newText(Font[scaled_fontsize], obj.data)
|
||||
end
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
elseif obj.type == 'bezier' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(zdata, vx(obj.data[i]))
|
||||
table.insert(zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"on":1,"Surface":3,"vx":5,"vy":8,"Viewport":6,"on.draw":11,"fw_parent":10,"scale":7}
|
50
0011-on.draw
50
0011-on.draw
|
@ -1,50 +0,0 @@
|
|||
on.draw = function()
|
||||
for _,obj in ipairs(Surface) do
|
||||
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
|
||||
if obj.type == 'rectangle' then
|
||||
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.width),scale(obj.height))
|
||||
elseif obj.type == 'line' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'circle' then
|
||||
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
|
||||
elseif obj.type == 'arc' then
|
||||
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
|
||||
elseif obj.type == 'ellipse' then
|
||||
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
|
||||
elseif obj.type == 'text' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.text = love.graphics.newText(Font[scaled_fontsize], obj.data)
|
||||
end
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
elseif obj.type == 'bezier' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(zdata, vx(obj.data[i]))
|
||||
table.insert(zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"vx":5,"vy":8,"on":1,"scale":7,"on.mouse_press":12,"Surface":3,"on.draw":11,"fw_parent":11,"Viewport":6}
|
|
@ -1,3 +0,0 @@
|
|||
on.mouse_press = function(x,y, mouse_button)
|
||||
Pan = {x=Viewport.x+x,y=Viewport.y+y}
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"vx":5,"vy":8,"on":1,"on.mouse_release":13,"scale":7,"on.mouse_press":12,"Surface":3,"on.draw":11,"fw_parent":12,"Viewport":6}
|
|
@ -1,3 +0,0 @@
|
|||
on.mouse_release = function(x,y, mouse_button)
|
||||
Pan = nil
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"vx":5,"vy":8,"on":1,"on.mouse_release":13,"scale":7,"on.mouse_press":12,"Surface":3,"on.update":14,"on.draw":11,"fw_parent":14,"Viewport":6}
|
|
@ -1,6 +0,0 @@
|
|||
on.update = function(dt)
|
||||
if Pan then
|
||||
Viewport.x = Pan.x - App.mouse_x()
|
||||
Viewport.y = Pan.y - App.mouse_y()
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":15,"on.mouse_press":12,"Surface":3,"on.mouse_release":13,"scale":7,"on.update":14,"on":1,"vx":5,"Viewport":6,"vy":8,"fw_parent":14,"on.draw":11}
|
|
@ -1,6 +0,0 @@
|
|||
on.keychord_press = function(chord, key)
|
||||
if chord == 'C-=' then
|
||||
-- zoom in
|
||||
Viewport.zoom = Viewport.zoom+0.1
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":16,"on.mouse_press":12,"Surface":3,"on.mouse_release":13,"scale":7,"on.update":14,"on":1,"vx":5,"Viewport":6,"vy":8,"fw_parent":15,"on.draw":11}
|
|
@ -1,9 +0,0 @@
|
|||
on.keychord_press = function(chord, key)
|
||||
if chord == 'C-=' then
|
||||
-- zoom in
|
||||
Viewport.zoom = Viewport.zoom+0.1
|
||||
elseif chord == 'C--' then
|
||||
-- zoom out
|
||||
Viewport.zoom = Viewport.zoom-0.1
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"on.mouse_press":12,"Surface":3,"on.mouse_release":13,"scale":7,"on.update":14,"on":1,"vx":5,"Viewport":6,"vy":8,"fw_parent":16,"on.draw":11}
|
|
@ -1,12 +0,0 @@
|
|||
on.keychord_press = function(chord, key)
|
||||
if chord == 'C-=' then
|
||||
-- zoom in
|
||||
Viewport.zoom = Viewport.zoom+0.1
|
||||
elseif chord == 'C--' then
|
||||
-- zoom out
|
||||
Viewport.zoom = Viewport.zoom-0.1
|
||||
elseif chord == 'C-0' then
|
||||
-- reset zoom
|
||||
Viewport.zoom = 1.0
|
||||
end
|
||||
end
|
34
0018-Page
34
0018-Page
|
@ -1,34 +0,0 @@
|
|||
Page = {
|
||||
-- page
|
||||
x=0, y=0,
|
||||
w=800, cols={
|
||||
-- editor covering left side
|
||||
{
|
||||
name='editor',
|
||||
doc='prose goes here, on the left half of the window',
|
||||
margin=Margin_left,
|
||||
data={"Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",},
|
||||
w=400, bg={r=1,g=1,b=0}
|
||||
},
|
||||
-- a table on the right
|
||||
{ name='searches', margin=50, rows={
|
||||
{ data={''}, w=90,},
|
||||
{ cols={
|
||||
{ data={'search:'}, w=90,},
|
||||
{ name='search', bg={r=0.8,g=0.8,b=0.8}, data={''}, w=90,},
|
||||
}},
|
||||
{ data={''}, w=90,},
|
||||
{ data={'table:'}, w=90,},
|
||||
{ bg={r=0.8,g=0.8,b=0.8}, rows={
|
||||
{ cols={
|
||||
{data={'abc'}, w=90,},
|
||||
{data={'def'}, w=90,},
|
||||
}},
|
||||
{ cols={
|
||||
{data={'abc'}, w=90,},
|
||||
{data={'def'}, w=90,},
|
||||
}},
|
||||
}},
|
||||
}},
|
||||
},
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":6,"scale":7,"vy":8,"Page":18,"on.draw":11,"fw_parent":17,"on.mouse_press":12,"Surface":3,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
33
0019-Page
33
0019-Page
|
@ -1,33 +0,0 @@
|
|||
Page = {
|
||||
-- page
|
||||
x=0, y=0,
|
||||
width=800, cols={
|
||||
-- editor covering left side
|
||||
{
|
||||
name='editor',
|
||||
doc='prose goes here, on the left half of the window',
|
||||
margin=Margin_left,
|
||||
data={"Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",},
|
||||
width=400, bg={r=1,g=1,b=0}
|
||||
},
|
||||
-- a table on the right
|
||||
{ name='searches', margin=50, rows={
|
||||
{ data={''},},
|
||||
{ cols={
|
||||
{ data={'search:'},},
|
||||
{ name='search', bg={r=0.8,g=0.8,b=0.8}, data={''}, width=90,},
|
||||
}},
|
||||
{ data={'table:'},},
|
||||
{ bg={r=0.8,g=0.8,b=0.8}, cols={
|
||||
{ width=90, rows={
|
||||
{data={'abc'},},
|
||||
{data={'abc'},},
|
||||
}},
|
||||
{ width=90, rows={
|
||||
{data={'def'},},
|
||||
{data={'def'},},
|
||||
}},
|
||||
}},
|
||||
}},
|
||||
},
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":6,"scale":7,"vy":8,"Page":19,"on.draw":11,"fw_parent":18,"on.mouse_press":12,"Surface":3,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
12
0020-Surface
12
0020-Surface
|
@ -1,12 +0,0 @@
|
|||
Surface = {
|
||||
-- test data
|
||||
{type='rectangle', x=50,y=50, width=20,height=80, r=1,g=0,b=0},
|
||||
{type='line', data={0,0, 0,600}},
|
||||
{type='line', data={0,0, 800,0}},
|
||||
{type='text', data='0', x=-20,y=-20},
|
||||
{type='edit', data={'abc', 'def'}, x=100, y=50, w=50,h=50,},
|
||||
{type='circle', x=300,y=200, radius=40, r=1,g=0,b=1},
|
||||
{type='arc', x=0,y=0, radius=50, angle1=0, angle2=math.pi*2/3},
|
||||
{type='ellipse', x=100,y=100, radiusx=10, radiusy=50},
|
||||
{type='bezier', data={25,25, 25,125, 75,25, 125,25}},
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":6,"scale":7,"vy":8,"Page":19,"on.draw":11,"fw_parent":19,"on.mouse_press":12,"Surface":20,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":6,"scale":7,"vy":8,"Page":19,"on.draw":21,"fw_parent":20,"on.mouse_press":12,"Surface":20,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
50
0021-on.draw
50
0021-on.draw
|
@ -1,50 +0,0 @@
|
|||
on.draw = function()
|
||||
for _,obj in ipairs(Surface) do
|
||||
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
|
||||
if obj.type == 'rectangle' then
|
||||
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.width),scale(obj.height))
|
||||
elseif obj.type == 'line' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'circle' then
|
||||
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
|
||||
elseif obj.type == 'arc' then
|
||||
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
|
||||
elseif obj.type == 'ellipse' then
|
||||
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
|
||||
elseif obj.type == 'bezier' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(zdata, vx(obj.data[i]))
|
||||
table.insert(zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
elseif obj.type == 'text' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.text = love.graphics.newText(Font[scaled_fontsize], obj.data)
|
||||
end
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":6,"scale":7,"vy":8,"Page":19,"on.draw":22,"fw_parent":21,"on.mouse_press":12,"Surface":20,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
62
0022-on.draw
62
0022-on.draw
|
@ -1,62 +0,0 @@
|
|||
on.draw = function()
|
||||
for _,obj in ipairs(Surface) do
|
||||
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
|
||||
if obj.type == 'rectangle' then
|
||||
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.width),scale(obj.height))
|
||||
elseif obj.type == 'line' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'circle' then
|
||||
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
|
||||
elseif obj.type == 'arc' then
|
||||
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
|
||||
elseif obj.type == 'ellipse' then
|
||||
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
|
||||
elseif obj.type == 'bezier' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(zdata, vx(obj.data[i]))
|
||||
table.insert(zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
elseif obj.type == 'text' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.text = love.graphics.newText(Font[scaled_fontsize], obj.data)
|
||||
end
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'edit' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.editor = edit.initialize(obj.y, obj.x, obj.x+obj.w, scaled_fontsize, math.floor(scaled_fontsize*1.3))
|
||||
obj.editor.lines = load_array(obj.data)
|
||||
end
|
||||
edit.draw(obj.editor, obj.fg or {r=0,g=0,b=0})
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":6,"scale":7,"vy":8,"Page":19,"on.draw":23,"fw_parent":22,"on.mouse_press":12,"Surface":20,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
63
0023-on.draw
63
0023-on.draw
|
@ -1,63 +0,0 @@
|
|||
on.draw = function()
|
||||
for _,obj in ipairs(Surface) do
|
||||
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
|
||||
if obj.type == 'rectangle' then
|
||||
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.width),scale(obj.height))
|
||||
elseif obj.type == 'line' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'circle' then
|
||||
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
|
||||
elseif obj.type == 'arc' then
|
||||
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
|
||||
elseif obj.type == 'ellipse' then
|
||||
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
|
||||
elseif obj.type == 'bezier' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(zdata, vx(obj.data[i]))
|
||||
table.insert(zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
elseif obj.type == 'text' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.text = love.graphics.newText(Font[scaled_fontsize], obj.data)
|
||||
end
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'edit' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.editor = edit.initialize(obj.y, obj.x, obj.x+obj.w, scaled_fontsize, math.floor(scaled_fontsize*1.3))
|
||||
obj.editor.lines = load_array(obj.data)
|
||||
Text.redraw_all(obj.editor)
|
||||
end
|
||||
edit.draw(obj.editor, obj.fg or {r=0,g=0,b=0})
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":6,"scale":7,"vy":8,"Page":19,"on.draw":24,"fw_parent":23,"on.mouse_press":12,"Surface":20,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
63
0024-on.draw
63
0024-on.draw
|
@ -1,63 +0,0 @@
|
|||
on.draw = function()
|
||||
for _,obj in ipairs(Surface) do
|
||||
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
|
||||
if obj.type == 'rectangle' then
|
||||
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.width),scale(obj.height))
|
||||
elseif obj.type == 'line' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'circle' then
|
||||
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
|
||||
elseif obj.type == 'arc' then
|
||||
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
|
||||
elseif obj.type == 'ellipse' then
|
||||
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
|
||||
elseif obj.type == 'bezier' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(zdata, vx(obj.data[i]))
|
||||
table.insert(zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
elseif obj.type == 'text' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.text = love.graphics.newText(Font[scaled_fontsize], obj.data)
|
||||
end
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'edit' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.editor == nil or obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.editor = edit.initialize(obj.y, obj.x, obj.x+obj.w, scaled_fontsize, math.floor(scaled_fontsize*1.3))
|
||||
obj.editor.lines = load_array(obj.data)
|
||||
Text.redraw_all(obj.editor)
|
||||
end
|
||||
edit.draw(obj.editor, obj.fg or {r=0,g=0,b=0})
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":6,"scale":7,"vy":8,"Page":19,"on.draw":25,"fw_parent":24,"on.mouse_press":12,"Surface":20,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
64
0025-on.draw
64
0025-on.draw
|
@ -1,64 +0,0 @@
|
|||
on.draw = function()
|
||||
for _,obj in ipairs(Surface) do
|
||||
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
|
||||
if obj.type == 'rectangle' then
|
||||
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.width),scale(obj.height))
|
||||
elseif obj.type == 'line' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'circle' then
|
||||
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
|
||||
elseif obj.type == 'arc' then
|
||||
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
|
||||
elseif obj.type == 'ellipse' then
|
||||
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
|
||||
elseif obj.type == 'bezier' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(zdata, vx(obj.data[i]))
|
||||
table.insert(zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
elseif obj.type == 'text' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.text = love.graphics.newText(Font[scaled_fontsize], obj.data)
|
||||
end
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'edit' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.editor == nil or obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
print(edit)
|
||||
obj.editor = edit.initialize(obj.y, obj.x, obj.x+obj.w, scaled_fontsize, math.floor(scaled_fontsize*1.3))
|
||||
obj.editor.lines = load_array(obj.data)
|
||||
Text.redraw_all(obj.editor)
|
||||
end
|
||||
edit.draw(obj.editor, obj.fg or {r=0,g=0,b=0})
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":6,"scale":7,"vy":8,"Page":19,"on.draw":26,"fw_parent":25,"on.mouse_press":12,"Surface":20,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
53
0026-on.draw
53
0026-on.draw
|
@ -1,19 +1,10 @@
|
|||
on.draw = function()
|
||||
love.graphics.setColor(1,0,0)
|
||||
for _,obj in ipairs(Surface) do
|
||||
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
|
||||
if obj.type == 'rectangle' then
|
||||
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.width),scale(obj.height))
|
||||
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
|
||||
elseif obj.type == 'line' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'circle' then
|
||||
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
|
||||
|
@ -22,43 +13,13 @@ on.draw = function()
|
|||
elseif obj.type == 'ellipse' then
|
||||
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
|
||||
elseif obj.type == 'bezier' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(zdata, vx(obj.data[i]))
|
||||
table.insert(zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
elseif obj.type == 'text' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.text = love.graphics.newText(Font[scaled_fontsize], obj.data)
|
||||
end
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'edit' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.editor == nil or obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
print(edit, edit.initialize)
|
||||
obj.editor = edit.initialize(obj.y, obj.x, obj.x+obj.w, scaled_fontsize, math.floor(scaled_fontsize*1.3))
|
||||
obj.editor.lines = load_array(obj.data)
|
||||
Text.redraw_all(obj.editor)
|
||||
elseif obj.type == 'text' then
|
||||
if obj.w == nil then
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
else
|
||||
edit.draw(obj.editor, obj.fg or {r=0,g=0,b=0}, not obj.show_cursor)
|
||||
end
|
||||
edit.draw(obj.editor, obj.fg or {r=0,g=0,b=0})
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":6,"scale":7,"vy":8,"Page":19,"on.draw":27,"fw_parent":26,"on.mouse_press":12,"Surface":20,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
63
0027-on.draw
63
0027-on.draw
|
@ -1,63 +0,0 @@
|
|||
on.draw = function()
|
||||
for _,obj in ipairs(Surface) do
|
||||
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
|
||||
if obj.type == 'rectangle' then
|
||||
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.width),scale(obj.height))
|
||||
elseif obj.type == 'line' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'circle' then
|
||||
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
|
||||
elseif obj.type == 'arc' then
|
||||
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
|
||||
elseif obj.type == 'ellipse' then
|
||||
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
|
||||
elseif obj.type == 'bezier' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(zdata, vx(obj.data[i]))
|
||||
table.insert(zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
elseif obj.type == 'text' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.text = love.graphics.newText(Font[scaled_fontsize], obj.data)
|
||||
end
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'edit' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.editor == nil or obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.editor = edit.initialize_state(obj.y, obj.x, obj.x+obj.w, scaled_fontsize, math.floor(scaled_fontsize*1.3))
|
||||
obj.editor.lines = load_array(obj.data)
|
||||
Text.redraw_all(obj.editor)
|
||||
end
|
||||
edit.draw(obj.editor, obj.fg or {r=0,g=0,b=0})
|
||||
end
|
||||
end
|
||||
end
|
12
0028-Surface
12
0028-Surface
|
@ -1,12 +0,0 @@
|
|||
Surface = {
|
||||
-- test data
|
||||
{type='rectangle', x=50,y=50, width=20,height=80, r=1,g=0,b=0},
|
||||
{type='line', data={0,0, 0,600}},
|
||||
{type='line', data={0,0, 800,0}},
|
||||
{type='text', data='0', x=-20,y=-20},
|
||||
{type='edit', data={'abc', 'def'}, x=100, y=50, w=50,h=50, fg={r=0,g=0, b=0.5}},
|
||||
{type='circle', x=300,y=200, radius=40, r=1,g=0,b=1},
|
||||
{type='arc', x=0,y=0, radius=50, angle1=0, angle2=math.pi*2/3},
|
||||
{type='ellipse', x=100,y=100, radiusx=10, radiusy=50},
|
||||
{type='bezier', data={25,25, 25,125, 75,25, 125,25}},
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":6,"scale":7,"vy":8,"Page":19,"on.draw":27,"fw_parent":27,"on.mouse_press":12,"Surface":28,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
|
@ -1 +0,0 @@
|
|||
Viewport = {x=-50, y=-50, w=800,h=600, zoom=1.5}
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":29,"scale":7,"vy":8,"Page":19,"on.draw":27,"fw_parent":28,"on.mouse_press":12,"Surface":28,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
12
0030-Surface
12
0030-Surface
|
@ -1,12 +0,0 @@
|
|||
Surface = {
|
||||
-- test data
|
||||
{type='rectangle', x=50,y=50, width=20,height=80, r=1,g=0,b=0},
|
||||
{type='line', data={0,0, 0,600}},
|
||||
{type='line', data={0,0, 800,0}},
|
||||
{type='text', data='0', x=-20,y=-20},
|
||||
{type='edit', data={'abc', 'def'}, x=100, y=50, w=50,h=50, fg={r=0,g=0, b=0.9}},
|
||||
{type='circle', x=300,y=200, radius=40, r=1,g=0,b=1},
|
||||
{type='arc', x=0,y=0, radius=50, angle1=0, angle2=math.pi*2/3},
|
||||
{type='ellipse', x=100,y=100, radiusx=10, radiusy=50},
|
||||
{type='bezier', data={25,25, 25,125, 75,25, 125,25}},
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":29,"scale":7,"vy":8,"Page":19,"on.draw":27,"fw_parent":29,"on.mouse_press":12,"Surface":30,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":29,"scale":7,"vy":8,"Page":19,"on.draw":31,"fw_parent":30,"on.mouse_press":12,"Surface":30,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
63
0031-on.draw
63
0031-on.draw
|
@ -1,63 +0,0 @@
|
|||
on.draw = function()
|
||||
for _,obj in ipairs(Surface) do
|
||||
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
|
||||
if obj.type == 'rectangle' then
|
||||
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.width),scale(obj.height))
|
||||
elseif obj.type == 'line' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'circle' then
|
||||
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
|
||||
elseif obj.type == 'arc' then
|
||||
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
|
||||
elseif obj.type == 'ellipse' then
|
||||
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
|
||||
elseif obj.type == 'bezier' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(zdata, vx(obj.data[i]))
|
||||
table.insert(zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
elseif obj.type == 'text' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.text = love.graphics.newText(Font[scaled_fontsize], obj.data)
|
||||
end
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'edit' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.editor == nil or obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.editor = edit.initialize_state(vy(obj.y), vx(obj.x), vx(obj.x+obj.w), scaled_fontsize, math.floor(scaled_fontsize*1.3))
|
||||
obj.editor.lines = load_array(obj.data)
|
||||
Text.redraw_all(obj.editor)
|
||||
end
|
||||
edit.draw(obj.editor, obj.fg or {r=0,g=0,b=0})
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":29,"scale":7,"vy":8,"Page":19,"on.draw":32,"fw_parent":31,"on.mouse_press":12,"Surface":30,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
66
0032-on.draw
66
0032-on.draw
|
@ -1,66 +0,0 @@
|
|||
on.draw = function()
|
||||
for _,obj in ipairs(Surface) do
|
||||
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
|
||||
if obj.type == 'rectangle' then
|
||||
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.width),scale(obj.height))
|
||||
elseif obj.type == 'line' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'circle' then
|
||||
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
|
||||
elseif obj.type == 'arc' then
|
||||
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
|
||||
elseif obj.type == 'ellipse' then
|
||||
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
|
||||
elseif obj.type == 'bezier' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(zdata, vx(obj.data[i]))
|
||||
table.insert(zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
elseif obj.type == 'text' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.text = love.graphics.newText(Font[scaled_fontsize], obj.data)
|
||||
end
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'edit' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y or obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.editor = edit.initialize_state(vy(obj.y), vx(obj.x), vx(obj.x+obj.w), scaled_fontsize, math.floor(scaled_fontsize*1.3))
|
||||
obj.editor.lines = load_array(obj.data)
|
||||
Text.redraw_all(obj.editor)
|
||||
end
|
||||
edit.draw(obj.editor, obj.fg or {r=0,g=0,b=0})
|
||||
end
|
||||
end
|
||||
end
|
12
0033-Surface
12
0033-Surface
|
@ -1,12 +0,0 @@
|
|||
Surface = {
|
||||
-- test data
|
||||
{type='rectangle', x=50,y=50, width=20,height=80, r=1,g=0,b=0},
|
||||
{type='line', data={0,0, 0,600}},
|
||||
{type='line', data={0,0, 800,0}},
|
||||
{type='text', data='0', x=-20,y=-20},
|
||||
--{type='edit', data={'abc', 'def'}, x=100, y=50, w=50,h=50, fg={r=0,g=0, b=0.9}},
|
||||
{type='circle', x=300,y=200, radius=40, r=1,g=0,b=1},
|
||||
{type='arc', x=0,y=0, radius=50, angle1=0, angle2=math.pi*2/3},
|
||||
{type='ellipse', x=100,y=100, radiusx=10, radiusy=50},
|
||||
{type='bezier', data={25,25, 25,125, 75,25, 125,25}},
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":29,"scale":7,"vy":8,"Page":19,"on.draw":32,"fw_parent":32,"on.mouse_press":12,"Surface":33,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
|
@ -1 +0,0 @@
|
|||
{"on.keychord_press":17,"Viewport":29,"scale":7,"vy":8,"Page":19,"on.draw":34,"fw_parent":33,"on.mouse_press":12,"Surface":33,"on.mouse_release":13,"on":1,"on.update":14,"vx":5}
|
66
0034-on.draw
66
0034-on.draw
|
@ -1,66 +0,0 @@
|
|||
on.draw = function()
|
||||
for _,obj in ipairs(Surface) do
|
||||
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
|
||||
if obj.type == 'rectangle' then
|
||||
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.width),scale(obj.height))
|
||||
elseif obj.type == 'line' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'circle' then
|
||||
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
|
||||
elseif obj.type == 'arc' then
|
||||
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
|
||||
elseif obj.type == 'ellipse' then
|
||||
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
|
||||
elseif obj.type == 'bezier' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(zdata, vx(obj.data[i]))
|
||||
table.insert(zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
end
|
||||
elseif obj.type == 'text' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.text = love.graphics.newText(Font[scaled_fontsize], obj.data)
|
||||
end
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'edit' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y or obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.editor = edit.initialize_state(vy(obj.y), vx(obj.x), vx(obj.x+obj.w), scaled_fontsize, math.floor(scaled_fontsize*1.3))
|
||||
obj.editor.lines = load_array(obj.data)
|
||||
Text.redraw_all(obj.editor)
|
||||
end
|
||||
edit.draw(obj.editor, obj.fg or {r=0,g=0,b=0})
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
{"Viewport":29,"Page":19,"vy":8,"vx":5,"Surface":33,"on.mouse_press":12,"on":1,"on.mouse_release":13,"on.draw":35,"on.update":14,"scale":7,"fw_parent":34,"on.keychord_press":17}
|
66
0035-on.draw
66
0035-on.draw
|
@ -1,66 +0,0 @@
|
|||
on.draw = function()
|
||||
for _,obj in ipairs(Surface) do
|
||||
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
|
||||
if obj.type == 'rectangle' then
|
||||
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.width),scale(obj.height))
|
||||
elseif obj.type == 'line' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'circle' then
|
||||
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
|
||||
elseif obj.type == 'arc' then
|
||||
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
|
||||
elseif obj.type == 'ellipse' then
|
||||
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
|
||||
elseif obj.type == 'bezier' then
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
zdata = {}
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(zdata, vx(obj.data[i]))
|
||||
table.insert(zdata, vy(obj.data[i+1]))
|
||||
end
|
||||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
end
|
||||
love.graphics.line(unpack(obj.zdata))
|
||||
elseif obj.type == 'text' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.text = love.graphics.newText(Font[scaled_fontsize], obj.data)
|
||||
end
|
||||
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
|
||||
elseif obj.type == 'edit' then
|
||||
local scaled_fontsize = scale(obj.fontsize or 20)
|
||||
if obj.saved_zoom ~= Viewport.zoom or obj.saved_x ~= Viewport.x or obj.saved_y ~= Viewport.y or obj.scaled_fontsize ~= scaled_fontsize then
|
||||
obj.saved_zoom = Viewport.zoom
|
||||
obj.saved_x = Viewport.x
|
||||
obj.saved_y = Viewport.y
|
||||
obj.scaled_fontsize = scaled_fontsize
|
||||
if Font == nil then Font = {} end
|
||||
if Font[scaled_fontsize] == nil then
|
||||
Font[scaled_fontsize] = love.graphics.newFont(scaled_fontsize)
|
||||
end
|
||||
obj.editor = edit.initialize_state(vy(obj.y), vx(obj.x), vx(obj.x+obj.w), scaled_fontsize, math.floor(scaled_fontsize*1.3))
|
||||
obj.editor.lines = load_array(obj.data)
|
||||
Text.redraw_all(obj.editor)
|
||||
end
|
||||
edit.draw(obj.editor, obj.fg or {r=0,g=0,b=0})
|
||||
end
|
||||
end
|
||||
end
|
12
0036-Surface
12
0036-Surface
|
@ -1,12 +0,0 @@
|
|||
Surface = {
|
||||
-- test data
|
||||
{type='rectangle', x=50,y=50, width=20,height=80, r=1,g=0,b=0},
|
||||
{type='line', data={0,0, 0,600}},
|
||||
{type='line', data={0,0, 800,0}},
|
||||
{type='text', data='0', x=-20,y=-20},
|
||||
{type='edit', data={'abc', 'def'}, x=100, y=50, w=50,h=50, fg={r=0,g=0, b=0.9}},
|
||||
{type='circle', x=300,y=200, radius=40, r=1,g=0,b=1},
|
||||
{type='arc', x=0,y=0, radius=50, angle1=0, angle2=math.pi*2/3},
|
||||
{type='ellipse', x=100,y=100, radiusx=10, radiusy=50},
|
||||
{type='bezier', data={25,25, 25,125, 75,25, 125,25}},
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
{"Viewport":29,"Page":19,"vy":8,"vx":5,"Surface":36,"on.mouse_press":12,"on":1,"on.mouse_release":13,"on.draw":35,"on.update":14,"scale":7,"fw_parent":35,"on.keychord_press":17}
|
12
0037-Surface
12
0037-Surface
|
@ -1,12 +0,0 @@
|
|||
Surface = {
|
||||
-- test data
|
||||
{type='rectangle', x=50,y=50, width=20,height=80, r=1,g=0,b=0},
|
||||
{type='line', data={0,0, 0,600}},
|
||||
{type='line', data={0,0, 800,0}},
|
||||
{type='text', data='0', x=-20,y=-20},
|
||||
{type='edit', data={'abc', 'def'}, x=100, y=50, w=50,h=50, fg={r=0,g=0.4, b=0.9}},
|
||||
{type='circle', x=300,y=200, radius=40, r=1,g=0,b=1},
|
||||
{type='arc', x=0,y=0, radius=50, angle1=0, angle2=math.pi*2/3},
|
||||
{type='ellipse', x=100,y=100, radiusx=10, radiusy=50},
|
||||
{type='bezier', data={25,25, 25,125, 75,25, 125,25}},
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
{"Viewport":29,"Page":19,"vy":8,"vx":5,"Surface":37,"on.mouse_press":12,"on":1,"on.mouse_release":13,"on.draw":35,"on.update":14,"scale":7,"fw_parent":36,"on.keychord_press":17}
|
12
0038-Surface
12
0038-Surface
|
@ -1,12 +0,0 @@
|
|||
Surface = {
|
||||
-- test data
|
||||
{type='rectangle', x=50,y=50, width=20,height=80, r=1,g=0,b=0},
|
||||
{type='line', data={0,0, 0,600}},
|
||||
{type='line', data={0,0, 800,0}},
|
||||
{type='text', data='0', x=-20,y=-20},
|
||||
{type='edit', data={'abc', 'def'}, x=150, y=50, w=50,h=50, fg={r=0,g=0.4, b=0.9}},
|
||||
{type='circle', x=300,y=200, radius=40, r=1,g=0,b=1},
|
||||
{type='arc', x=0,y=0, radius=50, angle1=0, angle2=math.pi*2/3},
|
||||
{type='ellipse', x=100,y=100, radiusx=10, radiusy=50},
|
||||
{type='bezier', data={25,25, 25,125, 75,25, 125,25}},
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user