00001
00004 #ifndef __UTIL_H
00005 #define __UTIL_H
00006
00007 #include <vector>
00008 #include <string>
00009 #include "graphics.h"
00010
00012 struct nnctime {
00014 long secs;
00015
00017 long msecs;
00018 };
00019
00021 struct Velocity {
00023 double dx, dy;
00024
00026 nnctime pertime;
00027 };
00028
00030
00034 nnctime operator-(nnctime &a, nnctime &b);
00035
00037
00041 nnctime Util_GetTime();
00042
00044
00049 nnctime Util_DiffTime(nnctime *old, nnctime *now = NULL);
00050
00052
00058 int Util_TimePassed(nnctime *old, Uint32 ms);
00059
00061
00064 Rect Util_BuildRect(int, int, int, int);
00065
00067
00071 int Util_Random(int max);
00072
00074
00082 Velocity Util_BuildVelocity (double dx, double dy, nnctime *old, nnctime *now = NULL);
00083
00085
00093 bool Util_Intersect(Rect &R1, Rect &R2);
00094
00096
00109 vector<Surface *> Util_parseImage(string filename);
00110
00112
00116 int Util_FindBestSurfaceSize(int w, int h);
00117
00118 #endif