diff --git a/pixler.bas b/pixler.bas index 5ab5fd9..9043eab 100644 --- a/pixler.bas +++ b/pixler.bas @@ -11,7 +11,7 @@ type layertype kind as long end type -redim shared layers(1) as layertype +dim shared layers(0) as layertype dim shared state as statetype @@ -21,17 +21,12 @@ dim shared mousedown as integer dim shared rmouseclicked as integer dim shared rmousedown as integer $resize:on -screen _newimage(750,480,32) +screen _newimage(640,480,32) _delay 0.1 temp&=_resize redim shared pal(0) as _unsigned long dim as integer ch1,ch2,ch3,bt loadpalette "endesga16",pal() -layers(0).ihandle=_newimage(640,350,32) -layers(1).ihandle=_newimage(640,350,32) -_dest layers(0).ihandle -line (0,0)-(_width-1,_height-1),_rgb32(255),bf -_dest 0 do line (0,0)-(_width-1,_height-1),backgroundcolor1,bf @@ -40,7 +35,7 @@ do mouseclicked=0 rmouseclicked=0 if mousedown=-1 and _mousebutton(1)=0 then mouseclicked=-1 - if rmousedown=-1 and _mousebutton(2)=0 then rmouseclicked=-1 + if rmousedown=-1 and _mousebutton(1)=0 then rmouseclicked=-1 mousedown=_mousebutton(1) rmousedown=_mousebutton(2) toolbox @@ -78,30 +73,7 @@ sub colorpicker end sub sub canvas -' 1. Define the box boundaries - dim boxX1 as integer: boxX1 = 70 - dim boxWidth as integer: boxWidth = _width - 1 - boxX1 - dim boxHeight as integer: boxHeight = _height - 20 - - ' 2. Draw the background box - line (boxX1, 0)-(_width - 1, boxHeight), _rgb32(64), bf - - ' 3. Loop through layers and calculate centering for each - for i = 0 to ubound(layers) - dim imgW as integer: imgW = _width(layers(i).ihandle) - - ' Calculate X to center the image relative to the box - ' We take the box start (70) and add half of the remaining whitespace - dim drawX as integer - drawX = boxX1 + (boxWidth - imgW) / 2 - - ' If you also want it centered vertically: - dim imgH as integer: imgH = _height(layers(i).ihandle) - dim drawY as integer - drawY = (boxHeight - imgH) / 2 - - _putimage (drawX, drawY), layers(i).ihandle - next +line (70,0)-(_width-1,_height-20),_rgb32(64),bf end sub function icon(index as long)