Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add command parser #26213

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions core/bind/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ _ResourceSaver::_ResourceSaver() {

/////////////////OS

CommandParser *_OS::get_command_parser() const {
return OS::get_singleton()->get_command_parser();
}

void _OS::global_menu_add_item(const String &p_menu, const String &p_label, const Variant &p_signal, const Variant &p_meta) {

OS::get_singleton()->global_menu_add_item(p_menu, p_label, p_signal, p_meta);
Expand Down Expand Up @@ -542,6 +546,18 @@ Vector<String> _OS::get_cmdline_args() {
return cmdlinev;
}

Vector<String> _OS::get_project_args() {

List<String> cmdline = OS::get_singleton()->get_project_args();
Vector<String> cmdlinev;
for (List<String>::Element *E = cmdline.front(); E; E = E->next()) {

cmdlinev.push_back(E->get());
}

return cmdlinev;
}

String _OS::get_locale() const {

return OS::get_singleton()->get_locale();
Expand Down Expand Up @@ -1169,6 +1185,8 @@ _OS *_OS::singleton = NULL;

void _OS::_bind_methods() {

ClassDB::bind_method(D_METHOD("get_command_parser"), &_OS::get_command_parser);

//ClassDB::bind_method(D_METHOD("get_mouse_position"),&_OS::get_mouse_position);
//ClassDB::bind_method(D_METHOD("is_mouse_grab_enabled"),&_OS::is_mouse_grab_enabled);

Expand Down Expand Up @@ -1267,6 +1285,7 @@ void _OS::_bind_methods() {

ClassDB::bind_method(D_METHOD("get_name"), &_OS::get_name);
ClassDB::bind_method(D_METHOD("get_cmdline_args"), &_OS::get_cmdline_args);
ClassDB::bind_method(D_METHOD("get_project_args"), &_OS::get_project_args);

ClassDB::bind_method(D_METHOD("get_datetime", "utc"), &_OS::get_datetime, DEFVAL(false));
ClassDB::bind_method(D_METHOD("get_date", "utc"), &_OS::get_date, DEFVAL(false));
Expand Down
3 changes: 3 additions & 0 deletions core/bind/core_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ class _OS : public Object {
MONTH_DECEMBER
};

CommandParser *get_command_parser() const;

void global_menu_add_item(const String &p_menu, const String &p_label, const Variant &p_signal, const Variant &p_meta);
void global_menu_add_separator(const String &p_menu);
void global_menu_remove_item(const String &p_menu, int p_idx);
Expand Down Expand Up @@ -238,6 +240,7 @@ class _OS : public Object {

String get_name() const;
Vector<String> get_cmdline_args();
Vector<String> get_project_args();

String get_locale() const;
String get_latin_keyboard_variant() const;
Expand Down
Loading