SpeechBubble.hpp

Go to the documentation of this file.
00001 /*
00002 SagaEngine library
00003 Copyright (c) 2002-2006 Skalden Studio AS
00004 
00005 This software is provided 'as-is', without any express or implied 
00006 warranty. In no event will the authors be held liable for any 
00007 damages arising from the use of this software.
00008 
00009 Permission is granted to distribute the library under the terms of the 
00010 Q Public License version 1.0. Be sure to read and understand the license
00011 before using the library. It should be included here, or you may read it
00012 at http://www.trolltech.com/products/qt/licenses/licensing/qpl
00013 
00014 The original version of this library can be located at:
00015 http://www.sagaengine.com/
00016 
00017 Rune Myrland
00018 rune@skalden.com
00019 */
00020 
00021 
00022 #ifndef o3d_widget_SpeechBubble_hpp
00023 #define o3d_widget_SpeechBubble_hpp
00024 
00025 #include "O3dPre.hpp"
00026 #include "sim/message/MessageListener.hpp"
00027 #include "o3d/input/InputHandler.hpp"
00028 #include <OgreOverlay.h>
00029 #include <OgreOverlayElement.h>
00030 
00031 namespace se_ogre {
00032     class _SeOgreExport SpeechBubble : public se_core::MessageListener, InputHandler {
00033     public:
00034         SpeechBubble();
00035         virtual ~SpeechBubble();
00036 
00037         bool init();
00038         void cleanup();
00039 
00040         void infoEvent(char* text);
00041         void startMonologueEvent(se_core::Actor& speaker);
00042         void stopMonologueEvent(se_core::Actor& speaker);
00043         void speechEvent(se_core::Actor& speaker, const char* messageName);
00044         void trackUserFeedback();
00045 
00046         void keyPressed(const OIS::KeyEvent* e) {
00047             trackUserFeedback();
00048         }
00049         bool joyButtonPressed (int button) {
00050             trackUserFeedback();
00051             return true;
00052         }
00053         void mousePressed(const OIS::MouseEvent* e, int button) {
00054             trackUserFeedback();
00055         }
00056 
00057         void keyReleased(const OIS::KeyEvent* e) {
00058             if(!below()) return;
00059             below()->keyReleased(e);
00060         }
00061 
00062         bool joyButtonReleased (int button) {
00063             if(!below()) return true;
00064             return below()->joyButtonReleased(button);
00065         }
00066 
00067         void mouseReleased(const OIS::MouseEvent* e, int button) {
00068             if(!below()) return;
00069             below()->mouseReleased(e, button);
00070         }
00071 
00072         static bool translate(const char* messageName, wchar_t* buffer);
00073         void grabbedFocusEvent();
00074         void lostFocusEvent();
00075 
00076     private:
00077         bool isMonologue_, shouldTrack_;
00078         se_core::Actor* speaker_;
00079         const se_core::Physics* speakerCamera_;
00080         Ogre::Overlay* speechOverlay_,* infoOverlay_;
00081         Ogre::OverlayElement* speechCaption_,* infoCaption_;
00082         static const int MAX_LINE_LENGTH = 50;
00083     };
00084 }
00085 
00086 #endif

Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:09 2007 by Doxygen version 1.3.9.1.

SourceForge.net Logo