Gorgon Game Engine
DrawablePointer Class Reference

This class turns a drawable into a pointer. More...

Inheritance diagram for DrawablePointer:
[legend]

Public Member Functions

 DrawablePointer ()=default
 
 DrawablePointer (const AssumeOwnershipTag &, const Drawable &image, Geometry::Point hotspot)
 Initializes a pointer. More...
 
 DrawablePointer (const AssumeOwnershipTag &tag, const Drawable &image, int x, int y)
 Initializes a pointer. More...
 
 DrawablePointer (const Drawable &image, Geometry::Point hotspot)
 Initializes a pointer. More...
 
 DrawablePointer (const Drawable &image, int x, int y)
 Initializes a pointer. More...
 
 DrawablePointer (const DrawablePointer &other)=delete
 
 DrawablePointer (DrawablePointer &&other)
 
 ~DrawablePointer ()
 
void Assume (const Drawable &value)
 Changes the image of the pointer by assuming the ownership of the given image. More...
 
void Assume (const Drawable &value, Geometry::Point hotspot)
 Changes the image of the pointer by assuming the ownership of the given image. More...
 
void Assume (const Drawable &value, int x, int y)
 Changes the image of the pointer by assuming the ownership of the given image. More...
 
const Drawable & GetImage () const
 Returns the image contained in this pointer. More...
 
bool HasImage () const
 Returns if the pointer has an image. More...
 
DrawablePointer & operator= (const DrawablePointer &)=delete
 
DrawablePointer & operator= (DrawablePointer &&other)
 
const Drawable & Release ()
 Releases the ownership of the drawable and removes it from the pointer. More...
 
void RemoveImage ()
 Removes the image from the pointer. More...
 
void SetImage (const Drawable &value)
 Changes the image of this pointer. More...
 
- Public Member Functions inherited from Pointer
virtual ~Pointer ()
 
- Public Member Functions inherited from Drawable
virtual ~Drawable ()
 
void Draw (TextureTarget &target, const Geometry::Point &p, RGBAf color=RGBAf(1.f)) const
 Draw to the given coordinates. More...
 
void Draw (TextureTarget &target, const Geometry::Pointf &p, RGBAf color=RGBAf(1.f)) const
 Draw to the given coordinates. More...
 
void Draw (TextureTarget &target, float x, float y, RGBAf color=RGBAf(1.f)) const
 Draw to the given coordinates. More...
 
void Draw (TextureTarget &target, int x, int y, RGBAf color=RGBAf(1.f)) const
 Draw to the given coordinates. More...
 

Protected Member Functions

void draw (Gorgon::Graphics::TextureTarget &target, const Geometry::Pointf &p, Gorgon::Graphics::RGBAf color) const override
 This is the only function that needs to implemented for a drawable. More...
 

Detailed Description

This class turns a drawable into a pointer.

Constructor & Destructor Documentation

◆ DrawablePointer() [1/7]

DrawablePointer ( )
default

◆ DrawablePointer() [2/7]

DrawablePointer ( const Drawable &  image,
int  x,
int  y 
)

Initializes a pointer.

Ownership of the drawable is not transferred. Use Assume function after invoking default constructor to transfer ownership.

◆ DrawablePointer() [3/7]

DrawablePointer ( const Drawable &  image,
Geometry::Point  hotspot 
)

Initializes a pointer.

Ownership of the drawable is not transferred. Use Assume function after invoking default constructor to transfer ownership.

◆ DrawablePointer() [4/7]

DrawablePointer ( const AssumeOwnershipTag &  tag,
const Drawable &  image,
int  x,
int  y 
)

Initializes a pointer.

Ownership of the drawable is not transferred. Use Assume function after invoking default constructor to transfer ownership.

◆ DrawablePointer() [5/7]

DrawablePointer ( const AssumeOwnershipTag &  ,
const Drawable &  image,
Geometry::Point  hotspot 
)

Initializes a pointer.

Ownership of the drawable is not transferred. Use Assume function after invoking default constructor to transfer ownership.

◆ DrawablePointer() [6/7]

DrawablePointer ( const DrawablePointer &  other)
delete

◆ DrawablePointer() [7/7]

◆ ~DrawablePointer()

Member Function Documentation

◆ Assume() [1/3]

void Assume ( const Drawable &  value)

Changes the image of the pointer by assuming the ownership of the given image.

References DrawablePointer::RemoveImage().

◆ Assume() [2/3]

void Assume ( const Drawable &  value,
Geometry::Point  hotspot 
)

Changes the image of the pointer by assuming the ownership of the given image.

References DrawablePointer::RemoveImage().

◆ Assume() [3/3]

void Assume ( const Drawable &  value,
int  x,
int  y 
)

Changes the image of the pointer by assuming the ownership of the given image.

References DrawablePointer::RemoveImage().

◆ draw()

void draw ( Gorgon::Graphics::TextureTarget &  target,
const Geometry::Pointf &  p,
Gorgon::Graphics::RGBAf  color 
) const
overrideprotectedvirtual

This is the only function that needs to implemented for a drawable.

Implements Drawable.

References Drawable::Draw().

◆ GetImage()

const Drawable& GetImage ( ) const

Returns the image contained in this pointer.

You should check HasImage before accessing to the image

References ASSERT.

◆ HasImage()

bool HasImage ( ) const

Returns if the pointer has an image.

◆ operator=() [1/2]

DrawablePointer& operator= ( const DrawablePointer &  )
delete

◆ operator=() [2/2]

DrawablePointer& operator= ( DrawablePointer &&  other)

◆ Release()

const Drawable& Release ( )

Releases the ownership of the drawable and removes it from the pointer.

◆ RemoveImage()

void RemoveImage ( )

Removes the image from the pointer.

◆ SetImage()

void SetImage ( const Drawable &  value)

Changes the image of this pointer.

References DrawablePointer::RemoveImage().


The documentation for this class was generated from the following file: