WindowVX: Make more compatible with RGSS2
This commit is contained in:
		
							parent
							
								
									8042289291
								
							
						
					
					
						commit
						cbdd19e525
					
				
					 1 changed files with 28 additions and 7 deletions
				
			
		| 
						 | 
					@ -35,6 +35,16 @@
 | 
				
			||||||
#include <algorithm>
 | 
					#include <algorithm>
 | 
				
			||||||
#include <sigc++/connection.h>
 | 
					#include <sigc++/connection.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef RGSS3
 | 
				
			||||||
 | 
					# define DEF_Z 100
 | 
				
			||||||
 | 
					# define DEF_PADDING 12
 | 
				
			||||||
 | 
					# define DEF_BACK_OPAC 192
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					# define DEF_Z 0
 | 
				
			||||||
 | 
					# define DEF_PADDING 16
 | 
				
			||||||
 | 
					# define DEF_BACK_OPAC 255
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<typename T>
 | 
					template<typename T>
 | 
				
			||||||
struct Sides
 | 
					struct Sides
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -231,10 +241,10 @@ struct WindowVXPrivate
 | 
				
			||||||
	      width(w),
 | 
						      width(w),
 | 
				
			||||||
	      height(h),
 | 
						      height(h),
 | 
				
			||||||
	      geo(x, y, w, h),
 | 
						      geo(x, y, w, h),
 | 
				
			||||||
	      padding(12),
 | 
						      padding(DEF_PADDING),
 | 
				
			||||||
	      paddingBottom(padding),
 | 
						      paddingBottom(padding),
 | 
				
			||||||
	      opacity(255),
 | 
						      opacity(255),
 | 
				
			||||||
	      backOpacity(192),
 | 
						      backOpacity(DEF_BACK_OPAC),
 | 
				
			||||||
	      contentsOpacity(255),
 | 
						      contentsOpacity(255),
 | 
				
			||||||
	      openness(255),
 | 
						      openness(255),
 | 
				
			||||||
	      tone(&tmp.tone),
 | 
						      tone(&tmp.tone),
 | 
				
			||||||
| 
						 | 
					@ -754,8 +764,12 @@ struct WindowVXPrivate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			glState.scissorBox.push();
 | 
								glState.scissorBox.push();
 | 
				
			||||||
			glState.scissorTest.pushSet(true);
 | 
								glState.scissorTest.pushSet(true);
 | 
				
			||||||
			glState.scissorBox.setIntersect(clip);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef RGSS3
 | 
				
			||||||
 | 
								glState.scissorBox.setIntersect(clip);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
								glState.scissorBox.setIntersect(IntRect(trans.x, trans.y, geo.w, geo.h));
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
			IntRect pad = padRect;
 | 
								IntRect pad = padRect;
 | 
				
			||||||
			pad.x += trans.x;
 | 
								pad.x += trans.x;
 | 
				
			||||||
			pad.y += trans.y;
 | 
								pad.y += trans.y;
 | 
				
			||||||
| 
						 | 
					@ -763,8 +777,12 @@ struct WindowVXPrivate
 | 
				
			||||||
			if (drawCursor)
 | 
								if (drawCursor)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				Vec2i contTrans = pad.pos();
 | 
									Vec2i contTrans = pad.pos();
 | 
				
			||||||
				contTrans.x += -contentsOff.x + cursorRect->x;
 | 
									contTrans.x += cursorRect->x;
 | 
				
			||||||
				contTrans.y += -contentsOff.y + cursorRect->y;
 | 
									contTrans.y += cursorRect->y;
 | 
				
			||||||
 | 
					#ifdef RGSS3
 | 
				
			||||||
 | 
									contTrans.x -= contentsOff.x;
 | 
				
			||||||
 | 
									contTrans.y -= contentsOff.y;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
				shader.setTranslation(contTrans);
 | 
									shader.setTranslation(contTrans);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				TEX::setSmooth(true);
 | 
									TEX::setSmooth(true);
 | 
				
			||||||
| 
						 | 
					@ -774,6 +792,9 @@ struct WindowVXPrivate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (contents)
 | 
								if (contents)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 | 
					#ifndef RGSS3
 | 
				
			||||||
 | 
									glState.scissorBox.setIntersect(clip);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
				Vec2i contTrans = pad.pos();
 | 
									Vec2i contTrans = pad.pos();
 | 
				
			||||||
				contTrans.x -= contentsOff.x;
 | 
									contTrans.x -= contentsOff.x;
 | 
				
			||||||
				contTrans.y -= contentsOff.y;
 | 
									contTrans.y -= contentsOff.y;
 | 
				
			||||||
| 
						 | 
					@ -793,14 +814,14 @@ struct WindowVXPrivate
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
WindowVX::WindowVX(Viewport *viewport)
 | 
					WindowVX::WindowVX(Viewport *viewport)
 | 
				
			||||||
	: ViewportElement(viewport, 100)
 | 
						: ViewportElement(viewport, DEF_Z)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	p = new WindowVXPrivate(0, 0, 0, 0);
 | 
						p = new WindowVXPrivate(0, 0, 0, 0);
 | 
				
			||||||
	onGeometryChange(scene->getGeometry());
 | 
						onGeometryChange(scene->getGeometry());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
WindowVX::WindowVX(int x, int y, int width, int height)
 | 
					WindowVX::WindowVX(int x, int y, int width, int height)
 | 
				
			||||||
    : ViewportElement(0, 100)
 | 
					    : ViewportElement(0, DEF_Z)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	p = new WindowVXPrivate(x, y, width, height);
 | 
						p = new WindowVXPrivate(x, y, width, height);
 | 
				
			||||||
	onGeometryChange(scene->getGeometry());
 | 
						onGeometryChange(scene->getGeometry());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue