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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include "stdafx.h"

#include "Headers/GUIButton.h"

#include "Platform/Audio/Headers/SFXDevice.h"

#include <CEGUI/CEGUI.h>

namespace Divide {

GUIButton::AudioCallback GUIButton::_soundCallback;

GUIButton::GUIButton(U64 guiID,
                     const stringImpl& name,
                     const stringImpl& text,
                     const stringImpl& guiScheme,
                     const RelativePosition2D& offset,
                     const RelativeScale2D& size,
                     CEGUI::Window* parent,
                     ButtonCallback callback,
                     AudioDescriptor_ptr onClickSound)
    : GUIElement(guiID, name, parent, GUIType::GUI_BUTTON),
      _callbackFunction(callback),
      _btnWindow(nullptr),
      _onClickSound(onClickSound)
{
    
    _btnWindow = CEGUI::WindowManager::getSingleton().createWindow((guiScheme + "/Button").c_str(), text.c_str());

    _btnWindow->setPosition(offset);

    _btnWindow->setSize(size);

    _btnWindow->setText(text.c_str());

    _btnWindow->subscribeEvent(CEGUI::PushButton::EventClicked,
                               CEGUI::Event::Subscriber(&GUIButton::joystickButtonPressed, this));

    _parent->addChild(_btnWindow);
    setActive(true);
}

GUIButton::~GUIButton()
{
    _parent->removeChild(_btnWindow);
}

void GUIButton::setActive(const bool active) {
    if (isActive() != active) {
        _btnWindow->setEnabled(active);
        GUIElement::setActive(active);
    }
}

void GUIButton::setVisible(const bool visible) {
    if (isVisible() != visible) {
        _btnWindow->setVisible(visible);
        GUIElement::setVisible(visible);
    }
}

void GUIButton::setText(const stringImpl& text) {
    _btnWindow->setText(text.c_str());
}

void GUIButton::setTooltip(const stringImpl& tooltipText) {
    _btnWindow->setTooltipText(tooltipText.c_str());
}

void GUIButton::setFont(const stringImpl& fontName,
                        const stringImpl& fontFileName, U32 size) {
    if (!fontName.empty()) {
        if (!CEGUI::FontManager::getSingleton().isDefined(fontName.c_str())) {
            CEGUI::FontManager::getSingleton().createFreeTypeFont(
                fontName.c_str(), to_F32(size), true, fontFileName.c_str());
        }

        if (CEGUI::FontManager::getSingleton().isDefined(fontName.c_str())) {
            _btnWindow->setFont(fontName.c_str());
        }
    }
}

bool GUIButton::joystickButtonPressed(const CEGUI::EventArgs& /*e*/) {
    if (_callbackFunction) {
        _callbackFunction(getGUID());
        if (_onClickSound && _soundCallback) {
            _soundCallback(_onClickSound);
        }
        return true;
    }
    return false;
}

void GUIButton::setOnClickSound(const AudioDescriptor_ptr& onClickSound) {
    _onClickSound = onClickSound;
}


bool GUIButton::soundCallback(const AudioCallback& cbk) {
    bool hasCbk = _soundCallback ? true : false;
    _soundCallback = cbk;

    return hasCbk;
}

};

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

Diff revisions: vs.
Revision Author Commited Message
1003 Diff Diff IonutCava picture IonutCava Tue 19 Dec, 2017 17:08:06 +0000

[Ionut]
- GUI cleanup

1002 Diff Diff IonutCava picture IonutCava Mon 18 Dec, 2017 17:31:54 +0000

[Ionut]
- Cleanup GUI a bit
- Disable some nVidia GL warnings

979 Diff Diff IonutCava picture IonutCava Tue 21 Nov, 2017 23:24:57 +0000

[Ionut]
- W.I.P. Rework GUI element positioning and scaling
- Update ImGUI and IMGUI_ADDONS

969 Diff Diff IonutCava picture IonutCava Mon 13 Nov, 2017 00:15:57 +0000

[Ionut]
- Further improve DisplayWindow <-> Input relationship
- Add Flip-Y 2D camera (D3D style projection)
- Fix IMGUI rendering
- Add IMGUI sample and IMWINDOW sample rendering at the same time
- Improve IMWINDOW multi-window support
— Bug: nothing rendering in child platform windows
- Add draw command to move render context from one window to another

966 Diff Diff IonutCava picture IonutCava Mon 06 Nov, 2017 17:10:01 +0000

[Ionut]
- Remove old “add2DRenderFunction” and use command buffers instead
- Allow frame to blit to the screen or a render target of choice

952 Diff Diff IonutCava picture IonutCava Wed 25 Oct, 2017 00:35:37 +0000

[Ionut]
- Added the CEGUI rendering project to our solution for easier modification, debugging and integration
- Updated to OIS 1.4
- Some updates to the WindowHandle struct

  • Only compiled in Debug*
941 Diff Diff IonutCava picture IonutCava Mon 04 Sep, 2017 20:55:02 +0000

[Ionut]
- Update CEGUI from static to dynamic config (some dlls might still be missing)
- Attempt to work around a weird string issue with the newest VS2017 update

890 Diff Diff IonutCava picture IonutCava Sun 14 May, 2017 20:54:59 +0000

[Ionut]
- Add pre-compiled header support
- Initial code for per-stage tessellation computation

867 Diff Diff IonutCava picture IonutCava Mon 20 Feb, 2017 17:01:12 +0000

[IonutCava]
- Rename to_XNN and to_const_XNN functions to reflect the target data type they are converting to.
- Cleanup Angle namespace and remove all “inDegrees” parameters from rotation functions. Use aliases to differentiate between Degree and Radian parameters.
- Profile guided optimizations.

804 IonutCava picture IonutCava Thu 01 Dec, 2016 17:20:59 +0000

[IonutCava]
- Singleton elimination update Part I: get it to compile
— The following classes are no longer Singletons: GFXDevice, GL_API, DX_API, SFXWrapper, FmodWrapper, SDLWrapper, ALWrapper, PXDevice, InputInterface, RenderPassManager, SceneManager and ResourceManager;
— Refactor system to a Context / Component based implementation (Pass relevant context to objects: e.g. GFXDevice object to Textures, GUI to GUIElements, etc)
— Make devices and managers components of the kernel
— Allow multiple Resource caches to co-exist. This may prove useful for later when a more fragmented memory model is need (per frame / per scene / global caches / etc)

  • next steps: part II – cleanup/refactor new code, part III – optimise code, part IV – remove remaining Singletons (e.g. Application, ParamHandler, FrameListenerManager, Recast, PostFX and DebugInterface)