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

Public Member Functions

 Line (Vector init_p1, Vector init_p2)
 
 Line ()
 
void setP1 (Vector new_p1)
 
Vector getP1 () const
 
void setP2 (Vector new_p2)
 
Vector getP2 () const
 
std::string toString () const
 
void draw () const
 

Private Attributes

Vector m_p1
 
Vector m_p2
 

Constructor & Destructor Documentation

◆ Line() [1/2]

df::Line::Line ( Vector  init_p1,
Vector  init_p2 
)

Create line segment from p1 to p2.

◆ Line() [2/2]

df::Line::Line ( )

Default line segment is at (0,0).

Member Function Documentation

◆ draw()

void df::Line::draw ( ) const

Draw pixel line.

◆ getP1()

Vector df::Line::getP1 ( ) const

Get first endpoint.

◆ getP2()

Vector df::Line::getP2 ( ) const

Get second endpoint.

◆ setP1()

void df::Line::setP1 ( Vector  new_p1)

Set first endpoint.

◆ setP2()

void df::Line::setP2 ( Vector  new_p2)

Set second endpoint.

◆ toString()

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

Return attributes as string.

Member Data Documentation

◆ m_p1

Vector df::Line::m_p1
private

First endpoint.

◆ m_p2

Vector df::Line::m_p2
private

Second endpoint.