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
108
109
110
111
112
113
114
115
116
/*
Copyright (c) 2017 DIVIDE-Studio
Copyright (c) 2009 Ionut Cava

This file is part of DIVIDE Framework.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software
and associated documentation files (the "Software"), to deal in the Software
without restriction,
including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/

#ifndef _CORE_WINDOW_MANAGER_H_
#define _CORE_WINDOW_MANAGER_H_

#include "Platform/Headers/DisplayWindow.h"
#include "Utility/Headers/Colours.h"

namespace Divide {

enum class RenderAPI : U32;

struct WindowDescriptor {
    enum class Flags : U8 {
        FULLSCREEN = toBit(1),
        DECORATED = toBit(2),
        RESIZEABLE = toBit(3),
        HIDDEN = toBit(4),
        ALLOW_HIGH_DPI = toBit(5)
    };

    U32 targetDisplay = 0;
    stringImpl title;
    vec2<U16> dimensions;
    vec4<F32> clearColour = DefaultColours::DIVIDE_BLUE;
    U32 flags = to_base(Flags::DECORATED) | to_base(Flags::RESIZEABLE) | to_base(Flags::ALLOW_HIGH_DPI);
};

class PlatformContext;
class WindowManager {
public:
    WindowManager();
    ~WindowManager();

    ErrorCode init(PlatformContext& context,
                   RenderAPI api,
                   const vec2<U16>& initialResolution,
                   bool startFullScreen,
                   I32 targetDisplayIndex);

    void close();

    void update(const U64 deltaTimeUS);

    bool anyWindowFocus() const;

    void setActiveWindow(U32 index);
    U32 createWindow(const WindowDescriptor& descriptor, ErrorCode& err);
    bool destroyWindow(DisplayWindow*& window);

    inline I32 targetDisplay() const;
    inline void targetDisplay(I32 displayIndex);

    void setCursorPosition(I32 x, I32 y) const;
    vec2<I32> getCursorPosition() const;
    void snapCursorToCenter() const;

    inline DisplayWindow& getActiveWindow();
    inline const DisplayWindow& getActiveWindow() const;
    inline DisplayWindow& getWindow(I64 guid);
    inline const DisplayWindow& getWindow(I64 guid) const;
    inline DisplayWindow& getWindow(U32 index);
    inline const DisplayWindow& getWindow(U32 index) const;

    inline U32 getWindowCount() const;

    void handleWindowEvent(WindowEvent event, I64 winGUID, I32 data1, I32 data2);

    vec2<U16> getFullscreenResolution() const;

protected:
    U32 createAPIFlags(RenderAPI api);
    void pollSDLEvents();

protected:
    U32 _apiFlags;
    I32 _displayIndex;
    I64 _activeWindowGUID;
    I64 _mainWindowGUID;
    I64 _focusedWindowGUID;
    PlatformContext* _context;
    vectorImpl<DisplayWindow*> _windows;
};
}; //namespace Divide
#endif //_CORE_WINDOW_MANAGER_H_

#include "WindowManager.inl"

Commits for Divide-Framework/trunk/Source Code/Core/Headers/WindowManager.h

Diff revisions: vs.
Revision Author Commited Message
970 Diff Diff IonutCava picture IonutCava Mon 13 Nov, 2017 17:16:44 +0000

[Ionut]
- ImWindow <-> DisplayWindow fixes

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

968 Diff Diff IonutCava picture IonutCava Tue 07 Nov, 2017 17:32:31 +0000

[Ionut]
- Consistent naming between timing variables

963 Diff Diff IonutCava picture IonutCava Sun 05 Nov, 2017 18:31:51 +0000

[Ionut]
- More multi-window fixes
- Profile guided performance improvements

962 Diff Diff IonutCava picture IonutCava Fri 03 Nov, 2017 17:17:55 +0000

[Ionut]
- Fix creation/destruction of multiple DisplayWindows
- Add an InputInterface per DisplayWindow
- More work on the ImWindow based Editor

960 Diff Diff IonutCava picture IonutCava Thu 02 Nov, 2017 17:39:53 +0000

[Ionut]
- Started porting ImWindow to our command buffer based rendering system.
- Also moved mouse positioning system to the window manager since mouse position is always relative to the active window

951 Diff Diff IonutCava picture IonutCava Mon 23 Oct, 2017 23:25:49 +0000

[Ionut]
- Added a new project to the solution: Divide-Editor
— This project will be a Unity-style tool for the framework built using IMGUI and ImWindow
— Examples:

- Modified DisplayWindow class heavily to support new requirements

921 Diff Diff IonutCava picture IonutCava Fri 28 Jul, 2017 17:46:23 +0000

[Ionut]
- Fix HiZ Construction
- Fix Window close requests

836 Diff Diff IonutCava picture IonutCava Fri 27 Jan, 2017 14:59:56 +0000

[IonutCava]
- Update copyright notice

829 IonutCava picture IonutCava Tue 24 Jan, 2017 17:28:39 +0000

[IonutCava]
- Separate resourceLocation for resources into resourceLocation and resourceName.
- More XML config loading refactoring