Beatmup
Beatmup::Scene::Layer Class Reference

Abstract scene layer having name, type, geometry and some content to display. More...

#include <scene.h>

Inheritance diagram for Beatmup::Scene::Layer:
Beatmup::Object Beatmup::Scene::BitmapLayer Beatmup::Scene::SceneLayer Beatmup::Scene::CustomMaskedBitmapLayer Beatmup::Scene::ShadedBitmapLayer Beatmup::Scene::MaskedBitmapLayer Beatmup::Scene::ShapedBitmapLayer

Public Types

enum class  Type {
  SceneLayer = 0 , BitmapLayer , MaskedBitmapLayer , ShapedBitmapLayer ,
  ShadedBitmapLayer
}
 

Public Member Functions

Type getType () const
 
const std::string & getName () const
 
void setName (const char *name)
 
AffineMappinggetMapping ()
 
const AffineMappinggetMapping () const
 
void setMapping (const AffineMapping &mapping)
 
virtual bool testPoint (float x, float y) const
 Tests if a given point falls in the layer. More...
 
virtual LayergetChild (float x, float y, unsigned int recursionDepth=0) const
 Picks a child layer at given point, if any. More...
 
bool isVisible () const
 Returns layer visibility flag. More...
 
bool isPhantom () const
 Returns true if the layer is ignored when searching a layer by point. More...
 
void setVisible (bool visible)
 Sets layer visibility. More...
 
void setPhantom (bool phantom)
 Makes/unmakes the layer "phantom". More...
 
template<class LayerType >
LayerType & castTo () const
 
- Public Member Functions inherited from Beatmup::Object
virtual ~Object ()
 

Protected Member Functions

 Layer (Type type)
 
virtual void render (RenderingContext &context)
 

Protected Attributes

AffineMapping mapping
 layer mapping More...
 
bool visible
 layer visibility More...
 
bool phantom
 if true, layer is ignored by selection by point More...
 

Private Member Functions

 Layer (const Layer &)=delete
 disabling copying constructor More...
 

Private Attributes

Type type
 
std::string name
 layer name More...
 

Friends

class SceneRenderer
 

Detailed Description

Abstract scene layer having name, type, geometry and some content to display.

The layer geometry is defined by an AffineMapping describing the position and the orientation of the layer content in the rendered image.

Definition at line 64 of file scene.h.

Member Enumeration Documentation

◆ Type

Enumerator
SceneLayer 

layer containing a scene

BitmapLayer 

layer displaying a bitmap

MaskedBitmapLayer 

layer displaying a bitmap with mask

ShapedBitmapLayer 

layer displaying a bitmap within a shape

ShadedBitmapLayer 

layer displaying a bitmap through a custom fragment shader

Definition at line 68 of file scene.h.

68  {
69  SceneLayer = 0, //!< layer containing a scene
70  BitmapLayer, //!< layer displaying a bitmap
71  MaskedBitmapLayer, //!< layer displaying a bitmap with mask
72  ShapedBitmapLayer, //!< layer displaying a bitmap within a shape
73  ShadedBitmapLayer //!< layer displaying a bitmap through a custom fragment shader
74  };

Constructor & Destructor Documentation

◆ Layer() [1/2]

Beatmup::Scene::Layer::Layer ( const Layer )
privatedelete

disabling copying constructor

◆ Layer() [2/2]

Scene::Layer::Layer ( Type  type)
protected

Definition at line 238 of file scene.cpp.

238 : visible(true), phantom(false), type(type) {}
bool visible
layer visibility
Definition: scene.h:81
bool phantom
if true, layer is ignored by selection by point
Definition: scene.h:82

Member Function Documentation

◆ render()

virtual void Beatmup::Scene::Layer::render ( RenderingContext context)
inlineprotectedvirtual

◆ getType()

Type Beatmup::Scene::Layer::getType ( ) const
inline
Returns
type of the current layer.

Definition at line 92 of file scene.h.

92 { return type; }

◆ getName()

