home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 February / maximum-cd-2009-02.iso / DiscContents / SMC_1.6_win32.exe / src / core / camera.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-07-01  |  2.4 KB  |  82 lines

  1. /***************************************************************************
  2.  * camera.h  -  header for the corresponding cpp file
  3.  *
  4.  * Copyright (C) 2006 - 2008 Florian Richter
  5.  ***************************************************************************/
  6. /*
  7.    This program is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation; either version 3 of the License, or
  10.    (at your option) any later version.
  11.    
  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  14. */
  15.  
  16. #ifndef SMC_CAMERA_H
  17. #define SMC_CAMERA_H
  18.  
  19. #include "../core/globals.h"
  20. #include "../core/math/rect.h"
  21.  
  22. /* *** *** *** *** *** cCamera *** *** *** *** *** *** *** *** *** *** *** *** */
  23.  
  24. class cCamera
  25. {
  26. public:
  27.     cCamera( void );
  28.     ~cCamera( void );
  29.  
  30.     // set camera position
  31.     void Set_Pos( float nx, float ny );
  32.     void Set_Pos_X( float nx );
  33.     void Set_Pos_Y( float ny );
  34.     // move the camera
  35.     void Move( float move_x, float move_y );
  36.     /* moves to the given position gradually
  37.      * returns 0 if reached nearest the possible position
  38.     */
  39.     bool Move_to_Position_Gradually( float px, float py );
  40.  
  41.     // update
  42.     void Update( void );
  43.  
  44.     // center on the player with the given direction ( DIR_HORIZONTAL, DIR_VERTICAL and DIR_ALL )
  45.     void Center( ObjectDirection direction = DIR_ALL );
  46.     // get centered player position x
  47.     float Get_Center_Pos_X( void );
  48.     // get centered player position y
  49.     float Get_Center_Pos_Y( void );
  50.  
  51.     // reset limits
  52.     void Reset_Limits( void );
  53.     // set limits
  54.     void Set_Limits( GL_rect rect );
  55.     void Set_Limit_X( float val );
  56.     void Set_Limit_Y( float val );
  57.     void Set_Limit_W( float val );
  58.     void Set_Limit_H( float val );
  59.     // update limit with the given position
  60.     void Update_Limit( float &nx, float &ny );
  61.     void Update_Limit_X( float &nx );
  62.     void Update_Limit_Y( float &ny );
  63.     // update if position changed
  64.     void Update_Position( void );
  65.  
  66.     // position
  67.     float x, y;
  68.     // additional position offset
  69.     float x_offset, y_offset;
  70.     // position offset speed
  71.     float hor_offset_speed, ver_offset_speed;
  72.     // limits
  73.     GL_rect limit_rect;
  74.  
  75.     // fixed horizontal scrolling velocity
  76.     float fixed_hor_vel;
  77. };
  78.  
  79. /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
  80.  
  81. #endif
  82.