Gorgon Game Engine
Pointer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Base.h"
4 #include "Animation.h"
5 #include "AnimationStorage.h"
6 #include "../Graphics/Pointer.h"
7 #include "../Graphics/Drawables.h"
8 #include "../Graphics/Bitmap.h"
9 #include "../Graphics/Animations.h"
10 #include "../Graphics/TextureAnimation.h"
11 #include "../Utils/Assert.h"
12 #include "../Geometry/Point.h"
13 
14 
15 namespace Gorgon { namespace Resource {
16 
17  class File;
18  class Reader;
19 
26  public:
29  Add(bmp);
30  }
31 
34  dynamic_cast<Graphics::BitmapAnimationProvider&>(*this) = std::move(anim);
35  }
36 
38  type(type) {
39 
40  }
41 
42  Pointer(const Pointer &) = delete;
43 
44  Pointer &operator =(const Pointer &) = delete;
45 
46  GID::Type GetGID() const override { return GID::Pointer; }
47 
50  return type;
51  }
52 
55  type = value;
56  }
57 
58  void Prepare() override;
59 
63 
65  static Resource::Pointer* LoadResource(std::weak_ptr< Gorgon::Resource::File > file, std::shared_ptr< Gorgon::Resource::Reader > reader, long unsigned int size);
66 
68  static Pointer *LoadLegacy(std::weak_ptr<File> file, std::shared_ptr<Reader> reader, unsigned long size) { Utils::NotImplemented(); }
69 
70  protected:
71  Graphics::PointerType type = Graphics::PointerType::Arrow;
72 
74 
75  virtual ~Pointer() { }
76 
77  void save(Writer &writer) const override;
78  };
79 
80 
81 } }
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::Resource::GID::File
constexpr Type File
File.
Definition: GID.h:84
Gorgon::Resource::GID::Pointer
constexpr Type Pointer
Definition: GID.h:196
Gorgon::Resource::Pointer::Prepare
void Prepare() override
This function shall prepare this resource to be used after resource is loaded.
Definition: Pointer.cpp:63
Gorgon::Graphics::basic_TextureAnimationProvider
Definition: TextureAnimation.h:137
Gorgon::Graphics::PointerType::None
@ None
No pointer is selected or using default.
Gorgon::Resource::Pointer::LoadLegacy
static Pointer * LoadLegacy(std::weak_ptr< File > file, std::shared_ptr< Reader > reader, unsigned long size)
This function loads a bitmap font resource from the given file.
Definition: Pointer.h:68
Base.h
Gorgon::Resource::Pointer::type
Graphics::PointerType type
Definition: Pointer.h:71
Gorgon::Resource::Pointer::Pointer
Pointer(const Pointer &)=delete
Gorgon::Resource::Pointer::LoadResource
static Resource::Pointer * LoadResource(std::weak_ptr< Gorgon::Resource::File > file, std::shared_ptr< Gorgon::Resource::Reader > reader, long unsigned int size)
This function loads a bitmap font resource from the given file.
Definition: Pointer.cpp:6
Gorgon::Graphics::basic_PointerProvider::hotspot
Geometry::Point hotspot
Hotspot will be transferred to newly created pointers.
Definition: Pointer.h:269
Gorgon::Resource::Pointer::GetType
Graphics::PointerType GetType() const
Returns the type of the pointer.
Definition: Pointer.h:49
Gorgon::Graphics::PointerType
PointerType
Pointer types.
Definition: Pointer.h:280
Gorgon::Graphics::BitmapPointerProvider
basic_PointerProvider< BitmapAnimationProvider > BitmapPointerProvider
Definition: Pointer.h:276
Gorgon
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
Gorgon::Resource::AnimationStorage
This class denotes the resource is an image animation storage.
Definition: AnimationStorage.h:12
Gorgon::Resource::Pointer::animmoveout
virtual Graphics::RectangularAnimationStorage animmoveout() override
Definition: Pointer.cpp:69
Gorgon::Resource::Pointer::operator=
Pointer & operator=(const Pointer &)=delete
Gorgon::Resource::Pointer
Pointer resource that can be used to create a new pointer to be displayed.
Definition: Pointer.h:25
AnimationStorage.h
Gorgon::Graphics::Bitmap
This object contains an bitmap image.
Definition: Bitmap.h:25
Gorgon::Resource::Pointer::MoveOut
Graphics::BitmapPointerProvider MoveOut()
Moves the pointer provider out of resource system.
Definition: Pointer.cpp:47
Gorgon::Resource::Pointer::SetType
void SetType(Graphics::PointerType value)
Sets the type of the pointer.
Definition: Pointer.h:54
Gorgon::Graphics::basic_PointerProvider
This class stores information that allows an animated pointer to be created.
Definition: Pointer.h:218
Gorgon::Resource::Pointer::GetGID
GID::Type GetGID() const override
This function shall return Gorgon ID of this resource.
Definition: Pointer.h:46
Gorgon::Geometry::basic_Point
This class represents a 2D point.
Definition: Point.h:32
Gorgon::Resource::Writer
This class allows resource objects to save their data to a stream.
Definition: Writer.h:59
Gorgon::UI::Graphics
@ Graphics
Definition: Template.h:164
Gorgon::Resource::Pointer::Pointer
Pointer(Graphics::BitmapAnimationProvider &&anim, Geometry::Point hotspot, Graphics::PointerType type)
Definition: Pointer.h:32
Gorgon::Resource::Pointer::Pointer
Pointer(Graphics::Bitmap &bmp, Geometry::Point hotspot, Graphics::PointerType type)
Definition: Pointer.h:27
Gorgon::Resource::GID::Type
Type to store GID information.
Definition: GID.h:23
Gorgon::Resource::Pointer::~Pointer
virtual ~Pointer()
Definition: Pointer.h:75
Gorgon::Resource::Pointer::Pointer
Pointer(Graphics::PointerType type=Graphics::PointerType::None)
Definition: Pointer.h:37
Gorgon::Utils::NotImplemented
void NotImplemented(const std::string &what="This feature")
Definition: Assert.h:187
Animation.h
Gorgon::Resource::Pointer::save
void save(Writer &writer) const override
Definition: Pointer.cpp:51