Merged changes from branches/supertux-milestone2-grumbel/ to trunk/supertux/
[supertux.git] / src / video / surface.hpp
index 8961606..9613917 100644 (file)
@@ -1,38 +1,27 @@
-//  $Id$
-// 
 //  SuperTux
 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
 //
-//  This program 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
-//  of the License, or (at your option) any later version.
+//  This program 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 3 of the License, or
+//  (at your option) any later version.
 //
 //  This program 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 this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-//  02111-1307, USA.
-#ifndef __SURFACE_HPP__
-#define __SURFACE_HPP__
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef HEADER_SUPERTUX_VIDEO_SURFACE_HPP
+#define HEADER_SUPERTUX_VIDEO_SURFACE_HPP
 
 #include <string>
 
-class ImageTexture;
+#include "math/vector.hpp"
 
-/// bitset for drawing effects
-enum DrawingEffect {
-  /** Don't apply anything */
-  NO_EFFECT       = 0x0000,
-  /** Draw the Surface upside down */
-  VERTICAL_FLIP     = 0x0001,
-  /** Draw the Surface from left to down */
-  HORIZONTAL_FLIP   = 0x0002,
-};
+class Texture;
 
 /**
  * A rectangular image.
@@ -42,43 +31,39 @@ enum DrawingEffect {
 class Surface
 {
 private:
-  friend class DrawingContext;
-  friend class Font;
-  ImageTexture* texture;
-
-  float uv_left;
-  float uv_top;
-  float uv_right;
-  float uv_bottom;
-
-  void draw(float x, float y, float alpha, float angle, DrawingEffect effect) const;
-  void draw(float x, float y, float alpha, DrawingEffect effect) const;
-  void draw_part(float src_x, float src_y, float dst_x, float dst_y,
-                 float width, float height,
-                 float alpha, DrawingEffect effect) const;
+  Texture* texture;
+  void *surface_data;
+  int x;
+  int y;
+  int w;
+  int h;
+  bool flipx;
 
-  float width;
-  float height;
 public:
   Surface(const std::string& file);
   Surface(const std::string& file, int x, int y, int w, int h);
   Surface(const Surface& other);
   ~Surface();
 
-  /** flip the surface horizontally */
-  void hflip();
-  
   const Surface& operator= (const Surface& other);
 
-  float get_width() const
-  {
-    return width;
-  }
+  /** flip the surface horizontally */
+  void hflip();
+  bool get_flipx() const;
 
-  float get_height() const
-  {
-    return height;
-  }
+  Texture *get_texture() const;
+  void *get_surface_data() const;
+  int get_x() const;
+  int get_y() const;
+  int get_width() const;
+  int get_height() const;
+  Vector get_position() const;
+  /**
+   * returns a vector containing width and height
+   */
+  Vector get_size() const;
 };
 
 #endif
+
+/* EOF */