Return to move_listener.h CVS log | Up to Nevrax / code / client |
File: Nevrax / code / client / Attic / move_listener.h (download) Revision 1.1, Mon Dec 4 10:56:01 2000 UTC (19 months, 3 weeks ago) by coutelas Branch: MAIN no message |
/** \file move_listener.h * <File description> * * $Id: move_listener.h,v 1.1 2000/12/04 10:56:01 coutelas Exp $ */ /* Copyright, 2000 Nevrax Ltd. * * This file is part of NEVRAX NEL. * NEVRAX NEL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * NEVRAX NEL is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * You should have received a copy of the GNU General Public License * along with NEVRAX NEL; see the file COPYING. If not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #ifndef NL_MOVE_LISTENER_H #define NL_MOVE_LISTENER_H #include "nel/misc/types_nl.h" #include "nel/misc/event_listener.h" #include "nel/misc/matrix.h" #include "nel/3d/viewport.h" namespace NL3D { /** * CMoveListener is a listener that handle a 3d matrix with mouse events. * \author Stephane Coutelas * \author Nevrax France * \date 2000 */ class CMoveListener : public NLMISC::IEventListener { public: /** * Constructor. * You should call setViewMatrix + setFrustrum or setCamera, setViewport, setHotStop and setMouseMode to initialize * the whole object. By default, the viewmatrix is identity, the frustrum is (1,1,1,1,1), the hot spot is (0,0,0) * and the viewport is fullscreen. The mouse mode is set to the NelStyle. */ CMoveListener(); /** * Set the current view matrix to use. * \param matrix is the matrix to set. * \see setWithCamera() getViewMatrix() */ void setViewMatrix (const NLMISC::CMatrix& matrix) { _ViewMatrix=matrix; } /** * Set the current frustrum to use. * \param left is the left border of the frustrum. * \param right is the right border of the frustrum. * \param top is the top border of the frustrum. * \param bottom is the bottom border of the frustrum. * \param depth is the depth coordinate left, right, top and bottom values. * \see setWithCamera() */ void setFrustrum (float left, float right, float bottom, float top, float depth) { _Left=left; _Right=right; _Bottom=bottom; _Top=top; _Depth=depth; } /** * Set the view matrix and the frustrum with a camera. * \param camera is the camera use to copy view matrix and frustrum. * \see setViewMatrix() setFrustrum() */ void setWithCamera (const class CCamera& camera); /** * Set the viewport in use in the window. By default, the viewport is fullwindow. * \param viewport is the viewport to use. All events outside the viewport are ignored. */ void setViewport (const NL3D::CViewport& viewport) { _Viewport=viewport; } /** * Get the current view matrix. This matrix is updated with mouse events. * \return The current view matrix. * \see setViewMatrix() */ const NLMISC::CMatrix& getViewMatrix () const { return _ViewMatrix; } /** * Register the listener to the server. */ void addToServer (NLMISC::CEventServer& server); /** * Unregister the listener to the server. */ void removeFromServer (NLMISC::CEventServer& server); private: /// Internal use virtual void operator ()(const NLMISC::CEvent& event); NLMISC::CMatrix _ViewMatrix; NL3D::CViewport _Viewport; float _Top; float _Bottom; float _Left; float _Right; float _Depth; float _X; float _Y; float _Z; float _RotZ; float _RotX; float _MouseX; float _MouseY; static const float _StepTransX; static const float _StepTransY; static const float _StepTransZ; static const float _StepRotZ; static const float _StepRotX; }; // NL3D } #endif // NL_MOVE_LISTENER_H /* End of move_listener.h */