Add Graphics#restore_window
Requested by matias1lol.
This commit is contained in:
		
							parent
							
								
									7b9d436ede
								
							
						
					
					
						commit
						df9494e60c
					
				
					 4 changed files with 27 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -218,6 +218,15 @@ RB_METHOD(graphicsMaximizeWindow)
 | 
			
		|||
	return Qnil;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RB_METHOD(graphicsRestoreWindow)
 | 
			
		||||
{
 | 
			
		||||
	RB_UNUSED_PARAM;
 | 
			
		||||
 | 
			
		||||
	shState->eThread().requestWindowRestore();
 | 
			
		||||
 | 
			
		||||
	return Qnil;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
DEF_GRA_PROP_I(FrameRate)
 | 
			
		||||
DEF_GRA_PROP_I(FrameCount)
 | 
			
		||||
DEF_GRA_PROP_I(Brightness)
 | 
			
		||||
| 
						 | 
				
			
			@ -278,4 +287,5 @@ void graphicsBindingInit()
 | 
			
		|||
 | 
			
		||||
	_rb_define_module_function(module, "resize_window", graphicsResizeWindow);
 | 
			
		||||
	_rb_define_module_function(module, "maximize_window", graphicsMaximizeWindow);
 | 
			
		||||
	_rb_define_module_function(module, "restore_window", graphicsRestoreWindow);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,6 +13,10 @@ Resizes the game window to width x height. If `recenter` is **true**, also cente
 | 
			
		|||
 | 
			
		||||
Maximizes the game window, ignoring the `winResizable` config option.
 | 
			
		||||
 | 
			
		||||
## Graphics.restore_window()
 | 
			
		||||
 | 
			
		||||
Restores the game window from a maximized or minimized state.
 | 
			
		||||
 | 
			
		||||
## Bitmap.write_to_png(filename)
 | 
			
		||||
filename: String  
 | 
			
		||||
returns: self  
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -81,6 +81,7 @@ enum
 | 
			
		|||
	REQUEST_SETFULLSCREEN = 0,
 | 
			
		||||
	REQUEST_WINRESIZE,
 | 
			
		||||
	REQUEST_WINMAXIMIZE,
 | 
			
		||||
	REQUEST_WINRESTORE,
 | 
			
		||||
	REQUEST_MESSAGEBOX,
 | 
			
		||||
	REQUEST_SETCURSORVISIBLE,
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -464,6 +465,10 @@ void EventThread::process(RGSSThreadData &rtData)
 | 
			
		|||
				SDL_MaximizeWindow(win);
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
			case REQUEST_WINRESTORE :
 | 
			
		||||
				SDL_RestoreWindow(win);
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
			case UPDATE_FPS :
 | 
			
		||||
				if (rtData.config.printFPS)
 | 
			
		||||
					Debug() << "FPS:" << event.user.code;
 | 
			
		||||
| 
						 | 
				
			
			@ -634,6 +639,13 @@ void EventThread::requestWindowMaximize()
 | 
			
		|||
	SDL_PushEvent(&event);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EventThread::requestWindowRestore()
 | 
			
		||||
{
 | 
			
		||||
	SDL_Event event;
 | 
			
		||||
	event.type = usrIdStart + REQUEST_WINRESTORE;
 | 
			
		||||
	SDL_PushEvent(&event);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EventThread::requestShowCursor(bool mode)
 | 
			
		||||
{
 | 
			
		||||
	SDL_Event event;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -90,6 +90,7 @@ public:
 | 
			
		|||
	void requestFullscreenMode(bool mode);
 | 
			
		||||
	void requestWindowResize(int width, int height, bool recenter = false);
 | 
			
		||||
	void requestWindowMaximize();
 | 
			
		||||
	void requestWindowRestore();
 | 
			
		||||
	void requestShowCursor(bool mode);
 | 
			
		||||
 | 
			
		||||
	void requestTerminate();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue