Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wonky mouse control
#1
Is there something I'm missing here? This is supposed to operate so that you click somewhere, a dot is set there, and then you click somewhere else and a line is drawn between the two points. Sometimes the line is drawn, sometimes it isn't, and sometimes it's drawn in seemingly weird places.
Code:
screenres 320,200
setmouse 160,100
do until inkey$=chr$(27)
    getmouse mousex,mousey,,mb
    if mb then
        pset (mousex,mousey),2
        do
            getmouse mousex2,mousey2,,mb2
            if mb2 then exit do
        loop
        line (mousex,mousey)-(mousex2,mousey2),2
    end if
loop

[EDIT]Alright, there is something seriously wrong.
Code:
screenres 320,200,8,2,1
sleep
That code doesn't work. It initializes 320,200, but it ain't fullscreen. :o
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#2
Zack:

Code:
dim mousex, mousey,mousex2,mousey2,mb,mb2,x,y
screenres 320,200
setmouse 160,100
do until inkey$=chr$(27)
    getmouse mousex,mousey,,mb
    if mb=1 then
        pset (mousex,mousey),2
        do:getmouse x,y,,mb:loop until mb=0

        do
            getmouse mousex2,mousey2,,mb2
            if mb2=1 then exit do
        loop
        line (mousex,mousey)-(mousex2,mousey2),2
        do:getmouse x,y,,mb:loop until mb=0
    end if
loop

-Mouse button presses last long, you have to wait for its release or they will propagate to your next reads.

-Freebasic sets mouse buttons to -1 if you click them out of the window. At that moment x and y are -1 too, so to avoid lines starting and ending at -1,-1, check for thhe real value of the left click, that's 1

-In FB for Windows 320 x 200 is a SVGA mode, most modern cards does'nt support resolutions that low in SVGA. Check SCREENLIST to see if it's supported.

BTW: Did you finished your trike?
Antoni
Reply
#3
Thanks Antoni, I didn't know that. It works now.

And...um, trike? I wasn't building a trike...?
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#4
Quote:And...um, trike? I wasn't building a trike...?

http://forum.qbasicnews.com/viewtopic.php?p=84062#84062


*smacks* :P
Reply
#5
It did'nt go far, I see Big Grin
Antoni
Reply
#6
Oh, that. I call it a go-kart, not a trike. Big Grin
I never ended up building it. Not enough cash. Sad
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)