Bubba-3D  0.9.0
Awesome game engine!
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Dimension Class Reference

#include <Dimension.h>

Public Types

enum  DimensionUnit {
  PIXELS, PERCENTAGE, FILL, WRAP,
  PERCENTAGE_PLUS_PIXELS
}
 

Public Member Functions

float getSize (float room)
 
DimensionUnit getUnit ()
 
int getWeight ()
 
int getPixels ()
 
float getPercentage ()
 
 Dimension ()
 

Static Public Member Functions

static Dimension fromPercentage (float percentage)
 
static Dimension fromPixels (int pixels)
 
static Dimension fromPercentagePlusPixels (float percentage, int pixels)
 
static Dimension fill ()
 
static Dimension fill (unsigned int weight)
 
static Dimension wrap ()
 

Detailed Description

A collection of units used to represent distance and size in the user interface library

Definition at line 28 of file Dimension.h.

Constructor & Destructor Documentation

Dimension::Dimension ( )

Use the static functions to create dimensions

Definition at line 86 of file Dimension.cpp.

Member Function Documentation

Dimension Dimension::fill ( )
static

A unit that uses up the unused space of the container. Alias for fill(1)

Definition at line 52 of file Dimension.cpp.

Dimension Dimension::fill ( unsigned int  weight)
static

A unit that uses up the weighted unused space of the container. If the container contains one fill element with weight 1 and one fill element with weight 2 then the first will take up a third of the space and the second element will take up two thirds of the space.

Fill element always take up the space not used by elements which are not fill elements.

Definition at line 56 of file Dimension.cpp.

Dimension Dimension::fromPercentage ( float  percentage)
static

Create a dimension based an a percentage of the size of the container

Definition at line 33 of file Dimension.cpp.

Dimension Dimension::fromPercentagePlusPixels ( float  percentage,
int  pixels 
)
static

Allows contstruction of a unit which is based on a percentage of the size of the container plus a constant number of pixels.

Definition at line 45 of file Dimension.cpp.

Dimension Dimension::fromPixels ( int  pixels)
static

A constant size dimension which is always pixels wide.

Definition at line 39 of file Dimension.cpp.

float Dimension::getPercentage ( )

If this is a percentage element, return the percentage

Definition at line 78 of file Dimension.cpp.

int Dimension::getPixels ( )

If this is a pixel element, return the number of pixels of this element.

Definition at line 74 of file Dimension.cpp.

float Dimension::getSize ( float  room)

Retrieves the size of this Dimension based on the size of the container. only works for Dimension::DimensionUnit::PIXELS, Dimension::DimensionUnit::PERCENTAGE and Dimension::DimensionUnit::PERCENTAGE_PLUS_PIXELS

Definition at line 23 of file Dimension.cpp.

Dimension::DimensionUnit Dimension::getUnit ( )

Returns the unit of this dimension

Definition at line 66 of file Dimension.cpp.

int Dimension::getWeight ( )

If this is a fill element, return the weight of this Dimension

Definition at line 70 of file Dimension.cpp.

Dimension Dimension::wrap ( )
static

Mostly used with sizes of elements. Will be the minimum size possible size without cutting any content.

Definition at line 62 of file Dimension.cpp.


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