Viewport: Add zero arg constructor (RGSS3) and bind in MRI
This commit is contained in:
		
							parent
							
								
									5bc6f6f32c
								
							
						
					
					
						commit
						7a655528e4
					
				
					 3 changed files with 25 additions and 0 deletions
				
			
		| 
						 | 
					@ -32,6 +32,13 @@ RB_METHOD(viewportInitialize)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Viewport *v;
 | 
						Viewport *v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef RGSS3
 | 
				
			||||||
 | 
						if (argc == 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							v = new Viewport();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	if (argc == 1)
 | 
						if (argc == 1)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		/* The rect arg is only used to init the viewport,
 | 
							/* The rect arg is only used to init the viewport,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,6 +26,7 @@
 | 
				
			||||||
#include "util.h"
 | 
					#include "util.h"
 | 
				
			||||||
#include "quad.h"
 | 
					#include "quad.h"
 | 
				
			||||||
#include "glstate.h"
 | 
					#include "glstate.h"
 | 
				
			||||||
 | 
					#include "graphics.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <SDL_rect.h>
 | 
					#include <SDL_rect.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -112,6 +113,18 @@ Viewport::Viewport(Rect *rect)
 | 
				
			||||||
	initViewport(rect->x, rect->y, rect->width, rect->height);
 | 
						initViewport(rect->x, rect->y, rect->width, rect->height);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef RGSS3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Viewport::Viewport()
 | 
				
			||||||
 | 
					    : SceneElement(*shState->screen()),
 | 
				
			||||||
 | 
					      sceneLink(this)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						const Graphics &graphics = shState->graphics();
 | 
				
			||||||
 | 
						initViewport(0, 0, graphics.width(), graphics.height());
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Viewport::initViewport(int x, int y, int width, int height)
 | 
					void Viewport::initViewport(int x, int y, int width, int height)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	p = new ViewportPrivate(x, y, width, height, this);
 | 
						p = new ViewportPrivate(x, y, width, height, this);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,6 +34,11 @@ class Viewport : public Scene, public SceneElement, public Flashable, public Dis
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	Viewport(int x, int y, int width, int height);
 | 
						Viewport(int x, int y, int width, int height);
 | 
				
			||||||
	Viewport(Rect *rect);
 | 
						Viewport(Rect *rect);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef RGSS3
 | 
				
			||||||
 | 
						Viewport();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	~Viewport();
 | 
						~Viewport();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	DECL_ATTR( Rect,  Rect*  )
 | 
						DECL_ATTR( Rect,  Rect*  )
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue