summaryrefslogtreecommitdiff
path: root/src/graphic
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-13 23:38:31 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-13 23:38:31 +0000
commit65c1d2b0b022de1340509738e65314474e2eb141 (patch)
tree2bbda5306b2a03d1e68455456fe1e65edd4e157e /src/graphic
parent0b6e2b1e4a256da0c2418af63df1c90e9a120690 (diff)
downloadmana-client-65c1d2b0b022de1340509738e65314474e2eb141.tar.gz
mana-client-65c1d2b0b022de1340509738e65314474e2eb141.tar.bz2
mana-client-65c1d2b0b022de1340509738e65314474e2eb141.tar.xz
mana-client-65c1d2b0b022de1340509738e65314474e2eb141.zip
Added heavily modified resource manager by zenogais that is currently using
Allegro to load/draw images. Only the login wallpaper is currently loaded using the resource manager and the resource manager still waits with searching for available files until they are asked for instead of indexing what is available.
Diffstat (limited to 'src/graphic')
-rw-r--r--src/graphic/image.cpp46
-rw-r--r--src/graphic/image.h73
2 files changed, 9 insertions, 110 deletions
diff --git a/src/graphic/image.cpp b/src/graphic/image.cpp
index 9d0d3cac..008c4017 100644
--- a/src/graphic/image.cpp
+++ b/src/graphic/image.cpp
@@ -24,37 +24,13 @@
#include "image.h"
-// Image
-
-Image::Image(int offset_x, int offset_y) {
- this->offset_x = offset_x;
- this->offset_y = offset_y;
-}
-
-
-// RleImage
-
-RleImage::RleImage(RLE_SPRITE *src, int offset_x, int offset_y):
- Image(offset_x, offset_y)
-{
- this->src = src;
-}
-
-RleImage::~RleImage() {
- destroy_rle_sprite(src);
-}
-
-void RleImage::draw(BITMAP *dest, int x, int y) {
- draw_rle_sprite(dest, src, x + offset_x, y + offset_y);
-}
-
-
// VideoImage
VideoImage::VideoImage(BITMAP *src, int offset_x, int offset_y):
- Image(offset_x, offset_y)
+ src(src),
+ offset_x(offset_x),
+ offset_y(offset_y)
{
- this->src = src;
}
VideoImage::~VideoImage() {
@@ -73,22 +49,6 @@ void VideoImage::draw(BITMAP *dst, int x, int y) {
// Spriteset
-Spriteset::Spriteset(std::string filename)
-{
- DATAFILE *datafile = load_datafile(filename.c_str());
- if (!datafile)error("Unable to load graphic file: " + filename);
- int i = 0;
- while (datafile[i].type != DAT_END) {
- Image *temp_image;
- temp_image = new RleImage(
- (RLE_SPRITE*)datafile[i].dat,
- getProperty(&datafile[i], DAT_ID('X','C','R','P')),
- getProperty(&datafile[i], DAT_ID('Y','C','R','P')));
- spriteset.push_back(temp_image);
- i++;
- }
-}
-
Spriteset::Spriteset(BITMAP *bmp, int width, int height, int offx, int offy)
{
/*
diff --git a/src/graphic/image.h b/src/graphic/image.h
index 60e04eac..1bc43ef4 100644
--- a/src/graphic/image.h
+++ b/src/graphic/image.h
@@ -31,72 +31,17 @@
#include "../log.h"
/**
- * A class storing a single sprite in video memory if available,
- * else as a refernece to a RLE_SPRITE in a datafile.
- * The class stores the offsets needed to compensate the cropping
- * operated by the grabber utility.
+ * A video image stored in memory.
*/
-class Image {
- public:
- /**
- * Creates an Image
- * @param offset_x is the x offset from where to start drawing
- * @param offset_y is the y offset from where to start drawing
- */
- Image(int offset_x, int offset_y);
-
- /**
- * Virtual function to draw a sprite
- * @param dest is the destination bitmap on which to draw the sprite
- * @param x is the horizontal position
- * @param y is the vertical position
- */
- virtual void draw(BITMAP *dest, int x, int y) = 0;
-
- protected:
- // From where to start drawing
- int offset_x, offset_y;
-};
-
-/**
- * A RLE sprite
- */
-class RleImage : public Image {
- public:
- /**
- * Creates a RleSprite
- * @param src is a reference to a RLE_SPRITE in a datafile
- * @param offset_x is the x offset from where to start drawing
- * @param offset_y is the y offset from where to start drawing
- */
- RleImage(RLE_SPRITE *src, int offset_x, int offset_y);
-
- /**
- * Destructor
- */
- virtual ~RleImage();
-
- /**
- * Draws a sprite
- */
- void draw(BITMAP *dest, int x, int y);
-
+class VideoImage {
private:
- // Reference to RLE_SPRITE
- RLE_SPRITE *src;
-};
-
-/**
- * An image stored in video memory
- */
-class VideoImage : public Image {
- private:
- // Reference to bitmap stored in video memory
BITMAP *src;
+ int offset_x, offset_y;
+
public:
/**
* Creates a VideoImage
- * @param src is a reference to a BITMAP in video memory
+ * @param src is a reference to a BITMAP
* @param offset_x is the x offset from where to start drawing
* @param offset_y is the y offset from where to start drawing
*/
@@ -119,13 +64,7 @@ class VideoImage : public Image {
class Spriteset {
public:
// Vector storing the whole spriteset.
- std::vector<Image*> spriteset;
-
- /**
- * Load a datafile containing the spriteset
- * @param filename is the path of the datafile
- */
- Spriteset(std::string filename);
+ std::vector<VideoImage*> spriteset;
/*
* Cuts the passed bitmap in a grid of sub bitmaps.