-Renamed GlobalConfig to ProjectSettings, makes more sense.
-Added system for feature overrides, it's pretty cool :)
This commit is contained in:
parent
89588d4334
commit
25678b1876
162 changed files with 1296 additions and 831 deletions
|
|
@ -28,7 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "dir_access.h"
|
||||
#include "global_config.h"
|
||||
#include "project_settings.h"
|
||||
#include "os/file_access.h"
|
||||
#include "os/memory.h"
|
||||
#include "os/os.h"
|
||||
|
|
@ -37,7 +37,7 @@ String DirAccess::_get_root_path() const {
|
|||
|
||||
switch (_access_type) {
|
||||
|
||||
case ACCESS_RESOURCES: return GlobalConfig::get_singleton()->get_resource_path();
|
||||
case ACCESS_RESOURCES: return ProjectSettings::get_singleton()->get_resource_path();
|
||||
case ACCESS_USERDATA: return OS::get_singleton()->get_data_dir();
|
||||
default: return "";
|
||||
}
|
||||
|
|
@ -200,10 +200,10 @@ String DirAccess::fix_path(String p_path) const {
|
|||
|
||||
case ACCESS_RESOURCES: {
|
||||
|
||||
if (GlobalConfig::get_singleton()) {
|
||||
if (ProjectSettings::get_singleton()) {
|
||||
if (p_path.begins_with("res://")) {
|
||||
|
||||
String resource_path = GlobalConfig::get_singleton()->get_resource_path();
|
||||
String resource_path = ProjectSettings::get_singleton()->get_resource_path();
|
||||
if (resource_path != "") {
|
||||
|
||||
return p_path.replace_first("res:/", resource_path);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include "core/io/file_access_pack.h"
|
||||
#include "core/io/marshalls.h"
|
||||
#include "global_config.h"
|
||||
#include "project_settings.h"
|
||||
#include "os/os.h"
|
||||
|
||||
#include "thirdparty/misc/md5.h"
|
||||
|
|
@ -135,10 +135,10 @@ String FileAccess::fix_path(const String &p_path) const {
|
|||
|
||||
case ACCESS_RESOURCES: {
|
||||
|
||||
if (GlobalConfig::get_singleton()) {
|
||||
if (ProjectSettings::get_singleton()) {
|
||||
if (r_path.begins_with("res://")) {
|
||||
|
||||
String resource_path = GlobalConfig::get_singleton()->get_resource_path();
|
||||
String resource_path = ProjectSettings::get_singleton()->get_resource_path();
|
||||
if (resource_path != "") {
|
||||
|
||||
return r_path.replace("res:/", resource_path);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "input.h"
|
||||
#include "global_config.h"
|
||||
#include "project_settings.h"
|
||||
#include "input_map.h"
|
||||
#include "os/os.h"
|
||||
Input *Input::singleton = NULL;
|
||||
|
|
@ -101,7 +101,7 @@ void Input::get_argument_options(const StringName &p_function, int p_idx, List<S
|
|||
if (p_idx == 0 && (pf == "is_action_pressed" || pf == "action_press" || pf == "action_release" || pf == "is_action_just_pressed" || pf == "is_action_just_released")) {
|
||||
|
||||
List<PropertyInfo> pinfo;
|
||||
GlobalConfig::get_singleton()->get_property_list(&pinfo);
|
||||
ProjectSettings::get_singleton()->get_property_list(&pinfo);
|
||||
|
||||
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
|
||||
const PropertyInfo &pi = E->get();
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ bool InputEvent::is_action_type() const {
|
|||
if (String(p_method) == "is_action" && p_argidx == 0) {
|
||||
|
||||
List<PropertyInfo> pinfo;
|
||||
GlobalConfig::get_singleton()->get_property_list(&pinfo);
|
||||
ProjectSettings::get_singleton()->get_property_list(&pinfo);
|
||||
|
||||
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
|
||||
const PropertyInfo &pi = E->get();
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@
|
|||
#include "os.h"
|
||||
|
||||
#include "dir_access.h"
|
||||
#include "global_config.h"
|
||||
#include "input.h"
|
||||
#include "os/file_access.h"
|
||||
#include "project_settings.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
|
|
@ -260,7 +260,7 @@ String OS::get_locale() const {
|
|||
|
||||
String OS::get_resource_dir() const {
|
||||
|
||||
return GlobalConfig::get_singleton()->get_resource_path();
|
||||
return ProjectSettings::get_singleton()->get_resource_path();
|
||||
}
|
||||
|
||||
String OS::get_system_dir(SystemDir p_dir) const {
|
||||
|
|
@ -269,7 +269,7 @@ String OS::get_system_dir(SystemDir p_dir) const {
|
|||
}
|
||||
|
||||
String OS::get_safe_application_name() const {
|
||||
String an = GlobalConfig::get_singleton()->get("application/config/name");
|
||||
String an = ProjectSettings::get_singleton()->get("application/config/name");
|
||||
Vector<String> invalid_char = String("\\ / : * ? \" < > |").split(" ");
|
||||
for (int i = 0; i < invalid_char.size(); i++) {
|
||||
an = an.replace(invalid_char[i], "-");
|
||||
|
|
@ -494,6 +494,24 @@ int OS::get_power_percent_left() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
bool OS::check_feature_support(const String &p_feature) {
|
||||
|
||||
if (p_feature == get_name())
|
||||
return true;
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (p_feature == "debug")
|
||||
return true;
|
||||
#else
|
||||
if (p_feature == "release")
|
||||
return true;
|
||||
#endif
|
||||
|
||||
if (_check_internal_feature_support(p_feature))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
OS::OS() {
|
||||
last_error = NULL;
|
||||
singleton = this;
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ protected:
|
|||
virtual void set_cmdline(const char *p_execpath, const List<String> &p_args);
|
||||
|
||||
void _ensure_data_dir();
|
||||
virtual bool _check_internal_feature_support(const String &p_feature) = 0;
|
||||
|
||||
public:
|
||||
typedef int64_t ProcessID;
|
||||
|
|
@ -408,7 +409,7 @@ public:
|
|||
virtual int get_power_seconds_left();
|
||||
virtual int get_power_percent_left();
|
||||
|
||||
virtual bool check_feature_support(const String &p_feature) = 0;
|
||||
bool check_feature_support(const String &p_feature);
|
||||
|
||||
bool is_hidpi_allowed() const { return _allow_hidpi; }
|
||||
OS();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue