Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[484dc9]: manuals / vgui_users_guide / node13.html Maximize Restore History

Download this file

node13.html    83 lines (80 with data), 3.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 98.1 release (February 19th, 1998)
originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Getting mouse position</TITLE>
<META NAME="description" CONTENT="Getting mouse position">
<META NAME="keywords" CONTENT="vgui_users_guide">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="vgui_users_guide.css">
<LINK REL="next" HREF="node14.html">
<LINK REL="previous" HREF="node12.html">
<LINK REL="up" HREF="node12.html">
<LINK REL="next" HREF="node14.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html180"
HREF="node14.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="/usr/local/share/latex2html/icons.gif/next_motif.gif"></A>
<A NAME="tex2html177"
HREF="node12.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="/usr/local/share/latex2html/icons.gif/up_motif.gif"></A>
<A NAME="tex2html171"
HREF="node12.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="/usr/local/share/latex2html/icons.gif/previous_motif.gif"></A>
<A NAME="tex2html179"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="/usr/local/share/latex2html/icons.gif/contents_motif.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html181"
HREF="node14.html">Rubberbanding</A>
<B> Up:</B> <A NAME="tex2html178"
HREF="node12.html">Handling events</A>
<B> Previous:</B> <A NAME="tex2html172"
HREF="node12.html">Handling events</A>
<BR>
<BR>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION00510000000000000000">
Getting mouse position</A>
</H1>
<P>
<FONT SIZE="-2">When a mouse button is pressed it produces an event which is passed to the
<TT>handle_impl</TT> function of the tableau. In order to use a mouse event we need to write
our own tableau which is derived from a <TT>vgui_tableau</TT>.
</FONT>
<P>
<FONT SIZE="-2">In this next example we get the mouse position when the left mouse button is pressed on
the image. The mouse position is given in viewport coordinates with the lower-left corner
as the origin. (In general the viewport will be the area displaying OpenGL).
</FONT>
<P>
<FONT SIZE="-2"><IMG
WIDTH="622" HEIGHT="842" ALIGN="BOTTOM" BORDER="0"
SRC="img10.gif"
ALT="\begin{center}\vbox{\input{mouse-position}
}\end{center}">
</FONT>
<P>
<FONT SIZE="-2">We can use this to draw a line onto the image. In this next example a line is drawn between
two points selected by pressing the left mouse button.
</FONT>
<P>
<BR><HR>
<ADDRESS>
<I>Target Junior User</I>
<BR><I>2000-10-31</I>
</ADDRESS>
</BODY>
</HTML>