Gorgon Game Engine
SizeController Class Reference

This class allows control over a sizable object. More...

Public Types

enum  Tiling {
  Single, Stretch, Tile, Integral_Smaller,
  Integral_Fill, Integral_Best
}
 Controls how a direction is tiled. More...
 

Public Member Functions

 SizeController ()
 Creates a default size controller which tiles the object from top-left. More...
 
 SizeController (Graphics::Tiling tile, Placement p=Placement::TopLeft)
 Creates a new size controller with the given tiling options and placement. More...
 
 SizeController (Placement p)
 Creates a size controller that places a single object to the given placement. More...
 
 SizeController (Tiling h, Tiling v, Placement p=Placement::TopLeft)
 Creates a new size controller with the given tiling options and placement. More...
 
Geometry::Rectangle CalculateArea (const Geometry::Size &objectsize, const Geometry::Size &area) const
 Calculates the drawing area of the object according to the tiling and placement rules. More...
 
Geometry::Rectangle CalculateArea (const Geometry::Size &repeatingsize, const Geometry::Size &fixedsize, const Geometry::Size &area) const
 Calculates the drawing area of the object according to the tiling and placement rules. More...
 
Geometry::Rectanglef CalculateArea (const Geometry::Sizef &objectsize, const Geometry::Sizef &area) const
 Calculates the drawing area of the object according to the tiling and placement rules. More...
 
Geometry::Rectangle CalculateArea (const Geometry::Sizef &repeatingsize, const Geometry::Sizef &fixedsize, const Geometry::Sizef &area) const
 Calculates the drawing area of the object according to the tiling and placement rules. More...
 
Geometry::Point CalculateOffset (const Geometry::Size &objectsize, const Geometry::Size &area) const
 Calculates the size of the object according to the tiling and placement rules. More...
 
Geometry::Point CalculateOffset (const Geometry::Size &repeatingsize, const Geometry::Size &fixedsize, const Geometry::Size &area) const
 Calculates the size of the object according to the tiling and placement rules. More...
 
Geometry::Pointf CalculateOffset (const Geometry::Sizef &objectsize, const Geometry::Sizef &area) const
 Calculates the size of the object according to the tiling and placement rules. More...
 
Geometry::Pointf CalculateOffset (const Geometry::Sizef &repeatingsize, const Geometry::Sizef &fixedsize, const Geometry::Sizef &area) const
 Calculates the size of the object according to the tiling and placement rules. More...
 
Geometry::Size CalculateSize (Geometry::Size objectsize, const Geometry::Size &area) const
 Calculates the size of the object according to the tiling rules. More...
 
Geometry::Size CalculateSize (Geometry::Size repeatingsize, const Geometry::Size &fixedsize, const Geometry::Size &area) const
 Calculates the size of the object according to the tiling rules. More...
 
Geometry::Sizef CalculateSize (Geometry::Sizef objectsize, const Geometry::Sizef &area) const
 Calculates the size of the object according to the tiling rules. More...
 
Geometry::Sizef CalculateSize (Geometry::Sizef repeatingsize, const Geometry::Sizef &fixedsize, const Geometry::Sizef &area) const
 Calculates the size of the object according to the tiling rules. More...
 
Graphics::Tiling GetTiling () const
 

Public Attributes

Tiling Horizontal
 Horizontal tiling mode. More...
 
Placement Place
 Placement method. More...
 
Tiling Vertical
 Vertical tiling mode. More...
 

Detailed Description

This class allows control over a sizable object.

Member Enumeration Documentation

◆ Tiling

enum Tiling

Controls how a direction is tiled.

Enumerator
Single 

The drawing is drawn only once with its original size.

The placement of this single drawing will be determined by the alignment.

Stretch 

The drawing is stretched along this axis to cover the given size.

If the given drawing object is truly scalable, this value acts same as Tile.

Tile 

The drawing is tiled along this axis to cover the given size.

If the area is smaller, drawing will be cut from the given size. If the area is larger, drawing will be repeated as necessary. While repeating, it is possible for drawing not to cover the area exactly, In this case, alignment determines which side will be incomplete. If center alignment is selected, both sides will have same amount of incomplete drawing.

Integral_Smaller 

The drawing is tiled along this axis to cover the given size.

