![]() |
Gorgon Game Engine
|
This layer allows drawing texture images on. More...
Public Member Functions | |
Layer () | |
Constructor that sets the layer to cover entire parent, no matter how big it is. More... | |
Layer (const Geometry::Bounds &bounds) | |
Initializing constructor. More... | |
Layer (const Geometry::Point &location) | |
Constructor that places the layer to the given location. More... | |
Layer (const Layer &)=delete | |
Copy constructor is disabled. More... | |
Layer (Layer &&other) | |
Move constructor. More... | |
virtual void | Clear () override |
Clears drawing buffer, in layer architecture this request only affects the layer itself, not its children. More... | |
void | DisableClipping () |
Disables graphics clipping. More... | |
virtual void | Draw (const Geometry::Pointf &location, const Geometry::Sizef &size, RGBAf color=RGBAf(1.f)) |
Draws a textureless solid colored rectangle on the screen. More... | |
virtual void | Draw (const Geometry::Pointf &location, float w, float h, RGBAf color=RGBAf(1.f)) |
Draws a textureless solid colored rectangle on the screen. More... | |
virtual void | Draw (const Geometry::Pointf &p1, const Geometry::Pointf &p2, const Geometry::Pointf &p3, const Geometry::Pointf &p4, RGBAf color=RGBAf(1.f)) override |
Prefer using Draw functions of image or animations. More... | |
virtual void | Draw (const Geometry::Pointf &p1, const Geometry::Pointf &p2, const Geometry::Pointf &p3, const Geometry::Pointf &p4, RGBAf color=RGBAf(1.f))=0 |
Draws a textureless solid colored rectangle on the screen. More... | |
virtual void | Draw (const Geometry::Rectanglef &location, RGBAf color=RGBAf(1.f)) |
Draws a textureless solid colored rectangle on the screen. More... | |
virtual void | Draw (const TextureSource &image, const Geometry::Pointf &location, RGBAf color) |
Draws a simple image to the screen to the given position. More... | |
virtual void | Draw (const TextureSource &image, const Geometry::Pointf &p1, const Geometry::Pointf &p2, const Geometry::Pointf &p3, const Geometry::Pointf &p4, const Geometry::Pointf &tex1, const Geometry::Pointf &tex2, const Geometry::Pointf &tex3, const Geometry::Pointf &tex4, RGBAf color=RGBAf(1.f)) override |
Prefer using Draw functions of image or animations. More... | |
virtual void | Draw (const TextureSource &image, const Geometry::Pointf &p1, const Geometry::Pointf &p2, const Geometry::Pointf &p3, const Geometry::Pointf &p4, const Geometry::Pointf &tex1, const Geometry::Pointf &tex2, const Geometry::Pointf &tex3, const Geometry::Pointf &tex4, RGBAf color=RGBAf(1.f))=0 |
Draws a simple texture to the screen. More... | |
virtual void | Draw (const TextureSource &image, const Geometry::Pointf &p1, const Geometry::Pointf &p2, const Geometry::Pointf &p3, const Geometry::Pointf &p4, RGBAf color=RGBAf(1.f)) override |
Prefer using Draw functions of image or animations. More... | |
virtual void | Draw (const TextureSource &image, const Geometry::Pointf &p1, const Geometry::Pointf &p2, const Geometry::Pointf &p3, const Geometry::Pointf &p4, RGBAf color=RGBAf(1.f))=0 |
Draws a simple texture to the screen. More... | |
virtual void | Draw (const TextureSource &image, const Geometry::Rectanglef &location, RGBAf color=RGBAf(1.f)) |
Draws a simple image to the screen to the given position with the given size. More... | |
virtual void | Draw (const TextureSource &image, Tiling tiling, const Geometry::Rectanglef &location, RGBAf color=RGBAf(1.f)) override |
Prefer using Draw functions of image or animations. More... | |
virtual void | Draw (const TextureSource &image, Tiling tiling, const Geometry::Rectanglef &location, RGBAf color=RGBAf(1.f))=0 |
Draws a simple image to the screen using the given tiling method, coordinates and size. More... | |
virtual void | Draw (float x, float y, const Geometry::Sizef &size, RGBAf color=RGBAf(1.f)) |
Draws a textureless solid colored rectangle on the screen. More... | |
virtual void | Draw (float x, float y, float w, float h, RGBAf color=RGBAf(1.f)) |
Draws a textureless solid colored rectangle on the screen. More... | |
virtual void | Draw (int x, int y, int w, int h, RGBAf color=RGBAf(1.f)) |
Draws a textureless solid colored rectangle on the screen. More... | |
virtual void | Draw (RGBAf color=RGBAf(1.f)) |
Draws a textureless solid colored rectangle to cover the texture target. More... | |
void | EnableClipping () |
Enables graphics clipping from the visible borders of the layer. More... | |
virtual RGBAf | GetColor () const |
Changes the tint color of the layer, every image pixel will be multiplied by this color. More... | |
virtual DrawMode | GetDrawMode () const override |
Get current drawing mode. See Layer page to see available drawing modes. More... | |
virtual Geometry::Size | GetTargetSize () const override |
Get size of the target. More... | |
virtual RGBAf | GetTintColor () const |
Returns the tint color of the layer, every image pixel will be multiplied by this color. More... | |
bool | IsClippingEnabled () const |
Returns if the clipping is enabled. More... | |
virtual void | NewMask () override |
Queues the start of a new mask. Only one mask buffer exists and it will be cleared and reused. More... | |
virtual void | Render () override |
Render this layer to the GL. This function is used internally and not necessary to be called. More... | |
virtual void | SetColor (RGBAf value) |
Changes the tint color of the layer, every image pixel will be multiplied by this color. More... | |
virtual void | SetDrawMode (DrawMode mode) override |
Change current drawing mode. See Layer page to see available drawing modes. More... | |
virtual void | SetTintColor (RGBAf value) |
Changes the tint color of the layer, every image pixel will be multiplied by this color. More... | |
void | Swap (Layer &other) |
![]() | |
Layer () | |
Constructor that sets the layer to cover entire parent, no matter how big it is. More... | |
Layer (const Geometry::Bounds &bounds) | |
Initializing constructor. More... | |
Layer (const Geometry::Point &location) | |
Constructor that places the layer to the given location. More... | |
Layer (const Layer &)=delete | |
Copy constructor is disabled. More... | |
Layer (Layer &&other) | |
Move constructor. More... | |
virtual | ~Layer () |
Destructor. More... | |
virtual void | Hide () |
Hides this layer. More... | |
virtual bool | IsVisible () const |
Returns whether this layer is effectively visible. More... | |
Layer & | operator= (const Layer &)=delete |
Copy assignment is deleted. More... | |
Layer & | operator= (Layer &&other) |
Move assignment. More... | |
virtual bool | propagate_mouseevent (Input::Mouse::EventType evet, Geometry::Point location, Input::Mouse::Button button, float amount, MouseHandler &handlers) |
Propagates a mouse event. More... | |
virtual void | Show () |
Displays this layer. More... | |
void | Swap (Layer &other) |
Swaps two layers, mostly used for move semantics. More... | |
void | Add (Layer &layer) |
Adds the given layer as a child. More... | |
void | Add (Layer *layer) |
Adds the given layer as a child. More... | |
void | setname (std::string value) |
For debugging. More... | |
void | Insert (Layer &layer, long under) |
Inserts the given layer before the given index. More... | |
void | Insert (Layer *layer, long under) |
Inserts the given layer before the given index. More... | |
void | Remove (Layer &layer) |
Removes the given layer. More... | |
void | Remove (Layer *layer) |
Removes the given layer. More... | |
bool | HasParent () const |
Returns whether this layer has a parent. More... | |
virtual Layer & | GetParent () const |
Returns the parent of this layer. More... | |
Layer & | GetTopLevel () const |
Returns the top level layer that contains this layer. More... | |
virtual Geometry::Point | TranslateToTopLevel (Geometry::Point location={0, 0}) const |
Translates the given location to the top level. More... | |
Layer & | GetTopLevel () |
Containers::Collection< Layer >::ConstIterator | begin () const |
An iterator pointing to the start of the children. More... | |
Containers::Collection< Layer >::ConstIterator | end () const |
An iterator pointing to the end of the children. More... | |
Containers::Collection< Layer >::ConstIterator | First () const |
An iterator pointing to the start of the children. More... | |
Containers::Collection< Layer >::ConstIterator | Last () const |
An iterator pointing to the last item of the children. More... | |
void | PlaceBefore (int before) |
Places this layer before the given index. More... | |
void | PlaceToTop () |
Places this layer to the top of the layer stack its in. More... | |
void | PlaceToBottom () |
Places this layer to the bottom of the layer stack. More... | |
int | GetOrder () const |
Gets the current order of the stack. More... | |
virtual void | Move (const Geometry::Point &location) |
Moves this layer to the given location. More... | |
virtual void | Move (int x, int y) |
Moves this layer to the given location. More... | |
virtual void | Resize (const Geometry::Size &size) |
Resizes the layer to the given size. More... | |
virtual void | Resize (int width, int height) |
Resizes the layer to the given size. More... | |
void | SetWidth (int width) |
Resizes the layer to the given size. More... | |
void | SetHeight (int height) |
Resizes the layer to the given size. More... | |
void | SetBounds (const Geometry::Bounds &bounds) |
Sets the boundaries of this layer. More... | |
Geometry::Size | GetSize () const |
Returns the size of the layer. More... | |
Geometry::Size | GetCalculatedSize () const |
Returns the size of the layer. More... | |
int | GetWidth () const |
Returns the width of the layer. More... | |
int | GetHeight () const |
Returns the height of the layer. More... | |
Geometry::Point | GetLocation () const |
Returns the current location of the layer. More... | |
int | GetLeft () const |
Returns the current location of the layer. More... | |
int | GetTop () const |
Returns the current location of the layer. More... | |
Geometry::Bounds | GetBounds () const |
Returns the boundaries of the layer. More... | |
Geometry::Bounds | GetEffectiveBounds () const |
Returns the effective boundaries of the layer. More... | |
![]() | |
virtual void | Draw (const Geometry::Pointf &location, const Geometry::Sizef &size, RGBAf color=RGBAf(1.f)) |
Draws a textureless solid colored rectangle on the screen. More... | |
virtual void | Draw (const Geometry::Pointf &location, float w, float h, RGBAf color=RGBAf(1.f)) |
Draws a textureless solid colored rectangle on the screen. More... | |
virtual void | Draw (const Geometry::Rectanglef &location, RGBAf color=RGBAf(1.f)) |
Draws a textureless solid colored rectangle on the screen. More... | |
virtual void | Draw (const TextureSource &image, const Geometry::Pointf &location, RGBAf color) |
Draws a simple image to the screen to the given position. More... | |
virtual void | Draw (const TextureSource &image, const Geometry::Rectanglef &location, RGBAf color=RGBAf(1.f)) |
Draws a simple image to the screen to the given position with the given size. More... | |
virtual void | Draw (float x, float y, const Geometry::Sizef &size, RGBAf color=RGBAf(1.f)) |
Draws a textureless solid colored rectangle on the screen. More... | |
virtual void | Draw (float x, float y, float w, float h, RGBAf color=RGBAf(1.f)) |
Draws a textureless solid colored rectangle on the screen. More... | |
virtual void | Draw (int x, int y, int w, int h, RGBAf color=RGBAf(1.f)) |
Draws a textureless solid colored rectangle on the screen. More... | |
virtual void | Draw (RGBAf color=RGBAf(1.f)) |
Draws a textureless solid colored rectangle to cover the texture target. More... | |
Additional Inherited Members | |
![]() | |
enum | DrawMode { Normal, FrameBuffer, ToMask, UseMask } |
![]() | |
const Containers::Collection< Layer > & | Children |
Sub-layers that this layer holds, all the sub-layers are considered to be above current layer. More... | |
![]() | |
static const Geometry::Bounds | EntireRegion |
When used as layer bounds, represents the entire region its placed in. More... | |
![]() | |
virtual void | added (Layer &layer) |
Will be called when a layer is added. More... | |
void | dotransformandclip (bool inverse=false) |
Performs transformation and clipping. Use inverse for reverse mapping for mouse events. More... | |
virtual void | located (Layer *parent) |
Will be called when this layer is added to another. More... | |
virtual void | removed (Layer &layer) |
Will be called when a layer is removed. More... | |
void | reverttransformandclip () |
Reverts previously done transformation. More... | |
![]() | |
Geometry::Bounds | bounds |
Bounds of this layer. More... | |
Containers::Collection< Layer > | children |
Child layers that this layer holds, all child layers are considered to be above current layer. More... | |
bool | isvisible |
Whether this layer is visible, invisible layers will not be drawn or receive any events. More... | |
std::string | name |
For debugging. More... | |
Layer * | parent |
Parent layer, could be nullptr. More... | |
This layer allows drawing texture images on.
Any graphics that are drawn over a layer stays there unless Clear function is called. This allows static layers to be drawn only once. Layers stack, and child layers are drawn on top of parent. Clearing parent layer will not clear child layers.
It is possible to draw surfaces without a texture to this layer. Graphics clipping is optional and disabled by default. This means any texture falling outside the layer will still be visible. Use EnableClipping to change this behavior. Additionally, this layer allows tinting the textures given to it. Use SetTintColor to change the tinting color. Tint color is multiplicatively effective to the underlying layers. This means if you set tint color of a layer, you don't need to set it separately for its children. It is better to use Draw functions of the images or animations instead of Draw functions of the layer.
Currently Normal, and FrameBuffer modes are supported.
Layer | ( | const Geometry::Bounds & | bounds | ) |
Initializing constructor.
Layer | ( | ) |
Constructor that sets the layer to cover entire parent, no matter how big it is.
The location of the layer is set to be the origin
Layer | ( | const Geometry::Point & | location | ) |
Constructor that places the layer to the given location.
Move constructor.
References Layer::Swap().
|
overridevirtual |
Clears drawing buffer, in layer architecture this request only affects the layer itself, not its children.
Implements TextureTarget.
void DisableClipping | ( | ) |
Disables graphics clipping.
virtual void Draw |
Draws a textureless solid colored rectangle on the screen.
References TextureTarget::Draw().
virtual void Draw |
Draws a textureless solid colored rectangle on the screen.
References TextureTarget::Draw().
|
overridevirtual |
Prefer using Draw functions of image or animations.
Implements TextureTarget.
virtual void Draw |
Draws a textureless solid colored rectangle on the screen.
virtual void Draw |
Draws a textureless solid colored rectangle on the screen.
References basic_Rectangle< T_ >::BottomLeft(), basic_Rectangle< T_ >::BottomRight(), TextureTarget::Draw(), basic_Rectangle< T_ >::TopLeft(), and basic_Rectangle< T_ >::TopRight().
virtual void Draw |
Draws a simple image to the screen to the given position.
References TextureTarget::Draw(), and TextureSource::GetImageSize().
|
overridevirtual |
Prefer using Draw functions of image or animations.
Implements TextureTarget.
virtual void Draw |
Draws a simple texture to the screen.
This variant allows every corner on the target and on the texture be specified. The texture target should be cleared before the texture drawn on it is destroyed
|
overridevirtual |
Prefer using Draw functions of image or animations.
Implements TextureTarget.
virtual void Draw |
Draws a simple texture to the screen.
This variant allows every corner on the target to be specified. The texture target should be cleared before the texture drawn on it is destroyed
virtual void Draw |
Draws a simple image to the screen to the given position with the given size.
References basic_Rectangle< T_ >::BottomLeft(), basic_Rectangle< T_ >::BottomRight(), TextureTarget::Draw(), basic_Rectangle< T_ >::TopLeft(), and basic_Rectangle< T_ >::TopRight().
|
overridevirtual |
Prefer using Draw functions of image or animations.
Implements TextureTarget.
References basic_Rectangle< T_ >::BottomLeft(), basic_Rectangle< T_ >::BottomRight(), Layer::Draw(), TextureSource::GetCoordinates(), TextureSource::GetImageSize(), basic_Rectangle< T_ >::Height, Gorgon::Graphics::Horizontal, TextureSource::IsPartial(), Gorgon::Graphics::None, Gorgon::Utils::NotImplemented(), basic_Rectangle< T_ >::TopLeft(), basic_Rectangle< T_ >::TopRight(), and basic_Rectangle< T_ >::Width.
virtual void Draw |
Draws a simple image to the screen using the given tiling method, coordinates and size.
virtual void Draw |
Draws a textureless solid colored rectangle on the screen.
References TextureTarget::Draw().
virtual void Draw |
Draws a textureless solid colored rectangle on the screen.
References TextureTarget::Draw().
virtual void Draw |
Draws a textureless solid colored rectangle on the screen.
References TextureTarget::Draw().
virtual void Draw |
Draws a textureless solid colored rectangle to cover the texture target.
References TextureTarget::Draw(), and TextureTarget::GetTargetSize().
void EnableClipping | ( | ) |
Enables graphics clipping from the visible borders of the layer.
|
virtual |
Changes the tint color of the layer, every image pixel will be multiplied by this color.
|
overridevirtual |
Get current drawing mode. See Layer page to see available drawing modes.
Implements TextureTarget.
|
overridevirtual |
Get size of the target.
Implements TextureTarget.
References Layer::bounds, Layer::GetEffectiveBounds(), basic_Bounds< T_ >::GetSize(), basic_Bounds< T_ >::Height(), and basic_Bounds< T_ >::Width().
|
virtual |
Returns the tint color of the layer, every image pixel will be multiplied by this color.
bool IsClippingEnabled | ( | ) | const |
Returns if the clipping is enabled.
|
overridevirtual |
Queues the start of a new mask. Only one mask buffer exists and it will be cleared and reused.
Implements TextureTarget.
|
overridevirtual |
Render this layer to the GL. This function is used internally and not necessary to be called.
Reimplemented from Layer.
References Gorgon::Graphics::internal::ActivateQuadVertices(), Gorgon::Graphics::Alpha, Layer::children, Gorgon::GL::Clear(), Gorgon::Clip, Layer::dotransformandclip(), Gorgon::Graphics::internal::DrawQuadVertices(), TextureTarget::FrameBuffer, glBlendFuncSeparate, basic_Bounds< T_ >::Height(), basic_Size< T_ >::Height, Layer::isvisible, Gorgon::LayerColor, basic_Bounds< T_ >::Left, Gorgon::Graphics::Normal, TextureTarget::Normal, Layer::reverttransformandclip(), Gorgon::ScreenSize, MaskedAlphaShader::SetAlpha(), Gorgon::GL::SetDefaultBlending(), Gorgon::GL::SetDefaultClear(), MaskedShader::SetDiffuse(), MaskedShader::SetMask(), MaskedAlphaShader::SetMask(), MaskedFillShader::SetMask(), MaskedShader::SetTextureCoords(), MaskedAlphaShader::SetTextureCoords(), MaskedShader::SetTint(), MaskedAlphaShader::SetTint(), MaskedFillShader::SetTint(), MaskedShader::SetVertexCoords(), MaskedAlphaShader::SetVertexCoords(), MaskedFillShader::SetVertexCoords(), Gorgon::Graphics::ToMask, TextureTarget::ToMask, basic_Bounds< T_ >::Top, Gorgon::Transform, Shader::Use(), MaskedShader::Use(), MaskedAlphaShader::Use(), MaskedFillShader::Use(), TextureTarget::UseMask, and basic_Bounds< T_ >::Width().
|
virtual |
Changes the tint color of the layer, every image pixel will be multiplied by this color.
This value effects only the images drawn after it is set.
|
overridevirtual |
Change current drawing mode. See Layer page to see available drawing modes.
Implements TextureTarget.
|
virtual |
Changes the tint color of the layer, every image pixel will be multiplied by this color.
void Swap | ( | Layer & | other | ) |
References Layer::bounds, Layer::Children, Layer::children, Layer::isvisible, Layer::parent, and Gorgon::swap().