Author Topic: Rubber Banding  (Read 1794 times)

0 Members and 1 Guest are viewing this topic.

Offline bjmillet

  • Newbie
  • *
  • Posts: 2
Rubber Banding
« on: December 17, 2009, 07:06:41 AM »
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.


Offline sapero

  • Senior Developer
  • Hero Member
  • *****
  • Posts: 1291
Re: Rubber Banding
« Reply #1 on: December 17, 2009, 08:23:35 AM »
You need to call LINE (the first one) using previous coordinates:
Code: [Select]
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
« Last Edit: December 17, 2009, 08:25:58 AM by sapero »

Offline bjmillet

  • Newbie
  • *
  • Posts: 2
Re: Rubber Banding
« Reply #2 on: December 17, 2009, 10:48:02 AM »
Thank you so much and no it makes sense to me.