Add Graphics#maximize_window
Works even if the window is not resizable by user. Requested by matias1lol.
This commit is contained in:
		
							parent
							
								
									de43f7da92
								
							
						
					
					
						commit
						7b9d436ede
					
				
					 4 changed files with 28 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -209,6 +209,15 @@ RB_METHOD(graphicsResizeWindow)
 | 
			
		|||
	return Qnil;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RB_METHOD(graphicsMaximizeWindow)
 | 
			
		||||
{
 | 
			
		||||
	RB_UNUSED_PARAM;
 | 
			
		||||
 | 
			
		||||
	shState->eThread().requestWindowMaximize();
 | 
			
		||||
 | 
			
		||||
	return Qnil;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
DEF_GRA_PROP_I(FrameRate)
 | 
			
		||||
DEF_GRA_PROP_I(FrameCount)
 | 
			
		||||
DEF_GRA_PROP_I(Brightness)
 | 
			
		||||
| 
						 | 
				
			
			@ -268,4 +277,5 @@ void graphicsBindingInit()
 | 
			
		|||
	INIT_GRA_PROP_BIND( ShowCursor, "show_cursor" );
 | 
			
		||||
 | 
			
		||||
	_rb_define_module_function(module, "resize_window", graphicsResizeWindow);
 | 
			
		||||
	_rb_define_module_function(module, "maximize_window", graphicsMaximizeWindow);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,4 @@
 | 
			
		|||
 | 
			
		||||
# mkxp extenions for Dancing Dragon Games / Symphony of War
 | 
			
		||||
 | 
			
		||||
## Graphics.resize_window(width, height, recenter)
 | 
			
		||||
| 
						 | 
				
			
			@ -8,6 +9,10 @@ returns: nil
 | 
			
		|||
 | 
			
		||||
Resizes the game window to width x height. If `recenter` is **true**, also center the window on the current screen.
 | 
			
		||||
 | 
			
		||||
## Graphics.maximize_window()
 | 
			
		||||
 | 
			
		||||
Maximizes the game window, ignoring the `winResizable` config option.
 | 
			
		||||
 | 
			
		||||
## Bitmap.write_to_png(filename)
 | 
			
		||||
filename: String  
 | 
			
		||||
returns: self  
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -80,6 +80,7 @@ enum
 | 
			
		|||
{
 | 
			
		||||
	REQUEST_SETFULLSCREEN = 0,
 | 
			
		||||
	REQUEST_WINRESIZE,
 | 
			
		||||
	REQUEST_WINMAXIMIZE,
 | 
			
		||||
	REQUEST_MESSAGEBOX,
 | 
			
		||||
	REQUEST_SETCURSORVISIBLE,
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -459,6 +460,10 @@ void EventThread::process(RGSSThreadData &rtData)
 | 
			
		|||
				updateCursorState(cursorInWindow, gameScreen);
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
			case REQUEST_WINMAXIMIZE :
 | 
			
		||||
				SDL_MaximizeWindow(win);
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
			case UPDATE_FPS :
 | 
			
		||||
				if (rtData.config.printFPS)
 | 
			
		||||
					Debug() << "FPS:" << event.user.code;
 | 
			
		||||
| 
						 | 
				
			
			@ -622,6 +627,13 @@ void EventThread::requestWindowResize(int width, int height, bool recenter)
 | 
			
		|||
	SDL_PushEvent(&event);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EventThread::requestWindowMaximize()
 | 
			
		||||
{
 | 
			
		||||
	SDL_Event event;
 | 
			
		||||
	event.type = usrIdStart + REQUEST_WINMAXIMIZE;
 | 
			
		||||
	SDL_PushEvent(&event);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EventThread::requestShowCursor(bool mode)
 | 
			
		||||
{
 | 
			
		||||
	SDL_Event event;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -89,6 +89,7 @@ public:
 | 
			
		|||
	/* Called from RGSS thread */
 | 
			
		||||
	void requestFullscreenMode(bool mode);
 | 
			
		||||
	void requestWindowResize(int width, int height, bool recenter = false);
 | 
			
		||||
	void requestWindowMaximize();
 | 
			
		||||
	void requestShowCursor(bool mode);
 | 
			
		||||
 | 
			
		||||
	void requestTerminate();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue