more用ペイントソース


ペイント

ソース名「ペイント」で保存。

if(ismore()){offlocal()}
csx=16 '幅'
csy=16 '高さ'
#menu##colbox##io##drawing##init&term##pack##util#
r=startdlg(1)
lock()
initialize()
if(r){loadi(1)}
unlock(0)
bc=1
aw=1
repaint()
run()
func lsoft(){
@(mt,"新規","セーブ","ロード","変更","原寸大","ツール","閉じる")
@(nums,"","","","","","","","","")
mainmenuc=mx=7
r=createm(mx,0,240-22*mx,90)
soft2("終了")
soft1("menu")
switch(r){
case 1:
 @(mt,"CSV形式","圧縮形式")
 mx=2
 clearkey()
 r=createm(mx,83,234-22*(mainmenuc+mx-1-1),125)
 soft2("終了")
 soft1("menu")
 if(r!="canceled"){
 saveimg(r)}
 break;
case 2:
 @(mt,"セーブデータから","直接入力")
 mx=2
 clearkey()
 r=createm(mx,83,234-22*(mainmenuc+mx-1-2),125)
 soft2("終了")
 soft1("menu")
 if(r!="canceled"){r=!r
 loadi(r)}
 break;
case 3:
 @(mt,"キャンバスサイズ")
 mx=1
 clearkey()
 r=createm(mx,83,234-22*(mainmenuc+mx-3-1),125)
 soft2("終了")
 soft1("menu")
 if(r!="canceled"){
 clearkey()
 while(scan){}
 pcsx=csx;pcsy=csy
 startdlg(0,csx,csy)
 initialize()
 showwait()
 redraw(pcsx,pcsy)
 disvar(pcsx)disvar(pcsx)
 }
 break;
case 0:
 for(x=0;x<csx;x++){for(y=0;y<csy;y++){ct[x][y]=0}}
 pcsx=csx pcsy=csy
 startdlg(0,csx,csy)
 clear(0,0,width,height)
 showwait()
 aw=1
 initialize()
 break;
case 4:
 col(0)
 rect(119-csx/2,119-csy/2,csx+1,csy+1)
 drawimg(smpw,120-csx/2,120-csy/2,0)
 input()
 break;
case 5:
 @(mt,"操作","反転","ペン")
 mx=3
 clearkey()
 r=createm(mx,83,pr=234-22*(mainmenuc+mx-5-1),90)
 switch(r){
 case 2:
  @(mt,"塗りつぶし","ペン","四角形","直線")
  mx=4
  clearkey()
  r=createm(mx,123,pr-22*2+3,110)
  switch(r){
   case 0:pen="can"break
   case 1:pen="pen"break
   case 2:pen="rect"break
   case 3:pen="line"break
  }
  break
 case 1:
  @(mt,"左右","上下")
  mx=2
  clearkey()
  r=createm(mx,123,pr-22*1+3,110)
  if(r==0){
   showwait()
   for(x=0;x<csx;x++){
    for(y=0;y<csy;y++){
     pct[csx-x-1][y]=ct[x][y]
    }
   }
   for(x=0;x<csx;x++){
    for(y=0;y<csy;y++){
     ct[x][y]=pct[x][y]
    }
   }
   showwait()
   redraw(csx,csy)
  }
  elsif(r==1){
   showwait()
   for(x=0;x<csx;x++){
    for(y=0;y<csy;y++){
     pct[x][csy-y-1]=ct[x][y]
    }
   }
   for(x=0;x<csx;x++){
    for(y=0;y<csy;y++){
     ct[x][y]=pct[x][y]
    }
   }
   showwait()
   redraw(csx,csy)
   break
  }
  break
 case 0:
  @(mt,"コピー","デリート","ペースト")
  mx=3
  clearkey()
  r=createm(mx,123,pr-22*mx+3,90)
  switch(r){
  case 0: icop()break
  case 1: idel()break
  case 2: ipas()break
  }
  break
 }
 soft2("終了")
 soft1("menu")
 break
}
}
func sc(ad){
trgt(off)
if(mxo*pw>159&&myo*pw>159){ col(0)
rect(10,10,60,60)
col(bc)
frect(11,11,59,59)
}else{
col(0)
rect(170,170,60,60)
col(bc)
frect(171,171,59,59)
}
ada=pow(2,ad)
while(scan&ada){}
while(1){
sleep(10)
s=scan
if(s&ada){
colr=(0xFF0000&c[ad])>>16
colg=(0x00FF00&c[ad])>>8
colb=(0x0000FF&c[ad])
drawimg(bk,0,0,0)
bc=colbox(colr,colg,colb)
c[ad]=bc
soft2("終了")
soft1("menu")
s=0
break;
}elsif(s!=0){break;}
}
return;
}

menu

ソース名「menu」で保存

func createm(mx,mzx,mzy,wdth){
soft1("")
soft2("閉じる")
makeimg(bm,wdth+1,22*mx+1)
mmy=0
trgt(bm)
setfont("S")
for(i=0;i<mx;i++){
col(0xA06400)
rect(0,22*i,wdth,22)
color(245,245,190)
frect(1,22*i+1,wdth-1,21)
col(0)
text(nums[i],4,22*i+3,0)
text(mt[i],24,22*i+3,0)}
trgt(off)
drawimg(bm,mzx,mzy,0)
clearkey()
while(1){
s=input(30)
lock()
msel(mmy,155,155,110)
unlock(1)
mmy=mmy-((s&4096)!=0)+((s&32768)!=0)
if(mmy<0){mmy=0}elsif(mmy>mx-1){mmy=mx-1}elsif(s&262144){
mmy="canceled"
break;
}
elsif(s&65536){
msel(mmy,95,95,40)
break;
}elsif(s&2){if(0<mx){msel(0,95,95,40)mmy=0break;}}elsif(s&4){if(1<mx){msel(1,95,95,40)mmy=1break;}}elsif(s&8){if(2<mx){msel(2,95,95,40)mmy=2break;}}elsif(s&16){if(3<mx){msel(3,95,95,40)mmy=3break;}}elsif(s&32){if(4<mx){msel(4,95,95,40)mmy=4break;}}elsif(s&64){if(5<mx){msel(5,95,95,40)mmy=5break;}}elsif(s&128){if(6<mx){msel(6,95,95,40)mmy=6break;}}elsif(s&256){if(7<mx){msel(7,95,95,40)mmy=7break;}}elsif(s&512){if(8<mx){msel(8,95,95,40)mmy=8break;}}
}
clearkey()
while(scan){}
return mmy;
}
func repaintm(mzx,mzy){
trgt(off)
drawimg(bm,mzx,mzy,0)
}
func msel(n,sc1,sc2,sc3){
lock()
repaintm(mzx,mzy)
trgt(off)
setfont("S")
color(sc1,sc2,sc3)
frect(mzx+1,mzy+22*(n)+1,wdth-1,21)
col(0)
text(nums[n],mzx+4,mzy+22*n+3,0)
text(mt[n],mzx+24,mzy+22*(n)+3,0)
col(0)
unlock(0)
}

ちょっと長いんで分割
more用ペイントソース2