Gorgon Game Engine
Null.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Base.h"
4 #include "GID.h"
5 
6 namespace Gorgon { namespace Resource {
7 
8  class File;
9  class Reader;
10  class Writer;
11 
17  class Null : public Base {
18  public:
19 
21  virtual GID::Type GetGID() const override { return GID::Null; }
22 
24  static Null *LoadResource(std::weak_ptr<File> file, std::shared_ptr<Reader> reader, unsigned long size);
25 
26  static void SaveThis(Writer &writer);
27 
28  protected:
29  virtual void save(Writer &writer) const override;
30 
31  };
32 
33 } }
Gorgon::Animation::basic_Storage
This class stores animations as a part of itself so that it can be moved around as a value rather tha...
Definition: Storage.h:21
Gorgon::Graphics::basic_MaskedObjectProvider::SetMask
void SetMask(A_ *value)
Sets the mask provider, ownership semantics will not be changed.
Definition: MaskedObject.h:198
Gorgon::Resource::GID::PNG
constexpr Type PNG
PNG compression.
Definition: GID.h:126
Gorgon::Resource::GID::File
constexpr Type File
File.
Definition: GID.h:84
Gorgon::String::From
std::enable_if< decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, std::string >::type From(const T_ &e)
Definition: Enum.h:303
Gorgon::Containers::basic_Image::GetMode
Graphics::ColorMode GetMode() const
Returns the color mode of the image.
Definition: Image.h:1311
Gorgon::Graphics::EmptyImage::Instance
static EmptyImage & Instance()
Returns the instance for empty image. Only one instance is enough.
Definition: EmptyImage.h:50
Gorgon::Containers::Image
basic_Image< Byte > Image
Definition: Image.h:1364
File.h
Gorgon::Resource::GID::Image_Props
constexpr Type Image_Props
Image properties.
Definition: GID.h:151
Gorgon::Resource::GID::Image_Data
constexpr Type Image_Data
Uncompressed image data.
Definition: GID.h:155
Gorgon::Graphics::ColorMode
ColorMode
Color modes for images.
Definition: Color.h:16
Gorgon::Resource::Writer::GetStream
std::ostream & GetStream()
This should be last resort, use if the actual stream is needed.
Definition: Writer.h:96
Gorgon::Graphics::BitmapAnimationProvider
basic_TextureAnimationProvider< Bitmap, basic_TextureAnimation, basic_AnimationFrame< Bitmap > > BitmapAnimationProvider
Definition: TextureAnimation.h:520
Gorgon::Resource::GID::Null
constexpr Type Null
Null resource.
Definition: GID.h:105
Gorgon::Encoding::Png
PNG Png
A ready to use PNG class.
Definition: PNG.cpp:304
Gorgon::Graphics::basic_MaskedObjectProvider::GetBase
A_ * GetBase() const
Returns the base component. Could return nullptr.
Definition: MaskedObject.h:180
Gorgon::Resource::Image::isloaded
bool isloaded
Whether this image resource is loaded or not.
Definition: Image.h:95
Gorgon::Resource::Image::animmoveout
virtual Graphics::RectangularAnimationStorage animmoveout() override
Definition: Image.cpp:210
Gorgon::Graphics::Texture::mode
ColorMode mode
Color mode of the texture, necessary to choose correct texture.
Definition: Texture.h:198
Gorgon::Resource::Image::entrypoint
unsigned long entrypoint
Entry point of this resource within the physical file.
Definition: Image.h:89
Gorgon::Resource::LoadError::VersionMismatch
@ VersionMismatch
Version in the file is not recognized.
Definition: Reader.h:31
Base.h
Gorgon::Resource::SaveAnimation
void SaveAnimation(Writer &writer, const Graphics::RectangularAnimationProvider &object)
Saves a given generic rectangular animation as resource.
Definition: Resource.cpp:22
Gorgon::Graphics::ColorMode::Invalid
@ Invalid
This is used to mark invalid color data.
Reader.h
Gorgon::Resource::Writer::WriteChunkHeader
void WriteChunkHeader(GID::Type type, unsigned long size)
Writes the header of a chunk.
Definition: Writer.h:364
Gorgon::Resource::Image::SaveThis
static void SaveThis(Writer &writer, const Graphics::Bitmap &bmp, GID::Type type=GID::Image)
This function can be used to save a bitmap as image resource without modifying it.
Definition: Image.cpp:171
Gorgon::Containers::basic_Image::RawData
Byte * RawData()
Returns the raw data pointer.
Definition: Image.h:211
Gorgon::Containers::basic_Image::ChangeMode
void ChangeMode(Graphics::ColorMode value)
Changes the color mode of the image.
Definition: Image.h:1317
Gorgon::Geometry::basic_Size::Height
T_ Height
Height of this size object.
Definition: Size.h:261
Gorgon::Resource::Image::save
void save(Writer &writer) const override
Definition: Image.cpp:141
Image.h
Gorgon::Resource::Null::GetGID
virtual GID::Type GetGID() const override
01010000h, (System, Folder)
Definition: Null.h:21
Gorgon::Resource::GID::MaskedObject
constexpr Type MaskedObject
Definition: GID.h:242
GID.h
contains Gorgon IDs
Gorgon::Encoding::PNG::Encode
void Encode(const Containers::Image &input, std::ostream &output, bool replace_colormode=false)
Encodes a given input.
Definition: PNG.h:163
Gorgon::Resource::GID::Image
constexpr Type Image
Image resource.
Definition: GID.h:149
Gorgon::Resource::Writer::WriteObjectStart
Marker WriteObjectStart(const Base &base)
Writes the start of an object. Should have a matching WriteEnd with the returned marker.
Definition: File.cpp:211
Gorgon::Graphics::Bitmap::GetMode
Graphics::ColorMode GetMode() const override
Returns the color mode of the image.
Definition: Bitmap.h:422
Gorgon::Resource::Writer::WriteChunkSize
void WriteChunkSize(unsigned long value)
Writes chunk size to the stream.
Definition: Writer.h:319
Gorgon::Resource::MaskedObject::MoveOutProvider
IMaskedObjectProvider & MoveOutProvider() override
This function moves this animation provider into a new provider.
Definition: MaskedObject.cpp:199
Gorgon::Resource::Null::save
virtual void save(Writer &writer) const override
Definition: Null.cpp:5
Gorgon::Resource::GID::Image_Cmp_Data
constexpr Type Image_Cmp_Data
Compressed image data.
Definition: GID.h:157
Gorgon::Graphics::Bitmap::data
Containers::Image * data
Container for the image data, could be null indicating its discarded.
Definition: Bitmap.h:767
Gorgon::Resource::MaskedObject::SaveThis
static void SaveThis(Writer &writer, const Graphics::IMaskedObjectProvider &provider)
Definition: MaskedObject.cpp:141
Gorgon::Utils::ASSERT_FALSE
void ASSERT_FALSE(const std::string &message, int skip=1, int depth=4)
Definition: Assert.h:192
Gorgon::Resource::GID::Image_Cmp_Props
constexpr Type Image_Cmp_Props
Image compression properties.
Definition: GID.h:153
Gorgon::Resource::MaskedObject::animmoveout
virtual Graphics::RectangularAnimationStorage animmoveout() override
Definition: MaskedObject.cpp:195
Null.h
Gorgon::Resource::MaskedObject::save
void save(Writer &writer) const override
Definition: MaskedObject.cpp:122
Gorgon::Containers::basic_Image::GetTotalSize
unsigned long GetTotalSize() const
Total size of this image in number units.
Definition: Image.h:1306
Gorgon
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
Gorgon::Geometry::basic_Size
This class represents a 2D geometric size.
Definition: Size.h:23
Gorgon::Resource::Image::Image
Image()=default
Gorgon::Resource::Writer::WriteChunkStart
Marker WriteChunkStart(GID::Type type)
Writes the start of a chunk. Should have a matching WriteEnd.
Definition: Writer.h:351
Gorgon::Graphics::Bitmap::HasData
bool HasData() const
Checks if this image resource has a data attached to it.
Definition: Bitmap.h:163
ASSERT
#define ASSERT(expression, message,...)
Replaces regular assert to allow messages and backtrace.
Definition: Assert.h:161
MaskedObject.h
Gorgon::Containers::Collection
Collection is a container for reference typed objects.
Definition: Collection.h:21
AnimationStorage.h
Gorgon::Resource::Image::MoveOutAsBitmap
Graphics::Bitmap MoveOutAsBitmap()
Moves the data out of resource system. Use Prepare and Discard before moving to avoid data duplicatio...
Definition: Image.cpp:204
Gorgon::Resource::Writer::WriteArray
void WriteArray(const T_ *data, unsigned long size)
Writes an array to the file.
Definition: Writer.h:288
Gorgon::Resource::GID::None
constexpr Type None
Empty, different from Null resource.
Definition: GID.h:81
Gorgon::Graphics::Bitmap
This object contains an bitmap image.
Definition: Bitmap.h:25
Gorgon::Resource::GID::Animation
constexpr Type Animation
Definition: GID.h:187
Gorgon::Resource::Base
This class is the base for all Gorgon Resources.
Definition: Base.h:20
Gorgon::Graphics::basic_MaskedObjectProvider
This object creates a masked object from two graphics object.
Definition: MaskedObject.h:109
Gorgon::Resource::Image::Load
bool Load()
Loads the image from the disk. This function requires image to be tied to a resource file.
Definition: Image.cpp:29
Gorgon::Resource::Image::compression
GID::Type compression
Compression mode.
Definition: Image.h:85
Gorgon::Graphics::MaskedObjectProvider
basic_MaskedObjectProvider< RectangularAnimationProvider > MaskedObjectProvider
Definition: MaskedObject.h:342
Gorgon::Resource::Image::reader
std::shared_ptr< Reader > reader
Used to handle late loading.
Definition: Image.h:92
Gorgon::Containers::Collection::GetCount
long GetCount() const
Returns number of elements.
Definition: Collection.h:236
Gorgon::Graphics::Bitmap::GetSize
Geometry::Size GetSize() const override
Returns the size of this image resource.
Definition: Bitmap.h:436
Gorgon::Resource::Writer
This class allows resource objects to save their data to a stream.
Definition: Writer.h:59
Gorgon::Resource::MaskedObject::LoadResource
static MaskedObject * LoadResource(std::weak_ptr< File > file, std::shared_ptr< Reader > reader, unsigned long size)
This function loads a masked object resource from the file.
Definition: MaskedObject.cpp:37
Gorgon::Graphics::basic_MaskedObjectProvider::GetMask
A_ * GetMask() const
Returns the mask component. Could return nullptr.
Definition: MaskedObject.h:185
Gorgon::Resource::LoadError
This class represents a loading error.
Definition: Reader.h:16
Gorgon::Resource::Writer::WriteEnd
void WriteEnd(Marker &marker)
This function performs writes necessary to end a chunk that is represented by the marker.
Definition: Writer.h:373
Gorgon::Graphics::RectangularAnimationStorage
Gorgon::Animation::basic_Storage< RectangularAnimationProvider > RectangularAnimationStorage
Definition: Animations.h:374
Gorgon::Geometry::basic_Size::Area
T_ Area() const
Returns the exact area of the rectangle has the size of this object.
Definition: Size.h:240
Gorgon::Graphics::MaskedBitmapAnimationProvider
basic_MaskedObjectProvider< BitmapAnimationProvider > MaskedBitmapAnimationProvider
Definition: MaskedObject.h:345
Gorgon::Resource::Writer::WriteInt32
void WriteInt32(long value)
Writes a 32-bit integer to the stream.
Definition: Writer.h:149
Gorgon::Graphics::IMaskedObjectProvider
For ease of use in resource system.
Definition: MaskedObject.h:10
Gorgon::Encoding::PNG::Decode
void Decode(std::istream &input, Containers::Image &output)
Decodes the given PNG data.
Definition: PNG.h:186
Gorgon::Geometry::basic_Size::Width
T_ Width
Width of this size object.
Definition: Size.h:258
Gorgon::Resource::Null
This is a null resource, it can be used in places where a resource is required but it is not wanted.
Definition: Null.h:17
Gorgon::Resource::Image::loaded
void loaded()
Definition: Image.cpp:22
Gorgon::Resource::MaskedObject
This is a masked object resource.
Definition: MaskedObject.h:15
Gorgon::Resource::Writer::WriteBool
void WriteBool(bool value)
Writes a boolean value. In resource 1.0, booleans are stored as 32bit integers.
Definition: Writer.h:220
Gorgon::Resource::GID::Type
Type to store GID information.
Definition: GID.h:23
Gorgon::Resource::Base::children
Containers::Collection< Base > children
Child objects that this resource object have.
Definition: Base.h:162
Gorgon::Resource::Writer::WriteEnum32
void WriteEnum32(E_ value)
Writes an enumeration as 32-bit integer to the stream.
Definition: Writer.h:140
Gorgon::Graphics::basic_MaskedObjectProvider::SetBase
void SetBase(A_ *value)
Sets the base provider, ownership semantics will not be changed.
Definition: MaskedObject.h:190
Gorgon::Resource::MaskedObject::MaskedObject
MaskedObject()
Creates a new empty masked object.
Definition: MaskedObject.h:42
Gorgon::Resource::Image::LoadResource
static Image * LoadResource(std::weak_ptr< File > file, std::shared_ptr< Reader > reader, unsigned long size)
This function loads a image resource from the given file.
Definition: Image.cpp:9
Gorgon::Graphics::Bitmap::Destroy
void Destroy()
Definition: Bitmap.h:125
Gorgon::Resource::Writer::WriteGID
void WriteGID(GID::Type value)
Writes a GID to the given stream.
Definition: Writer.h:303
Gorgon::Resource::Null::SaveThis
static void SaveThis(Writer &writer)
Definition: Null.cpp:14
Gorgon::Graphics::Bitmap::size
Geometry::Size size
Size of the texture.
Definition: Texture.h:195
Gorgon::Graphics::Bitmap::GetData
Containers::Image & GetData() const
Returns the data attached to this bitmap. If no data is present, this function throws.
Definition: Bitmap.h:168
Gorgon::Resource::Null::LoadResource
static Null * LoadResource(std::weak_ptr< File > file, std::shared_ptr< Reader > reader, unsigned long size)
This function loads a line resource from the file.
Definition: Null.cpp:10
Gorgon::Resource::Image
This resource contains images.
Definition: Image.h:23
Animation.h
Gorgon::Containers::basic_Image::GetSize
Geometry::Size GetSize() const
Returns the size of the image.
Definition: Image.h:1291
Gorgon::Resource::Image::load
bool load(std::shared_ptr< Reader > reader, unsigned long size, bool forceload)
Loads the image from the data stream.
Definition: Image.cpp:48
Gorgon::Resource::LoadError::Unknown
@ Unknown
An unknown error occurred.
Definition: Reader.h:22