mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-03 23:21:15 +00:00 
			
		
		
		
	-added windowed mode with -w, fixes #3020
-changed default windowed resolution to 1280x720
This commit is contained in:
		
							parent
							
								
									ec8f0d7eb9
								
							
						
					
					
						commit
						cc7880fba5
					
				
					 5 changed files with 16 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -75,7 +75,7 @@ public:
 | 
			
		|||
		bool fullscreen;
 | 
			
		||||
		bool resizable;
 | 
			
		||||
		float get_aspect() const { return (float)width/(float)height; }
 | 
			
		||||
		VideoMode(int p_width=640,int p_height=480,bool p_fullscreen=false, bool p_resizable = true) {width=p_width; height=p_height; fullscreen=p_fullscreen; resizable = p_resizable; }
 | 
			
		||||
		VideoMode(int p_width=1280,int p_height=720,bool p_fullscreen=false, bool p_resizable = true) {width=p_width; height=p_height; fullscreen=p_fullscreen; resizable = p_resizable; }
 | 
			
		||||
	};
 | 
			
		||||
protected:
 | 
			
		||||
friend class Main;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -95,6 +95,7 @@ static TranslationServer *translation_server = NULL;
 | 
			
		|||
 | 
			
		||||
static OS::VideoMode video_mode;
 | 
			
		||||
static bool init_maximized=false;
 | 
			
		||||
static bool init_windowed=false;
 | 
			
		||||
static bool init_fullscreen=false;
 | 
			
		||||
static bool init_use_custom_pos=false;
 | 
			
		||||
static bool debug_collisions=false;
 | 
			
		||||
| 
						 | 
				
			
			@ -146,6 +147,7 @@ void Main::print_help(const char* p_binary) {
 | 
			
		|||
	OS::get_singleton()->print("\t-p XxY\t : Request Window Position\n");
 | 
			
		||||
	OS::get_singleton()->print("\t-f\t\t : Request Fullscreen\n");
 | 
			
		||||
	OS::get_singleton()->print("\t-mx\t\t Request Maximized\n");
 | 
			
		||||
	OS::get_singleton()->print("\t-w\t\t Request Windowed\n");
 | 
			
		||||
	OS::get_singleton()->print("\t-vd DRIVER\t : Video Driver (");
 | 
			
		||||
	for (int i=0;i<OS::get_singleton()->get_video_driver_count();i++) {
 | 
			
		||||
		
 | 
			
		||||
| 
						 | 
				
			
			@ -354,6 +356,9 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
 | 
			
		|||
		} else if (I->get()=="-mx") { // video driver
 | 
			
		||||
 | 
			
		||||
			init_maximized=true;
 | 
			
		||||
		} else if (I->get()=="-w") { // video driver
 | 
			
		||||
 | 
			
		||||
			init_windowed=true;
 | 
			
		||||
		} else if (I->get()=="-vd") { // video driver
 | 
			
		||||
		
 | 
			
		||||
			if (I->next()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -841,11 +846,7 @@ Error Main::setup2() {
 | 
			
		|||
	if (init_use_custom_pos) {
 | 
			
		||||
		OS::get_singleton()->set_window_position(init_custom_pos);
 | 
			
		||||
	}
 | 
			
		||||
	if (init_maximized) {
 | 
			
		||||
		OS::get_singleton()->set_window_maximized(true);
 | 
			
		||||
	} else if (init_fullscreen) {
 | 
			
		||||
		OS::get_singleton()->set_window_fullscreen(true);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	register_core_singletons();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -859,8 +860,12 @@ Error Main::setup2() {
 | 
			
		|||
	if (init_screen!=-1) {
 | 
			
		||||
		OS::get_singleton()->set_current_screen(init_screen);
 | 
			
		||||
	}
 | 
			
		||||
	if (init_maximized) {
 | 
			
		||||
	if (init_windowed) {
 | 
			
		||||
		//do none..
 | 
			
		||||
	} else if (init_maximized) {
 | 
			
		||||
		OS::get_singleton()->set_window_maximized(true);
 | 
			
		||||
	} else if (init_fullscreen) {
 | 
			
		||||
		OS::get_singleton()->set_window_fullscreen(true);
 | 
			
		||||
	}
 | 
			
		||||
	MAIN_PRINT("Main: Load Remaps");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -838,8 +838,8 @@ const char * OS_OSX::get_video_driver_name(int p_driver) const {
 | 
			
		|||
OS::VideoMode OS_OSX::get_default_video_mode() const {
 | 
			
		||||
 | 
			
		||||
	VideoMode vm;
 | 
			
		||||
	vm.width=800;
 | 
			
		||||
	vm.height=600;
 | 
			
		||||
	vm.width=1280;
 | 
			
		||||
	vm.height=720;
 | 
			
		||||
	vm.fullscreen=false;
 | 
			
		||||
	vm.resizable=true;
 | 
			
		||||
	return vm;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -148,7 +148,7 @@ const char * OS_Windows::get_video_driver_name(int p_driver) const {
 | 
			
		|||
 | 
			
		||||
OS::VideoMode OS_Windows::get_default_video_mode() const {
 | 
			
		||||
 | 
			
		||||
	return VideoMode(800,600,false);	
 | 
			
		||||
	return VideoMode(1280,720,false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int OS_Windows::get_audio_driver_count() const {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -82,7 +82,7 @@ const char * OS_X11::get_video_driver_name(int p_driver) const {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
OS::VideoMode OS_X11::get_default_video_mode() const {
 | 
			
		||||
	return OS::VideoMode(800,600,false);
 | 
			
		||||
	return OS::VideoMode(1280,720,false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int OS_X11::get_audio_driver_count() const {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue