Claypool

Courses

Publications

Students

Projects

Service

Downloads

Misc


Dragonfly: utility.h Source File
Dragonfly 2.2
A text-based game engine

utility.h

00001 //
00002 // utility.h
00003 //
00004 // Utility functions to support Dragonfly and its games.
00005 //
00006 // Functions here do not use any attributes of any classes, so
00007 // can stand alone.
00008 //
00009 
00010 #ifndef __UTILITY_H__
00011 #define __UTILITY_H__
00012 
00013 // System includes
00014 #include <sstream>              // for intToString()
00015 
00016 // Engine includes
00017 #include "Box.h"
00018 #include "Circle.h"
00019 #include "GameObject.h"
00020 #include "Line.h"
00021 #include "Position.h"
00022 
00023 // Function prototypes
00024 bool valueInRange(int value, int min, int max);
00025 Box getWorldBox(GameObject *p_go);
00026 float worldDistance(Position p1, Position p2);
00027 bool boxContainsPoint(Box b, Position p);
00028 bool lineIntersectsLine(Line line1, Line line2);
00029 bool lineIntersectsBox(Line line, Box b);
00030 bool boxIntersectsBox(Box box1, Box box2);
00031 bool circleIntersectsBox(Circle circle, Box b);
00032 void splash();
00033 
00034  /// Returns pretty-formatted string.
00035 char *getTimeString();      
00036 
00037 /// Convert world position to view position.
00038 Position worldToView(Position world_pos);
00039 
00040 /// Convert view position to world position. 
00041 Position viewToWorld(Position view_pos);
00042 
00043 /// Convert int to a string, returning string
00044 string intToString(int number);
00045 
00046 #endif // __UTILITY_H__
 All Classes Functions Variables Friends