new editor settings customization of where to run the game from the editor
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
/*************************************************************************/
|
||||
#include "editor_run.h"
|
||||
#include "globals.h"
|
||||
|
||||
#include "editor_settings.h"
|
||||
|
||||
EditorRun::Status EditorRun::get_status() const {
|
||||
|
||||
@@ -61,6 +61,70 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int screen = EditorSettings::get_singleton()->get("game_window_placement/screen");
|
||||
|
||||
if (screen==0) {
|
||||
screen=OS::get_singleton()->get_current_screen();
|
||||
} else {
|
||||
screen--;
|
||||
}
|
||||
|
||||
Rect2 screen_rect;
|
||||
screen_rect.pos=OS::get_singleton()->get_screen_position(screen);
|
||||
screen_rect.size=OS::get_singleton()->get_screen_size(screen);
|
||||
|
||||
|
||||
Size2 desired_size;
|
||||
|
||||
desired_size.x=Globals::get_singleton()->get("display/width");
|
||||
desired_size.y=Globals::get_singleton()->get("display/height");
|
||||
|
||||
Size2 test_size;
|
||||
test_size.x=Globals::get_singleton()->get("display/test_width");
|
||||
test_size.y=Globals::get_singleton()->get("display/test_height");
|
||||
if (test_size.x>0 && test_size.y>0) {
|
||||
|
||||
desired_size=test_size;
|
||||
}
|
||||
|
||||
|
||||
int window_placement=EditorSettings::get_singleton()->get("game_window_placement/rect");
|
||||
|
||||
switch(window_placement) {
|
||||
case 0: { // default
|
||||
|
||||
args.push_back("-p");
|
||||
args.push_back(itos(screen_rect.pos.x)+"x"+itos(screen_rect.pos.y));
|
||||
} break;
|
||||
case 1: { // centered
|
||||
Vector2 pos=screen_rect.pos+((screen_rect.size-desired_size)/2).floor();
|
||||
args.push_back("-p");
|
||||
args.push_back(itos(pos.x)+"x"+itos(pos.y));
|
||||
} break;
|
||||
case 2: { // custom pos
|
||||
Vector2 pos = EditorSettings::get_singleton()->get("game_window_placement/rect_custom_position");
|
||||
pos+=screen_rect.pos;
|
||||
args.push_back("-p");
|
||||
args.push_back(itos(pos.x)+"x"+itos(pos.y));
|
||||
} break;
|
||||
case 3: { // force maximized
|
||||
Vector2 pos=screen_rect.pos;
|
||||
args.push_back("-p");
|
||||
args.push_back(itos(pos.x)+"x"+itos(pos.y));
|
||||
args.push_back("-mx");
|
||||
|
||||
} break;
|
||||
case 4: { // force fullscreen
|
||||
|
||||
Vector2 pos=screen_rect.pos;
|
||||
args.push_back("-p");
|
||||
args.push_back(itos(pos.x)+"x"+itos(pos.y));
|
||||
args.push_back("-f");
|
||||
} break;
|
||||
}
|
||||
|
||||
|
||||
if (p_breakpoints.size()) {
|
||||
|
||||
args.push_back("-bp");
|
||||
|
||||
@@ -496,6 +496,15 @@ void EditorSettings::_load_defaults() {
|
||||
set("2d_editor/bone_selected_color",Color(0.9,0.45,0.45,0.9));
|
||||
set("2d_editor/bone_ik_color",Color(0.9,0.9,0.45,0.9));
|
||||
|
||||
set("game_window_placement/rect",0);
|
||||
hints["game_window_placement/rect"]=PropertyInfo(Variant::INT,"game_window_placement/rect",PROPERTY_HINT_ENUM,"Default,Centered,Custom Position,Force Maximized,Force Full Screen");
|
||||
String screen_hints="Default (Same as Editor)";
|
||||
for(int i=0;i<OS::get_singleton()->get_screen_count();i++) {
|
||||
screen_hints+=",Monitor "+itos(i+1);
|
||||
}
|
||||
set("game_window_placement/rect_custom_position",Vector2());
|
||||
set("game_window_placement/screen",0);
|
||||
hints["game_window_placement/screen"]=PropertyInfo(Variant::INT,"game_window_placement/screen",PROPERTY_HINT_ENUM,screen_hints);
|
||||
|
||||
set("on_save/compress_binary_resources",true);
|
||||
set("on_save/save_modified_external_resources",true);
|
||||
|
||||
Reference in New Issue
Block a user