1. Need Crash Course in Mouse Support
- Posted by Alan Tu <ATU5713 at COMPUSERVE.COM>
Jun 10, 1998
-
Last edited Jun 11, 1998
I need a crash course in mouse programming in Euphoria.
First in DOS32. I think I can have the program just look for clicks,
instead of the move event. Now, if I display a text on the screen, and m=
y
event would be the left mouse click on that text. get_mouse would return=
a
three atom sequence:
1. left-down
2 & 3 coordinates
The coordinates seem to run into at least a hundred. What is the
coordinate system used? Is it pixels? If so, I guess I need a crash
course on that too.
Then, is mouse programming in WIN32 easier or harder than DOS32? I don't=
see any Euphoria routines that track mice in WIN32.
Thanks in advance.
--Alan
=
2. Re: Need Crash Course in Mouse Support
At 10:34 PM 6/10/98 -0400, you wrote:
>I need a crash course in mouse programming in Euphoria.
>
>First in DOS32. I think I can have the program just look for clicks,
>instead of the move event. Now, if I display a text on the screen, and my
>event would be the left mouse click on that text. get_mouse would return
>a three atom sequence:
>
>1. left-down
>2 & 3 coordinates
to check for the left down event use:
if and_bits(LEFT_DOWN,events[1]) then ....
If you only want to catch clicks and not
movement call:
mouse_events(254)
>The coordinates seem to run into at least a hundred. What is the
>coordinate system used? Is it pixels? If so, I guess I need a crash
>course on that too.
It *should * be pixels, in some graphics modes
DOS erroniously reports x value as double what it should be.
>Then, is mouse programming in WIN32 easier or harder than DOS32? I don't
>see any Euphoria routines that track mice in WIN32.
*EVERYTHING* is harder in WIN32 (thanks Bill)
Any mouse interaction is handled through the windows API.
here's a quick example:
include graphics.e
include mouse.e
object events
if graphics_mode(19)
while 1 do
events=get_mouse()
if sequence(events) then
if and_bits(LEFT_DOWN,events[1]) then
puts(1,"\nLeft button was pressed at :")
?events[2..3]
abort(0)
end if
end if
end while
Have fun,
Graeme.
----------------------------------------------------
3. Re: Need Crash Course in Mouse Support
> Data de tramesa: Wed, 10 Jun 1998 22:34:04 -0400
> Enviar resposta a: Euphoria Programming for MS-DOS <EUPHORIA at
> cwisserver1.mcs.muohio.edu>
> De : Alan Tu <ATU5713 at COMPUSERVE.COM>
> Assumpte: Need Crash Course in Mouse Support
> A: EUPHORIA at cwisserver1.mcs.muohio.edu
Hi Alan,
> I need a crash course in mouse programming in Euphoria.
Yeah! I'm dealing with the same problem.David Cuny post a tutorial
about the subject...if you want it,drop me a line and I will send it
to you.Maybe together we'll be able to solve the problem!!
> First in DOS32. I think I can have the program just look for clicks,
> instead of the move event. Now, if I display a text on the screen, and my
> event would be the left mouse click on that text. get_mouse would return a
> three atom sequence:
>
> 1. left-down
> 2 & 3 coordinates
>
I wrote a little crappy program wich shows you how to work with the
mouse in text mode and how to create buttons.It's in the user's
contribution web page...give it a try and tell me what you think
about it :)
It checks buttons you pressed,the current position of the
pointer,the position where you pressed either left&right
buttons and something else that I don't remember right now...play
with it!
> The coordinates seem to run into at least a hundred. What is the
> coordinate system used? Is it pixels? If so, I guess I need a crash
> course on that too.
>
I had the same problem when I started to program the mouse!In text-
mode it seems that you have to 'scale' the screen coordinates by
dividing the X & Y coordinates by 8 (I still don't know why!!!)I'm not
quite sure but I think that it's due to some peculiarity of the Dos
system.
> Then, is mouse programming in WIN32 easier or harder than DOS32? I don't
> see any Euphoria routines that track mice in WIN32.
>
I've never programed before in graphical mode so I think that I
can't help you with that matter:(
...but some day I will get started!
> Thanks in advance.
>
> --Alan
>
>
Regards,
Luis
4. Re: Need Crash Course in Mouse Support
Luis,
If you can send me David's tutorial, that would be great. If your progra=
m
isn't too big, please send that to me too.
--Alan
=
5. Re: Need Crash Course in Mouse Support
- Posted by Irv <irv at ELLIJAY.COM>
Jun 11, 1998
-
Last edited Jun 12, 1998
At 11:41 AM 6/11/98 +0000, Luis wrote:
>> The coordinates seem to run into at least a hundred. What is the
>> coordinate system used? Is it pixels? If so, I guess I need a crash
>> course on that too.
>>
>I had the same problem when I started to program the mouse!In text-
>mode it seems that you have to 'scale' the screen coordinates by
>dividing the X & Y coordinates by 8 (I still don't know why!!!)I'm not
>quite sure but I think that it's due to some peculiarity of the Dos
>system.
>
Luis:
This is because the normal text screen has 80 characters across.
Each character is 8 pixels wide, therefore 8 x 80 = 640, which
happens to fit nicely.
Irv