Dark Bit Factory & Gravity
PROGRAMMING => Freebasic => Topic started by: Shockwave on May 17, 2006
-
Been scratching my head over this one, I need to be able to;
Detect the status of the left mouse button
Detect the X+Y mouse position
Detect the up and down arrows
Whilst using tinyptc, getmouse and multikey don't seem to be working for me here.
-
Bah! Can't get it to work at all :(
-
Ah well I worked out the cursor keys, just in case anyone else needs to detect the cursor keys whilst using tinyptc, you can do it like this;
kk=inkey$
if kk=CHR$(255)+"H" then Y=Y-1 :' Up Arrow
if kk=CHR$(255)+"P" then Y=Y+1 :' Down Arrow
It seems that when you press a special key, two characters are placed into the keyboard buffer, the first one always seems to be chr$(255).
I'm still stuck on the mouse though.
If anyone knows how to read the mouse when using this lib I'd really appreciate it :)
-
I think for using the mouse you may need to be using gfxlib matey.
As I found GetMouse() And SetMouse() Press F1 in fbide for bringing up extra help by the start of the commands.
Hope it helps.
-
Thanks Clyde, I know about Getmouse and setmouse, also multikey worked for me in gfxlib but I can't get the mouse co-ords whilst using tinyptc.
There must be a work around.
Cheers for looking though mate.
-
No worries mate, I'll keep an eye out for anything useful dude.
-
Maybe there's a port that can be peeked or something to find it..
-
Dude, I've been asking about using the mouse with TinyPTC, and it's a no goer.
Gfxlib is what people are telling me is the way forward with the mouse matey.
-
Mmm.. If the mouse is connected to the PC though surely the input from it goes somewhere?
Thanks for looking Clyde. I guess I'm just frustrated at it because I can't work it out either.
-
Yeah, I asked on your behalf at FBNet as Im interested in this too, for some user interaction with effects.
There were suggestions of including gfxlib.bi , but according to the replies it doesnt seem pos. But, just thinking possibly you could use tinyptc wrapped in windows gui stuff.
-
Since TinyPTC is only a GFX Buffer system so you will need to include some form of input detection, maybe FB has some Directinput commands you can use or access to the default winapi keyboard and mouse stuff. But how you can tie them to the PTC buffer for the mouse position might be a problem due to how tinyptc works. Of course if your just looking to detect if the mouse is moved up/down /left/right then it wont matter so much :)
[EDIT]
Having a look at the FB examples theres one called conmouse.bas, which opens a console window and checks mouse position, now it looks like it's using the command thats meant to be part of the libgfx thing but it's not opened a screen so maybe it's possible to use that in some way to detect mouse movement, it wont display the mouse but you could draw your own pointer if you wanted. Other than that I still think that you might be able to use the winapi approach, there's a couple examples of windows programs with a wndproc for event tracking, now if you used that in the background it might work as well.
-
That's good stuff, thanks Jon.