Dragonfly 4.20
A text-based game engine
Public Member Functions | Private Attributes | List of all members
df::Box Class Reference

Public Member Functions

 Box (Vector init_corner, float init_horizontal, float init_vertical)
 
 Box ()
 
void setCorner (Vector new_corner)
 
Vector getCorner () const
 
void setHorizontal (float new_horizontal)
 
float getHorizontal () const
 
void setVertical (float new_vertical)
 
float getVertical () const
 
std::string toString () const
 
bool operator== (const Box &other) const
 
bool operator!= (const Box &other) const
 
void draw ()
 
int serialize (std::stringstream *p_ss) const
 
int deserialize (std::stringstream *p_ss)
 

Private Attributes

Vector m_corner
 
float m_horizontal
 
float m_vertical
 

Constructor & Destructor Documentation

◆ Box() [1/2]

df::Box::Box ( Vector  init_corner,
float  init_horizontal,
float  init_vertical 
)

Create box with upper-left corner, horiz and vert sizes.

◆ Box() [2/2]

df::Box::Box ( )

Create box with (0,0) for corner, and 0 for horiz and vert.

Member Function Documentation

◆ deserialize()

int df::Box::deserialize ( std::stringstream *  p_ss)

Deserialize attributes from stream.

Return 0 if ok, else -1.

◆ draw()

void df::Box::draw ( )

Draw box outline in pixels.

◆ getCorner()

Vector df::Box::getCorner ( ) const

Get upper left corner of box.

◆ getHorizontal()

float df::Box::getHorizontal ( ) const

Get horizontal size of box.

◆ getVertical()

float df::Box::getVertical ( ) const

Get vertical size of box.

◆ operator==()

bool df::Box::operator== ( const Box other) const

Compare two boxes.

◆ serialize()

int df::Box::serialize ( std::stringstream *  p_ss) const

Serialize attributes to stream.

Return 0 if ok, else -1.

◆ setCorner()

void df::Box::setCorner ( Vector  new_corner)

Set upper left corner of box.

◆ setHorizontal()

void df::Box::setHorizontal ( float  new_horizontal)

Set horizontal size of box.

◆ setVertical()

void df::Box::setVertical ( float  new_vertical)

Set vertical size of box.

◆ toString()

std::string df::Box::toString ( ) const

Return attributes as string.

Member Data Documentation

◆ m_corner

Vector df::Box::m_corner
private

Upper left corner of box.

◆ m_horizontal

float df::Box::m_horizontal
private

Horizontal dimension.

◆ m_vertical

float df::Box::m_vertical
private

Vertical dimension.