~ubuntu-branches/ubuntu/vivid/mygui/vivid

« back to all changes in this revision

Viewing changes to Demos/Demo_Controllers/DemoKeeper.cpp

  • Committer: Package Import Robot
  • Author(s): Scott Howard, Bret Curtis, Scott Howard
  • Date: 2014-09-18 17:57:48 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140918175748-dd8va78mvpw1jbes
Tags: 3.2.1-1
[ Bret Curtis ]
* Updated license for majority of files from LGPL to Expat (MIT)

[ Scott Howard ]
* New upstream release
* Updated patch to add build option for system GLEW libraries
* All patches accepted upstream except shared_libraries.patch
* Bumped SONAME due to dropped symbols, updated *.symbols and package
  names
* Updated license of debian/* to Expat with permission of all authors
* Don't install Doxygen autogenerated md5 and map files (thanks
  lintian)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*!
2
 
        @file
3
 
        @author         Albert Semenov
4
 
        @date           08/2008
5
 
*/
6
 
#include "Precompiled.h"
7
 
#include "DemoKeeper.h"
8
 
#include "Base/Main.h"
9
 
 
10
 
namespace demo
11
 
{
12
 
 
13
 
        DemoKeeper::DemoKeeper() :
14
 
                mMenu1(nullptr),
15
 
                mMenu2(nullptr),
16
 
                mMenu3(nullptr),
17
 
                mMenu4(nullptr),
18
 
                mIsAnim(false)
19
 
        {
20
 
        }
21
 
 
22
 
        void DemoKeeper::setupResources()
23
 
        {
24
 
                base::BaseManager::setupResources();
25
 
                addResourceLocation(getRootMedia() + "/Demos/Demo_Controllers");
26
 
                addResourceLocation(getRootMedia() + "/Common/Demos");
27
 
        }
28
 
 
29
 
        void DemoKeeper::createScene()
30
 
        {
31
 
                MyGUI::LayoutManager::getInstance().loadLayout("Wallpaper.layout");
32
 
                const MyGUI::VectorWidgetPtr& root = MyGUI::LayoutManager::getInstance().loadLayout("HelpPanel.layout");
33
 
                root.at(0)->findWidget("Text")->castType<MyGUI::TextBox>()->setCaption("ControllerFadeAlpha and ControllerPosition examples.");
34
 
 
35
 
                mIsAnim = false;
36
 
 
37
 
                mMenu1 = new State("Menu1.layout", ControllerType::Inertional);
38
 
                mMenu1->eventButtonPress = MyGUI::newDelegate(this, &DemoKeeper::notifyButtonPress);
39
 
 
40
 
                mMenu2 = new State("Menu2.layout", ControllerType::Accelerated);
41
 
                mMenu2->eventButtonPress = MyGUI::newDelegate(this, &DemoKeeper::notifyButtonPress);
42
 
 
43
 
                mMenu3 = new State("Menu3.layout", ControllerType::Slowed);
44
 
                mMenu3->eventButtonPress = MyGUI::newDelegate(this, &DemoKeeper::notifyButtonPress);
45
 
 
46
 
                mMenu4 = new State("Menu4.layout", ControllerType::Jump);
47
 
                mMenu4->eventButtonPress = MyGUI::newDelegate(this, &DemoKeeper::notifyButtonPress);
48
 
 
49
 
                mMenu1->setVisible(true);
50
 
                mType = ControllerType::Inertional;
51
 
        }
52
 
 
53
 
        void DemoKeeper::destroyScene()
54
 
        {
55
 
                delete mMenu1;
56
 
                mMenu1 = nullptr;
57
 
                delete mMenu2;
58
 
                mMenu2 = nullptr;
59
 
                delete mMenu3;
60
 
                mMenu3 = nullptr;
61
 
                delete mMenu4;
62
 
                mMenu4 = nullptr;
63
 
        }
64
 
 
65
 
        void DemoKeeper::notifyButtonPress(ControllerType _type, bool _complite)
66
 
        {
67
 
                if (_complite)
68
 
                {
69
 
                        mIsAnim = false;
70
 
                        return;
71
 
                }
72
 
 
73
 
                if (mType == _type || mIsAnim) return;
74
 
                mIsAnim = true;
75
 
 
76
 
                if (mType == ControllerType::Inertional) mMenu1->setVisible(false);
77
 
                else if (mType == ControllerType::Accelerated) mMenu2->setVisible(false);
78
 
                else if (mType == ControllerType::Slowed) mMenu3->setVisible(false);
79
 
                else if (mType == ControllerType::Jump) mMenu4->setVisible(false);
80
 
 
81
 
                mType = _type;
82
 
 
83
 
                if (mType == ControllerType::Inertional) mMenu1->setVisible(true);
84
 
                else if (mType == ControllerType::Accelerated) mMenu2->setVisible(true);
85
 
                else if (mType == ControllerType::Slowed) mMenu3->setVisible(true);
86
 
                else if (mType == ControllerType::Jump) mMenu4->setVisible(true);
87
 
        }
88
 
 
89
 
} // namespace demo
90
 
 
91
 
