Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "Headers/SceneGUIElements.h"

#include "Headers/GUI.h"
#include "Headers/GUIFlash.h"
#include "Headers/GUIText.h"
#include "Headers/GUIButton.h"
#include "Headers/GUIConsole.h"
#include "Headers/GUIMessageBox.h"

#include "Platform/Video/Headers/GFXDevice.h"

#ifndef CEGUI_STATIC
#define CEGUI_STATIC
#include <CEGUI/CEGUI.h>
#endif //CEGUI_STATIC

namespace Divide {

SceneGUIElements::SceneGUIElements(Scene& parentScene, GUI& context)
    : GUIInterface(context, context.getDisplayResolution()),
      SceneComponent(parentScene)
{
}

SceneGUIElements::~SceneGUIElements()
{
}

void SceneGUIElements::draw(GFXDevice& context) {
    static vectorImpl<GUITextBatchEntry> textBatch;
    textBatch.resize(0);
    for (const GUIMap::value_type& guiStackIterator : _guiElements) {
        GUIElement& element = *guiStackIterator.second.first;
        // Skip hidden elements
        if (element.isVisible()) {
            // Cache text elements
            if (element.getType() == GUIType::GUI_TEXT) {
                GUIText& textElement = static_cast<GUIText&>(element);
                if (!textElement.text().empty()) {
                    textBatch.emplace_back(&textElement, textElement.getPosition(), textElement.getStateBlockHash());
                }
            }
            else {
                element.draw(context);
            }
        }
    }
    if (!textBatch.empty()) {
        Attorney::GFXDeviceGUI::drawText(context, textBatch);
    }
}

void SceneGUIElements::onEnable() {
    for (const GUIMap::value_type& guiStackIterator : _guiElements) {
        guiStackIterator.second.first->setVisible(guiStackIterator.second.second);
    }
}

void SceneGUIElements::onDisable() {
    for (const GUIMap::value_type& guiStackIterator : _guiElements) {
        guiStackIterator.second.first->setVisible(false);
    }
}

}; // namespace Divide

Commits for Divide-Framework/trunk/Source Code/GUI/SceneGUIElements.cpp

Diff revisions: vs.
Revision Author Commited Message
802 Diff Diff IonutCava picture IonutCava Tue 29 Nov, 2016 17:15:38 +0000

[IonutCava]
- GUI class is no longer a Singleton
- Reduced usage of GFXDevice::instance()

715 Diff Diff IonutCava picture IonutCava Fri 27 May, 2016 16:19:22 +0000

[IonutCava]
- Added initial Fade In / Fade Out post effect (used for scene transitions for now)
- Added a GUI Interface that handles a list of GUI elements (used by GUI and SceneGUIElements)
- Fixed some race conditions related to multi-threaded scene loading (a lot remain to be fixed)
- Improved per-thread GPU sync system a bit
- Simplified Singleton define macros (although we should get rid of singletons all together)

714 IonutCava picture IonutCava Thu 26 May, 2016 16:26:23 +0000

[IonutCava]
- Initial code for multithreaded scene load:
— Tasks can have a “sync with gpu” flag that will cause them to use a shared context (so they can call GL functions)
- Added per scene GUI lists that get passed to the main GUI class (still need a base class to hold the map and accessors to avoid code duplication)
- Re-enabled threading unit tests