#include <uimanager.h>
Public Member Functions | |
Manager (Case::Case *pcase) | |
Constructor. | |
Animation * | getAnimation (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 Manager * | instance () |
Get the only instance of this class. | |
Private Attributes | |
Case::Case * | m_Case |
Pointer to current case. | |
std::map< ustring, Animation > | m_Animations |
Map of registered animations. |
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:
UI::Manager::Manager | ( | Case::Case * | pcase | ) |
UI::Manager * UI::Manager::instance | ( | ) | [static] |
Get the only instance of this class.
UI::Animation * UI::Manager::getAnimation | ( | const ustring & | id | ) |
Get a pointer to an animation struct.
void UI::Manager::handleGUIClick | ( | const Point & | mouse, | |
const ustring & | id | |||
) |
Handle any mouse events on a GUI element.
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.
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.
id | The ID of the animation |
void UI::Manager::unsyncBounceTexture | ( | const ustring & | id, | |
bool | left | |||
) |
Disable one texture of a synchronized bounce animation.
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.
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.
void UI::Manager::setGUIButtonText | ( | const ustring & | id, | |
const ustring & | text | |||
) |
Set button text for a GUI button.
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.
id | The ID of the button to check | |
p | The current position of the cursor |
void UI::Manager::clickGUIButton | ( | const ustring & | id | ) |
Executes the callback for the clicked button and prepares it for animation.
id | The ID of the button |
void UI::Manager::registerGUIButton | ( | const ustring & | id, | |
int | w, | |||
const Button & | button | |||
) |
Register a GUI button.
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
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.
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.
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.
id | The ID of the animation |
void UI::Manager::registerTestimonySequence | ( | const ustring & | id | ) |
Register a testimony sprite sequence animation.
id | The ID of the animation |
void UI::Manager::registerCrossExamineSequence | ( | const ustring & | id | ) |
Register a cross examination sprite sequence animation.
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.
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()
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.
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!").
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.
id | The ID of the animation |
void UI::Manager::registerAddEvidenceSequence | ( | const ustring & | id | ) |
Register an animation to handle adding evidence.
id | The ID of the animation |
void UI::Manager::drawAnimation | ( | const ustring & | id | ) |
Draw an arbitrary animation.
id | The ID of the animation |
int UI::Manager::fadeOut | ( | const ustring & | id | ) |
Fade out the current scene to black.
id | The ID of the animation |
int UI::Manager::animateAddEvidence | ( | const ustring & | id, | |
const Case::Evidence * | evidence | |||
) |
animate the add evidence animation
id | The ID of the animation | |
evidence | Pointer to evidence to include in the animation |
bool UI::Manager::flash | ( | const ustring & | id | ) |
Perform a flash effect.
id | The ID of the animation |
bool UI::Manager::blink | ( | const ustring & | id | ) |
Perform an image blink animation.
id | The ID of the animation |
bool UI::Manager::exclamation | ( | const ustring & | id, | |
const Character * | source | |||
) |
Perform an exclamation animation.
id | The ID of the animation | |
source | The character who is the source of this exclamation |
bool UI::Manager::slideBG | ( | const ustring & | id, | |
SDL_Surface * | bg | |||
) |
Slide a background image.
id | The ID of the animation | |
bg | The background image |
bool UI::Manager::moveCourtCamera | ( | const ustring & | id, | |
SDL_Surface * | panorama, | |||
UI::Limit | start, | |||
UI::Limit | end | |||
) |
Perform a court camera movement.
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 |
bool UI::Manager::animateTestimonySequence | ( | const ustring & | id | ) |
Animate the testimony sprite sequence.
id | The ID of the animation |
bool UI::Manager::animateCrossExamineSequence | ( | const ustring & | id, | |
SDL_Surface * | leftLawyer, | |||
SDL_Surface * | rightLawyer | |||
) |
Animate the cross examination sprite sequence.
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 |
bool UI::Manager::animateSyncBounce | ( | const ustring & | id | ) |
Animate a synchronized bounce animation.
id | The ID of the animation |
bool UI::Manager::animateGreenBar | ( | const ustring & | id | ) |
Animate the green bar for cross examination attempts and other misc things.
id | The ID of the animation |
bool UI::Manager::animateGUIButton | ( | const ustring & | id | ) |
Animate a GUI button.
id | The ID of the button |