Dragonfly 4.20
A text-based game engine
|
Namespaces | |
namespace | Keyboard |
namespace | Mouse |
Typedefs | |
typedef std::tuple< int, int > | Cell |
using | delayedMessage = std::tuple< int, char *, size_t > |
using | delayQueue = std::queue< delayedMessage > |
Enumerations | |
enum class | ButtonAttribute : unsigned int { APPEARANCE = 1 << (ViewObjectAttributeMax + 0) } |
enum | Color { UNDEFINED_COLOR = -1 , BLACK = 0 , RED , GREEN , YELLOW , BLUE , MAGENTA , CYAN , WHITE , CUSTOM } |
enum | Justification { LEFT_JUSTIFIED , CENTER_JUSTIFIED , RIGHT_JUSTIFIED } |
enum | EventKeyboardAction { UNDEFINED_KEYBOARD_ACTION = -1 , KEY_PRESSED , KEY_RELEASED , KEY_DOWN } |
enum | EventMouseAction { UNDEFINED_MOUSE_ACTION = -1 , CLICKED , PRESSED , MOVED } |
enum class | NetworkEventLabel { UNDEFINED = -1 , ACCEPT , CONNECT , CLOSE , DATA } |
enum | SearchResult { NOT_FOUND , INCOMPLETE , FOUND } |
enum class | MessageType { UNDEFINED_MESSAGE =-1 , SYNC_OBJECT , DELETE_OBJECT , SET_GAME_OVER , KEYBOARD_INPUT , MOUSE_INPUT , CUSTOM_MESSAGE } |
enum | Solidness { HARD , SOFT , SPECTRAL } |
enum class | ObjectAttribute : unsigned int { ID = 1 << 0 , ACTIVE = 1 << 1 , VISIBLE = 1 << 2 , EVENTS = 1 << 3 , BOX = 1 << 4 , POSITION = 1 << 5 , TYPE = 1 << 6 , ANIMATION = 1 << 7 , ALTITUDE = 1 << 8 , SOLIDNESS = 1 << 9 , NO_SOFT = 1 << 10 , SPEED = 1 << 11 , DIRECTION = 1 << 12 , ACCELERATION = 1 << 13 , SHAPE = 1 << 14 , PATH = 1 << 15 , FOLLOW_PATH = 1 << 16 , AVOID_COLLISIONS = 1 << 17 } |
enum | ParticleType { UNDEFINED_PARTICLE_TYPE = -1 , SMOKE , SPARKS , RINGS , FIREWORKS } |
enum | ParticleClass { UNDEFINED_PARTICLE_CLASS = -1 , PARTICLE , FIREWORK } |
enum | Direction { UNDEFINED_DIRECTION = -1 , UP , DOWN , LEFT , RIGHT } |
enum | PrecipitationType { UNDEFINED_PRECIPITATION_TYPE = -1 , SNOW , RAIN , STARFIELD } |
enum | ShapeType { UNDEFINED_SHAPE = -1 , CIRCLE , SQUARE , TRIANGLE } |
enum class | TextBoxAttribute : unsigned int { TEXT = 1 << (ViewObjectAttributeMax + 0) , APPEARANCE = 1 << (ViewObjectAttributeMax + 1) } |
enum class | TextEntryAttribute : unsigned int { TEXT = 1 << (ViewObjectAttributeMax + 0) , APPEARANCE = 1 << (ViewObjectAttributeMax + 1) } |
enum class | ViewObjectAttribute : unsigned int { VALUE = 1 << (ObjectAttributeMax + 0) , APPEARANCE = 1 << (ObjectAttributeMax + 1) } |
enum | ViewObjectLocation { UNDEFINED =-1 , TOP_LEFT , TOP_CENTER , TOP_RIGHT , CENTER_LEFT , CENTER_CENTER , CENTER_RIGHT , BOTTOM_LEFT , BOTTOM_CENTER , BOTTOM_RIGHT } |
Functions | |
float | charHeight (void) |
float | charWidth (void) |
Vector | spacesToPixels (Vector spaces) |
Vector | pixelsToSpaces (Vector pixels) |
bool | valueInRange (float value, float min, float max) |
Box | getWorldBox (const Object *p_o) |
Box | getWorldBox (const Object *p_o, Vector where) |
float | distance (Vector p1, Vector p2) |
float | distance (Object *p_o1, Object *p_o2) |
bool | boxContainsPosition (Box b, Vector p) |
bool | boxContainsBox (Box b1, Box b2) |
bool | lineIntersectsLine (Line line1, Line line2) |
bool | lineIntersectsBox (Line line, Box b) |
bool | boxIntersectsBox (Box box1, Box box2) |
bool | circleIntersectsBox (Circle circle, Box b) |
int | splash () |
char * | getTimeString () |
Vector | worldToView (Vector world_pos) |
Vector | viewToWorld (Vector view_pos) |
std::string | toString (int i) |
std::string | toString (float f) |
std::string | toString (char c) |
std::string | toString (bool b) |
std::string | toString (Color color) |
std::string | toString (Path path) |
std::string | toString (Keyboard::Key key_val) |
std::string | toString (Solidness solid) |
std::string | toString (ViewObjectLocation location) |
std::string | toString (MessageType message) |
std::string | match (std::string str, std::string find) |
int | addParticles (int count, int count_spread, Vector position, float position_spread, Vector direction, float direction_spread, float size, float size_spread, float speed, float speed_spread, int age, int age_spread, unsigned char opacity, char opacity_spread, unsigned char r, unsigned char g, unsigned char b, unsigned char color_spread, ParticleClass particle_class=PARTICLE) |
int | addParticles (ParticleType type, Vector position, float scale=1.0, Color color=CUSTOM) |
int | addParticles (PrecipitationType type, Direction direction, float scale=1.0, Color color=CUSTOM) |
void | colorToRGB (Color color, unsigned char &r, unsigned char &g, unsigned char &b) |
sf::Color | colorToSFML (Color color) |
Vector | getNormal (const Object *p_o1, const Object *p_o2) |
std::string | maskToString (unsigned int mask) |
int | explode (const Sprite *p_sprite, int index, Vector position, int age, float speed, float rotate) |
float | vectorToAngle (df::Vector v) |
Variables | |
const int | ButtonAttributeMax = ViewObjectAttributeMax + 1 |
const Color | COLOR_DEFAULT = WHITE |
const int | WINDOW_HORIZONTAL_PIXELS_DEFAULT = 1024 |
const int | WINDOW_VERTICAL_PIXELS_DEFAULT = 768 |
const int | WINDOW_HORIZONTAL_CHARS_DEFAULT = 80 |
const int | WINDOW_VERTICAL_CHARS_DEFAULT = 24 |
const int | WINDOW_STYLE_DEFAULT = sf::Style::Titlebar|sf::Style::Close |
const Color | WINDOW_BACKGROUND_COLOR_DEFAULT = BLACK |
const std::string | WINDOW_TITLE_DEFAULT = "Dragonfly" |
const std::string | FONT_FILE_DEFAULT = "df-font.ttf" |
const float | FONT_SCALE_DEFAULT = 2.0 |
const std::string | UNDEFINED_EVENT = "df-undefined" |
const std::string | COLLISION_EVENT = "df-collision" |
const std::string | KEYBOARD_EVENT = "df-keyboard" |
const std::string | NETWORK_KEYBOARD_EVENT = "df-keyboard-network" |
const std::string | MSE_EVENT = "df-mouse" |
const std::string | NETWORK_MSE_EVENT = "df-mouse-network" |
const std::string | NETWORK_EVENT = "df-network" |
const std::string | NETWORK_CREATE_EVENT = "df-network-create" |
const std::string | NETWORK_CUSTOM_EVENT = "df-custom-network" |
const std::string | NETWORK_DELETE_EVENT = "df-network-delete" |
const std::string | NETWORK_GAME_OVER_EVENT = "df-network-game-over" |
const std::string | NETWORK_SYNC_EVENT = "df-network-sync" |
const std::string | OUT_EVENT = "df-out" |
const std::string | PATH_EVENT = "df-path" |
const std::string | STEP_EVENT = "df-step" |
const std::string | VIEW_EVENT = "df-view" |
const std::string | FRAPS_STRING = "fps" |
const std::string | FRAPS_FILENAME = "fraps" |
const std::string | CONFIG_FILENAME = "df-config.txt" |
const int | FRAME_TIME_DEFAULT = 33 |
const int | GRID_WIDTH_DEFAULT = 20 |
const int | GRID_HEIGHT_DEFAULT = 8 |
const std::string | LOGFILE_DEFAULT = "dragonfly.log" |
const int | MAX_EVENTS = 100 |
const std::string | DRAGONFLY_PORT = "9876" |
const int | MAX_OBJ_EVENTS = 100 |
const int | ObjectAttributeMax = 18 |
const int | QUADTREE_THRESH_DEFAULT = 1 |
const int | QUADTREE_MAX_DEPTH = 10 |
const int | MAX_SPRITES = 1000 |
const int | MAX_SOUNDS = 100 |
const int | MAX_MUSICS = 50 |
const int | MAX_ALTITUDE = 4 |
const std::string | UNDEFINED_STATE = "__undefined state__" |
const int | TextBoxAttributeMax = ViewObjectAttributeMax + 2 |
const int | TextEntryAttributeMax = ViewObjectAttributeMax + 2 |
const int | ViewObjectAttributeMax = ObjectAttributeMax + 2 |
An animation for a sprite.
The view object.
A 2d (x,y) vector.
A basic TextEntry.
A basic TextBox, with word wrap and scrolling.
A finite state machine.
The sprite.
Dragonfly for splash screen.
Text for splash screen.
The sound.
A single-space, 2d shape for drawing.
A precipitation particle.
A particle.
An iterator for ObjectLists.
A list of Objects.
The base game world object.
The music.
The base manager.
A line segment.
Fraps (FRAmes Per Second) recorder.
A sprite frame.
A firework particle.
A "view" event.
A "step" event, generated once per game loop.
An "pathfinding" event.
An "out of bounds" event.
A "mouse" event over the network.
A "mouse" event.
A "keyboard" event over the network.
A "keyboard" event.
A "collision" event.
The base event.
A debris particle.
Colors for Dragonfly.
The clock, for timing.
A 2d circle.
A basic button.
A 2-d bounding box.
Invokes callback() when clicked. Changes to highlight color on mouse over.
Handle incoming network messages.
< Objects (often) have animated sprites. < Objects have a bounding box. < Objects can handle events. < Objects can seek along path. Objects can do pathfinding. Objects can have simple drawing shapes. < Objects need a float location.
An A* pathfinding class.
|
strong |
Categories of button attributes that indicate modification.
enum df::Color |
Colors Dragonfly recognizes.
enum df::Direction |
Directions.
enum df::EventMouseAction |
Set of mouse actions recognized by Dragonfly.
enum df::Justification |
String justifications.
|
strong |
Categories of Object attributes that indicate modification.
enum df::ParticleClass |
Particle classes.
enum df::ParticleType |
Particle types.
Precipitation types.
enum df::Solidness |
|
strong |
Categories of TextBox attributes that indicate modification.
|
strong |
Categories of TextEntry attributes that indicate modification.
|
strong |
Categories of ViewObject attributes that indicate modification.
General location on screen.
int df::addParticles | ( | int | count, |
int | count_spread, | ||
Vector | position, | ||
float | position_spread, | ||
Vector | direction, | ||
float | direction_spread, | ||
float | size, | ||
float | size_spread, | ||
float | speed, | ||
float | speed_spread, | ||
int | age, | ||
int | age_spread, | ||
unsigned char | opacity, | ||
char | opacity_spread, | ||
unsigned char | r, | ||
unsigned char | g, | ||
unsigned char | b, | ||
unsigned char | color_spread, | ||
ParticleClass | particle_class = PARTICLE |
||
) |
Add particles.
Each parameter has average and spread. count - number to add position - location direction - direction to move [(0,0) for random] size - size (pixels) speed - speed (spaces/tick) age - age (ticks) opacity - how "see through" [0-255, 0 is transparent] r, g, b - color in RGB values Particle class - class to add (default is PARTICLE). Return 0 if ok, else -1.
int df::addParticles | ( | ParticleType | type, |
Vector | position, | ||
float | scale = 1.0 , |
||
Color | color = CUSTOM |
||
) |
Add particles of specific type.
type - type of particle: SMOKE, SPARKS, RINGS, FIREWORKS. position - location scale - scale size (default 1.0) color - dragonfly color to use (default 'built-in') Return 0 if ok, else -1.
int df::addParticles | ( | PrecipitationType | type, |
Direction | direction, | ||
float | scale = 1.0 , |
||
Color | color = CUSTOM |
||
) |
Add environment particles of specific type.
type - type of particle: RAIN, SNOW, STARFIELD. direction - direction particle travels: UP, DOWN, LEFT, RIGHT. scale - scale size (default 1.0) color - dragonfly color to use (default 'built-in') Return 0 if ok, else -1.
float df::charHeight | ( | void | ) |
Compute character height in pixels, based on window size.
float df::charWidth | ( | void | ) |
Compute character width in pixels, based on window size.
void df::colorToRGB | ( | Color | color, |
unsigned char & | r, | ||
unsigned char & | g, | ||
unsigned char & | b | ||
) |
Set RGB color based on DF color.
sf::Color df::colorToSFML | ( | Color | color | ) |
Return SFML color based on DF color.
Return distance between any two Objects.
Return -1.0 if error.
int df::explode | ( | const Sprite * | p_sprite, |
int | index, | ||
Vector | position, | ||
int | age, | ||
float | speed, | ||
float | rotate | ||
) |
"Explode" a sprite frame into small, Particles.
index - frame index position - location of frame position - location of frame age - how long it should last (in ticks) speed - speed (in spaces per tick) (negative to "implode") rotate - degrees to spin (per tick) Return 0 if ok, else -1.
char * df::getTimeString | ( | ) |
Returns pretty-formatted time as char * string.
Return true if Line segments intersect.
(Parallel line segments don't intersect). (Co-linear lines will NOT intersect).
std::string df::maskToString | ( | unsigned int | mask | ) |
Return bitmask as string.
std::string df::match | ( | std::string | str, |
std::string | find | ||
) |
Match key:value pair in string in str, returning value.
Pairs separated by commas (,). If str is empty, use previously parsed string str. All whitespace is ignored. Return empty string if no match.
int df::splash | ( | ) |
Launch splash screen. Return 0 if ok, else -1.
std::string df::toString | ( | bool | b | ) |
Convert boolean to string, returning string.
std::string df::toString | ( | char | c | ) |
Convert character to string, returning string.
std::string df::toString | ( | Color | color | ) |
Convert Dragonfly Color to string, returning string.
std::string df::toString | ( | float | f | ) |
Convert float to string, returning string.
std::string df::toString | ( | int | i | ) |
Convert integer to string, returning string.
std::string df::toString | ( | Keyboard::Key | key_val | ) |
Convert Dragonfly key to string, returning string.
std::string df::toString | ( | Solidness | solid | ) |
Convert Solidness to string, returning string.
std::string df::toString | ( | ViewObjectLocation | location | ) |
Convert ViewObjectLocation to string, returning string.
bool df::valueInRange | ( | float | value, |
float | min, | ||
float | max | ||
) |
Return true if value is between min and max (inclusive).
const Color df::COLOR_DEFAULT = WHITE |
If color not specified, will use this.
const std::string df::CONFIG_FILENAME = "df-config.txt" |
Default Dragonfly cofiguration file.
Override with DRAGONFLY_CONFIG environment variable.
const int df::FRAME_TIME_DEFAULT = 33 |
Default frame time (game loop time) in milliseconds (33 ms == 30 f/s).
const std::string df::LOGFILE_DEFAULT = "dragonfly.log" |
Default Dragonfly logfile.
Override with DRAGONFLY_LOG environment variable.
const int df::MAX_EVENTS = 100 |
Max number of different events.
const int df::MAX_OBJ_EVENTS = 100 |
Max number of events Object can be interested in.
const int df::WINDOW_HORIZONTAL_PIXELS_DEFAULT = 1024 |
Defaults for SFML window.