Results 1 to 3 of 3

Thread: TDirectDraw.OnMouseMove

  1. #1

    TDirectDraw.OnMouseMove

    I am trying to draw on a TDirectDraw.Surface.Canvas by plotting the current (x,y) in my OnMouseMove, but to get a continous line, I have to move the mouse slowly. Does anyone know of a way to insure that each OnMouseMove event is triggered no more than one-pixel away from the last, or a way to insure that lines drawn in this manner are continous?

    procedure TForm1.DXDraw1MouseMove(Sender: TObject; Shift: TShiftState; X,
    Y: Integer);
    begin
    DXDraw1.Surface.Canvas.Pixels[x,y] := clWhite;
    end;

    Thanks!
    -----------------------------------------
    <br />S.o.D.

  2. #2

    TDirectDraw.OnMouseMove

    You might want to use a flag and a GameLoop.
    When the user clicks the mouse on a spot, set the flag to true and have a TPoint variable for the startpoint. Draw the line in your gameloop on the screen from the startpoint to the current mouse position and when the mouse is clicked again then save the endposition somewhere and then you have a continious line.

    Or do you want to draw the line to another point everytime you move your mouse, then it's going to be difficult to get a contious line, since you'll have to have some sort of starting and ending point to draw the line and when you just move the mouse than there is no endpoint and no startpoint, just new lines everytime
    Do it by the book, but be the author!
    <br />
    <br />Visit the Lion Productions website at:
    <br />http://lionprod.f2o.org

  3. #3

    TDirectDraw.OnMouseMove

    That works. It is a little chunky, but I think that's because of the conversion happening each plot. Thanks for the help!
    -----------------------------------------
    <br />S.o.D.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Comodo SSL