rudimentary load, save and export in esc menu.

This commit is contained in:
visionmercer 2026-05-12 13:37:07 +02:00
commit 3a02d6d06c

View file

@ -689,18 +689,62 @@ END FUNCTION
sub menu()
dim logo as long
logo=_loadimage("logo.png")
dim filename as string
' A logo is needed'
'logo=_loadimage("logo.png")
Line (0,0)-(_width-1,_height-1),_rgb32(0,192),bf
'_putimage ((_width(0)-_width(logo))/2,10),logo
dim i as integer
dim fh as integer
do until done
k$=inkey$
while _mouseinput:wend
mouseclicked=mbd and not _mousebutton(1)
mbd=_mousebutton(1)
if link(10,10,"open") then system
if link(10,34,"save") then system
if link(10,56,"exit") then system
if link(10,10,"open") then
filename=textinput(10,10,100,23,"")
if filename="" then exit sub
fh = freefile
redim commands(2000) as string
open filename for input as fh
do until eof(fh)
line input #fh, commands(i)
i=i+1
if i>ubound(commands) then redim _preserve commands(ubound(commands)*2) as string
loop
close fh
redim _preserve commands(i-1) as string
redraw
end if
if link(10,34,"save") then
filename=textinput(1,34,100,23,"")
if filename="" then exit sub
fh = freefile
open filename for output as fh
for i=0 to ubound(commands)
print #fh, commands(i)
next i
close fh
end if
if link(10,56,"export") then
filename=textinput(10,56,100,23,"")
if filename="" then exit sub
select case lcase$(right$(filename,4))
case ".png"
save32bitPNG layers(1).ihandle, filename
case ".bmp"
save24bitBmp layers(1).ihandle, filename
case ".ppm"
savebinaryPPM layers(1).ihandle, filename
case else
save32bitPNG layers(1).ihandle, filename
end select
end if
if link(10,78,"exit") then system
if k$=chr$(27) then done=-1
_limit 30
_display