#define HEADER_SUPERTUX_VIDEO_GL_SURFACE_DATA_HPP
#include "video/surface.hpp"
+#include "video/surface_data.hpp"
-class GLSurfaceData
+class GLSurfaceData : public SurfaceData
{
private:
const Surface &surface;
#include "supertux/gameconfig.hpp"
#include "supertux/globals.hpp"
#include "video/surface.hpp"
+#include "video/surface_data.hpp"
#include "video/texture.hpp"
-class SDLSurfaceData
+class SDLSurfaceData : public SurfaceData
{
private:
const Surface &surface;
return texture;
}
-void*
+SurfaceData*
Surface::get_surface_data() const
{
return surface_data;
#include "math/rect.hpp"
class Texture;
+class SurfaceData;
/**
* A rectangular image.
private:
Texture* texture;
- void *surface_data;
+ SurfaceData* surface_data;
Rect rect;
bool flipx;
bool get_flipx() const;
Texture *get_texture() const;
- void *get_surface_data() const;
+ SurfaceData* get_surface_data() const;
int get_x() const;
int get_y() const;
int get_width() const;
--- /dev/null
+// SuperTux
+// Copyright (C) 2009 Ingo Ruhnke <grumbel@gmx.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 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, see <http://www.gnu.org/licenses/>.
+
+#ifndef HEADER_SUPERTUX_VIDEO_SURFACE_DATA_HPP
+#define HEADER_SUPERTUX_VIDEO_SURFACE_DATA_HPP
+
+class SurfaceData
+{
+public:
+ virtual ~SurfaceData() {}
+};
+
+#endif
+
+/* EOF */
}
}
-void*
+SurfaceData*
VideoSystem::new_surface_data(const Surface &surface)
{
switch(g_config->video)
}
void
-VideoSystem::free_surface_data(void *surface_data)
+VideoSystem::free_surface_data(SurfaceData* surface_data)
{
- // FIXME: this won't call any destructors
- delete reinterpret_cast<char *>(surface_data);
+ delete surface_data;
}
VideoSystem::Enum
class Lightmap;
class Texture;
class Surface;
+class SurfaceData;
class VideoSystem
{
static Renderer* new_renderer();
static Lightmap* new_lightmap();
static Texture* new_texture(SDL_Surface *image);
- static void* new_surface_data(const Surface &surface);
- static void free_surface_data(void *surface_data);
+ static SurfaceData* new_surface_data(const Surface &surface);
+ static void free_surface_data(SurfaceData* surface_data);
static Enum get_video_system(const std::string &video);
static std::string get_video_string(Enum video);