Edit history, like a true winner, start of redraw logic.
This commit is contained in:
parent
8b5c09d7dd
commit
9e5db80b0a
2 changed files with 169 additions and 153 deletions
|
|
@ -8,7 +8,7 @@ function textinput$ (x as integer,y as integer,w as integer,h as integer,__text
|
||||||
end if
|
end if
|
||||||
drawtextinput x,y,w,h,__text,1
|
drawtextinput x,y,w,h,__text,1
|
||||||
if not mouseclicked then exit function
|
if not mouseclicked then exit function
|
||||||
text=""
|
'text=""
|
||||||
cursor=len(text)+1
|
cursor=len(text)+1
|
||||||
dim relativeX as integer
|
dim relativeX as integer
|
||||||
do
|
do
|
||||||
|
|
|
||||||
52
pixler.bas
52
pixler.bas
|
|
@ -65,14 +65,14 @@ addcommand "fcolor ("+hex$(state.fcolor)+")"
|
||||||
addcommand "bcolor ("+hex$(state.bcolor)+")"
|
addcommand "bcolor ("+hex$(state.bcolor)+")"
|
||||||
|
|
||||||
dim lastMX, lastMY
|
dim lastMX, lastMY
|
||||||
dim diffX as integer
|
|
||||||
dim diffY as integer
|
|
||||||
dim oldWidth as integer
|
|
||||||
dim oldHeight as integer
|
|
||||||
dim keyin as string
|
dim keyin as string
|
||||||
dim mouseWorldY as integer
|
dim mouseWorldY as integer
|
||||||
dim mouseWorldX as integer
|
dim mouseWorldX as integer
|
||||||
|
|
||||||
|
dim diffX as integer
|
||||||
|
dim diffY as integer
|
||||||
|
dim oldWidth as integer
|
||||||
|
dim oldHeight as integer
|
||||||
oldWidth=_width
|
oldWidth=_width
|
||||||
oldHeight=_height
|
oldHeight=_height
|
||||||
do
|
do
|
||||||
|
|
@ -164,7 +164,7 @@ loop
|
||||||
|
|
||||||
sub commandlist
|
sub commandlist
|
||||||
dim i as long
|
dim i as long
|
||||||
dim listWidth as integer:listWidth = 150
|
dim listWidth as integer:listWidth = 250
|
||||||
dim x as integer:x=_width-listWidth
|
dim x as integer:x=_width-listWidth
|
||||||
|
|
||||||
' Draw background for the list
|
' Draw background for the list
|
||||||
|
|
@ -176,8 +176,34 @@ sub commandlist
|
||||||
for i = ubound(commands) - 1 to 0 step -1
|
for i = ubound(commands) - 1 to 0 step -1
|
||||||
y = (ubound(commands)-i) * 16
|
y = (ubound(commands)-i) * 16
|
||||||
if y < _height - 20 then
|
if y < _height - 20 then
|
||||||
_printstring (x + 5, y + 5), left$(commands(i), 18)
|
'_printstring (x + 5, y + 5), left$(commands(i), 31)
|
||||||
|
if link(x + 5, y + 5, left$(commands(i), 31)) then
|
||||||
|
commands(i)=textinput(x + 5, y + 5,248,23, commands(i))
|
||||||
end if
|
end if
|
||||||
|
end if
|
||||||
|
next i
|
||||||
|
if button(x,_height-25, 60,23, "redraw") then redraw
|
||||||
|
end sub
|
||||||
|
|
||||||
|
sub redraw
|
||||||
|
redim numarr(0) as long
|
||||||
|
for i=lbound(commands) to ubound(commands)
|
||||||
|
select case lcase$(_trim$(left$(commands(i),instr(commands(i),"(")-1)))
|
||||||
|
case "canvas"
|
||||||
|
case "fcolor"
|
||||||
|
case "bcolor"
|
||||||
|
case "pixel"
|
||||||
|
case "line"
|
||||||
|
case "brushwidth"
|
||||||
|
case "box"
|
||||||
|
case "fbox"
|
||||||
|
case "circle"
|
||||||
|
case "fcircle"
|
||||||
|
case "polygon"
|
||||||
|
case "fpolygon"
|
||||||
|
case "floodfill"
|
||||||
|
case else
|
||||||
|
end select
|
||||||
next i
|
next i
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
|
|
@ -328,10 +354,6 @@ sub canvas
|
||||||
static drawCol
|
static drawCol
|
||||||
if _mousebutton(1) then drawCol = state.fcolor
|
if _mousebutton(1) then drawCol = state.fcolor
|
||||||
if _mousebutton(2) then drawCol = state.bcolor
|
if _mousebutton(2) then drawCol = state.bcolor
|
||||||
|
|
||||||
' 4. Interaction Logic
|
|
||||||
'if _mousex > boxX1 then
|
|
||||||
' Start Drawing Logic
|
|
||||||
if state.tool = 9 and (mouseclicked or rmouseclicked) then
|
if state.tool = 9 and (mouseclicked or rmouseclicked) then
|
||||||
_dest layers(1).ihandle
|
_dest layers(1).ihandle
|
||||||
_source layers(1).ihandle
|
_source layers(1).ihandle
|
||||||
|
|
@ -346,7 +368,6 @@ sub canvas
|
||||||
_source 0
|
_source 0
|
||||||
exit sub
|
exit sub
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if state.tool = 10 and (mouseclicked or rmouseclicked) then
|
if state.tool = 10 and (mouseclicked or rmouseclicked) then
|
||||||
_dest layers(1).ihandle
|
_dest layers(1).ihandle
|
||||||
_source layers(1).ihandle
|
_source layers(1).ihandle
|
||||||
|
|
@ -361,7 +382,6 @@ sub canvas
|
||||||
_source 0
|
_source 0
|
||||||
exit sub
|
exit sub
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if state.tool = 7 or state.tool = 8 then
|
if state.tool = 7 or state.tool = 8 then
|
||||||
if mouseclicked then
|
if mouseclicked then
|
||||||
polypoints(pointCount * 2) = canX
|
polypoints(pointCount * 2) = canX
|
||||||
|
|
@ -376,7 +396,6 @@ sub canvas
|
||||||
state.isDrawing = -1
|
state.isDrawing = -1
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if state.isDrawing then
|
if state.isDrawing then
|
||||||
' We use Layer 2 as the temporary preview "rubber-band" layer
|
' We use Layer 2 as the temporary preview "rubber-band" layer
|
||||||
_dest layers(2).ihandle
|
_dest layers(2).ihandle
|
||||||
|
|
@ -415,7 +434,6 @@ sub canvas
|
||||||
thickline polypoints((pointCount - 1) * 2), polypoints((pointCount - 1) * 2 + 1), canX, canY, state.fcolor
|
thickline polypoints((pointCount - 1) * 2), polypoints((pointCount - 1) * 2 + 1), canX, canY, state.fcolor
|
||||||
end if
|
end if
|
||||||
end select
|
end select
|
||||||
|
|
||||||
' 5. Commit Logic
|
' 5. Commit Logic
|
||||||
dim commit as integer: commit = 0
|
dim commit as integer: commit = 0
|
||||||
if state.tool = 7 or state.tool = 8 then
|
if state.tool = 7 or state.tool = 8 then
|
||||||
|
|
@ -423,7 +441,6 @@ sub canvas
|
||||||
else
|
else
|
||||||
if (mousedown=0) and (rmousedown=0) then commit = -1
|
if (mousedown=0) and (rmousedown=0) then commit = -1
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if commit then
|
if commit then
|
||||||
_dest layers(1).ihandle ' Final destination is always the drawing layer
|
_dest layers(1).ihandle ' Final destination is always the drawing layer
|
||||||
if (state.tool = 8 or state.tool=7) and pointCount > 2 then
|
if (state.tool = 8 or state.tool=7) and pointCount > 2 then
|
||||||
|
|
@ -475,14 +492,13 @@ sub canvas
|
||||||
addcommand "fbox ("+tst(state.startX)+","+tst(state.startY)+","+tst(canX)+","+tst(canY)+","+hex$(drawCol)+")"
|
addcommand "fbox ("+tst(state.startX)+","+tst(state.startY)+","+tst(canX)+","+tst(canY)+","+hex$(drawCol)+")"
|
||||||
end select
|
end select
|
||||||
end if
|
end if
|
||||||
|
|
||||||
_dest layers(2).ihandle: cls , 0
|
_dest layers(2).ihandle: cls , 0
|
||||||
state.isDrawing = 0
|
state.isDrawing = 0
|
||||||
pointCount = 0
|
pointCount = 0
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
'end if
|
|
||||||
_dest 0 ' Ensure we return to main screen
|
_dest 0
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
function icon (index as long)
|
function icon (index as long)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue