Panda3D
|
00001 // Filename: mouseSubregion.h 00002 // Created by: drose (13May05) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef MOUSESUBREGION_H 00016 #define MOUSESUBREGION_H 00017 00018 #include "pandabase.h" 00019 00020 #include "mouseInterfaceNode.h" 00021 #include "luse.h" 00022 #include "linmath_events.h" 00023 #include "buttonEventList.h" 00024 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : MouseSubregion 00028 // Description : The MouseSubregion object scales the mouse inputs 00029 // from within a rectangular region of the screen, as if 00030 // they were the full-screen inputs. 00031 // 00032 // If you choose your MouseSubregion coordinates to 00033 // exactly match a DisplayRegion within your window, you 00034 // end up with a virtual mouse within your 00035 // DisplayRegion. 00036 //////////////////////////////////////////////////////////////////// 00037 class EXPCL_PANDA_TFORM MouseSubregion : public MouseInterfaceNode { 00038 PUBLISHED: 00039 MouseSubregion(const string &name); 00040 ~MouseSubregion(); 00041 00042 INLINE PN_stdfloat get_left() const; 00043 INLINE PN_stdfloat get_right() const; 00044 INLINE PN_stdfloat get_bottom() const; 00045 INLINE PN_stdfloat get_top() const; 00046 INLINE void set_dimensions(PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t); 00047 00048 protected: 00049 // Inherited from DataNode 00050 virtual void do_transmit_data(DataGraphTraverser *trav, 00051 const DataNodeTransmit &input, 00052 DataNodeTransmit &output); 00053 00054 private: 00055 PN_stdfloat _l; 00056 PN_stdfloat _r; 00057 PN_stdfloat _b; 00058 PN_stdfloat _t; 00059 00060 PN_stdfloat _minx, _miny; 00061 PN_stdfloat _scalex, _scaley; 00062 00063 private: 00064 // inputs 00065 int _pixel_xy_input; 00066 int _pixel_size_input; 00067 int _xy_input; 00068 int _button_events_input; 00069 00070 // outputs 00071 int _pixel_xy_output; 00072 int _pixel_size_output; 00073 int _xy_output; 00074 int _button_events_output; 00075 00076 PT(EventStoreVec2) _pixel_xy; 00077 PT(EventStoreVec2) _pixel_size; 00078 PT(EventStoreVec2) _xy; 00079 PT(ButtonEventList) _button_events; 00080 00081 public: 00082 static TypeHandle get_class_type() { 00083 return _type_handle; 00084 } 00085 static void init_type() { 00086 MouseInterfaceNode::init_type(); 00087 register_type(_type_handle, "MouseSubregion", 00088 MouseInterfaceNode::get_class_type()); 00089 } 00090 virtual TypeHandle get_type() const { 00091 return get_class_type(); 00092 } 00093 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00094 00095 private: 00096 static TypeHandle _type_handle; 00097 }; 00098 00099 #include "mouseSubregion.I" 00100 00101 #endif