Utils Namespace Reference

Namespace for all various functions that don't belong to any class. More...


Namespaces

namespace  FS
 Namespace for general filesystem functions for cross-platform compatability.

Enumerations

enum  MessageType { MESSAGE_CRITICAL = 0, MESSAGE_WARNING }
 Error message types.

Functions

void alert (const ustring &text, const MessageType &type=MESSAGE_CRITICAL)
 Display an alert message to the user.
void scriptToLimits (const ustring &str, UI::Limit &start, UI::Limit &end)
 Convert a court camera script string to animation limits.
Color keyToColor (char ch)
 Map a char representing a text color to the actual color.
void debugMessage (const ustring &msg)
 Print a debug message.
bool pointInRect (const Point &p, const Rect &rect)
 See if a point is in a rectangle.
Point calculateShakePoint (int highestRadius)
 Calculate a random offset point (used during shake animations).
int randomRange (int min, int max)
 Get a random number in the provided range.
Point getMouseLocation (Uint8 *modState=NULL)
 Get the location of the mouse pointer.
SDL_Surface * createSurface (int width, int height)
 Create a blank surface.
ustring ucharToStr (uchar ch)
 Convert a Unicode char to a string.
ustring itoa (int num)
 Convert an integer to string.
StringVector explodeString (const ustring &delimiter, const ustring &str)
 Break a string apart based on a delimiting substring.
StringVector explodeString (uchar delimiter, const ustring &str)
 Break a string apart based on a delimiting character.
int amountInString (const ustring &sub, const ustring &str)
 Count occurrences of a substring in a string.

Variables

bool g_DebugOn = false
 Whether or not debugging is enabled in the player.
bool g_DebugOn
 Whether or not debugging is enabled in the player.


Detailed Description

Namespace for all various functions that don't belong to any class.

Function Documentation

void Utils::alert ( const ustring &  text,
const MessageType &  type = MESSAGE_CRITICAL 
)

Display an alert message to the user.

Note:
This will show a message box on Windows, and console output on Linux
Parameters:
text The text to display
type The type of message

int Utils::amountInString ( const ustring &  sub,
const ustring &  str 
)

Count occurrences of a substring in a string.

Parameters:
sub The substring to test
str The string to test
Returns:
The amount of times sub is found in str

Point Utils::calculateShakePoint ( int  highestRadius  ) 

Calculate a random offset point (used during shake animations).

Parameters:
highestRadius The largest radius to use in the calculation
Returns:
The computed point

SDL_Surface * Utils::createSurface ( int  width,
int  height 
)

Create a blank surface.

Parameters:
width The width
height The height
Returns:
A new surface

void Utils::debugMessage ( const ustring &  msg  ) 

Print a debug message.

Note:
: On Windows, this will display a message box
Parameters:
msg The string to display

StringVector Utils::explodeString ( uchar  delimiter,
const ustring &  str 
)

Break a string apart based on a delimiting character.

Parameters:
delimiter The character to use as a separator
str The string to break apart
Returns:
A string vector with the pieces of the broken string

StringVector Utils::explodeString ( const ustring &  delimiter,
const ustring &  str 
)

Break a string apart based on a delimiting substring.

Parameters:
delimiter The substring to use as a separator
str The string to break apart
Returns:
A string vector with the pieces of the broken string

Point Utils::getMouseLocation ( Uint8 *  modState = NULL  ) 

Get the location of the mouse pointer.

Parameters:
modState Optional SDL mod button state
Returns:
The current mouse location

ustring Utils::itoa ( int  num  ) 

Convert an integer to string.

Parameters:
num The integer value
Returns:
A string with this value

Color Utils::keyToColor ( char  ch  ) 

Map a char representing a text color to the actual color.

Parameters:
ch The color code character
Returns:
Completed Color object based on provided color code

bool Utils::pointInRect ( const Point p,
const Rect rect 
)

See if a point is in a rectangle.

Parameters:
p The point to test
rect The rect to test against
Returns:
true if the point is in range, false otherwise

int Utils::randomRange ( int  min,
int  max 
)

Get a random number in the provided range.

Parameters:
min The lower value in the range
max The upper value in the range
Returns:
A random number in this range

void Utils::scriptToLimits ( const ustring &  str,
UI::Limit start,
UI::Limit end 
)

Convert a court camera script string to animation limits.

The provided string should be in the form of: "location1,location2" or the returned limits won't be correct

Parameters:
str The string
start The returned beginning location
end The returned end location

ustring Utils::ucharToStr ( uchar  ch  ) 

Convert a Unicode char to a string.

Parameters:
ch The character
Returns:
A string with this character


Generated on Fri Feb 22 22:29:24 2008 for Phoenix Wright Case Player API by  doxygen 1.5.3