March 28, 2024, 02:16:21 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Rubber Banding

Started by bjmillet, December 17, 2009, 07:06:41 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bjmillet

I'm new to Emergence Basic but not programming.  I've programmed in VB, C, C+, Fortran and every olde school language.  I'm working on a graphic design program and want to have "rubber banding" of lines and bezier curves.  I've done it in VB but am running into difficulties with ebasic.  I believe this is mainly to ignorance of ebasic.  I have been play with the example "draw.eba".  It rubber bands ellipses and rectangles.  When I use the same methodology for lines, it just flickers.


sapero

December 17, 2009, 08:23:35 AM #1 Last Edit: December 17, 2009, 08:25:58 AM by sapero
You need to call LINE (the first one) using previous coordinates:
SUB handlemouse(mx:int,my:int,qual:int)

IF(qual = 1)
RASTERMODE mywin,@RMXORPEN
SELECT mode
case 0
' use tempx,tempy (previous coordinates)
LINE mywin,l,t,tempx,tempy,RGB(255,255,255)
case 1
RECT mywin,l,t,w,h,RGB(255,255,255)
case 2
ELLIPSE mywin,l,t,w,h,RGB(255,255,255)
ENDSELECT
w = mx - l
h = my - t
SELECT mode
case 0
LINE mywin,l,t,mx,my,RGB(255,255,255)
case 1
RECT mywin,l,t,w,h,RGB(255,255,255)
case 2
ELLIPSE mywin,l,t,w,h,RGB(255,255,255)
ENDSELECT
RASTERMODE mywin,@RMCOPYPEN
ENDIF

tempx = mx
tempy = my

RETURN
ENDSUB

bjmillet

Thank you so much and no it makes sense to me.