Panda3D
Loading...
Searching...
No Matches
mouseSubregion.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file mouseSubregion.I
10 * @author drose
11 * @date 2005-05-13
12 */
13
14/**
15 * Retrieves the x coordinate of the left edge of the rectangle within the
16 * window. This number will be in the range [0..1].
17 */
19get_left() const {
20 return _l;
21}
22
23/**
24 * Retrieves the x coordinate of the right edge of the rectangle within the
25 * window. This number will be in the range [0..1].
26 */
28get_right() const {
29 return _r;
30}
31
32/**
33 * Retrieves the y coordinate of the bottom edge of the rectangle within the
34 * window. This number will be in the range [0..1].
35 */
37get_bottom() const {
38 return _b;
39}
40
41/**
42 * Retrieves the y coordinate of the top edge of the rectangle within the
43 * window. This number will be in the range [0..1].
44 */
46get_top() const {
47 return _t;
48}
49
50/**
51 * Changes the region of the window in which the mouse is considered to be
52 * active. The parameters are identical to those for a DisplayRegion: they
53 * range from 0 to 1, where 0,0 is the lower left corner and 1,1 is the upper
54 * right; (0, 1, 0, 1) represents the whole window.
55 */
57set_dimensions(PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t) {
58 _l = l;
59 _r = r;
60 _b = b;
61 _t = t;
62
63 _minx = l * 2.0f - 1.0f;
64 _miny = b * 2.0f - 1.0f;
65
66 PN_stdfloat maxx = r * 2.0f - 1.0f;
67 PN_stdfloat maxy = t * 2.0f - 1.0f;
68
69 _scalex = 2.0f / (maxx - _minx);
70 _scaley = 2.0f / (maxy - _miny);
71}
PN_stdfloat get_right() const
Retrieves the x coordinate of the right edge of the rectangle within the window.
PN_stdfloat get_left() const
Retrieves the x coordinate of the left edge of the rectangle within the window.
void set_dimensions(PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t)
Changes the region of the window in which the mouse is considered to be active.
PN_stdfloat get_bottom() const
Retrieves the y coordinate of the bottom edge of the rectangle within the window.
PN_stdfloat get_top() const
Retrieves the y coordinate of the top edge of the rectangle within the window.