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
/*
   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_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::PLATFORM_CLOSE_ERROR: {
            return "Could not deinitialize target platform!";
        };

        case ErrorCode::PLATFORM_INIT_ERROR: {
            return "Could not initialize target platform!";
        };

        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::WINDOW_INIT_ERROR: {
            return "Windowing system 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::GLSL_INIT_ERROR: {
            return "GLSL pre-init failed";
        };
        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::OGL_OLD_HARDWARE: {
        	return "Current hardware does not support the minimum Opengl "
        	       "features required or the maximum supported version is too old"; 
        };
        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::OCL_INIT_ERROR: {
            return "OpenCL could not find any compatible devices!";
        };
        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 void Application::RequestShutdown() {
    _requestShutdown = true;
}

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

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

inline Kernel& Application::kernel() const {
    assert(_kernel != nullptr);
    return *_kernel;
}

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

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

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.getActiveWindow().getDimensions();
    setCursorPosition(to_int(center.x / 2), to_int(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<void>& cbk) {
    _shutdownCallback.push_back(cbk);
}

};  // namespace Divide

#endif  //_CORE_APPLICATION_INL_

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

Diff revisions: vs.
Revision Author Commited Message
842 Diff Diff IonutCava picture IonutCava Wed 01 Feb, 2017 17:25:15 +0000

[IonutCava]
- Start to implement scripting support via ChaiScript: http://chaiscript.com/
- Cleanup DELEGATE_CBK alias

837 Diff Diff IonutCava picture IonutCava Sun 29 Jan, 2017 15:45:58 +0000

[IonutCava]
- File system updates

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

[IonutCava]
- Update copyright notice

768 Diff Diff IonutCava picture IonutCava Fri 09 Sep, 2016 14:38:51 +0000

[IonutCava]
- Refactored framework entry points (init, step, shutdown) to allow the addition of hot code reloading in the future

734 Diff Diff IonutCava picture IonutCava Tue 21 Jun, 2016 16:28:11 +0000

[IonutCava]
- Added a render target pool:
— All render targets are now allocated (and tracked) by the GFXDevice.
— Allocation routines return a slim RenderTargetHandle object that will be used later on in draw commands.

- Added a refraction render pass that will handle translucent objects that need refracted textures instead of clear transparency
— Both reflective nodes and refractive nodes are not gathered properly at this point

- All API specific objects (buffers, textures, etc) are now initialized in the GFXDevice class (see GFXDeviceObjects.cpp)
— This allowed for the slimming of the RenderAPIWrapper interface

- Improved ENABLE_GPU_VALIDATION macro utilization:
— It enabled shadow map split plane debugging
— It bypasses loading shaders from text cache

686 Diff Diff IonutCava picture IonutCava Thu 21 Apr, 2016 16:24:19 +0000

[IonutCava]
- Refactor the scene self-registering system to prevent linker related issues
- Add a SGNRelationshipCache class that can quickly verify if any 2 given nodes are related in any way
— This should speed up Octree updates by a lot

note: The template refactoring code has significantly slowed down performance for reasons yet unknown. Investigating.

679 Diff Diff IonutCava picture IonutCava Wed 13 Apr, 2016 21:21:51 +0000

[IonutCava]
- Add unit tests for task system
- Adapt task system for better modularity
- Split Divide-Game into Game lib and Game executable projects
- Cleanup unit test projects

669 Diff Diff IonutCava picture IonutCava Mon 04 Apr, 2016 16:15:35 +0000

[IonutCava]
- Move Task creation calls to TaskPool.h
- Allow tasks to use any pool, but default behaviour is to use the Kernel’s main task pool
- Change image transparency check to use the task pool instead of OpenMP
— Perfect place for future parallel_for implementation
- Warning fixes
- Some method renaming for improved readability

660 Diff Diff IonutCava picture IonutCava Mon 21 Mar, 2016 17:11:19 +0000

[IonutCava]
- Finish Parent<->Children thread pool system
- Use new thread pool system for most multithreaded tasks in the engine: culling, sorting, light preparation, etc
- Add platform specific init/close calls at the start and end of the main function for future use

654 IonutCava picture IonutCava Tue 01 Mar, 2016 17:22:09 +0000

[Ionut]
- Moved window related code from rendering API code into proper classes:
— DisplayWindow handles SDL based window management
— WindowManager handles multiple DisplayWindow instances
— Code still needs proper extensive testing
- Small performance optimizations