Dragonfly 4.20
A text-based game engine
|
Public Member Functions | |
int | startUp () override |
void | shutDown () override |
int | drawCh (Vector world_pos, char ch, Color color, float rotation=0.0f) const |
int | drawCh (Vector world_pos, char ch, unsigned char r, unsigned char g, unsigned char b, float rotation=0.0f) const |
int | drawString (Vector world_pos, std::string str, Justification just, Color color) const |
void | setHorizontal (int new_horizontal) |
int | getHorizontal () const |
void | setVertical (int new_vertical) |
int | getVertical () const |
int | getHorizontalPixels () const |
int | getVerticalPixels () const |
bool | setBackgroundColor (Color new_color) |
void | shake (int scale_x, int scale_y, int duration, bool delta=false) |
int | swapBuffers () |
sf::RenderWindow * | getWindow () const |
Public Member Functions inherited from df::Manager | |
std::string | getType () const |
virtual int | startUp () |
virtual void | shutDown () |
bool | isStarted () const |
int | onEvent (const Event *p_event) const |
int | registerInterest (Object *p_o, std::string event_type) |
int | unregisterInterest (Object *p_o, std::string event_type) |
Static Public Member Functions | |
static DisplayManager & | getInstance () |
Private Member Functions | |
DisplayManager () | |
DisplayManager (DisplayManager const &) | |
void | operator= (DisplayManager const &) |
Private Attributes | |
sf::Font | m_font |
sf::RenderWindow * | m_p_window |
int | m_window_horizontal_pixels |
int | m_window_vertical_pixels |
int | m_window_horizontal_chars |
int | m_window_vertical_chars |
sf::RectangleShape * | m_p_rectangle |
sf::Color | m_window_background_color |
sf::Text * | m_p_text |
int | m_shake_duration |
int | m_shake_scale_x |
int | m_shake_scale_y |
int | m_shake_x |
int | m_shake_y |
Additional Inherited Members | |
Protected Member Functions inherited from df::Manager | |
void | setType (std::string new_type) |
|
private |
Private since a singleton.
|
private |
Don't allow copy.
int df::DisplayManager::drawCh | ( | Vector | world_pos, |
char | ch, | ||
Color | color, | ||
float | rotation = 0.0f |
||
) | const |
Draw character at window location (x,y) with color and rotation (degrees).
Return 0 if ok, else -1.
int df::DisplayManager::drawCh | ( | Vector | world_pos, |
char | ch, | ||
unsigned char | r, | ||
unsigned char | g, | ||
unsigned char | b, | ||
float | rotation = 0.0f |
||
) | const |
Draw character at window location (x,y) with custom color, and rotation (degrees).
Return 0 if ok, else -1.
int df::DisplayManager::drawString | ( | Vector | world_pos, |
std::string | str, | ||
Justification | just, | ||
Color | color | ||
) | const |
Draw string at window location (x,y) with color.
Justified left, center or right. Return 0 if ok, else -1.
int df::DisplayManager::getHorizontal | ( | ) | const |
Return window's horizontal maximum (in characters).
int df::DisplayManager::getHorizontalPixels | ( | ) | const |
Return window's horizontal maximum (in pixels).
|
static |
Get the one and only instance of the DisplayManager.
int df::DisplayManager::getVertical | ( | ) | const |
Return window's vertical maximum (in characters).
int df::DisplayManager::getVerticalPixels | ( | ) | const |
Return window's vertical maximum (in pixels).
sf::RenderWindow * df::DisplayManager::getWindow | ( | ) | const |
Return pointer to SFML graphics window.
|
private |
Don't allow assignment.
bool df::DisplayManager::setBackgroundColor | ( | Color | new_color | ) |
Set window's background color.
Return true if ok, else false.
void df::DisplayManager::setHorizontal | ( | int | new_horizontal | ) |
Set window's horizontal maximum (in characters).
void df::DisplayManager::setVertical | ( | int | new_vertical | ) |
Set window's vertical maximum (in characters).
void df::DisplayManager::shake | ( | int | scale_x, |
int | scale_y, | ||
int | duration, | ||
bool | delta = false |
||
) |
"Shake" window with severity scale (pixels) and duration (frames).
Delta true then add else replace.
|
overridevirtual |
Close graphics window.
Reimplemented from df::Manager.
|
overridevirtual |
Open graphics window, ready for text-based display.
Return 0 if ok, else -1.
Reimplemented from df::Manager.
int df::DisplayManager::swapBuffers | ( | ) |
Render current window buffer.
Return 0 if ok, else -1.
|
private |
Font used for ASCII graphics.
|
private |
Backing rectangle for under text.
|
private |
ASCII character to draw.
|
private |
Pointer to SFML window.
|
private |
Time left to shake (frames).
|
private |
Severity of shake (pixels).
|
private |
Shake (this frame).
|
private |
Background color of window.
|
private |
Horizontal ASCII spaces in window.
|
private |
Horizontal pixels in window.
|
private |
Vertical ASCII spaces in window.
|
private |
Vertical pixels in window.