delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/01/19:04:52

From: random AT visi DOT net (Michael Bosley)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Rubber band code in C & Allegro
Date: Fri, 01 May 1998 21:49:22 GMT
Organization: @Home Network
Lines: 36
Message-ID: <354a4123.345420875@news>
References: <35464871 DOT AFF16286 AT wpol DOT com>
NNTP-Posting-Host: cx582964-a.nwptn1.va.home.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Tue, 28 Apr 1998 06:11:29 GMT, John Kissell <jdk AT wpol DOT com> wrote:

>Has any one run across C code to generate a rubber band effect used to
>"rope in" and select a number of objects using the mouse?

I don't have it, although I will need it to, but it should be
something like...

on MouseButtonDown
  check to see if there is an object under the mouse pointer
  if there is and MouseButtonUp, select the object
  else
    save x1 coord
    save y1 coord
on MouseMove
  draw line from saved y1 to (saved y1 + current y)
  draw line from saved x1 to (saved x1 + current x)
  draw line from (saved y1 + current y) to current x
  draw line from (saved x1 + current x) to current y
on MouseButtonUp
  save x2 coord
  save y2 coord
find all mass selectable objects within square of (x1, y1), (x2, y2)

Somebody please look this ps.code over cause I might have made a
mistake here...  Also, I haven't used allegro so I don't know the
syntax to use to do the above

thx all!

Michael Bosley


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      Do Not Send Me Unsolicited Email!      
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019