Project

General

Profile

SO3Engine
SO3FlashWidgetFactory.cpp
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
33
34namespace SO3
35{
36
38{
39 hikariFlashManager = new Hikari::HikariManager();
40 hikariFlashManager->setKeyboardHookEnabled(false); // Disable Hikari's keyboard hook, cause so3 already got one that manages widget keyboard events.
41 hikariFlashManager->setPath("");
42 Ogre::Root::getSingleton().addFrameListener(this);
43}
44
46{
47 Ogre::Root::getSingleton().removeFrameListener(this);
48 SO3_SAFE_DELETE(hikariFlashManager);
49}
50
51bool SFlashWidgetFactory::frameStarted(const Ogre::FrameEvent& evt)
52{
53 if(hikariFlashManager)
54 hikariFlashManager->update();
55
56 return true;
57}
58
59SWidget* SFlashWidgetFactory::CreateWidgetImpl(SScene* targetScene, const std::string& widgetName, const int& xPos, const int& yPos, const unsigned short& width, const unsigned short& height, SViewPort* targetViewport, const unsigned int& widgetZOrder)
60{
61 SFlashWidget* flashWidget = static_cast <SFlashWidget*> (new SFlashWidget(targetScene, widgetName, xPos, yPos, width, height, targetViewport, widgetZOrder));
62 return flashWidget;
63}
64
65SWidget* SFlashWidgetFactory::CreateWidgetImpl(SScene* targetScene, const std::string& widgetName, const int& xPos, const int& yPos, const unsigned short& width, const unsigned short& height, SViewPort* targetViewport)
66{
67 SFlashWidget* flashWidget = static_cast <SFlashWidget*> (new SFlashWidget(targetScene, widgetName, xPos, yPos, width, height, targetViewport));
68 return flashWidget;
69}
70
71SWidget* SFlashWidgetFactory::CreateWidgetImpl(SScene* targetScene, const std::string& widgetName, const unsigned short& width, const unsigned short& height, SMaterial* targetMaterial, const unsigned short& targetTechnique, const unsigned short& targetPass, const unsigned short& targetTextureUnit)
72{
73 SWidget* flashWidget = new SFlashWidget(targetScene, widgetName, width, height, targetMaterial, targetTechnique, targetPass, targetTextureUnit);
74 return flashWidget;
75}
76
78{
79 if(existingWidget)
80 {
81 delete(existingWidget);
82 existingWidget = 0;
83 }
84}
85
86}
void setKeyboardHookEnabled(bool isEnabled)
Definition Hikari.cpp:401
void setPath(const std::string &assetsDirectory="")
Definition Hikari.cpp:134
virtual bool frameStarted(const Ogre::FrameEvent &evt)
virtual SWidget * CreateWidgetImpl(SScene *targetScene, const std::string &widgetName, const int &xPos, const int &yPos, const unsigned short &width, const unsigned short &height, SViewPort *targetViewport, const unsigned int &widgetZOrder)
virtual void DeleteWidgetImpl(SWidget *existingWidget)