MYGUI_APP(demo::DemoKeeper)
 
1
/*!
 
2
        @file
 
3
        @author         Albert Semenov
 
4
        @date           08/2008
 
5
*/
 
6
#include "Precompiled.h"
 
7
#include "DemoKeeper.h"
 
8
#include "Base/Main.h"
 
9
 
 
10
namespace demo
 
11
{
 
12
 
 
13
        DemoKeeper::DemoKeeper() :
 
14
                mMenu1(nullptr),
 
15
                mMenu2(nullptr),
 
16
                mMenu3(nullptr),
 
17
                mMenu4(nullptr),
 
18
                mIsAnim(false)
 
19
        {
 
20
        }
 
21
 
 
22
        void DemoKeeper::setupResources()
 
23
        {
 
24
                base::BaseManager::setupResources();
 
25
                addResourceLocation(getRootMedia() + "/Demos/Demo_Controllers");
 
26
                addResourceLocation(getRootMedia() + "/Common/Demos");
 
27
        }
 
28
 
 
29
        void DemoKeeper::createScene()
 
30
        {
 
31
                base::BaseDemoManager::createScene();
 
32
                MyGUI::LayoutManager::getInstance().loadLayout("Wallpaper.layout");
 
33
                const MyGUI::VectorWidgetPtr& root = MyGUI::LayoutManager::getInstance().loadLayout("HelpPanel.layout");
 
34
                if (root.size() == 1)
 
35
                        root.at(0)->findWidget("Text")->castType<MyGUI::TextBox>()->setCaption("ControllerFadeAlpha and ControllerPosition examples.");
 
36
 
 
37
                mIsAnim = false;
 
38
 
 
39
                mMenu1 = new State("Menu1.layout", ControllerType::Inertional);
 
40
                mMenu1->eventButtonPress = MyGUI::newDelegate(this, &DemoKeeper::notifyButtonPress);
 
41
 
 
42
                mMenu2 = new State("Menu2.layout", ControllerType::Accelerated);
 
43
                mMenu2->eventButtonPress = MyGUI::newDelegate(this, &DemoKeeper::notifyButtonPress);
 
44
 
 
45
                mMenu3 = new State("Menu3.layout", ControllerType::Slowed);
 
46
                mMenu3->eventButtonPress = MyGUI::newDelegate(this, &DemoKeeper::notifyButtonPress);
 
47
 
 
48
                mMenu4 = new State("Menu4.layout", ControllerType::Jump);
 
49
                mMenu4->eventButtonPress = MyGUI::newDelegate(this, &DemoKeeper::notifyButtonPress);
 
50
 
 
51
                mMenu1->setVisible(true);
 
52
                mType = ControllerType::Inertional;
 
53
        }
 
54
 
 
55
        void DemoKeeper::destroyScene()
 
56
        {
 
57
                delete mMenu1;
 
58
                mMenu1 = nullptr;
 
59
                delete mMenu2;
 
60
                mMenu2 = nullptr;
 
61
                delete mMenu3;
 
62
                mMenu3 = nullptr;
 
63
                delete mMenu4;
 
64
                mMenu4 = nullptr;
 
65
        }
 
66
 
 
67
        void DemoKeeper::notifyButtonPress(ControllerType _type, bool _complite)
 
68
        {
 
69
                if (_complite)
 
70
                {
 
71
                        mIsAnim = false;
 
72
                        return;
 
73
                }
 
74
 
 
75
                if (mType == _type || mIsAnim) return;
 
76
                mIsAnim = true;
 
77
 
 
78
                if (mType == ControllerType::Inertional) mMenu1->setVisible(false);
 
79
                else if (mType == ControllerType::Accelerated) mMenu2->setVisible(false);
 
80
                else if (mType == ControllerType::Slowed) mMenu3->setVisible(false);
 
81
                else if (mType == ControllerType::Jump) mMenu4->setVisible(false);
 
82
 
 
83
                mType = _type;
 
84
 
 
85
                if (mType == ControllerType::Inertional) mMenu1->setVisible(true);
 
86
                else if (mType == ControllerType::Accelerated) mMenu2->setVisible(true);
 
87
                else if (mType == ControllerType::Slowed) mMenu3->setVisible(true);
 
88
                else if (mType == ControllerType::Jump) mMenu4->setVisible(true);
 
89
        }
 
90
 
 
91
} // namespace demo
 
92
 
 
93
MYGUI_APP(demo::DemoKeeper)