Definition in file util.h.
#include <vector>
#include <string>
#include "graphics.h"
Go to the source code of this file.
Compounds | |
struct | nnctime |
structure to hold a time More... | |
struct | Velocity |
Structure to hold a velocity (unused at the current time). More... | |
Functions | |
nnctime | operator- (nnctime &a, nnctime &b) |
difference operator between ncctimes | |
nnctime | Util_GetTime () |
Gets the current time. | |
nnctime | Util_DiffTime (nnctime *old, nnctime *now=NULL) |
Does a difference between an old time and a new time. | |
int | Util_TimePassed (nnctime *old, Uint32 ms) |
Use to find how many times over a time has elapsed. | |
Rect | Util_BuildRect (int, int, int, int) |
Quick method to build a rect. | |
int | Util_Random (int max) |
Return a random number. | |
Velocity | Util_BuildVelocity (double dx, double dy, nnctime *old, nnctime *now=NULL) |
Function build a velocity based on time samples. | |
bool | Util_Intersect (Rect &R1, Rect &R2) |
Determine if two rectangles intersect. | |
vector< Surface * > | Util_parseImage (string filename) |
Load surfaces from a file description. | |
int | Util_FindBestSurfaceSize (int w, int h) |
Finds a good size for a texture. |
|
difference operator between ncctimes deduces the difference between time a and b.
Definition at line 42 of file util.cpp. References nnctime::msecs, and nnctime::secs. |
|
Quick method to build a rect.
Definition at line 75 of file util.cpp. References Rect. Referenced by Graphics::blitclip(), Background::Draw(), GameObject::GetBoundingRect(), and ExplodeObject::think(). |
|
Function build a velocity based on time samples.
Definition at line 85 of file util.cpp. References Velocity::dx, Velocity::dy, nnctime::msecs, Velocity::pertime, nnctime::secs, and Util_DiffTime(). |
|
Does a difference between an old time and a new time.
Definition at line 20 of file util.cpp. References nnctime::msecs, nnctime::secs, and Util_GetTime(). Referenced by Application::Run(), Crosshair::think(), Util_BuildVelocity(), and Util_TimePassed(). |
|
Finds a good size for a texture. Returns an integer in the power of 2 that will cover the width and height provided Definition at line 169 of file util.cpp. Referenced by Graphics::TexturizeSurface(). |
|
Gets the current time. This function uses SDL_GetTicks to determine the current clock.
Definition at line 9 of file util.cpp. References nnctime::msecs, and nnctime::secs. Referenced by Bear::Bear(), BearSpawnPoint::BearSpawnPoint(), Sprite::EnableAnimation(), ExplodeObject::ExplodeObject(), MainChar::FireWeapon(), Application::Run(), MainChar::setWalking(), Crosshair::think(), UFO::think(), UFO::UFO(), Util_DiffTime(), Util_Random(), and Util_TimePassed(). |
|
Determine if two rectangles intersect.
Definition at line 110 of file util.cpp. References Rect. Referenced by ObjectManager::FindFirstCollision(). |
|
Load surfaces from a file description. This function will read in from a file and create a vector of surfaces to pass to a sprite (or other) class for future use.
Definition at line 145 of file util.cpp. References Sprite::cache, and SpriteCache::Find(). Referenced by Bear::Bear(), Crosshair::Crosshair(), MainChar::MainChar(), and UFO::UFO(). |
|
Return a random number.
Definition at line 96 of file util.cpp. References nnctime::secs, and Util_GetTime(). Referenced by MainChar::FireWeapon(), UFO::think(), BearSpawnPoint::think(), and UFO::UFO(). |
|
Use to find how many times over a time has elapsed.
Definition at line 56 of file util.cpp. References nnctime::msecs, nnctime::secs, Util_DiffTime(), and Util_GetTime(). Referenced by Sprite::animate(), UFO::think(), MainChar::think(), ExplodeObject::think(), Crosshair::think(), BearSpawnPoint::think(), and Bear::think(). |