Compare commits

..

No commits in common. "827afeb19a106a7b053983bda86a6bd979783dff" and "79300e12df67ea2813f58ea1f5e4d4046429a6ab" have entirely different histories.

View file

@ -11,7 +11,7 @@ type layertype
kind as long kind as long
end type end type
redim shared layers(1) as layertype dim shared layers(0) as layertype
dim shared state as statetype dim shared state as statetype
@ -21,17 +21,12 @@ dim shared mousedown as integer
dim shared rmouseclicked as integer dim shared rmouseclicked as integer
dim shared rmousedown as integer dim shared rmousedown as integer
$resize:on $resize:on
screen _newimage(750,480,32) screen _newimage(640,480,32)
_delay 0.1 _delay 0.1
temp&=_resize temp&=_resize
redim shared pal(0) as _unsigned long redim shared pal(0) as _unsigned long
dim as integer ch1,ch2,ch3,bt dim as integer ch1,ch2,ch3,bt
loadpalette "endesga16",pal() 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 do
line (0,0)-(_width-1,_height-1),backgroundcolor1,bf line (0,0)-(_width-1,_height-1),backgroundcolor1,bf
@ -40,7 +35,7 @@ do
mouseclicked=0 mouseclicked=0
rmouseclicked=0 rmouseclicked=0
if mousedown=-1 and _mousebutton(1)=0 then mouseclicked=-1 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) mousedown=_mousebutton(1)
rmousedown=_mousebutton(2) rmousedown=_mousebutton(2)
toolbox toolbox
@ -78,30 +73,7 @@ sub colorpicker
end sub end sub
sub canvas sub canvas
' 1. Define the box boundaries line (70,0)-(_width-1,_height-20),_rgb32(64),bf
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
end sub end sub
function icon(index as long) function icon(index as long)