xoreos
0.0.5
|
#include <dialog.h>
Classes | |
struct | Reply |
A PC reply. More... | |
struct | ReplyLine |
A line of a PC reply. More... | |
Public Member Functions | |
DialogBox (float width, float height) | |
~DialogBox () | |
void | show () |
Show the box. More... | |
void | hide () |
Hide the box. More... | |
float | getWidth () const |
Return the box's width. More... | |
float | getHeight () const |
Return the box's height. More... | |
void | getPosition (float &x, float &y, float &z) const |
Return the box's position. More... | |
void | setPosition (float x, float y, float z) |
Set the box's position. More... | |
void | clear () |
Clear the complete contents. More... | |
void | setPortrait (const Common::UString &portrait) |
Set the current speaker's portrait. More... | |
void | setName (const Common::UString &name) |
Set the current speaker's name. More... | |
void | clearEntry () |
Clear the NPC entry. More... | |
void | setEntry (const Common::UString &entry) |
Set the NPC entry. More... | |
void | clearReplies () |
Clear the PC replies. More... | |
void | addReply (const Common::UString &reply, uint32 id) |
Add a PC reply. More... | |
void | finishReplies () |
Finished adding PC replies. More... | |
void | mouseMove (int x, int y) |
Notify the box that the mouse was moved. More... | |
void | mouseClick (int x, int y) |
Notify the box that the mouse was clicked. More... | |
void | pickReply (uint32 n) |
Pick the reply number n. More... | |
uint32 | getPickedID () const |
Return the reply ID that was clicked. More... | |
void | calculateDistance () |
Calculate the object's distance. More... | |
void | render (Graphics::RenderPass pass) |
Render the object. More... | |
Public Member Functions inherited from Graphics::GUIElement | |
GUIElement (GUIElementType type) | |
~GUIElement () | |
Public Member Functions inherited from Graphics::Renderable | |
Renderable (RenderableType type) | |
~Renderable () | |
bool | operator< (const Queueable &q) const |
virtual void | advanceTime (float dt) |
Advance time (used by renderables with animations). More... | |
virtual void | renderImmediate (const glm::mat4 &parentTransform) |
For shader based systems, don't sort anything, render this right_now. More... | |
virtual void | queueRender (const glm::mat4 &parentTransform) |
Queue the object for later rendering. More... | |
double | getDistance () const |
Get the distance of the object from the viewer. More... | |
uint32 | getID () const |
Get the object's unique ID. More... | |
bool | isClickable () const |
Is the object clickable? More... | |
void | setClickable (bool clickable) |
Set the object's clickable state. More... | |
const Common::UString & | getTag () const |
Get the object's tag. More... | |
void | setTag (const Common::UString &tag) |
Set the object's tag. More... | |
bool | isVisible () const |
Is the object visible? More... | |
virtual bool | isIn (float x, float y, float z) const |
Is that point within the object? More... | |
virtual bool | isIn (float x1, float y1, float z1, float x2, float y2, float z2) const |
Does the line from x1.y1.z1 to x2.y2.z2 intersect with the object? More... | |
Public Member Functions inherited from Graphics::Queueable | |
Queueable () | |
virtual | ~Queueable () |
Private Member Functions | |
void | showEntry () |
Show the entry. More... | |
void | hideEntry () |
Hide the entry. More... | |
void | showReplies () |
Show the replies. More... | |
void | hideReplies () |
Hide the replies. More... | |
bool | isIn (float x, float y) const |
Are the coordinates inside the box? More... | |
void | setHighlight (const std::list< ReplyLine >::iterator &h) |
Set the highlighted reply. More... | |
Private Attributes | |
float | _width |
The box's width. More... | |
float | _height |
The box's height. More... | |
float | _x |
The box's X position. More... | |
float | _y |
The box's Y position. More... | |
float | _z |
The box's Z position. More... | |
Common::ScopedPtr< Portrait > | _portrait |
The current speaker's portrait. More... | |
Common::ScopedPtr< Graphics::Aurora::Text > | _name |
The current speaker's name. More... | |
Graphics::Aurora::FontHandle | _font |
The dialog font. More... | |
Common::UString | _entry |
The NPC entry. More... | |
std::list< Reply > | _replies |
The PC replies. More... | |
Common::PtrList< Graphics::Aurora::Text > | _entryLines |
The NPC text lines. More... | |
std::list< ReplyLine > | _replyLines |
The PC text lines. More... | |
uint32 | _replyCount |
The number of replies. More... | |
float | _replyCountWidth |
The max width of a reply number text. More... | |
std::list< ReplyLine >::iterator | _highlightedReply |
The currently highlighted reply. More... | |
std::list< Reply >::const_iterator | _pickedReply |
The picked (clicked) reply. More... | |
Additional Inherited Members | |
Public Types inherited from Graphics::GUIElement | |
enum | GUIElementType { kGUIElementFront = kRenderableTypeGUIFront, kGUIElementBack = kRenderableTypeGUIBack, kGUIElementConsole = kRenderableTypeConsole } |
Protected Member Functions inherited from Graphics::Renderable | |
void | resort () |
void | lockFrame () |
void | unlockFrame () |
void | lockFrameIfVisible () |
void | unlockFrameIfVisible () |
Protected Member Functions inherited from Graphics::Queueable | |
bool | isInQueue (QueueType queue) const |
void | addToQueue (QueueType queue) |
void | removeFromQueue (QueueType queue) |
void | lockQueue (QueueType queue) |
void | unlockQueue (QueueType queue) |
void | sortQueue (QueueType queue) |
Protected Attributes inherited from Graphics::Renderable | |
QueueType | _queueExists |
QueueType | _queueVisible |
uint32 | _id |
bool | _clickable |
Common::UString | _tag |
double | _distance |
The distance of the object from the viewer. More... | |
Engines::NWN::DialogBox::DialogBox | ( | float | width, |
float | height | ||
) |
Definition at line 83 of file dialog.cpp.
References _font, _highlightedReply, _name, _pickedReply, _portrait, _replies, _replyLines, ConfigMan, FontMan, kLightBlueB, kLightBlueG, kLightBlueR, Engines::NWN::Portrait::kSizeMedium, and Common::ScopedPtrBase< T, Deallocator >::reset().
Engines::NWN::DialogBox::~DialogBox | ( | ) |
Definition at line 101 of file dialog.cpp.
References clearEntry(), and clearReplies().
void Engines::NWN::DialogBox::addReply | ( | const Common::UString & | reply, |
uint32 | id | ||
) |
|
virtual |
Calculate the object's distance.
Implements Graphics::Renderable.
Definition at line 483 of file dialog.cpp.
References Graphics::Renderable::_distance, and _z.
void Engines::NWN::DialogBox::clear | ( | ) |
Clear the complete contents.
Definition at line 218 of file dialog.cpp.
References clearEntry(), clearReplies(), setName(), and setPortrait().
void Engines::NWN::DialogBox::clearEntry | ( | ) |
Clear the NPC entry.
Definition at line 248 of file dialog.cpp.
References _entry, _entryLines, Common::PtrList< T, Deallocator >::clear(), Common::UString::clear(), Common::UString::empty(), GfxMan, and hideEntry().
Referenced by clear(), setEntry(), and ~DialogBox().
void Engines::NWN::DialogBox::clearReplies | ( | ) |
Clear the PC replies.
Definition at line 312 of file dialog.cpp.
References _pickedReply, _replies, _replyCount, _replyCountWidth, _replyLines, hideReplies(), and setHighlight().
Referenced by clear(), and ~DialogBox().
void Engines::NWN::DialogBox::finishReplies | ( | ) |
Finished adding PC replies.
Definition at line 334 of file dialog.cpp.
References _font, _replies, _replyCount, _replyCountWidth, _replyLines, _width, _x, _y, _z, Common::UString::format(), Graphics::Aurora::FontHandle::getFont(), Graphics::Renderable::isVisible(), kLightBlueB, kLightBlueG, kLightBlueR, MAX(), setPosition(), showReplies(), Graphics::Font::split(), and TokenMan.
float Engines::NWN::DialogBox::getHeight | ( | ) | const |
uint32 Engines::NWN::DialogBox::getPickedID | ( | ) | const |
Return the reply ID that was clicked.
Definition at line 430 of file dialog.cpp.
References _pickedReply, _replies, and Aurora::DLGFile::kInvalidLine.
void Engines::NWN::DialogBox::getPosition | ( | float & | x, |
float & | y, | ||
float & | z | ||
) | const |
float Engines::NWN::DialogBox::getWidth | ( | ) | const |
|
virtual |
Hide the box.
Reimplemented from Graphics::Renderable.
Definition at line 120 of file dialog.cpp.
References _name, _portrait, GfxMan, Graphics::Renderable::hide(), hideEntry(), and hideReplies().
|
private |
Hide the entry.
Definition at line 242 of file dialog.cpp.
References _entryLines.
Referenced by clearEntry(), and hide().
|
private |
Hide the replies.
Definition at line 302 of file dialog.cpp.
References _replyLines.
Referenced by clearReplies(), and hide().
|
privatevirtual |
Are the coordinates inside the box?
Reimplemented from Graphics::Renderable.
Definition at line 134 of file dialog.cpp.
References _height, _width, _x, and _y.
Referenced by mouseMove().
void Engines::NWN::DialogBox::mouseClick | ( | int | x, |
int | y | ||
) |
Notify the box that the mouse was clicked.
Definition at line 411 of file dialog.cpp.
References _highlightedReply, _pickedReply, _replies, _replyLines, and mouseMove().
void Engines::NWN::DialogBox::mouseMove | ( | int | x, |
int | y | ||
) |
Notify the box that the mouse was moved.
Definition at line 393 of file dialog.cpp.
References _replyLines, CursorMan, isIn(), and setHighlight().
Referenced by mouseClick().
void Engines::NWN::DialogBox::pickReply | ( | uint32 | n | ) |
Pick the reply number n.
Definition at line 420 of file dialog.cpp.
References _pickedReply, _replies, and _replyCount.
|
virtual |
Render the object.
Implements Graphics::Renderable.
Definition at line 487 of file dialog.cpp.
References _height, _width, _x, _y, Graphics::kRenderPassOpaque, pass, and TextureMan.
void Engines::NWN::DialogBox::setEntry | ( | const Common::UString & | entry | ) |
Set the NPC entry.
Definition at line 262 of file dialog.cpp.
References _entry, _entryLines, _font, _portrait, _width, _x, _y, _z, clearEntry(), Common::UString::empty(), Graphics::Aurora::FontHandle::getFont(), GfxMan, Graphics::Renderable::isVisible(), setPosition(), showEntry(), Graphics::Font::split(), and TokenMan.
|
private |
Set the highlighted reply.
Definition at line 437 of file dialog.cpp.
References _highlightedReply, _replyLines, kLightBlueB, kLightBlueG, and kLightBlueR.
Referenced by clearReplies(), and mouseMove().
void Engines::NWN::DialogBox::setName | ( | const Common::UString & | name | ) |
Set the current speaker's name.
Definition at line 230 of file dialog.cpp.
References _name.
Referenced by clear().
void Engines::NWN::DialogBox::setPortrait | ( | const Common::UString & | portrait | ) |
Set the current speaker's portrait.
Definition at line 226 of file dialog.cpp.
References _portrait.
Referenced by clear().
void Engines::NWN::DialogBox::setPosition | ( | float | x, |
float | y, | ||
float | z | ||
) |
Set the box's position.
Definition at line 157 of file dialog.cpp.
References _entryLines, _font, _height, _name, _portrait, _replyCountWidth, _replyLines, _x, _y, _z, Graphics::Aurora::FontHandle::getFont(), Graphics::Font::getHeight(), Graphics::Font::getLineSpacing(), GfxMan, and Graphics::Renderable::resort().
Referenced by finishReplies(), and setEntry().
|
virtual |
Show the box.
Reimplemented from Graphics::Renderable.
Definition at line 106 of file dialog.cpp.
References _name, _portrait, GfxMan, Graphics::Renderable::show(), showEntry(), and showReplies().
|
private |
Show the entry.
Definition at line 236 of file dialog.cpp.
References _entryLines.
Referenced by setEntry(), and show().
|
private |
Show the replies.
Definition at line 292 of file dialog.cpp.
References _replyLines.
Referenced by finishReplies(), and show().
|
private |
|
private |
The NPC text lines.
Definition at line 166 of file dialog.h.
Referenced by clearEntry(), hideEntry(), setEntry(), setPosition(), and showEntry().
|
private |
The dialog font.
Definition at line 161 of file dialog.h.
Referenced by DialogBox(), finishReplies(), setEntry(), and setPosition().
|
private |
The box's height.
Definition at line 149 of file dialog.h.
Referenced by getHeight(), isIn(), render(), and setPosition().
|
private |
The currently highlighted reply.
Definition at line 172 of file dialog.h.
Referenced by DialogBox(), mouseClick(), and setHighlight().
|
private |
The current speaker's name.
Definition at line 158 of file dialog.h.
Referenced by DialogBox(), hide(), setName(), setPosition(), and show().
|
private |
The picked (clicked) reply.
Definition at line 173 of file dialog.h.
Referenced by clearReplies(), DialogBox(), getPickedID(), mouseClick(), and pickReply().
|
private |
The current speaker's portrait.
Definition at line 156 of file dialog.h.
Referenced by DialogBox(), hide(), setEntry(), setPortrait(), setPosition(), and show().
|
private |
The PC replies.
Definition at line 164 of file dialog.h.
Referenced by addReply(), clearReplies(), DialogBox(), finishReplies(), getPickedID(), mouseClick(), and pickReply().
|
private |
The number of replies.
Definition at line 169 of file dialog.h.
Referenced by clearReplies(), finishReplies(), and pickReply().
|
private |
The max width of a reply number text.
Definition at line 170 of file dialog.h.
Referenced by clearReplies(), finishReplies(), and setPosition().
|
private |
The PC text lines.
Definition at line 167 of file dialog.h.
Referenced by clearReplies(), DialogBox(), finishReplies(), hideReplies(), mouseClick(), mouseMove(), setHighlight(), setPosition(), and showReplies().
|
private |
The box's width.
Definition at line 148 of file dialog.h.
Referenced by finishReplies(), getWidth(), isIn(), render(), and setEntry().
|
private |
The box's X position.
Definition at line 151 of file dialog.h.
Referenced by finishReplies(), getPosition(), isIn(), render(), setEntry(), and setPosition().
|
private |
The box's Y position.
Definition at line 152 of file dialog.h.
Referenced by finishReplies(), getPosition(), isIn(), render(), setEntry(), and setPosition().
|
private |
The box's Z position.
Definition at line 153 of file dialog.h.
Referenced by calculateDistance(), finishReplies(), getPosition(), setEntry(), and setPosition().