UI::Manager Class Reference

The core class that manages all user interface animations and GUI effects. More...

#include <uimanager.h>

List of all members.

Public Member Functions

 Manager (Case::Case *pcase)
 Constructor.
AnimationgetAnimation (const ustring &id)
 Get a pointer to an animation struct.
void handleGUIClick (const Point &mouse, const ustring &id)
 Handle any mouse events on a GUI element.
void handleGUIClick (const Point &mouse, const StringVector &ids)
 Iterate over all GUI elements, see which were clicked, and execute callbacks.
void reverseVelocity (const ustring &id)
 Reverse the velocity of a registered animation.
void unsyncBounceTexture (const ustring &id, bool left)
 Disable one texture of a synchronized bounce animation.
void resyncBounceTexture (const ustring &id, bool left)
 Enable one texture of a synchronized bounce animation.
bool isGUIBusy ()
 See if any GUI animations are still occurring.
void setGUIButtonText (const ustring &id, const ustring &text)
 Set button text for a GUI button.
bool mouseOverButton (const ustring &id, const Point &p)
 Check to see if the mouse is over a button.
void clickGUIButton (const ustring &id)
 Executes the callback for the clicked button and prepares it for animation.
void registerGUIButton (const ustring &id, int w, const Button &button)
 Register a GUI button.
void registerSideBounceAnimation (const ustring &id, const ustring &texture, bool horizontal, const Point &origin, int limitA, int limitB, int speed)
 Register an animation that bounces an image from side to side.
void registerFadeOut (const ustring &id, int speed, const AnimType &type)
 Register a fade out effect.
void registerFlash (const ustring &id, int speed)
 Register a flash effect.
void registerCourtCameraMovement (const ustring &id)
 Register a court camera movement effect.
void registerTestimonySequence (const ustring &id)
 Register a testimony sprite sequence animation.
void registerCrossExamineSequence (const ustring &id)
 Register a cross examination sprite sequence animation.
void registerBlink (const ustring &id, const ustring &texture, const Point &p, int speed)
 Register an animation that blinks an image.
void registerSyncBounce (const ustring &id, const ustring &tex1, const ustring &tex2, const Point &p1, const Point &p2, int limA, int limB, int speed)
 Register a synchronized image bounce animation.
void registerGreenBarControl (const ustring &id, const ustring &texture, const Point &p)
 Register a green bar control animation.
void registerExclamation (const ustring &id, const ustring &texture, const Point &p)
 Register an exclamation animation ("Objection!", "Hold It!", and "Take That!").
void registerBGSlide (const ustring &id)
 Register a sliding background animation.
void registerAddEvidenceSequence (const ustring &id)
 Register an animation to handle adding evidence.
void drawAnimation (const ustring &id)
 Draw an arbitrary animation.
int fadeOut (const ustring &id)
 Fade out the current scene to black.
int animateAddEvidence (const ustring &id, const Case::Evidence *evidence)
 animate the add evidence animation
bool flash (const ustring &id)
 Perform a flash effect.
bool blink (const ustring &id)
 Perform an image blink animation.
bool exclamation (const ustring &id, const Character *source)
 Perform an exclamation animation.
bool slideBG (const ustring &id, SDL_Surface *bg)
 Slide a background image.
bool moveCourtCamera (const ustring &id, SDL_Surface *panorama, Limit start, Limit end)
 Perform a court camera movement.
bool animateTestimonySequence (const ustring &id)
 Animate the testimony sprite sequence.
bool animateCrossExamineSequence (const ustring &id, SDL_Surface *leftLawyer, SDL_Surface *rightLawyer)
 Animate the cross examination sprite sequence.
bool animateSyncBounce (const ustring &id)
 Animate a synchronized bounce animation.
bool animateGreenBar (const ustring &id)
 Animate the green bar for cross examination attempts and other misc things.
bool animateGUIButton (const ustring &id)
 Animate a GUI button.

Static Public Member Functions

static Managerinstance ()
 Get the only instance of this class.

Private Attributes

Case::Casem_Case
 Pointer to current case.
std::map< ustring,
Animation
m_Animations
 Map of registered animations.


Detailed Description

The core class that manages all user interface animations and GUI effects.

This class is responsible for storing, allocating, and drawing various types of animations that are found in the player. There should only be once instance of this class, and that is in the actual Game class itself, although other functions can make use of the UI::Manager's drawing utilities by calling the UI::Manager::instance() function, which will return the pointer to the instance of the allocated class itself.

