Back to index

supertuxkart  0.5+dfsg1
camera.hpp
Go to the documentation of this file.
00001 //  $Id: camera.hpp 2111 2008-05-31 07:04:30Z cosmosninja $
00002 //
00003 //  SuperTuxKart - a fun racing game with go-kart
00004 //  Copyright (C) 2004-2005 Steve Baker <sjbaker1@airmail.net>
00005 //  Copyright (C) 2006 SuperTuxKart-Team, Steve Baker
00006 //
00007 //  This program is free software; you can redistribute it and/or
00008 //  modify it under the terms of the GNU General Public License
00009 //  as published by the Free Software Foundation; either version 2
00010 //  of the License, or (at your option) any later version.
00011 //
00012 
00013 //  This program is distributed in the hope that it will be useful,
00014 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 //  GNU General Public License for more details.
00017 //
00018 //  You should have received a copy of the GNU General Public License
00019 //  along with this program; if not, write to the Free Software
00020 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00021 
00022 #ifndef HEADER_CAMERA_H
00023 #define HEADER_CAMERA_H
00024 
00025 #include "LinearMath/btVector3.h"
00026 
00027 class ssgContext;
00028 class Kart;
00029 
00030 class Camera
00031 {
00032 public:
00033     enum Mode {
00034         CM_NORMAL,        // Normal camera mode
00035         CM_CLOSEUP,       // Normal camera, closer to kart
00036         CM_DRIFTING,      // FIXME: drifting behind when accelerating = not yet implemented
00037         CM_LEADER_MODE,   // for deleted player karts in follow the leader
00038         CM_REVERSE,       // Camera is pointing backwards
00039         CM_SIMPLE_REPLAY
00040     };
00041 protected:
00042     ssgContext *m_context ;
00043     sgCoord     m_current_pos;
00044     const Kart *m_kart;                 // the kart the camera is attached to
00045     Mode        m_mode;                 // CM_ value, see above
00046     float       m_x, m_y, m_w, m_h;     // window to us
00047     float       m_current_speed;        // current speed of camera
00048     float       m_last_pitch;           // for tiling the camera when going downhill
00049     float       m_distance;             // distance between camera and kart
00050 
00051 
00052 public:
00053          Camera           (int camera_index, const Kart* kart);
00054     void setMode          (Mode mode_);    
00055     void setScreenPosition(int pos);
00056     void reset            ();
00057     void update           (float dt);
00058     void apply            ();
00059 } ;
00060 
00061 #endif
00062 
00063 /* EOF */