home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 February / maximum-cd-2009-02.iso / DiscContents / SMC_1.6_win32.exe / src / level / level_background.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-09-08  |  3.1 KB  |  117 lines

  1. /***************************************************************************
  2.  * level_background.h  -  header for the corresponding cpp file
  3.  *
  4.  * Copyright (C) 2005 - 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_LEVEL_BACKGROUND_H
  17. #define SMC_LEVEL_BACKGROUND_H
  18.  
  19. #include "../core/globals.h"
  20. #include "../video/video.h"
  21. #include "../core/obj_manager.h"
  22.  
  23. /* *** *** *** *** *** *** *** Background Image Type *** *** *** *** *** *** *** *** *** *** */
  24.  
  25. enum BackgroundType
  26. {
  27.     BG_NONE = 0,            // no background type
  28.     BG_IMG_BOTTOM = 1,        // only horizontal on the bottom
  29.     BG_IMG_ALL = 2,            // into all directions
  30.     BG_IMG_TOP = 3,            // only horizontal on top
  31.     BG_GR_VER = 103,        // Gradient Vertical
  32.     BG_GR_HOR = 104            // Gradient Horizontal
  33. };
  34.  
  35. /* *** *** *** *** *** *** *** Background class *** *** *** *** *** *** *** *** *** *** */
  36.  
  37. class cBackground
  38. {
  39. public:
  40.     // default constructor
  41.     cBackground( void );
  42.     // create from stream
  43.     cBackground( CEGUI::XMLAttributes &attributes );
  44.     // destructor
  45.     ~cBackground( void );
  46.  
  47.     // Init defaults
  48.     void Init( void );
  49.  
  50.     // create from stream
  51.     void Create_from_Stream( CEGUI::XMLAttributes &attributes );
  52.     // save to stream
  53.     void Save_to_Stream( ofstream &file );
  54.  
  55.     // Sets the type of Background
  56.     void Set_Type( BackgroundType ntype );
  57.     void Set_Type( string ntype );
  58.  
  59.     // Sets the background color
  60.     void Set_Color_1( const Color &color );
  61.     void Set_Color_2( const Color &color );
  62.  
  63.     // Set the Position
  64.     void Set_Pos( float x, float y );
  65.     // Set the Position z
  66.     void Set_Pos_Z( float val );
  67.     // Set the Background image
  68.     void Set_Image( string nimg_file_1 );
  69.     // Set the Background Image scrolling speed
  70.     void Set_Scroll_Speed( float x = 1, float y = 1 );
  71.  
  72.     // Set constant x velocity
  73.     void Set_Const_Velocity_X( float vel );
  74.     // Set constant y velocity
  75.     void Set_Const_Velocity_Y( float vel );
  76.  
  77.     // Update
  78.     void Update( void );
  79.     // draw
  80.     void Draw( void );
  81.     // draw gradient
  82.     void Draw_Gradient( void );
  83.  
  84.     // Returns the name of the current type
  85.     string Get_Type_Name( void );
  86.  
  87.     // type
  88.     BackgroundType type;
  89.     // position
  90.     float posx, posy, posz;
  91.  
  92.     // - background image settings
  93.     // image
  94.     GL_Surface *img_1;
  95.     // image filename
  96.     string img_file_1;
  97.     // scrolling speed
  98.     float speedx, speedy;
  99.     // constant velocity
  100.     float const_velx, const_vely;
  101.  
  102.     // - background gradient settings
  103.     // colors
  104.     Color color_1, color_2;
  105. };
  106.  
  107. /* *** *** *** *** *** cBackground_Manager *** *** *** *** *** *** *** *** *** *** *** *** */
  108.  
  109. class cBackground_Manager : public cObject_Manager<cBackground>
  110. {
  111. public:
  112.     cBackground_Manager( void );
  113.     virtual ~cBackground_Manager( void );
  114. };
  115.  
  116. #endif
  117.