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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
/*
   Copyright (c) 2015 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_APPLICATION_INL_
#define _CORE_APPLICATION_INL_

namespace Divide {

inline const char* getErrorCodeName(ErrorCode code) {
    switch (code) {
        default:
        case ErrorCode::NO_ERR: {
            return "Unknown error";
        };
        case ErrorCode::MISSING_SCENE_DATA: {
            return "Invalid Scene Data. SceneManager failed to load the "
                   "specified scene";
        };
        case ErrorCode::MISSING_SCENE_LOAD_CALL: {
            return "The specified scene failed to load all of its data "
                   "properly";
        };
        case ErrorCode::CPU_NOT_SUPPORTED: {
            return "The current CPU has an insufficient core count and "
                   "as such, it's not supported";
        }
        case ErrorCode::GFX_NOT_SUPPORTED: {
            return "The specified rendering API is not fully implemented and "
                   "as such, it's not supported";
        };
        case ErrorCode::GFX_NON_SPECIFIED: {
            return "No rendering API specified before trying to initialize the "
                   "GFX Device";
        };
        case ErrorCode::SFX_NON_SPECIFIED: {
            return "No audio API specified before trying to initialize the "
                   "SFX Device";
        };
        case ErrorCode::PFX_NON_SPECIFIED:{
            return "No physx API specified before trying to initialize the "
                   "PFX Device";
        };
        case ErrorCode::SDL_INIT_ERROR: {
            return "SDL failed to initialize";
        };
        case ErrorCode::SDL_WINDOW_INIT_ERROR: {
            return "SDL failed to create a valid window";
        };
        case ErrorCode::FONT_INIT_ERROR: {
            return "Font system failed to create a valid context";
        };
        case ErrorCode::GLBINGING_INIT_ERROR: {
            return "GLBinding failed to initialize";
        };
        case ErrorCode::GL_OLD_HARDWARE: {
            return "Current hardware does not support the minimum OpenGL "
                   "features required";
        };
        case ErrorCode::DX_INIT_ERROR: {
            return "DirectX API failed to initialize";
        };
        case ErrorCode::DX_OLD_HARDWARE: {
            return "Current hardware does not support the minimum DirectX "
                   "features required";
        };
        case ErrorCode::SDL_AUDIO_INIT_ERROR: {
            return "SDL Audio library failed to initialize";
        };
        case ErrorCode::SDL_AUDIO_MIX_INIT_ERROR: {
            return "SDL Audio Mixer failed to initialize";
        };
        case ErrorCode::FMOD_AUDIO_INIT_ERROR: {
            return "FMod Audio library failed to initialize";
        };
        case ErrorCode::OAL_INIT_ERROR: {
            return "OpenAL failed to initialize";
        };
        case ErrorCode::PHYSX_INIT_ERROR: {
            return "The PhysX library failed to initialize";
        };
        case ErrorCode::PHYSX_EXTENSION_ERROR: {
            return "The PhysX library failed to load the required extensions";
        };
        case ErrorCode::NO_LANGUAGE_INI: {
            return "Invalid language file";
        };
        case ErrorCode::NOT_ENOUGH_RAM: {
            return "Insufficient physical RAM available to run the application!";
        };
    };
}

inline const vec2<U16>& WindowManager::getResolution() const {
    return _resolution;
}

inline const vec2<U16>& WindowManager::getPreviousResolution() const {
    return _prevResolution;
}

inline void WindowManager::setResolutionWidth(U16 w) {
    _prevResolution.set(_resolution);
    _resolution.width = w;
}

inline void WindowManager::setResolutionHeight(U16 h) {
    _prevResolution.set(_resolution);
    _resolution.height = h;
}

inline void WindowManager::setResolution(const vec2<U16>& resolution) {
    _prevResolution.set(_resolution);
    _resolution.set(resolution);
}

inline const vec2<U16>& WindowManager::getWindowDimension() const {
    return getWindowDimension(mainWindowType());
}

inline const vec2<U16>& WindowManager::getWindowDimension(WindowType windowType) const {
    return _windowDimensions[to_uint(windowType)];
}

inline void WindowManager::setWindowDimension(const vec2<U16>& newDimension) {
    setWindowDimension(mainWindowType(), newDimension);
}

inline void WindowManager::setWindowDimension(WindowType windowType,
                                              const vec2<U16>& newDimension) {
    _windowDimensions[to_uint(windowType)].set(newDimension);
}

inline bool WindowManager::hasFocus() const {
    return _hasFocus;
}

inline void WindowManager::hasFocus(const bool state) {
    _hasFocus = state;
}

inline WindowType WindowManager::mainWindowType() const {
    return _activeWindowType;
}

inline void WindowManager::mainWindowType(WindowType type) {
    _activeWindowType = type;
}

inline void Application::RequestShutdown() {
    _requestShutdown = true;
}

inline void Application::CancelShutdown() {
    _requestShutdown = false;
}

inline bool Application::ShutdownRequested() const {
    return _requestShutdown;
}

inline Kernel& Application::getKernel() const {
    return *_kernel;
}

inline WindowManager& Application::getWindowManager() {
    return _windowManager;
}

inline const WindowManager& Application::getWindowManager() const {
    return _windowManager;
}

inline const std::thread::id& Application::getMainThreadID() const {
    return _threadID;
}

inline bool Application::isMainThread() const {
    return (_threadID == std::this_thread::get_id());
}

inline void Application::setMemoryLogFile(const stringImpl& fileName) {
    _memLogBuffer = fileName;
}

inline bool Application::mainLoopActive() const {
    return _mainLoopActive;
}

inline void Application::mainLoopActive(bool state) {
    _mainLoopActive = state;
}

inline bool Application::mainLoopPaused() const {
    return _mainLoopPaused;
}

inline void Application::mainLoopPaused(bool state) {
    _mainLoopPaused = state;
}

inline void Application::snapCursorToCenter() const {
    const vec2<U16>& center = _windowManager.getResolution();
    snapCursorToPosition(center.x / 2, center.y / 2);
}

inline void Application::throwError(ErrorCode err) {
    _errorCode = err;
}

inline ErrorCode Application::errorCode() const {
    return _errorCode;
}

inline void Application::registerShutdownCallback(const DELEGATE_CBK<>& cbk) {
    _shutdownCallback.push_back(cbk);
}

inline SysInfo& Application::getSysInfo() {
    return _sysInfo;
}

inline const SysInfo& Application::getSysInfo() const {
    return _sysInfo;
}

};  // namespace Divide

#endif  //_CORE_APPLICATION_INL_

Commits for Divide-Framework/trunk/Source Code/Core/Headers/Application.inl

Diff revisions: vs.
Revision Author Commited Message
446 Diff Diff IonutCava picture IonutCava Mon 25 May, 2015 19:37:45 +0000

[Ionut]
- SDL based windowing system:
— Support for Windowed/FullScreen windowed/Fullscreen mode

445 Diff Diff IonutCava picture IonutCava Fri 22 May, 2015 15:47:37 +0000

[Ionut]
- Experimental work on windowing system upgrades (to allow all 3 states: windowed / fullscreen / splash windows to exist and switch between each-other seamlessly)

442 Diff Diff IonutCava picture IonutCava Wed 20 May, 2015 15:25:02 +0000

[Ionut]
- Better platform handling:
— All platform specific code moved in 3 separate files: PlatformDefinesWindows / PlatformDefinesUnix / PlatformDefinesApple
— Added CPU and RAM check at startup to make sure we meet minimum requirements to run properly
- Smart pointers should never used MemoryManager_NEW for allocating memory (MemoryManager_NEW tracks allocations but must be matched with a DELETE call in order to no report leaks). Corrected.
- Zombification of Singletons is only enabled in Debug builds
- Fixed a bug in Task.cpp (nowTime check) that prevented some tasks to run on the first call (changed a ‘>’ check to a ‘>=’)
— This also fixed bounding box computations for skinned submeshes
- Improved dead zone handling for joysticks

366 Diff Diff IonutCava picture IonutCava Tue 10 Mar, 2015 16:56:30 +0000

[Ionut]
- More type safe enum replacement

358 Diff Diff IonutCava picture IonutCava Sun 01 Mar, 2015 22:44:38 +0000

[Ionut]
- Fixed some OpenGL initialization issues and function calls (no proper support for DSA yet)
- Cleanup up the Sound and Physics Wrappers
- Some readability improvements here and there

354 Diff Diff IonutCava picture IonutCava Fri 20 Feb, 2015 17:17:37 +0000

[Ionut]
- Replaced GLEW with glbinding (requires a CEGUI recompile. It currently crashes)
- Replaced most “SceneGraphNode* const sgn” expressions with "SceneGraphNode& sgn"
- Replaced some pointers to kernel to references to kernel
- Fixed compilation issues with EASTL
- Removed NPOT -> POT texture conversion code. Modern GPUs handle NPOT textures perfectly fine

350 Diff Diff IonutCava picture IonutCava Tue 10 Feb, 2015 16:25:39 +0000

[Ionut]
- Simplified some Util-namespace level functions by using STL algorithms where possible
- Formatted the entire codebase using clang-format with the following style: "{BasedOnStyle: Google, IndentWidth: 4}"
- Attempted to make ProfileTimer thread-safe (temp fix until std::chrono works properly in Visual Studio)

349 Diff Diff IonutCava picture IonutCava Fri 06 Feb, 2015 17:11:39 +0000

[Ionut]
- More raw pointer replacements
- Removed some redundant parameters to a few scene and application functions

343 Diff Diff IonutCava picture IonutCava Thu 15 Jan, 2015 17:30:12 +0000

[Ionut]
- Refactored 2 singletons into static classes (Console and TerrainLoader)
- Changed some C-casts to static_casts
- Updated copyright notices

337 IonutCava picture IonutCava Wed 17 Dec, 2014 17:25:16 +0000

[Ionut]
- Replaced all tabs with 4 spaces (some spacing may be off now. no way to check all the files.)
- Moved implementation details for ParamHandler, BoundingBox, BoundingSphere and ProfileTimer to proper .inl and .cpp files. (more to follow)
- Update all forward declared enums with the required storage type (as requested by the C++11 standard)