src/spriteloader/spriteloader.hpp
author richk
Tue, 17 Jun 2008 13:41:57 +0000
branchNewGRF_ports
changeset 10995 311b38c7f9a7
parent 10991 d8811e327d12
permissions -rw-r--r--
(svn r13549) [NewGRF_ports] -Change: Make recolouring of groundtile (0x0f80) specific to NewGRF_ports only.
Also base groundsprite on airport_tile of station. This prevents mixed colour groundtiles in an airport.
6720
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
     1
/* $Id$ */
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
     2
10724
68a692eacf22 (svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents: 6872
diff changeset
     3
/** @file spriteloader.hpp Base for loading sprites. */
6720
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
     4
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
     5
#ifndef SPRITELOADER_HPP
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
     6
#define SPRITELOADER_HPP
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
     7
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
     8
class SpriteLoader {
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
     9
public:
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    10
	struct CommonPixel {
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    11
		uint8 r;  ///< Red-channel
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    12
		uint8 g;  ///< Green-channel
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    13
		uint8 b;  ///< Blue-channel
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    14
		uint8 a;  ///< Alpha-channel
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    15
		uint8 m;  ///< Remap-channel
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    16
	};
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    17
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    18
	struct Sprite {
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    19
		uint16 height;                   ///< Height of the sprite
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    20
		uint16 width;                    ///< Width of the sprite
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    21
		int16 x_offs;                    ///< The x-offset of where the sprite will be drawn
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    22
		int16 y_offs;                    ///< The y-offset of where the sprite will be drawn
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    23
		SpriteLoader::CommonPixel *data; ///< The sprite itself
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    24
	};
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    25
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    26
	/**
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    27
	 * Load a sprite from the disk and return a sprite struct which is the same for all loaders.
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    28
	 */
10991
d8811e327d12 (svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents: 10724
diff changeset
    29
	virtual bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos) = 0;
6720
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    30
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    31
	virtual ~SpriteLoader() { }
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    32
};
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    33
35756db7e577 (svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
diff changeset
    34
#endif /* SPRITELOADER_HPP */