Most of the rendering functions return a bool, which signifies whether or not the animation in question has completed. If an animation returns an int, then the value returned will represent the current state of the animation; that is, these types of animations are done in two parts:


Constructor & Destructor Documentation

UI::Manager::Manager ( Case::Case pcase  ) 

Constructor.

Parameters:
pcase Pointer to a Case::Case object to use for this manager


Member Function Documentation

UI::Manager * UI::Manager::instance (  )  [static]

Get the only instance of this class.

Returns:
A pointer to the only instance of this class

UI::Animation * UI::Manager::getAnimation ( const ustring &  id  ) 

Get a pointer to an animation struct.

Returns:
A pointer to the Animation struct requested, NULL if it doesn't exist

void UI::Manager::handleGUIClick ( const Point mouse,
const ustring &  id 
)

Handle any mouse events on a GUI element.

Parameters:
mouse Current position of cursor
id ID of GUI element to check

void UI::Manager::handleGUIClick ( const Point mouse,
const StringVector &  ids 
)

Iterate over all GUI elements, see which were clicked, and execute callbacks.

Parameters:
mouse Current position of cursor
ids String vector of IDs of elements to check

void UI::Manager::reverseVelocity ( const ustring &  id  ) 

Reverse the velocity of a registered animation.

Parameters:
id The ID of the animation

void UI::Manager::unsyncBounceTexture ( const ustring &  id,
bool  left 
)

Disable one texture of a synchronized bounce animation.

Parameters:
id The ID of the animation
left Passing true disables left texture, false disables right

void UI::Manager::resyncBounceTexture ( const ustring &  id,
bool  left 
)

Enable one texture of a synchronized bounce animation.

Parameters:
id The ID of the animation
left Passing true enables left texture, false enables right

bool UI::Manager::isGUIBusy (  ) 

See if any GUI animations are still occurring.

Returns:
true if there are animations still active, false otherwise

void UI::Manager::setGUIButtonText ( const ustring &  id,
const ustring &  text 
)

Set button text for a GUI button.

Parameters:
id The ID of the button
text The text to set

bool UI::Manager::mouseOverButton ( const ustring &  id,
const Point p 
)

Check to see if the mouse is over a button.

Parameters:
id The ID of the button to check
p The current position of the cursor
Returns:
true if there is a button under the cursor, false otherwise

void UI::Manager::clickGUIButton ( const ustring &  id  ) 

Executes the callback for the clicked button and prepares it for animation.

Parameters:
id The ID of the button

void UI::Manager::registerGUIButton ( const ustring &  id,
int  w,
const Button button 
)

Register a GUI button.

Parameters:
id The ID of the button
w The maximum width this button can occupy
button The Button object to register

void UI::Manager::registerSideBounceAnimation ( const ustring &  id,
const ustring &  texture,
bool  horizontal,
const Point origin,
int  limitA,
int  limitB,
int  speed 
)

Register an animation that bounces an image from side to side.

Limits are relative to origin; that is, if origin is (100, 100), and if the animation should bounce sideways 10 pixels in each direction, limits should be -10 and 10, respectively

Parameters:
id The ID of the animation
texture The image to associate
horizontal Flag whether or not this animation bounces the image horizontally, or vertically
origin The initial starting point
limitA The left limit
limitB The right limit
speed The speed of the animation

void UI::Manager::registerFadeOut ( const ustring &  id,
int  speed,
const AnimType type 
)

Register a fade out effect.

Parameters:
id The ID of the animation
speed The speed of the fade out
type The type of fade out

void UI::Manager::registerFlash ( const ustring &  id,
int  speed 
)

Register a flash effect.

Parameters:
id The ID of the animation
speed The speed of the flash

void UI::Manager::registerCourtCameraMovement ( const ustring &  id  ) 

Register a court camera movement effect.

Parameters:
id The ID of the animation

void UI::Manager::registerTestimonySequence ( const ustring &  id  ) 

Register a testimony sprite sequence animation.

Parameters:
id The ID of the animation

void UI::Manager::registerCrossExamineSequence ( const ustring &  id  ) 

Register a cross examination sprite sequence animation.

Parameters:
id The ID of the animation

void UI::Manager::registerBlink ( const ustring &  id,
const ustring &  texture,
const Point p,
int  speed 
)

Register an animation that blinks an image.

Parameters:
id The ID of the animation
texture The image to associate
p The point at which to draw the image
speed The speed of the blinking effect

