Reorganized scripts, fixed 'memory' not working with subdirectories
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1765 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
0129bb3590
commit
27e8d15971
@ -9,8 +9,7 @@
|
||||
-- as published by the Free Software Foundation; version 2
|
||||
-- of the License. See <http://www.gnu.org/licenses/>
|
||||
|
||||
--dofile("dawnbringer_lib.lua")
|
||||
require("dawnbringer_lib")
|
||||
dofile("../libs/dawnbringer_lib.lua")
|
||||
|
||||
OK,tin,clz,fade,amt,brikeep,falloff,nobg,briweight = inputbox("Apply PenColor 2 Brush",
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
-- "-" (Num): Zoom Out
|
||||
-- Esc: Exit script
|
||||
|
||||
require("dawnbringer_lib")
|
||||
dofile("../libs/dawnbringer_lib.lua")
|
||||
|
||||
|
||||
BRIDIAG_SHOW = 1 -- Show brightness/Grayscale diagonal (1 = on, 0 = off)
|
||||
@ -23,18 +23,7 @@ function ellipse2(x,y,a,b,stp,rot,col)
|
||||
sa = m.sin(ast*n) * b; ca = m.cos(ast*n) * a
|
||||
x1 = x + ca * cb - sa * sb
|
||||
y1 = y + ca * sb + sa * cb
|
||||
if (n > 0) then line(ox,oy,x1,y1,col); end
|
||||
end
|
||||
end
|
||||
--
|
||||
|
||||
--
|
||||
function line(x1,y1,x2,y2,c)
|
||||
local n,st,m; m = math
|
||||
st = m.max(1,m.abs(x2-x1),m.abs(y2-y1));
|
||||
for n = 0, st, 1 do
|
||||
putpicturepixel(m.floor(x1+n*(x2-x1)/st), m.floor(y1+n*(y2-y1)/st),
|
||||
c );
|
||||
if (n > 0) then drawline(ox,oy,x1,y1,col); end
|
||||
end
|
||||
end
|
||||
--
|
||||
@ -2,12 +2,11 @@
|
||||
--Spare page holds data - Plays on current
|
||||
--by Richard Fhager
|
||||
|
||||
require("memory")
|
||||
dofile("../libs/memory.lua")
|
||||
|
||||
arg=memory.load({XS=16,YS=16,SPACE=1,FRAMES=8,XOFF=0,YOFF=0,FPS=10})
|
||||
|
||||
OK, XS, YS, SPACE, FRAMES, XOFF, YOFF, FPS = inputbox("Sprite-Sheet
|
||||
Animator",
|
||||
OK, XS, YS, SPACE, FRAMES, XOFF, YOFF, FPS = inputbox("Sprite-Sheet Animator",
|
||||
"Sprite X-size", arg.XS, 1, 256,0,
|
||||
"Sprite Y-size", arg.YS, 1, 256,0,
|
||||
"Spacing", arg.SPACE, 0, 32,0,
|
||||
@ -1,4 +1,7 @@
|
||||
--BRUSH Scene: Amigaball 1.0
|
||||
--
|
||||
--Draws the famous 'Amiga ball' in the brush.
|
||||
--
|
||||
--by Richard Fhager
|
||||
--http://hem.fyristorg.com/dawnbringer/
|
||||
|
||||
@ -15,6 +18,11 @@
|
||||
|
||||
|
||||
w, h = getbrushsize()
|
||||
if (w<64 or h<64) then
|
||||
setbrushsize(64,64)
|
||||
w=64
|
||||
h=64
|
||||
end
|
||||
|
||||
for y = 0, h - 1, 1 do
|
||||
for x = 0, w - 1, 1 do
|
||||
@ -1,4 +1,7 @@
|
||||
--BRUSH Scene: Mandelbrot fractal v0.5
|
||||
--
|
||||
--Draws a Mandelbrot fractal in the current brush.
|
||||
--
|
||||
--by Richard Fhager
|
||||
--http://hem.fyristorg.com/dawnbringer/
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
-- memory.save(tab) and tab=memory.load()
|
||||
--
|
||||
-- The data will be stored in file called
|
||||
-- ZZZ<calling_function_name>.dat
|
||||
-- <calling_function_name>.dat
|
||||
-- in the lua directory
|
||||
--
|
||||
-- Example 1:
|
||||
@ -74,12 +74,18 @@ memory =
|
||||
-- Get part after directory name
|
||||
last_slash=0
|
||||
while true do
|
||||
local pos = string.find(info.short_src, "/", last_slash+1)
|
||||
local pos = string.find(info.source, "/", last_slash+1)
|
||||
if (pos==nil) then break end
|
||||
last_slash=pos
|
||||
end
|
||||
caller=string.sub(info.short_src, last_slash+1)
|
||||
|
||||
while true do
|
||||
local pos = string.find(info.source, "\\", last_slash+1)
|
||||
if (pos==nil) then break end
|
||||
last_slash=pos
|
||||
end
|
||||
|
||||
caller=string.sub(info.source, last_slash+1)
|
||||
|
||||
-- Remove file extension
|
||||
if (string.sub(caller,-4, -1)==".lua") then
|
||||
caller=string.sub(caller, 1, -5)
|
||||
@ -94,7 +100,7 @@ memory =
|
||||
-- messagebox(tostring(k))
|
||||
-- messagebox(tostring(v))
|
||||
--end
|
||||
local f, e = io.open("ZZZ"..caller..".dat", "w");
|
||||
local f, e = io.open(caller..".dat", "w");
|
||||
if (f ~= nil) then
|
||||
f:write("Entry {\n")
|
||||
for k, v in pairs(o) do
|
||||
@ -119,7 +125,7 @@ memory =
|
||||
o[k]=v
|
||||
end
|
||||
end
|
||||
local f = (loadfile("ZZZ"..caller..".dat"))
|
||||
local f = (loadfile(caller..".dat"))
|
||||
if (f ~= nil) then
|
||||
f()
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user