From 3a02d6d06ce2b27b7e87800d8e5ee2da8c275bf9 Mon Sep 17 00:00:00 2001 From: visionmercer <62051836+visionmercer@users.noreply.github.com> Date: Tue, 12 May 2026 13:37:07 +0200 Subject: [PATCH] rudimentary load, save and export in esc menu. --- pixler.bas | 52 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/pixler.bas b/pixler.bas index ca7325d..416487b 100644 --- a/pixler.bas +++ b/pixler.bas @@ -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