Compare commits
	
		
			14 commits
		
	
	
		
			e2bbcde85d
			...
			8bdbef1137
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 8bdbef1137 | |||
| 985cf1ad4b | |||
| a651639524 | |||
| 1c2dc115b8 | |||
| 3c6bc765c6 | |||
| d71919c2c3 | |||
| e156421b3b | |||
| 5d38b1f813 | |||
| 8fa94c0390 | |||
| 1856e677a3 | |||
| a92adee7f8 | |||
| d09fec941b | |||
| 94009441be | |||
| e32aa71f4b | 
					 14 changed files with 421 additions and 24 deletions
				
			
		| 
						 | 
					@ -433,6 +433,40 @@ RB_METHOD(bitmapInitializeCopy)
 | 
				
			||||||
	return self;
 | 
						return self;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RB_METHOD(bitmapWriteToPng)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						Bitmap *b = getPrivateData<Bitmap>(self);
 | 
				
			||||||
 | 
						const char *filename;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						rb_get_args(argc, argv, "z", &filename RB_ARG_END);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						b->writeToPng(filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return self;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RB_METHOD(bitmapVFlip)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						RB_UNUSED_PARAM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Bitmap *b = getPrivateData<Bitmap>(self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						b->vFlip();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return Qnil;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RB_METHOD(bitmapHFlip)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						RB_UNUSED_PARAM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Bitmap *b = getPrivateData<Bitmap>(self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						b->hFlip();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return Qnil;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
bitmapBindingInit()
 | 
					bitmapBindingInit()
 | 
				
			||||||
| 
						 | 
					@ -466,5 +500,9 @@ bitmapBindingInit()
 | 
				
			||||||
	_rb_define_method(klass, "radial_blur",        bitmapRadialBlur);
 | 
						_rb_define_method(klass, "radial_blur",        bitmapRadialBlur);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						_rb_define_method(klass, "write_to_png", bitmapWriteToPng);
 | 
				
			||||||
 | 
						_rb_define_method(klass, "v_flip", bitmapVFlip);
 | 
				
			||||||
 | 
						_rb_define_method(klass, "h_flip", bitmapHFlip);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	INIT_PROP_BIND(Bitmap, Font, "font");
 | 
						INIT_PROP_BIND(Bitmap, Font, "font");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,7 @@
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "graphics.h"
 | 
					#include "graphics.h"
 | 
				
			||||||
 | 
					#include "eventthread.h"
 | 
				
			||||||
#include "sharedstate.h"
 | 
					#include "sharedstate.h"
 | 
				
			||||||
#include "binding-util.h"
 | 
					#include "binding-util.h"
 | 
				
			||||||
#include "binding-types.h"
 | 
					#include "binding-types.h"
 | 
				
			||||||
| 
						 | 
					@ -195,6 +196,19 @@ RB_METHOD(graphicsPlayMovie)
 | 
				
			||||||
	return Qnil;
 | 
						return Qnil;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RB_METHOD(graphicsResizeWindow)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						RB_UNUSED_PARAM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int width, height;
 | 
				
			||||||
 | 
						bool recenter = false;
 | 
				
			||||||
 | 
						rb_get_args(argc, argv, "ii|b", &width, &height, &recenter RB_ARG_END);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						shState->eThread().requestWindowResize(width, height, recenter);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return Qnil;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DEF_GRA_PROP_I(FrameRate)
 | 
					DEF_GRA_PROP_I(FrameRate)
 | 
				
			||||||
DEF_GRA_PROP_I(FrameCount)
 | 
					DEF_GRA_PROP_I(FrameCount)
 | 
				
			||||||
DEF_GRA_PROP_I(Brightness)
 | 
					DEF_GRA_PROP_I(Brightness)
 | 
				
			||||||
| 
						 | 
					@ -252,4 +266,6 @@ void graphicsBindingInit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	INIT_GRA_PROP_BIND( Fullscreen, "fullscreen"  );
 | 
						INIT_GRA_PROP_BIND( Fullscreen, "fullscreen"  );
 | 
				
			||||||
	INIT_GRA_PROP_BIND( ShowCursor, "show_cursor" );
 | 
						INIT_GRA_PROP_BIND( ShowCursor, "show_cursor" );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						_rb_define_module_function(module, "resize_window", graphicsResizeWindow);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -115,6 +115,13 @@ RB_METHOD(inputMouseY)
 | 
				
			||||||
	return rb_fix_new(shState->input().mouseY());
 | 
						return rb_fix_new(shState->input().mouseY());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RB_METHOD(inputScrollV)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						RB_UNUSED_PARAM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return rb_fix_new(shState->input().scrollV());
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct
 | 
					struct
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -149,7 +156,9 @@ static buttonCodes[] =
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{ "MOUSELEFT",   Input::MouseLeft   },
 | 
						{ "MOUSELEFT",   Input::MouseLeft   },
 | 
				
			||||||
	{ "MOUSEMIDDLE", Input::MouseMiddle },
 | 
						{ "MOUSEMIDDLE", Input::MouseMiddle },
 | 
				
			||||||
	{ "MOUSERIGHT",  Input::MouseRight  }
 | 
						{ "MOUSERIGHT",  Input::MouseRight  },
 | 
				
			||||||
 | 
						{ "MOUSEX1",     Input::MouseX1     },
 | 
				
			||||||
 | 
						{ "MOUSEX2",     Input::MouseX2     }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static elementsN(buttonCodes);
 | 
					static elementsN(buttonCodes);
 | 
				
			||||||
| 
						 | 
					@ -168,6 +177,7 @@ inputBindingInit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	_rb_define_module_function(module, "mouse_x", inputMouseX);
 | 
						_rb_define_module_function(module, "mouse_x", inputMouseX);
 | 
				
			||||||
	_rb_define_module_function(module, "mouse_y", inputMouseY);
 | 
						_rb_define_module_function(module, "mouse_y", inputMouseY);
 | 
				
			||||||
 | 
						_rb_define_module_function(module, "scroll_v", inputScrollV);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (rgssVer >= 3)
 | 
						if (rgssVer >= 3)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										64
									
								
								doc/SDL_scancode_map.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								doc/SDL_scancode_map.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,64 @@
 | 
				
			||||||
 | 
					SDL = {
 | 
				
			||||||
 | 
						:UNKNOWN => 0x00,
 | 
				
			||||||
 | 
						:A => 0x04, :B => 0x05, :C => 0x06, :D => 0x07,
 | 
				
			||||||
 | 
						:E => 0x08, :F => 0x09, :G => 0x0A, :H => 0x0B,
 | 
				
			||||||
 | 
						:I => 0x0C, :J => 0x0D, :K => 0x0E, :L => 0x0F,
 | 
				
			||||||
 | 
						:M => 0x10, :N => 0x11, :O => 0x12, :P => 0x13,
 | 
				
			||||||
 | 
						:Q => 0x14, :R => 0x15, :S => 0x16, :T => 0x17,
 | 
				
			||||||
 | 
						:U => 0x18, :V => 0x19, :W => 0x1A, :X => 0x1B,
 | 
				
			||||||
 | 
						:Y => 0x1C, :Z => 0x1D, :N1 => 0x1E, :N2 => 0x1F,
 | 
				
			||||||
 | 
						:N3 => 0x20, :N4 => 0x21, :N5 => 0x22, :N6 => 0x23,
 | 
				
			||||||
 | 
						:N7 => 0x24, :N8 => 0x25, :N9 => 0x26, :N0 => 0x27,
 | 
				
			||||||
 | 
						:RETURN => 0x28, :ESCAPE => 0x29, :BACKSPACE => 0x2A, :TAB => 0x2B,
 | 
				
			||||||
 | 
						:SPACE => 0x2C, :MINUS => 0x2D, :EQUALS => 0x2E, :LEFTBRACKET => 0x2F,
 | 
				
			||||||
 | 
						:RIGHTBRACKET => 0x30, :BACKSLASH => 0x31, :NONUSHASH => 0x32, :SEMICOLON => 0x33,
 | 
				
			||||||
 | 
						:APOSTROPHE => 0x34, :GRAVE => 0x35, :COMMA => 0x36, :PERIOD => 0x37,
 | 
				
			||||||
 | 
						:SLASH => 0x38, :CAPSLOCK => 0x39, :F1 => 0x3A, :F2 => 0x3B,
 | 
				
			||||||
 | 
						:F3 => 0x3C, :F4 => 0x3D, :F5 => 0x3E, :F6 => 0x3F,
 | 
				
			||||||
 | 
						:F7 => 0x40, :F8 => 0x41, :F9 => 0x42, :F10 => 0x43,
 | 
				
			||||||
 | 
						:F11 => 0x44, :F12 => 0x45, :PRINTSCREEN => 0x46, :SCROLLLOCK => 0x47,
 | 
				
			||||||
 | 
						:PAUSE => 0x48, :INSERT => 0x49, :HOME => 0x4A, :PAGEUP => 0x4B,
 | 
				
			||||||
 | 
						:DELETE => 0x4C, :END => 0x4D, :PAGEDOWN => 0x4E, :RIGHT => 0x4F,
 | 
				
			||||||
 | 
						:LEFT => 0x50, :DOWN => 0x51, :UP => 0x52, :NUMLOCKCLEAR => 0x53,
 | 
				
			||||||
 | 
						:KP_DIVIDE => 0x54, :KP_MULTIPLY => 0x55, :KP_MINUS => 0x56, :KP_PLUS => 0x57,
 | 
				
			||||||
 | 
						:KP_ENTER => 0x58, :KP_1 => 0x59, :KP_2 => 0x5A, :KP_3 => 0x5B,
 | 
				
			||||||
 | 
						:KP_4 => 0x5C, :KP_5 => 0x5D, :KP_6 => 0x5E, :KP_7 => 0x5F,
 | 
				
			||||||
 | 
						:KP_8 => 0x60, :KP_9 => 0x61, :KP_0 => 0x62, :KP_PERIOD => 0x63,
 | 
				
			||||||
 | 
						:NONUSBACKSLASH => 0x64, :APPLICATION => 0x65, :POWER => 0x66, :KP_EQUALS => 0x67,
 | 
				
			||||||
 | 
						:F13 => 0x68, :F14 => 0x69, :F15 => 0x6A, :F16 => 0x6B,
 | 
				
			||||||
 | 
						:F17 => 0x6C, :F18 => 0x6D, :F19 => 0x6E, :F20 => 0x6F,
 | 
				
			||||||
 | 
						:F21 => 0x70, :F22 => 0x71, :F23 => 0x72, :F24 => 0x73,
 | 
				
			||||||
 | 
						:EXECUTE => 0x74, :HELP => 0x75, :MENU => 0x76, :SELECT => 0x77,
 | 
				
			||||||
 | 
						:STOP => 0x78, :AGAIN => 0x79, :UNDO => 0x7A, :CUT => 0x7B,
 | 
				
			||||||
 | 
						:COPY => 0x7C, :PASTE => 0x7D, :FIND => 0x7E, :MUTE => 0x7F,
 | 
				
			||||||
 | 
						:VOLUMEUP => 0x80, :VOLUMEDOWN => 0x81, :LOCKINGCAPSLOCK => 0x82, :LOCKINGNUMLOCK => 0x83,
 | 
				
			||||||
 | 
						:LOCKINGSCROLLLOCK => 0x84, :KP_COMMA => 0x85, :KP_EQUALSAS400 => 0x86, :INTERNATIONAL1 => 0x87,
 | 
				
			||||||
 | 
						:INTERNATIONAL2 => 0x88, :INTERNATIONAL3 => 0x89, :INTERNATIONAL4 => 0x8A, :INTERNATIONAL5 => 0x8B,
 | 
				
			||||||
 | 
						:INTERNATIONAL6 => 0x8C, :INTERNATIONAL7 => 0x8D, :INTERNATIONAL8 => 0x8E, :INTERNATIONAL9 => 0x8F,
 | 
				
			||||||
 | 
						:LANG1 => 0x90, :LANG2 => 0x91, :LANG3 => 0x92, :LANG4 => 0x93,
 | 
				
			||||||
 | 
						:LANG5 => 0x94, :LANG6 => 0x95, :LANG7 => 0x96, :LANG8 => 0x97,
 | 
				
			||||||
 | 
						:LANG9 => 0x98, :ALTERASE => 0x99, :SYSREQ => 0x9A, :CANCEL => 0x9B,
 | 
				
			||||||
 | 
						:CLEAR => 0x9C, :PRIOR => 0x9D, :RETURN2 => 0x9E, :SEPARATOR => 0x9F,
 | 
				
			||||||
 | 
						:OUT => 0xA0, :OPER => 0xA1, :CLEARAGAIN => 0xA2, :CRSEL => 0xA3,
 | 
				
			||||||
 | 
						:EXSEL => 0xA4, :KP_00 => 0xB0, :KP_000 => 0xB1, :THOUSANDSSEPARATOR => 0xB2,
 | 
				
			||||||
 | 
						:DECIMALSEPARATOR => 0xB3, :CURRENCYUNIT => 0xB4, :CURRENCYSUBUNIT => 0xB5, :KP_LEFTPAREN => 0xB6,
 | 
				
			||||||
 | 
						:KP_RIGHTPAREN => 0xB7, :KP_LEFTBRACE => 0xB8, :KP_RIGHTBRACE => 0xB9, :KP_TAB => 0xBA,
 | 
				
			||||||
 | 
						:KP_BACKSPACE => 0xBB, :KP_A => 0xBC, :KP_B => 0xBD, :KP_C => 0xBE,
 | 
				
			||||||
 | 
						:KP_D => 0xBF, :KP_E => 0xC0, :KP_F => 0xC1, :KP_XOR => 0xC2,
 | 
				
			||||||
 | 
						:KP_POWER => 0xC3, :KP_PERCENT => 0xC4, :KP_LESS => 0xC5, :KP_GREATER => 0xC6,
 | 
				
			||||||
 | 
						:KP_AMPERSAND => 0xC7, :KP_DBLAMPERSAND => 0xC8, :KP_VERTICALBAR => 0xC9, :KP_DBLVERTICALBAR => 0xCA,
 | 
				
			||||||
 | 
						:KP_COLON => 0xCB, :KP_HASH => 0xCC, :KP_SPACE => 0xCD, :KP_AT => 0xCE,
 | 
				
			||||||
 | 
						:KP_EXCLAM => 0xCF, :KP_MEMSTORE => 0xD0, :KP_MEMRECALL => 0xD1, :KP_MEMCLEAR => 0xD2,
 | 
				
			||||||
 | 
						:KP_MEMADD => 0xD3, :KP_MEMSUBTRACT => 0xD4, :KP_MEMMULTIPLY => 0xD5, :KP_MEMDIVIDE => 0xD6,
 | 
				
			||||||
 | 
						:KP_PLUSMINUS => 0xD7, :KP_CLEAR => 0xD8, :KP_CLEARENTRY => 0xD9, :KP_BINARY => 0xDA,
 | 
				
			||||||
 | 
						:KP_OCTAL => 0xDB, :KP_DECIMAL => 0xDC, :KP_HEXADECIMAL => 0xDD, :LCTRL => 0xE0,
 | 
				
			||||||
 | 
						:LSHIFT => 0xE1, :LALT => 0xE2, :LGUI => 0xE3, :RCTRL => 0xE4,
 | 
				
			||||||
 | 
						:RSHIFT => 0xE5, :RALT => 0xE6, :RGUI => 0xE7, :MODE => 0x101,
 | 
				
			||||||
 | 
						:AUDIONEXT => 0x102, :AUDIOPREV => 0x103, :AUDIOSTOP => 0x104, :AUDIOPLAY => 0x105,
 | 
				
			||||||
 | 
						:AUDIOMUTE => 0x106, :MEDIASELECT => 0x107, :WWW => 0x108, :MAIL => 0x109,
 | 
				
			||||||
 | 
						:CALCULATOR => 0x10A, :COMPUTER => 0x10B, :AC_SEARCH => 0x10C, :AC_HOME => 0x10D,
 | 
				
			||||||
 | 
						:AC_BACK => 0x10E, :AC_FORWARD => 0x10F, :AC_STOP => 0x110, :AC_REFRESH => 0x111,
 | 
				
			||||||
 | 
						:AC_BOOKMARKS => 0x112, :BRIGHTNESSDOWN => 0x113, :BRIGHTNESSUP => 0x114, :DISPLAYSWITCH => 0x115,
 | 
				
			||||||
 | 
						:KBDILLUMTOGGLE => 0x116, :KBDILLUMDOWN => 0x117, :KBDILLUMUP => 0x118, :EJECT => 0x119,
 | 
				
			||||||
 | 
						:SLEEP => 0x11A, :APP1 => 0x11B, :APP2 => 0x11C,
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										48
									
								
								doc/extension_doc.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								doc/extension_doc.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,48 @@
 | 
				
			||||||
 | 
					# mkxp extenions for Dancing Dragon Games / Symphony of War
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Graphics.resize_window(width, height, recenter)
 | 
				
			||||||
 | 
					width: Integer  
 | 
				
			||||||
 | 
					height: Integer  
 | 
				
			||||||
 | 
					recenter: Boolean, false by default  
 | 
				
			||||||
 | 
					returns: nil  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Resizes the game window to width x height. If `recenter` is **true**, also center the window on the current screen.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Bitmap.write_to_png(filename)
 | 
				
			||||||
 | 
					filename: String  
 | 
				
			||||||
 | 
					returns: self  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Writes the contents of the bitmap to `filename`, in PNG format.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Bitmap.v_flip() / .h_flip()
 | 
				
			||||||
 | 
					returns: nil  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Flips the bitmap image vertically / horizontally.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Input.scroll_v()
 | 
				
			||||||
 | 
					returns: Integer  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Returns the cumulative amount of scroll events (negative if down, positive if up) inbetween the current and last `Input.update` call.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Input::MOUSEX1 / ::MOUSEX2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					These two constants representing two extra mouse buttons can be passed to the familiar #press?/#trigger?/#repeat? functions.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## MKXP.data_directory()
 | 
				
			||||||
 | 
					returns: String  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Provides a PC-user-dependant, game-specific path to a writable directory, intended for save states, configuration and similar.
 | 
				
			||||||
 | 
					In `mkxp.conf`, both `dataPathOrg` and `dataPathApp` keys need to be set, otherwise it returns a generic directory shared by all mkxp games. It is recommended (though not required) to not put any spaces in the config strings.  
 | 
				
			||||||
 | 
					Real life example:  
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					dataPathOrg=dancingdragon
 | 
				
			||||||
 | 
					dataPathApp=skyborn
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## MKXP.mouse_in_window()
 | 
				
			||||||
 | 
					returns: Boolean
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Returns true if the mouse cursor is currently within the game window, false otherwise.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Arbitrary key states
 | 
				
			||||||
 | 
					Use `MKXP.raw_key_states` to get the current byte array of keystates, then call `#getbyte(scancode)` with `scancode` being one of the constants defined in `SDL_scancode_map.rb`. **0** means the key is released, **1** that it is pressed.
 | 
				
			||||||
							
								
								
									
										100
									
								
								sources.def
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								sources.def
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,100 @@
 | 
				
			||||||
 | 
					SOURCES=(
 | 
				
			||||||
 | 
					  src/main.cpp
 | 
				
			||||||
 | 
					  src/audio.cpp
 | 
				
			||||||
 | 
					  src/bitmap.cpp
 | 
				
			||||||
 | 
					  src/eventthread.cpp
 | 
				
			||||||
 | 
					  src/filesystem.cpp
 | 
				
			||||||
 | 
					  src/font.cpp
 | 
				
			||||||
 | 
					  src/iniconfig.cpp
 | 
				
			||||||
 | 
					  src/input.cpp
 | 
				
			||||||
 | 
					  src/plane.cpp
 | 
				
			||||||
 | 
					  src/scene.cpp
 | 
				
			||||||
 | 
					  src/sprite.cpp
 | 
				
			||||||
 | 
					  src/table.cpp
 | 
				
			||||||
 | 
					  src/tilequad.cpp
 | 
				
			||||||
 | 
					  src/viewport.cpp
 | 
				
			||||||
 | 
					  src/window.cpp
 | 
				
			||||||
 | 
					  src/texpool.cpp
 | 
				
			||||||
 | 
					  src/shader.cpp
 | 
				
			||||||
 | 
					  src/glstate.cpp
 | 
				
			||||||
 | 
					  src/tilemap.cpp
 | 
				
			||||||
 | 
					  src/autotiles.cpp
 | 
				
			||||||
 | 
					  src/graphics.cpp
 | 
				
			||||||
 | 
					  src/gl-debug.cpp
 | 
				
			||||||
 | 
					  src/etc.cpp
 | 
				
			||||||
 | 
					  src/config.cpp
 | 
				
			||||||
 | 
					  src/settingsmenu.cpp
 | 
				
			||||||
 | 
					  src/keybindings.cpp
 | 
				
			||||||
 | 
					  src/tileatlas.cpp
 | 
				
			||||||
 | 
					  src/sharedstate.cpp
 | 
				
			||||||
 | 
					  src/gl-fun.cpp
 | 
				
			||||||
 | 
					  src/gl-meta.cpp
 | 
				
			||||||
 | 
					  src/vertex.cpp
 | 
				
			||||||
 | 
					  src/soundemitter.cpp
 | 
				
			||||||
 | 
					  src/sdlsoundsource.cpp
 | 
				
			||||||
 | 
					  src/alstream.cpp
 | 
				
			||||||
 | 
					  src/audiostream.cpp
 | 
				
			||||||
 | 
					  src/rgssad.cpp
 | 
				
			||||||
 | 
					  src/bundledfont.cpp
 | 
				
			||||||
 | 
					  src/vorbissource.cpp
 | 
				
			||||||
 | 
					  src/windowvx.cpp
 | 
				
			||||||
 | 
					  src/tilemapvx.cpp
 | 
				
			||||||
 | 
					  src/tileatlasvx.cpp
 | 
				
			||||||
 | 
					  src/autotilesvx.cpp
 | 
				
			||||||
 | 
					  src/midisource.cpp
 | 
				
			||||||
 | 
					  src/fluid-fun.cpp
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SOURCES_C=(
 | 
				
			||||||
 | 
					  steamshim/steamshim_child.c
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					MRI_SOURCES=(
 | 
				
			||||||
 | 
					  binding-mri/binding-mri.cpp
 | 
				
			||||||
 | 
					  binding-mri/binding-util.cpp
 | 
				
			||||||
 | 
					  binding-mri/table-binding.cpp
 | 
				
			||||||
 | 
					  binding-mri/etc-binding.cpp
 | 
				
			||||||
 | 
					  binding-mri/bitmap-binding.cpp
 | 
				
			||||||
 | 
					  binding-mri/font-binding.cpp
 | 
				
			||||||
 | 
					  binding-mri/graphics-binding.cpp
 | 
				
			||||||
 | 
					  binding-mri/input-binding.cpp
 | 
				
			||||||
 | 
					  binding-mri/sprite-binding.cpp
 | 
				
			||||||
 | 
					  binding-mri/viewport-binding.cpp
 | 
				
			||||||
 | 
					  binding-mri/plane-binding.cpp
 | 
				
			||||||
 | 
					  binding-mri/window-binding.cpp
 | 
				
			||||||
 | 
					  binding-mri/tilemap-binding.cpp
 | 
				
			||||||
 | 
					  binding-mri/audio-binding.cpp
 | 
				
			||||||
 | 
					  binding-mri/module_rpg.cpp
 | 
				
			||||||
 | 
					  binding-mri/filesystem-binding.cpp
 | 
				
			||||||
 | 
					  binding-mri/windowvx-binding.cpp
 | 
				
			||||||
 | 
					  binding-mri/tilemapvx-binding.cpp
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EMBED=(
 | 
				
			||||||
 | 
					  shader/common.h
 | 
				
			||||||
 | 
					  shader/transSimple.frag
 | 
				
			||||||
 | 
					  shader/trans.frag
 | 
				
			||||||
 | 
					  shader/hue.frag
 | 
				
			||||||
 | 
					  shader/sprite.frag
 | 
				
			||||||
 | 
					  shader/plane.frag
 | 
				
			||||||
 | 
					  shader/gray.frag
 | 
				
			||||||
 | 
					  shader/bitmapBlit.frag
 | 
				
			||||||
 | 
					  shader/flatColor.frag
 | 
				
			||||||
 | 
					  shader/simple.frag
 | 
				
			||||||
 | 
					  shader/simpleColor.frag
 | 
				
			||||||
 | 
					  shader/simpleAlpha.frag
 | 
				
			||||||
 | 
					  shader/simpleAlphaUni.frag
 | 
				
			||||||
 | 
					  shader/flashMap.frag
 | 
				
			||||||
 | 
					  shader/minimal.vert
 | 
				
			||||||
 | 
					  shader/simple.vert
 | 
				
			||||||
 | 
					  shader/simpleColor.vert
 | 
				
			||||||
 | 
					  shader/sprite.vert
 | 
				
			||||||
 | 
					  shader/tilemap.vert
 | 
				
			||||||
 | 
					  shader/blur.frag
 | 
				
			||||||
 | 
					  shader/blurH.vert
 | 
				
			||||||
 | 
					  shader/blurV.vert
 | 
				
			||||||
 | 
					  shader/simpleMatrix.vert
 | 
				
			||||||
 | 
					  shader/tilemapvx.vert
 | 
				
			||||||
 | 
					  assets/liberation.ttf
 | 
				
			||||||
 | 
					  assets/icon.png
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
| 
						 | 
					@ -245,6 +245,48 @@ struct BitmapPrivate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		self->modified();
 | 
							self->modified();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						void downloadToSurface()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (!surface)
 | 
				
			||||||
 | 
								allocSurface();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							FBO::bind(gl.fbo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							glState.viewport.pushSet(IntRect(0, 0, gl.width, gl.height));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							::gl.ReadPixels(0, 0, gl.width, gl.height, GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							glState.viewport.pop();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						void flip(const IntRect &srcRect)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							TEXFBO newTex = shState->texPool().request(gl.width, gl.height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							SimpleShader &shader = shState->shaders().simple;
 | 
				
			||||||
 | 
							shader.bind();
 | 
				
			||||||
 | 
							shader.setTexOffsetX(0);
 | 
				
			||||||
 | 
							bindTexture(shader);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							Quad &quad = shState->gpQuad();
 | 
				
			||||||
 | 
							quad.setTexPosRect(srcRect, IntRect(0, 0, gl.width, gl.height));
 | 
				
			||||||
 | 
							quad.setColor(Vec4(1, 1, 1, 1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							glState.blend.pushSet(false);
 | 
				
			||||||
 | 
							pushSetViewport(shader);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							FBO::bind(newTex.fbo);
 | 
				
			||||||
 | 
							blitQuad(quad);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							popViewport();
 | 
				
			||||||
 | 
							glState.blend.pop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							shState->texPool().release(gl);
 | 
				
			||||||
 | 
							gl = newTex;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							onModified();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct BitmapOpenHandler : FileSystem::OpenHandler
 | 
					struct BitmapOpenHandler : FileSystem::OpenHandler
 | 
				
			||||||
| 
						 | 
					@ -901,17 +943,7 @@ Color Bitmap::getPixel(int x, int y) const
 | 
				
			||||||
		return Vec4();
 | 
							return Vec4();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!p->surface)
 | 
						if (!p->surface)
 | 
				
			||||||
	{
 | 
							p->downloadToSurface();
 | 
				
			||||||
		p->allocSurface();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		FBO::bind(p->gl.fbo);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		glState.viewport.pushSet(IntRect(0, 0, width(), height()));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		gl.ReadPixels(0, 0, width(), height(), GL_RGBA, GL_UNSIGNED_BYTE, p->surface->pixels);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		glState.viewport.pop();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint32_t pixel = getPixelAt(p->surface, p->format, x, y);
 | 
						uint32_t pixel = getPixelAt(p->surface, p->format, x, y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1400,6 +1432,28 @@ void Bitmap::setInitFont(Font *value)
 | 
				
			||||||
	p->font = value;
 | 
						p->font = value;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Bitmap::writeToPng(const char *filename)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						p->downloadToSurface();
 | 
				
			||||||
 | 
						IMG_SavePNG(p->surface, filename);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Bitmap::vFlip()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						guardDisposed();
 | 
				
			||||||
 | 
						GUARD_MEGA;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						p->flip(IntRect(0, p->gl.height, p->gl.width, -p->gl.height));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Bitmap::hFlip()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						guardDisposed();
 | 
				
			||||||
 | 
						GUARD_MEGA;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						p->flip(IntRect(p->gl.width, 0, -p->gl.width, p->gl.height));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEXFBO &Bitmap::getGLTypes()
 | 
					TEXFBO &Bitmap::getGLTypes()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return p->gl;
 | 
						return p->gl;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -105,6 +105,12 @@ public:
 | 
				
			||||||
	 * use at construction */
 | 
						 * use at construction */
 | 
				
			||||||
	void setInitFont(Font *value);
 | 
						void setInitFont(Font *value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* extensions */
 | 
				
			||||||
 | 
						void writeToPng(const char *filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						void vFlip();
 | 
				
			||||||
 | 
						void hFlip();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* <internal> */
 | 
						/* <internal> */
 | 
				
			||||||
	TEXFBO &getGLTypes();
 | 
						TEXFBO &getGLTypes();
 | 
				
			||||||
	SDL_Surface *megaSurface() const;
 | 
						SDL_Surface *megaSurface() const;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,6 +73,7 @@ uint8_t EventThread::keyStates[];
 | 
				
			||||||
EventThread::JoyState EventThread::joyState;
 | 
					EventThread::JoyState EventThread::joyState;
 | 
				
			||||||
EventThread::MouseState EventThread::mouseState;
 | 
					EventThread::MouseState EventThread::mouseState;
 | 
				
			||||||
EventThread::TouchState EventThread::touchState;
 | 
					EventThread::TouchState EventThread::touchState;
 | 
				
			||||||
 | 
					SDL_atomic_t EventThread::verticalScrollDistance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* User event codes */
 | 
					/* User event codes */
 | 
				
			||||||
enum
 | 
					enum
 | 
				
			||||||
| 
						 | 
					@ -100,6 +101,36 @@ bool EventThread::allocUserEvents()
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void writeResizeRequest(SDL_WindowEvent &event, int w, int h, bool recenter)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						event.data1 = w;
 | 
				
			||||||
 | 
						event.data2 = h;
 | 
				
			||||||
 | 
						event.padding3 = recenter ? 1 : 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void handleResizeRequest(SDL_Window *win, SDL_WindowEvent &event)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int newWidth = event.data1;
 | 
				
			||||||
 | 
						int newHeight = event.data2;
 | 
				
			||||||
 | 
						bool recenter = event.padding3 == 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (recenter)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							int display = SDL_GetWindowDisplayIndex(win);
 | 
				
			||||||
 | 
							if (display >= 0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								SDL_DisplayMode dm;
 | 
				
			||||||
 | 
								SDL_GetDesktopDisplayMode(display, &dm);
 | 
				
			||||||
 | 
								int newX = (dm.w - newWidth) / 2;
 | 
				
			||||||
 | 
								int newY = (dm.h - newHeight) / 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								SDL_SetWindowPosition(win, newX, newY);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						SDL_SetWindowSize(win, newWidth, newHeight);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EventThread::EventThread()
 | 
					EventThread::EventThread()
 | 
				
			||||||
    : fullscreen(false),
 | 
					    : fullscreen(false),
 | 
				
			||||||
      showCursor(false)
 | 
					      showCursor(false)
 | 
				
			||||||
| 
						 | 
					@ -184,6 +215,9 @@ void EventThread::process(RGSSThreadData &rtData)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		case SDL_MOUSEBUTTONDOWN :
 | 
							case SDL_MOUSEBUTTONDOWN :
 | 
				
			||||||
		case SDL_MOUSEBUTTONUP :
 | 
							case SDL_MOUSEBUTTONUP :
 | 
				
			||||||
 | 
								if (event.button.button == 8 || event.button.button == 9)
 | 
				
			||||||
 | 
									event.button.button -= (8 - SDL_BUTTON_X1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		case SDL_MOUSEMOTION :
 | 
							case SDL_MOUSEMOTION :
 | 
				
			||||||
			if (event.button.which == SDL_TOUCH_MOUSEID)
 | 
								if (event.button.which == SDL_TOUCH_MOUSEID)
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
| 
						 | 
					@ -380,6 +414,11 @@ void EventThread::process(RGSSThreadData &rtData)
 | 
				
			||||||
			updateCursorState(cursorInWindow, gameScreen);
 | 
								updateCursorState(cursorInWindow, gameScreen);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							case SDL_MOUSEWHEEL :
 | 
				
			||||||
 | 
								/* Only consider vertical scrolling for now */
 | 
				
			||||||
 | 
								SDL_AtomicAdd(&verticalScrollDistance, event.wheel.y);
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		case SDL_FINGERDOWN :
 | 
							case SDL_FINGERDOWN :
 | 
				
			||||||
			i = event.tfinger.fingerId;
 | 
								i = event.tfinger.fingerId;
 | 
				
			||||||
			touchState.fingers[i].down = true;
 | 
								touchState.fingers[i].down = true;
 | 
				
			||||||
| 
						 | 
					@ -404,7 +443,7 @@ void EventThread::process(RGSSThreadData &rtData)
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			case REQUEST_WINRESIZE :
 | 
								case REQUEST_WINRESIZE :
 | 
				
			||||||
				SDL_SetWindowSize(win, event.window.data1, event.window.data2);
 | 
									handleResizeRequest(win, event.window);
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			case REQUEST_MESSAGEBOX :
 | 
								case REQUEST_MESSAGEBOX :
 | 
				
			||||||
| 
						 | 
					@ -575,12 +614,11 @@ void EventThread::requestFullscreenMode(bool mode)
 | 
				
			||||||
	SDL_PushEvent(&event);
 | 
						SDL_PushEvent(&event);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void EventThread::requestWindowResize(int width, int height)
 | 
					void EventThread::requestWindowResize(int width, int height, bool recenter)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	SDL_Event event;
 | 
						SDL_Event event;
 | 
				
			||||||
	event.type = usrIdStart + REQUEST_WINRESIZE;
 | 
						event.type = usrIdStart + REQUEST_WINRESIZE;
 | 
				
			||||||
	event.window.data1 = width;
 | 
						writeResizeRequest(event.window, width, height, recenter);
 | 
				
			||||||
	event.window.data2 = height;
 | 
					 | 
				
			||||||
	SDL_PushEvent(&event);
 | 
						SDL_PushEvent(&event);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,6 +31,7 @@
 | 
				
			||||||
#include <SDL_joystick.h>
 | 
					#include <SDL_joystick.h>
 | 
				
			||||||
#include <SDL_mouse.h>
 | 
					#include <SDL_mouse.h>
 | 
				
			||||||
#include <SDL_mutex.h>
 | 
					#include <SDL_mutex.h>
 | 
				
			||||||
 | 
					#include <SDL_atomic.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,6 +77,7 @@ public:
 | 
				
			||||||
	static JoyState joyState;
 | 
						static JoyState joyState;
 | 
				
			||||||
	static MouseState mouseState;
 | 
						static MouseState mouseState;
 | 
				
			||||||
	static TouchState touchState;
 | 
						static TouchState touchState;
 | 
				
			||||||
 | 
						static SDL_atomic_t verticalScrollDistance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static bool allocUserEvents();
 | 
						static bool allocUserEvents();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -86,7 +88,7 @@ public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Called from RGSS thread */
 | 
						/* Called from RGSS thread */
 | 
				
			||||||
	void requestFullscreenMode(bool mode);
 | 
						void requestFullscreenMode(bool mode);
 | 
				
			||||||
	void requestWindowResize(int width, int height);
 | 
						void requestWindowResize(int width, int height, bool recenter = false);
 | 
				
			||||||
	void requestShowCursor(bool mode);
 | 
						void requestShowCursor(bool mode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void requestTerminate();
 | 
						void requestTerminate();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -119,7 +119,7 @@ GLState::GLState(const Config &conf)
 | 
				
			||||||
	blendMode.init(BlendNormal);
 | 
						blendMode.init(BlendNormal);
 | 
				
			||||||
	blend.init(true);
 | 
						blend.init(true);
 | 
				
			||||||
	scissorTest.init(false);
 | 
						scissorTest.init(false);
 | 
				
			||||||
	scissorBox.init(IntRect(0, 0, 640, 480));
 | 
						scissorBox.init(IntRect());
 | 
				
			||||||
	program.init(0);
 | 
						program.init(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (conf.maxTextureSize > 0)
 | 
						if (conf.maxTextureSize > 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -152,6 +152,7 @@ public:
 | 
				
			||||||
		pp.startRender();
 | 
							pp.startRender();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		glState.viewport.set(IntRect(0, 0, w, h));
 | 
							glState.viewport.set(IntRect(0, 0, w, h));
 | 
				
			||||||
 | 
							glState.scissorBox.pushSet(IntRect(0, 0, w, h));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		FBO::clear();
 | 
							FBO::clear();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -166,6 +167,8 @@ public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			brightnessQuad.draw();
 | 
								brightnessQuad.draw();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							glState.scissorBox.pop();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void requestViewportRender(const Vec4 &c, const Vec4 &f, const Vec4 &t)
 | 
						void requestViewportRender(const Vec4 &c, const Vec4 &f, const Vec4 &t)
 | 
				
			||||||
| 
						 | 
					@ -1063,8 +1066,8 @@ int Graphics::height() const
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Graphics::resizeScreen(int width, int height)
 | 
					void Graphics::resizeScreen(int width, int height)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	width = clamp(width, 1, 640);
 | 
						width = std::max(1, width);
 | 
				
			||||||
	height = clamp(height, 1, 480);
 | 
						height = std::max(1, height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Vec2i size(width, height);
 | 
						Vec2i size(width, height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,12 +28,13 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <SDL_scancode.h>
 | 
					#include <SDL_scancode.h>
 | 
				
			||||||
#include <SDL_mouse.h>
 | 
					#include <SDL_mouse.h>
 | 
				
			||||||
 | 
					#include <SDL_atomic.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <vector>
 | 
					#include <vector>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <assert.h>
 | 
					#include <assert.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define BUTTON_CODE_COUNT 24
 | 
					#define BUTTON_CODE_COUNT 26
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct ButtonState
 | 
					struct ButtonState
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -236,7 +237,7 @@ static const int mapToIndex[] =
 | 
				
			||||||
	0,
 | 
						0,
 | 
				
			||||||
	16, 17, 18, 19, 20,
 | 
						16, 17, 18, 19, 20,
 | 
				
			||||||
	0, 0, 0, 0, 0, 0, 0, 0,
 | 
						0, 0, 0, 0, 0, 0, 0, 0,
 | 
				
			||||||
	21, 22, 23
 | 
						21, 22, 23, 24, 25
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static elementsN(mapToIndex);
 | 
					static elementsN(mapToIndex);
 | 
				
			||||||
| 
						 | 
					@ -287,6 +288,9 @@ struct InputPrivate
 | 
				
			||||||
	Input::ButtonCode repeating;
 | 
						Input::ButtonCode repeating;
 | 
				
			||||||
	unsigned int repeatCount;
 | 
						unsigned int repeatCount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Cumulative vertical scroll distance since last update call */
 | 
				
			||||||
 | 
						int vScrollDistance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct
 | 
						struct
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		int active;
 | 
							int active;
 | 
				
			||||||
| 
						 | 
					@ -322,6 +326,8 @@ struct InputPrivate
 | 
				
			||||||
		dir4Data.previous = Input::None;
 | 
							dir4Data.previous = Input::None;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		dir8Data.active = 0;
 | 
							dir8Data.active = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							vScrollDistance = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	inline ButtonState &getStateCheck(int code)
 | 
						inline ButtonState &getStateCheck(int code)
 | 
				
			||||||
| 
						 | 
					@ -459,12 +465,14 @@ struct InputPrivate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void initMsBindings()
 | 
						void initMsBindings()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		msBindings.resize(3);
 | 
							msBindings.resize(5);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		size_t i = 0;
 | 
							size_t i = 0;
 | 
				
			||||||
		msBindings[i++] = MsBinding(SDL_BUTTON_LEFT,   Input::MouseLeft);
 | 
							msBindings[i++] = MsBinding(SDL_BUTTON_LEFT,   Input::MouseLeft);
 | 
				
			||||||
		msBindings[i++] = MsBinding(SDL_BUTTON_MIDDLE, Input::MouseMiddle);
 | 
							msBindings[i++] = MsBinding(SDL_BUTTON_MIDDLE, Input::MouseMiddle);
 | 
				
			||||||
		msBindings[i++] = MsBinding(SDL_BUTTON_RIGHT,  Input::MouseRight);
 | 
							msBindings[i++] = MsBinding(SDL_BUTTON_RIGHT,  Input::MouseRight);
 | 
				
			||||||
 | 
							msBindings[i++] = MsBinding(SDL_BUTTON_X1,     Input::MouseX1);
 | 
				
			||||||
 | 
							msBindings[i++] = MsBinding(SDL_BUTTON_X2,     Input::MouseX2);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void pollBindings(Input::ButtonCode &repeatCand)
 | 
						void pollBindings(Input::ButtonCode &repeatCand)
 | 
				
			||||||
| 
						 | 
					@ -640,6 +648,9 @@ void Input::update()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p->repeating = None;
 | 
						p->repeating = None;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Fetch new cumulative scroll distance and reset counter */
 | 
				
			||||||
 | 
						p->vScrollDistance = SDL_AtomicSet(&EventThread::verticalScrollDistance, 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool Input::isPressed(int button)
 | 
					bool Input::isPressed(int button)
 | 
				
			||||||
| 
						 | 
					@ -681,6 +692,11 @@ int Input::mouseY()
 | 
				
			||||||
	return (EventThread::mouseState.y - rtData.screenOffset.y) * rtData.sizeResoRatio.y;
 | 
						return (EventThread::mouseState.y - rtData.screenOffset.y) * rtData.sizeResoRatio.y;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int Input::scrollV()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return p->vScrollDistance;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Input::~Input()
 | 
					Input::~Input()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	delete p;
 | 
						delete p;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,7 +43,8 @@ public:
 | 
				
			||||||
		F5 = 25, F6 = 26, F7 = 27, F8 = 28, F9 = 29,
 | 
							F5 = 25, F6 = 26, F7 = 27, F8 = 28, F9 = 29,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* Non-standard extensions */
 | 
							/* Non-standard extensions */
 | 
				
			||||||
		MouseLeft = 38, MouseMiddle = 39, MouseRight = 40
 | 
							MouseLeft = 38, MouseMiddle = 39, MouseRight = 40,
 | 
				
			||||||
 | 
							MouseX1 = 41, MouseX2 = 42
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void update();
 | 
						void update();
 | 
				
			||||||
| 
						 | 
					@ -58,6 +59,7 @@ public:
 | 
				
			||||||
	/* Non-standard extensions */
 | 
						/* Non-standard extensions */
 | 
				
			||||||
	int mouseX();
 | 
						int mouseX();
 | 
				
			||||||
	int mouseY();
 | 
						int mouseY();
 | 
				
			||||||
 | 
						int scrollV();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	Input(const RGSSThreadData &rtData);
 | 
						Input(const RGSSThreadData &rtData);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue