5#ifndef __DISPLAY_MANAGER_H__
6#define __DISPLAY_MANAGER_H__
9#include <SFML/Graphics.hpp>
10#include <SFML/Graphics/RectangleShape.hpp>
19#define DM df::DisplayManager::getInstance()
32const int WINDOW_VERTICAL_PIXELS_DEFAULT = 768;
33const int WINDOW_HORIZONTAL_CHARS_DEFAULT = 80;
34const int WINDOW_VERTICAL_CHARS_DEFAULT = 24;
35const int WINDOW_STYLE_DEFAULT = sf::Style::Titlebar|sf::Style::Close;
36const Color WINDOW_BACKGROUND_COLOR_DEFAULT = BLACK;
37const std::string WINDOW_TITLE_DEFAULT =
"Dragonfly";
38const std::string FONT_FILE_DEFAULT =
"df-font.ttf";
39const float FONT_SCALE_DEFAULT = 2.0;
87 float rotation=0.0f)
const;
93 unsigned char g,
unsigned char b,
float rotation=0.0f)
const;
125 void shake(
int scale_x,
int scale_y,
int duration,
bool delta=
false);
Definition: DisplayManager.h:53
DisplayManager(DisplayManager const &)
Don't allow copy.
int m_window_horizontal_pixels
Horizontal pixels in window.
Definition: DisplayManager.h:61
int m_window_vertical_pixels
Vertical pixels in window.
Definition: DisplayManager.h:62
int m_window_horizontal_chars
Horizontal ASCII spaces in window.
Definition: DisplayManager.h:63
void shake(int scale_x, int scale_y, int duration, bool delta=false)
"Shake" window with severity scale (pixels) and duration (frames).
int m_shake_scale_y
Severity of shake (pixels).
Definition: DisplayManager.h:69
sf::RectangleShape * m_p_rectangle
Backing rectangle for under text.
Definition: DisplayManager.h:65
sf::Text * m_p_text
ASCII character to draw.
Definition: DisplayManager.h:67
bool setBackgroundColor(Color new_color)
Set window's background color.
sf::Font m_font
Font used for ASCII graphics.
Definition: DisplayManager.h:59
int getVertical() const
Return window's vertical maximum (in characters).
sf::RenderWindow * getWindow() const
Return pointer to SFML graphics window.
int m_shake_duration
Time left to shake (frames).
Definition: DisplayManager.h:68
void operator=(DisplayManager const &)
Don't allow assignment.
DisplayManager()
Private since a singleton.
sf::Color m_window_background_color
Background color of window.
Definition: DisplayManager.h:66
sf::RenderWindow * m_p_window
Pointer to SFML window.
Definition: DisplayManager.h:60
int getHorizontalPixels() const
Return window's horizontal maximum (in pixels).
int m_shake_y
Shake (this frame).
Definition: DisplayManager.h:70
int swapBuffers()
Render current window buffer.
static DisplayManager & getInstance()
Get the one and only instance of the DisplayManager.
void shutDown() override
Close graphics window.
void setVertical(int new_vertical)
Set window's vertical maximum (in characters).
int 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).
int drawString(Vector world_pos, std::string str, Justification just, Color color) const
Draw string at window location (x,y) with color.
int getHorizontal() const
Return window's horizontal maximum (in characters).
int startUp() override
Open graphics window, ready for text-based display.
void setHorizontal(int new_horizontal)
Set window's horizontal maximum (in characters).
int getVerticalPixels() const
Return window's vertical maximum (in pixels).
int m_window_vertical_chars
Vertical ASCII spaces in window.
Definition: DisplayManager.h:64
int 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).
An animation for a sprite.
Definition: Animation.h:15
float charHeight(void)
Compute character height in pixels, based on window size.
Vector pixelsToSpaces(Vector pixels)
Convert window pixels (x,y) to ASCII spaces (x,y).
const int WINDOW_HORIZONTAL_PIXELS_DEFAULT
Defaults for SFML window.
Definition: DisplayManager.h:31
Color
Colors Dragonfly recognizes.
Definition: Color.h:11
float charWidth(void)
Compute character width in pixels, based on window size.
Vector spacesToPixels(Vector spaces)
Convert ASCII spaces (x,y) to window pixels (x,y).
Justification
String justifications.
Definition: DisplayManager.h:24