void UI::Manager::registerSyncBounce ( const ustring &  id,
const ustring &  tex1,
const ustring &  tex2,
const Point p1,
const Point p2,
int  limA,
int  limB,
int  speed 
)

Register a synchronized image bounce animation.

For an explanation of the limits in this function, see the documentation for UI::Manager::registerSideBounceAnimation()

Parameters:
id The ID of the animation
tex1 The first image
tex2 The second image
p1 The point at which to draw the first image
p2 The point at which to draw the second image
limA The left limit
limB The right limit
speed The speed of the bounce animation

void UI::Manager::registerGreenBarControl ( const ustring &  id,
const ustring &  texture,
const Point p 
)

Register a green bar control animation.

Parameters:
id The ID of the animation
texture The image to use for the green bar
p The point at which to draw this animation

void UI::Manager::registerExclamation ( const ustring &  id,
const ustring &  texture,
const Point p 
)

Register an exclamation animation ("Objection!", "Hold It!", and "Take That!").

Parameters:
id The ID of the animation
texture The image to use for the exclamation
p The point at which to draw the animation

void UI::Manager::registerBGSlide ( const ustring &  id  ) 

Register a sliding background animation.

Parameters:
id The ID of the animation

void UI::Manager::registerAddEvidenceSequence ( const ustring &  id  ) 

Register an animation to handle adding evidence.

Parameters:
id The ID of the animation

void UI::Manager::drawAnimation ( const ustring &  id  ) 

Draw an arbitrary animation.

Parameters:
id The ID of the animation

int UI::Manager::fadeOut ( const ustring &  id  ) 

Fade out the current scene to black.

Parameters:
id The ID of the animation
Returns:
An animation return code (see the description of these functions)

int UI::Manager::animateAddEvidence ( const ustring &  id,
const Case::Evidence evidence 
)

animate the add evidence animation

Parameters:
id The ID of the animation
evidence Pointer to evidence to include in the animation
Returns:
An animation return code (see the description of these functions)

bool UI::Manager::flash ( const ustring &  id  ) 

Perform a flash effect.

Parameters:
id The ID of the animation
Returns:
true if the animation is done, false otherwise

bool UI::Manager::blink ( const ustring &  id  ) 

Perform an image blink animation.

Parameters:
id The ID of the animation
Returns:
true if the animation is done, false otherwise

bool UI::Manager::exclamation ( const ustring &  id,
const Character source 
)

Perform an exclamation animation.

Parameters:
id The ID of the animation
source The character who is the source of this exclamation
Returns:
true if the animation is done, false otherwise

bool UI::Manager::slideBG ( const ustring &  id,
SDL_Surface *  bg 
)

Slide a background image.

Parameters:
id The ID of the animation
bg The background image
Returns:
true if the animation is done, false otherwise

bool UI::Manager::moveCourtCamera ( const ustring &  id,
SDL_Surface *  panorama,
UI::Limit  start,
UI::Limit  end 
)

Perform a court camera movement.

Parameters:
id The ID of the animation
panorama Pointer to an image of a panorama of the court
start The starting location
end The ending location
Returns:
true if the animation is done, false otherwise

bool UI::Manager::animateTestimonySequence ( const ustring &  id  ) 

Animate the testimony sprite sequence.

Parameters:
id The ID of the animation
Returns:
true if the animation is done, false otherwise

bool UI::Manager::animateCrossExamineSequence ( const ustring &  id,
SDL_Surface *  leftLawyer,
SDL_Surface *  rightLawyer 
)

Animate the cross examination sprite sequence.

Parameters:
id The ID of the animation
leftLawyer Image of the character to appear in the upper image strip
rightLawyer Image of the character to appear in the lower image strip
Returns:
true if the animation is done, false otherwise

bool UI::Manager::animateSyncBounce ( const ustring &  id  ) 

Animate a synchronized bounce animation.

Parameters:
id The ID of the animation
Returns:
true if the animation is done, false otherwise

bool UI::Manager::animateGreenBar ( const ustring &  id  ) 

Animate the green bar for cross examination attempts and other misc things.

Parameters:
id The ID of the animation
Returns:
true if the animation is done, false otherwise

bool UI::Manager::animateGUIButton ( const ustring &  id  ) 

Animate a GUI button.

Parameters:
id The ID of the button
Returns:
true if the animation is done, false otherwise


The documentation for this class was generated from the following files:
Generated on Fri Feb 22 22:29:24 2008 for Phoenix Wright Case Player API by  doxygen 1.5.3