#include <SDL.h>
#include "math/vector.hpp"
#include "texture.hpp"
+#include "video_systems.hpp"
/**
* A rectangular image.
{
private:
Texture* texture;
+ void *surface_data;
int x;
int y;
int w;
texture->ref();
w = texture->get_image_width();
h = texture->get_image_height();
+ surface_data = new_surface_data(*this);
}
Surface(const std::string& file, int x, int y, int w, int h) :
flipx(false)
{
texture->ref();
+ surface_data = new_surface_data(*this);
}
Surface(const Surface& other) :
flipx(false)
{
texture->ref();
+ surface_data = new_surface_data(*this);
}
~Surface()
{
+ free_surface_data(surface_data);
texture->unref();
}
return texture;
}
+ void *get_surface_data() const
+ {
+ return surface_data;
+ }
+
int get_x() const
{
return x;
*/
Vector get_size() const
{ return Vector(get_width(), get_height()); }
-
- float get_uv_left() const
- {
- return (float) (x + (flipx ? w : 0)) / texture->get_texture_width();
- }
-
- float get_uv_top() const
- {
- return (float) y / texture->get_texture_height();
- }
-
- float get_uv_right() const
- {
- return (float) (x + (flipx ? 0 : w)) / texture->get_texture_width();
- }
-
- float get_uv_bottom() const
- {
- return (float) (y + h) / texture->get_texture_height();
- }
-
- //void draw_part(float src_x, float src_y, float dst_x, float dst_y,
- // float width, float height, float alpha,
- // DrawingEffect effect) const;
};
#endif