const std::string& Beatmup::Scene::Layer::getName ( ) const
inline

Definition at line 94 of file scene.h.

94 { return name; }
std::string name
layer name
Definition: scene.h:86

◆ setName()

void Beatmup::Scene::Layer::setName ( const char *  name)
inline

Definition at line 95 of file scene.h.

95 { this->name = name; }

◆ getMapping() [1/2]

AffineMapping& Beatmup::Scene::Layer::getMapping ( )
inline

Definition at line 97 of file scene.h.

97 { return mapping; }
AffineMapping mapping
layer mapping
Definition: scene.h:80

◆ getMapping() [2/2]

const AffineMapping& Beatmup::Scene::Layer::getMapping ( ) const
inline

Definition at line 98 of file scene.h.

98 { return mapping; }

◆ setMapping()

void Beatmup::Scene::Layer::setMapping ( const AffineMapping mapping)
inline

Definition at line 99 of file scene.h.

99 { this->mapping = mapping; }

◆ testPoint()

bool Scene::Layer::testPoint ( float  x,
float  y 
) const
virtual

Tests if a given point falls in the layer.

Reimplemented in Beatmup::Scene::ShapedBitmapLayer, Beatmup::Scene::MaskedBitmapLayer, Beatmup::Scene::BitmapLayer, and Beatmup::Scene::SceneLayer.

Definition at line 240 of file scene.cpp.

240  {
241  return mapping.isPointInside(Point(x, y));
242 }
bool isPointInside(const Point &point) const
Tests whether a point from the output domain is inside the input axes span.
Definition: geometry.cpp:87
CustomPoint< float > Point
Definition: geometry.h:626
jobject jlong jint jint y
jobject jlong jint x

◆ getChild()

Scene::Layer * Scene::Layer::getChild ( float  x,
float  y,
unsigned int  recursionDepth = 0 
) const
virtual

Picks a child layer at given point, if any.

Reimplemented in Beatmup::Scene::SceneLayer.

Definition at line 244 of file scene.cpp.

244  {
245  return nullptr;
246 }

◆ isVisible()

bool Beatmup::Scene::Layer::isVisible ( ) const
inline

Returns layer visibility flag.

Definition at line 114 of file scene.h.

114 { return visible; }

◆ isPhantom()

bool Beatmup::Scene::Layer::isPhantom ( ) const
inline

Returns true if the layer is ignored when searching a layer by point.

Definition at line 119 of file scene.h.

119 { return phantom; }

◆ setVisible()

void Beatmup::Scene::Layer::setVisible ( bool  visible)
inline

Sets layer visibility.

Definition at line 124 of file scene.h.

124 { this->visible = visible; }

◆ setPhantom()

void Beatmup::Scene::Layer::setPhantom ( bool  phantom)
inline

Makes/unmakes the layer "phantom".

Phantom layers are rendered as usual but not picked when searching a layer by point.

Definition at line 130 of file scene.h.

130 { this->phantom = phantom; }

◆ castTo()

template<class LayerType >
LayerType& Beatmup::Scene::Layer::castTo ( ) const
inline

Definition at line 132 of file scene.h.

132  {
133  return (LayerType&)(*this);
134  }

Friends And Related Function Documentation

◆ SceneRenderer

friend class SceneRenderer
friend

Definition at line 65 of file scene.h.

Member Data Documentation

◆ mapping

AffineMapping Beatmup::Scene::Layer::mapping
protected

layer mapping

Definition at line 80 of file scene.h.

◆ visible

bool Beatmup::Scene::Layer::visible
protected

layer visibility

Definition at line 81 of file scene.h.

◆ phantom

bool Beatmup::Scene::Layer::phantom
protected

if true, layer is ignored by selection by point

Definition at line 82 of file scene.h.

◆ type

Type Beatmup::Scene::Layer::type
private

Definition at line 85 of file scene.h.

◆ name

std::string Beatmup::Scene::Layer::name
private

layer name

Definition at line 86 of file scene.h.


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