In this mode, the drawing will never placed incomplete. Instead, it will be repeated to cover as much area as possible without exceeding the given size. Any area that is left will be distributed to the edges according to the selected alignment.

Integral_Fill 

The drawing is tiled along this axis to cover the given size.

In this mode, the drawing will never placed incomplete. Instead, it will be repeated to cover entire area. Excess drawing will be aligned depending on the selected alignment.

Integral_Best 

The drawing is tiled along this axis to cover the given size.

In this mode, the drawing will never placed incomplete. Instead, it will be repeated to cover entire area. If the last drawing that will be partial is more than 50% of the size of the original drawing, it will be drawn. Excess drawing or the area left empty is distributed according to the selected alignment.

Constructor & Destructor Documentation

◆ SizeController() [1/4]

Creates a default size controller which tiles the object from top-left.

◆ SizeController() [2/4]

Creates a size controller that places a single object to the given placement.

This is an implicit conversion constructor.

◆ SizeController() [3/4]

Creates a new size controller with the given tiling options and placement.

◆ SizeController() [4/4]

Creates a new size controller with the given tiling options and placement.

Member Function Documentation

◆ CalculateArea() [1/4]

Geometry::Rectangle CalculateArea ( const Geometry::Size objectsize,
const Geometry::Size area 
) const

Calculates the drawing area of the object according to the tiling and placement rules.

References Gorgon::Graphics::CalculateOffset(), SizeController::CalculateSize(), and SizeController::Place.

◆ CalculateArea() [2/4]

Geometry::Rectangle CalculateArea ( const Geometry::Size repeatingsize,
const Geometry::Size fixedsize,
const Geometry::Size area 
) const

Calculates the drawing area of the object according to the tiling and placement rules.

References Gorgon::Graphics::CalculateOffset(), SizeController::CalculateSize(), and SizeController::Place.

◆ CalculateArea() [3/4]

Geometry::Rectanglef CalculateArea ( const Geometry::Sizef objectsize,
const Geometry::Sizef area 
) const

Calculates the drawing area of the object according to the tiling and placement rules.

References Gorgon::Graphics::CalculateOffset(), SizeController::CalculateSize(), and SizeController::Place.

◆ CalculateArea() [4/4]

Geometry::Rectangle CalculateArea ( const Geometry::Sizef repeatingsize,
const Geometry::Sizef fixedsize,
const Geometry::Sizef area 
) const

Calculates the drawing area of the object according to the tiling and placement rules.

References Gorgon::Graphics::CalculateOffset(), SizeController::CalculateSize(), and SizeController::Place.

◆ CalculateOffset() [1/4]

Geometry::Point CalculateOffset ( const Geometry::Size objectsize,
const Geometry::Size area 
) const

Calculates the size of the object according to the tiling and placement rules.

References Gorgon::Graphics::CalculateOffset(), SizeController::CalculateSize(), and SizeController::Place.

◆ CalculateOffset() [2/4]

Geometry::Point CalculateOffset ( const Geometry::Size repeatingsize,
const Geometry::Size fixedsize,
const Geometry::Size area 
) const

Calculates the size of the object according to the tiling and placement rules.

References Gorgon::Graphics::CalculateOffset(), SizeController::CalculateSize(), and SizeController::Place.

◆ CalculateOffset() [3/4]

Geometry::Pointf CalculateOffset ( const Geometry::Sizef objectsize,
const Geometry::Sizef area 
) const

Calculates the size of the object according to the tiling and placement rules.

References Gorgon::Graphics::CalculateOffset(), SizeController::CalculateSize(), and SizeController::Place.

◆ CalculateOffset() [4/4]

Geometry::Pointf CalculateOffset ( const Geometry::Sizef repeatingsize,
const Geometry::Sizef fixedsize,
const Geometry::Sizef area 
) const

Calculates the size of the object according to the tiling and placement rules.

References Gorgon::Graphics::CalculateOffset(), SizeController::CalculateSize(), and SizeController::Place.

◆ CalculateSize() [1/4]

◆ CalculateSize() [2/4]

◆ CalculateSize() [3/4]

◆ CalculateSize() [4/4]

◆ GetTiling()

Member Data Documentation

◆ Horizontal

Tiling Horizontal

Horizontal tiling mode.

◆ Place

Placement Place

Placement method.

◆ Vertical

Tiling Vertical

Vertical tiling mode.


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