Explorar el Código

More work on ColorPicker

Marko Pintera hace 10 años
padre
commit
fc7fc179b9

+ 25 - 0
BansheeCore/Include/BsInput.h

@@ -142,6 +142,30 @@ namespace BansheeEngine
 		 */
 		Vector2I getPointerDelta() const { return mPointerDelta; }
 
+		/**
+		 * @brief	Query if the provided pointer button is currently 
+		 *			being held (this frame or previous frames).
+		 *
+		 * @param	pointerButton		Code of the button to query.
+		 */
+		bool isPointerButtonHeld(PointerEventButton pointerButton) const;
+
+		/**
+		 * @brief	Query if the provided pointer button is currently 
+		 *			being released (one true for one frame).
+		 *
+		 * @param	pointerButton		Code of the button to query.
+		 */
+		bool isPointerButtonUp(PointerEventButton pointerButton) const;
+
+		/**
+		 * @brief	Query if the provided pointer button is currently 
+		 *			being pressed (one true for one frame).
+		 *
+		 * @param	pointerButton		Code of the button to query.
+		 */
+		bool isPointerButtonDown(PointerEventButton pointerButton) const;
+
 		/**
 		 * @brief	Enables or disables mouse smoothing. Smoothing makes the changes to
 		 *			mouse axes more gradual.
@@ -206,6 +230,7 @@ namespace BansheeEngine
 		Vector<DeviceData> mDevices;
 		Vector2I mPointerPosition;
 		Vector2I mPointerDelta;
+		ButtonState mPointerButtonStates[3];
 		bool mLastPositionSet;
 
 		/************************************************************************/

+ 31 - 0
BansheeCore/Source/BsInput.cpp

@@ -31,6 +31,9 @@ namespace BansheeEngine
 		mOSInputHandler->onInputCommand.connect(std::bind(&Input::inputCommandEntered, this, _1));
 
 		RenderWindowManager::instance().onFocusGained.connect(std::bind(&Input::inputWindowChanged, this, _1));
+
+		for (int i = 0; i < 3; i++)
+			mPointerButtonStates[i] = ButtonState::Off;
 	}
 
 	Input::~Input()
@@ -68,6 +71,14 @@ namespace BansheeEngine
 			}
 		}
 
+		for (UINT32 i = 0; i < 3; i++)
+		{
+			if (mPointerButtonStates[i] == ButtonState::ToggledOff)
+				mPointerButtonStates[i] = ButtonState::Off;
+			else if (mPointerButtonStates[i] == ButtonState::ToggledOn)
+				mPointerButtonStates[i] = ButtonState::On;
+		}
+
 		mPointerDelta = Vector2I::ZERO; // Reset delta in case we don't receive any mouse input this frame
 
 		if(mRawInputHandler == nullptr)
@@ -158,12 +169,16 @@ namespace BansheeEngine
 
 	void Input::cursorPressed(const PointerEvent& event)
 	{
+		mPointerButtonStates[(UINT32)event.button] = ButtonState::ToggledOn;
+
 		if(!onPointerPressed.empty())
 			onPointerPressed(event);
 	}
 
 	void Input::cursorReleased(const PointerEvent& event)
 	{
+		mPointerButtonStates[(UINT32)event.button] = ButtonState::ToggledOff;
+
 		if(!onPointerReleased.empty())
 			onPointerReleased(event);
 	}
@@ -228,6 +243,22 @@ namespace BansheeEngine
 		return mDevices[deviceIdx].keyStates[button & 0x0000FFFF] == ButtonState::ToggledOn;
 	}
 
+	bool Input::isPointerButtonHeld(PointerEventButton pointerButton) const
+	{
+		return mPointerButtonStates[(UINT32)pointerButton] == ButtonState::On ||
+			mPointerButtonStates[(UINT32)pointerButton] == ButtonState::ToggledOn;
+	}
+
+	bool Input::isPointerButtonUp(PointerEventButton pointerButton) const
+	{
+		return mPointerButtonStates[(UINT32)pointerButton] == ButtonState::ToggledOff;
+	}
+
+	bool Input::isPointerButtonDown(PointerEventButton pointerButton) const
+	{
+		return mPointerButtonStates[(UINT32)pointerButton] == ButtonState::ToggledOn;
+	}
+
 	Vector2I Input::getPointerPosition() const
 	{
 		return mPointerPosition;

+ 2 - 1
BansheeEditor/Include/BsBuiltinEditorResources.h

@@ -306,7 +306,8 @@ namespace BansheeEngine
 		static const WString TreeViewElementHighlight;
 		static const WString TreeViewElementSepHighlight;
 
-		static const WString ColorPickerSliderHandleTex;
+		static const WString ColorPickerSliderHorzHandleTex;
+		static const WString ColorPickerSliderVertHandleTex;
 
 		static const WString ProgressBarFillTex;
 		static const WString ProgressBarBgTex;

+ 40 - 20
BansheeEditor/Source/BsBuiltinEditorResources.cpp

@@ -177,7 +177,8 @@ namespace BansheeEngine
 	const WString BuiltinEditorResources::TreeViewElementHighlight = L"TreeViewElementHighlight.psd";
 	const WString BuiltinEditorResources::TreeViewElementSepHighlight = L"TreeViewElementSepHighlight.psd";
 
-	const WString BuiltinEditorResources::ColorPickerSliderHandleTex = L"ColorPickerSliderHandle.psd";
+	const WString BuiltinEditorResources::ColorPickerSliderHorzHandleTex = L"ColorPickerSliderHorzHandle.psd";
+	const WString BuiltinEditorResources::ColorPickerSliderVertHandleTex = L"ColorPickerSliderVertHandle.psd";
 
 	const WString BuiltinEditorResources::ProgressBarFillTex = L"ProgressBarFill.psd";
 	const WString BuiltinEditorResources::ProgressBarBgTex = L"ProgressBarBg.psd";
@@ -1084,24 +1085,43 @@ namespace BansheeEngine
 		/* 							COLOR PICKER SLIDER                      	*/
 		/************************************************************************/
 
-		GUIElementStyle colorPickerSliderHandleStyle;
-		colorPickerSliderHandleStyle.fixedHeight = true;
-		colorPickerSliderHandleStyle.fixedWidth = true;
-		colorPickerSliderHandleStyle.height = 32;
-		colorPickerSliderHandleStyle.width = 10;
-		colorPickerSliderHandleStyle.normal.texture = getGUITexture(ColorPickerSliderHandleTex);
-		colorPickerSliderHandleStyle.hover.texture = colorPickerSliderHandleStyle.normal.texture;
-		colorPickerSliderHandleStyle.active.texture = colorPickerSliderHandleStyle.normal.texture;
-
-		mSkin.setStyle(GUISlider::getHandleStyleType(), colorPickerSliderHandleStyle);
-
-		GUIElementStyle colorPickerSliderStyle;
-		colorPickerSliderHandleStyle.fixedHeight = true;
-		colorPickerSliderHandleStyle.height = 32;
-		colorPickerSliderHandleStyle.minWidth = 50;
-		colorPickerSliderStyle.subStyles[GUISlider::getHandleStyleType()] = GUISlider::getHandleStyleType();
-
-		mSkin.setStyle("ColorPickerSlider", colorPickerSliderStyle);
+		GUIElementStyle colorPickerSliderHorzHandleStyle;
+		colorPickerSliderHorzHandleStyle.fixedHeight = true;
+		colorPickerSliderHorzHandleStyle.fixedWidth = true;
+		colorPickerSliderHorzHandleStyle.height = 32;
+		colorPickerSliderHorzHandleStyle.width = 10;
+		colorPickerSliderHorzHandleStyle.normal.texture = getGUITexture(ColorPickerSliderHorzHandleTex);
+		colorPickerSliderHorzHandleStyle.hover.texture = colorPickerSliderHorzHandleStyle.normal.texture;
+		colorPickerSliderHorzHandleStyle.active.texture = colorPickerSliderHorzHandleStyle.normal.texture;
+
+		mSkin.setStyle("ColorSliderHorzHandle", colorPickerSliderHorzHandleStyle);
+
+		GUIElementStyle colorPickerSliderHorzStyle;
+		colorPickerSliderHorzHandleStyle.fixedHeight = true;
+		colorPickerSliderHorzHandleStyle.height = 32;
+		colorPickerSliderHorzHandleStyle.minWidth = 50;
+		colorPickerSliderHorzStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderHorzHandle";
+
+		mSkin.setStyle("ColorSliderHorz", colorPickerSliderHorzStyle);
+
+		GUIElementStyle colorPickerSliderVertHandleStyle;
+		colorPickerSliderVertHandleStyle.fixedHeight = true;
+		colorPickerSliderVertHandleStyle.fixedWidth = true;
+		colorPickerSliderVertHandleStyle.height = 10;
+		colorPickerSliderVertHandleStyle.width = 30;
+		colorPickerSliderVertHandleStyle.normal.texture = getGUITexture(ColorPickerSliderVertHandleTex);
+		colorPickerSliderVertHandleStyle.hover.texture = colorPickerSliderVertHandleStyle.normal.texture;
+		colorPickerSliderVertHandleStyle.active.texture = colorPickerSliderVertHandleStyle.normal.texture;
+
+		mSkin.setStyle("ColorSliderVertHandle", colorPickerSliderVertHandleStyle);
+
+		GUIElementStyle colorPickerSliderVertStyle;
+		colorPickerSliderVertStyle.fixedWidth = true;
+		colorPickerSliderVertStyle.width = 30;
+		colorPickerSliderVertStyle.minHeight = 50;
+		colorPickerSliderVertStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderVertHandle";
+
+		mSkin.setStyle("ColorSliderVert", colorPickerSliderVertStyle);
 	}
 
 	void BuiltinEditorResources::preprocess()
@@ -1126,7 +1146,7 @@ namespace BansheeEngine
 			ScrollBarBgTex, MenuBarBgTex, MenuBarBtnNormalTex, MenuBarBtnHoverTex, MenuBarBansheeLogoTex, DockSliderNormalTex,
 			TreeViewExpandButtonOffNormal, TreeViewExpandButtonOffHover, TreeViewExpandButtonOnNormal, TreeViewExpandButtonOnHover,
 			TreeViewSelectionBackground, TreeViewEditBox, TreeViewElementHighlight, TreeViewElementSepHighlight, ProgressBarBgTex,
-			ProgressBarFillTex, ColorPickerSliderHandleTex };
+			ProgressBarFillTex, ColorPickerSliderHorzHandleTex, ColorPickerSliderVertHandleTex };
 
 		static const GpuProgramImportData GPU_PROGRAM_IMPORT_DATA[] = 
 		{

+ 29 - 13
BansheeEngine/Include/BsGUIArea.h

@@ -5,6 +5,14 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Type of layout that a GUIArea can initially be created with
+	 */
+	enum class GUILayoutType
+	{
+		LayoutX, LayoutY, LayoutExplicit
+	};
+
 	/**
 	 * @brief	GUIArea represents a freely positionable GUI panel with a GUILayout child.
 	 *			This is one of the top GUI elements (aside from GUIWidget) and all layouts
@@ -22,16 +30,18 @@ namespace BansheeEngine
 		 * Creates a new GUI area. All the layouts used in the area will be placed
 		 * within the specified bounds.
 		 *
-		 * @param	widget	Widget parent of the GUIArea.
-		 * @param	x		X position relative to parent widget position, in pixels.
-		 * @param	y		Y position relative to parent widget position, in pixels.
-		 * @param	width	Width of the area, in pixels. If 0 then the area will be of unlimited width.
-		 * @param	height	Height of the area, in pixels. If 0 then the area will be of unlimited height.
-		 * @param	depth	Depth of the area. This is relative to the depth of parent widget. Depth determines in what
-		 *					order are overlapping GUIAreas drawn. Areas with lower depth will be drawn in front of areas
-		 *					with higher depth.
+		 * @param	widget		Widget parent of the GUIArea.
+		 * @param	x			X position relative to parent widget position, in pixels.
+		 * @param	y			Y position relative to parent widget position, in pixels.
+		 * @param	width		Width of the area, in pixels. If 0 then the area will be of unlimited width.
+		 * @param	height		Height of the area, in pixels. If 0 then the area will be of unlimited height.
+		 * @param	depth		Depth of the area. This is relative to the depth of parent widget. Depth determines in what
+		 *						order are overlapping GUIAreas drawn. Areas with lower depth will be drawn in front of areas
+		 *						with higher depth.
+		 * @param	layoutType	Type of layout to create as the root layout for the area.
 		 */
-		static GUIArea* create(GUIWidget& widget, INT32 x, INT32 y, UINT32 width = 0, UINT32 height = 0, UINT16 depth = 0);
+		static GUIArea* create(GUIWidget& widget, INT32 x, INT32 y, UINT32 width = 0, UINT32 height = 0, UINT16 depth = 0, 
+			GUILayoutType layoutType = GUILayoutType::LayoutX);
 
 		/**
 		 * Creates a new GUI area. All the layouts used in the area will be placed
@@ -48,9 +58,11 @@ namespace BansheeEngine
 		 * @param	depth			Depth of the area. This is relative to the depth of parent widget. Depth determines in what
 		 *							order are overlapping GUIAreas drawn. Areas with lower depth will be drawn in front of areas
 		 *							with higher depth.
+		 * @param	layoutType		Type of layout to create as the root layout for the area.
 		 */
 		static GUIArea* createStretchedXY(GUIWidget& widget, UINT32 offsetLeft, 
-			UINT32 offsetRight, UINT32 offsetTop, UINT32 offsetBottom, UINT16 depth = 0);
+			UINT32 offsetRight, UINT32 offsetTop, UINT32 offsetBottom, UINT16 depth = 0,
+			GUILayoutType layoutType = GUILayoutType::LayoutX);
 
 		/**
 		 * Creates a new GUI area. All the layouts used in the area will be placed
@@ -67,9 +79,11 @@ namespace BansheeEngine
 		 * @param	depth			Depth of the area. This is relative to the depth of parent widget. Depth determines in what
 		 *							order are overlapping GUIAreas drawn. Areas with lower depth will be drawn in front of areas
 		 *							with higher depth.
+		 * @param	layoutType		Type of layout to create as the root layout for the area.
 		 */
 		static GUIArea* createStretchedX(GUIWidget& widget, UINT32 offsetLeft, 
-			UINT32 offsetRight, UINT32 y, UINT32 height, UINT16 depth = 0);
+			UINT32 offsetRight, UINT32 y, UINT32 height, UINT16 depth = 0,
+			GUILayoutType layoutType = GUILayoutType::LayoutX);
 
 		/**
 		 * Creates a new GUI area. All the layouts used in the area will be placed
@@ -86,9 +100,11 @@ namespace BansheeEngine
 		 * @param	depth			Depth of the area. This is relative to the depth of parent widget. Depth determines in what
 		 *							order are overlapping GUIAreas drawn. Areas with lower depth will be drawn in front of areas
 		 *							with higher depth.
+		 * @param	layoutType		Type of layout to create as the root layout for the area.
 		 */
 		static GUIArea* createStretchedY(GUIWidget& widget, UINT32 offsetTop, 
-			UINT32 offsetBottom, UINT32 x, UINT32 width, UINT16 depth = 0);
+			UINT32 offsetBottom, UINT32 x, UINT32 width, UINT16 depth = 0,
+			GUILayoutType layoutType = GUILayoutType::LayoutX);
 
 		/**
 		 * @brief	Destroys a GUI area and removes it from the parent GUIWidget.
@@ -196,7 +212,7 @@ namespace BansheeEngine
 		 *			position relative to the parent widget in pixels, and depth relative to
 		 *			parent widget (smaller depth means closer).
 		 */
-		GUIArea(GUIWidget* widget, INT32 x, INT32 y, UINT16 depth);
+		GUIArea(GUIWidget* widget, INT32 x, INT32 y, UINT16 depth, GUILayoutType layoutType);
 
 		/**
 		 * @brief	Check if any of the area properties changed since the last update.

+ 0 - 11
BansheeEngine/Include/BsGUIElementBase.h

@@ -264,11 +264,6 @@ namespace BansheeEngine
 		 */
 		GUILayout& addLayoutYInternal(GUIElementBase* parent);
 
-		/**
-		 * @brief	Creates and adds a new explicit layout to the specified "parent" element.
-		 */
-		GUILayout& addLayoutExplicitInternal(GUIElementBase* parent);
-
 		/**
 		 * @brief	Removes an existing layout from this element.
 		 */
@@ -286,12 +281,6 @@ namespace BansheeEngine
 		 */
 		GUILayout& insertLayoutYInternal(GUIElementBase* parent, UINT32 idx);
 
-		/**
-		 * @brief	Creates and adds a new explicit layout to the specified "parent" element,
-		 *			at a specific child index. Caller must ensure index is in valid range.
-		 */
-		GUILayout& insertLayoutExplicitInternal(GUIElementBase* parent, UINT32 idx);
-
 		GUIWidget* mParentWidget;
 		GUIElementBase* mParentElement;
 		Vector<GUIElementBase*> mChildren;	

+ 0 - 10
BansheeEngine/Include/BsGUILayout.h

@@ -42,11 +42,6 @@ namespace BansheeEngine
 		 */
 		GUILayout& addLayoutY() { return addLayoutYInternal(this); }
 
-		/**
-		 * @brief	Adds a new explicit layout as a child of this layout.
-		 */
-		GUILayout& addLayoutExplicit() { return addLayoutExplicitInternal(this); }
-
 		/**
 		 * @brief	Removes the specified child layout.
 		 */
@@ -62,11 +57,6 @@ namespace BansheeEngine
 		 */
 		GUILayout& insertLayoutY(UINT32 idx) { return insertLayoutYInternal(this, idx); }
 
-		/**
-		 * @brief	Inserts an explicit layout before the element at the specified index.
-		 */
-		GUILayout& insertLayoutExplicit(UINT32 idx) { return insertLayoutExplicitInternal(this, idx); }
-
 		/**
 		 * @brief	Adds a fixed space as a child of this layout. Size of space is specified in pixels.
 		 */

+ 27 - 12
BansheeEngine/Source/BsGUIArea.cpp

@@ -1,17 +1,31 @@
 #include "BsGUIArea.h"
 #include "BsGUIWidget.h"
 #include "BsGUILayoutX.h"
+#include "BsGUILayoutY.h"
+#include "BsGUILayoutExplicit.h"
 #include "BsGUIWidget.h"
 #include "BsRenderWindow.h"
 #include "BsViewport.h"
 
 namespace BansheeEngine
 {
-	GUIArea::GUIArea(GUIWidget* widget, INT32 x, INT32 y, UINT16 depth)
-		:mWidget(widget), mLeft(x), mTop(y), mDepth(depth), mIsDirty(true), mIsDisabled(false),
+	GUIArea::GUIArea(GUIWidget* widget, INT32 x, INT32 y, UINT16 depth, GUILayoutType layoutType)
+		:mWidget(widget), mLeft(x), mTop(y), mDepth(depth), mIsDirty(true), mIsDisabled(false), mLayout(nullptr),
 		mResizeXWithWidget(false), mResizeYWithWidget(false), mWidth(0), mHeight(0), mRight(0), mBottom(0)
 	{
-		mLayout = bs_new<GUILayoutX, PoolAlloc>(this);
+		switch (layoutType)
+		{
+		case GUILayoutType::LayoutX:
+			mLayout = bs_new<GUILayoutX>(this);
+			break;
+		case GUILayoutType::LayoutY:
+			mLayout = bs_new<GUILayoutY>(this);
+			break;
+		case GUILayoutType::LayoutExplicit:
+			mLayout = bs_new<GUILayoutExplicit>(this);
+			break;
+		}
+		
 		mLayout->_changeParentWidget(widget);
 
 		mWidget->registerArea(this);
@@ -19,12 +33,13 @@ namespace BansheeEngine
 
 	GUIArea::~GUIArea() 
 	{
-		bs_delete<PoolAlloc>(mLayout);
+		bs_delete(mLayout);
 	}
 
-	GUIArea* GUIArea::create(GUIWidget& widget, INT32 x, INT32 y, UINT32 width, UINT32 height, UINT16 depth)
+	GUIArea* GUIArea::create(GUIWidget& widget, INT32 x, INT32 y, UINT32 width, UINT32 height, 
+		UINT16 depth, GUILayoutType layoutType)
 	{
-		GUIArea* area = new (bs_alloc<GUIArea, PoolAlloc>()) GUIArea(&widget, x, y, depth);
+		GUIArea* area = new (bs_alloc<GUIArea, PoolAlloc>()) GUIArea(&widget, x, y, depth, layoutType);
 		area->mWidth = width;
 		area->mHeight = height;
 
@@ -32,9 +47,9 @@ namespace BansheeEngine
 	}
 
 	GUIArea* GUIArea::createStretchedXY(GUIWidget& widget, UINT32 offsetLeft, 
-		UINT32 offsetRight, UINT32 offsetTop, UINT32 offsetBottom, UINT16 depth)
+		UINT32 offsetRight, UINT32 offsetTop, UINT32 offsetBottom, UINT16 depth, GUILayoutType layoutType)
 	{
-		GUIArea* area = new (bs_alloc<GUIArea, PoolAlloc>()) GUIArea(&widget, offsetLeft, offsetTop, depth);
+		GUIArea* area = new (bs_alloc<GUIArea, PoolAlloc>()) GUIArea(&widget, offsetLeft, offsetTop, depth, layoutType);
 
 		area->mWidth = std::max(0, (INT32)widget.getTarget()->getWidth() - (INT32)offsetLeft - (INT32)offsetRight);
 		area->mHeight = std::max(0, (INT32)widget.getTarget()->getHeight() - (INT32)offsetTop - (INT32)offsetBottom);
@@ -47,9 +62,9 @@ namespace BansheeEngine
 	}
 
 	GUIArea* GUIArea::createStretchedX(GUIWidget& widget, UINT32 offsetLeft, 
-		UINT32 offsetRight, UINT32 offsetTop, UINT32 height, UINT16 depth)
+		UINT32 offsetRight, UINT32 offsetTop, UINT32 height, UINT16 depth, GUILayoutType layoutType)
 	{
-		GUIArea* area = new (bs_alloc<GUIArea, PoolAlloc>()) GUIArea(&widget, offsetLeft, offsetTop, depth);
+		GUIArea* area = new (bs_alloc<GUIArea, PoolAlloc>()) GUIArea(&widget, offsetLeft, offsetTop, depth, layoutType);
 
 		area->mWidth = std::max(0, (INT32)widget.getTarget()->getWidth() - (INT32)offsetLeft - (INT32)offsetRight);
 		area->mHeight = height;
@@ -61,9 +76,9 @@ namespace BansheeEngine
 	}
 
 	GUIArea* GUIArea::createStretchedY(GUIWidget& widget, UINT32 offsetTop, 
-		UINT32 offsetBottom, UINT32 offsetLeft, UINT32 width, UINT16 depth)
+		UINT32 offsetBottom, UINT32 offsetLeft, UINT32 width, UINT16 depth, GUILayoutType layoutType)
 	{
-		GUIArea* area = new (bs_alloc<GUIArea, PoolAlloc>()) GUIArea(&widget, offsetLeft, offsetTop, depth);
+		GUIArea* area = new (bs_alloc<GUIArea, PoolAlloc>()) GUIArea(&widget, offsetLeft, offsetTop, depth, layoutType);
 
 		area->mWidth = width;
 		area->mHeight = std::max(0, (INT32)widget.getTarget()->getHeight() - (INT32)offsetTop - (INT32)offsetBottom);

+ 0 - 33
BansheeEngine/Source/BsGUIElementBase.cpp

@@ -204,21 +204,6 @@ namespace BansheeEngine
 		return *entry;
 	}
 
-	GUILayout& GUIElementBase::addLayoutExplicitInternal(GUIElementBase* parent)
-	{
-		GUILayoutExplicit* entry = bs_new<GUILayoutExplicit, PoolAlloc>();
-		entry->_setParent(parent);
-
-		mChildren.push_back(entry);
-
-		if (mIsDisabled)
-			entry->disableRecursively();
-
-		markContentAsDirty();
-
-		return *entry;
-	}
-
 	void GUIElementBase::removeLayoutInternal(GUILayout& layout)
 	{
 		bool foundElem = false;
@@ -277,24 +262,6 @@ namespace BansheeEngine
 		return *entry;
 	}
 
-	GUILayout& GUIElementBase::insertLayoutExplicitInternal(GUIElementBase* parent, UINT32 idx)
-	{
-		if (idx < 0 || idx >(UINT32)mChildren.size())
-			BS_EXCEPT(InvalidParametersException, "Index out of range: " + toString(idx) + ". Valid range: 0 .. " + toString((UINT32)mChildren.size()));
-
-		GUILayoutExplicit* entry = bs_new<GUILayoutExplicit, PoolAlloc>();
-		entry->_setParent(parent);
-
-		mChildren.insert(mChildren.begin() + idx, entry);
-
-		if (mIsDisabled)
-			entry->disableRecursively();
-
-		markContentAsDirty();
-
-		return *entry;
-	}
-
 	void GUIElementBase::_registerChildElement(GUIElement* element)
 	{
 		GUIElementBase* parentElement = element->_getParent();

+ 56 - 9
MBansheeEditor/ColorPicker.cs

@@ -163,7 +163,7 @@ namespace BansheeEditor
             h4.AddFlexibleSpace();
             h4.AddElement(guiInputB);
 
-            GUIArea overlay = GUI.AddArea(0, 0, Width, Height, -1); // TODO - Create an area with explicit layout here
+            GUIArea overlay = GUI.AddArea(0, 0, Width, Height, -1, GUILayoutType.Explicit);
             overlay.layout.AddElement(guiSliderVert);
             overlay.layout.AddElement(guiSliderRHorz);
             overlay.layout.AddElement(guiSliderGHorz);
@@ -179,10 +179,14 @@ namespace BansheeEditor
 
             colorBox.OnValueChanged += OnColorBoxValueChanged;
 
-            // TODO
-            //WHen slider value changes convert RGB->HSV and vice versa as needed
-            //Actually position overlay elements
-            //Add alpha slider
+            // TODO - Add alpha slider
+        }
+
+        private void EditorUpdate()
+        {
+            Vector2I windowPos = ScreenToWindowPos(Input.PointerPosition);
+
+            colorBox.UpdateInput(windowPos);
         }
 
         private static void FillArea(int width, int height, Color[] colors, Color start, Color rightGradient, Color downGradient)
@@ -616,6 +620,8 @@ namespace BansheeEditor
 
         public class ColorSlider1DHorz
         {
+            private const int SLIDER_HEIGHT = 8;
+
             private int width, height;
             private Texture2D texture;
             private SpriteTexture spriteTexture;
@@ -632,6 +638,12 @@ namespace BansheeEditor
 
                 texture = new Texture2D(width, height);
                 spriteTexture = new SpriteTexture(texture);
+
+                Rect2I sliderBounds = guiTexture.Bounds;
+                sliderBounds.y -= SLIDER_HEIGHT;
+                sliderBounds.height += SLIDER_HEIGHT;
+
+                guiSlider.Bounds = sliderBounds;
             }
 
             public void UpdateTexture(Color start, Color step, bool isHSV)
@@ -652,6 +664,8 @@ namespace BansheeEditor
 
         public class ColorSlider1DVert
         {
+            private const int SLIDER_WIDTH = 7;
+
             private int width, height;
             private Texture2D texture;
             private SpriteTexture spriteTexture;
@@ -668,6 +682,12 @@ namespace BansheeEditor
 
                 texture = new Texture2D(width, height);
                 spriteTexture = new SpriteTexture(texture);
+
+                Rect2I sliderBounds = guiTexture.Bounds;
+                sliderBounds.x -= SLIDER_WIDTH;
+                sliderBounds.width += SLIDER_WIDTH;
+
+                guiSlider.Bounds = sliderBounds;
             }
 
             public void UpdateTexture(Color start, Color step, bool isHSV)
@@ -695,6 +715,8 @@ namespace BansheeEditor
             private GUITexture guiTexture;
             private GUITexture guiSliderHandle;
 
+            private Vector2 oldValue;
+
             public delegate void OnValueChangedDelegate(Vector2 value);
             public event OnValueChangedDelegate OnValueChanged;
 
@@ -746,15 +768,40 @@ namespace BansheeEditor
                 guiTexture.SetTexture(spriteTexture);
             }
 
-            public void UpdateInput()
+            public void UpdateInput(Vector2I windowPos)
             {
-                // TODO - Detect mouse input over GUITexture, detect coordinates and update gui slider handle position
-                // TODO - Trigger OnValueChanged as needed
+                if (Input.IsPointerButtonHeld(PointerButton.Left))
+                {
+                    Rect2I bounds = guiTexture.Bounds;
+
+                    if (bounds.Contains(windowPos))
+                    {
+                        Vector2 newValue = Vector2.zero;
+                        newValue.x = (windowPos.x - bounds.x) / (float)bounds.width;
+                        newValue.y = (windowPos.y - bounds.y) / (float)bounds.height;
+
+                        SetValue(newValue);
+                    }
+                }
             }
 
             public void SetValue(Vector2 value)
             {
-                // TODO - Move the handle to this position
+                if (oldValue == value)
+                    return;
+
+                Rect2I handleBounds = guiSliderHandle.Bounds;
+                Rect2I boxBounds = guiTexture.Bounds;
+
+                handleBounds.x = boxBounds.x + MathEx.RoundToInt(value.x * boxBounds.width) - handleBounds.width / 2;
+                handleBounds.y = boxBounds.y + MathEx.RoundToInt(value.y * boxBounds.height) - handleBounds.height / 2;
+
+                guiSliderHandle.Bounds = handleBounds;
+
+                oldValue = value;
+
+                if (OnValueChanged != null)
+                    OnValueChanged(value);
             }
         }
     }

+ 2 - 0
MBansheeEditor/EditorStyles.cs

@@ -12,5 +12,7 @@ namespace BansheeEditor
         public const string Button = "Button";
         public const string Toggle = "Toggle";
         public const string InputBox = "InputBox";
+        public const string ColorSliderHorz = "ColorSliderHorz";
+        public const string ColorSliderVert = "ColorSliderVert";
     }
 }

+ 20 - 0
MBansheeEditor/ModalWindow.cs

@@ -31,6 +31,20 @@ namespace BansheeEditor
             Internal_CreateInstance(this, allowCloseButton);
         }
 
+        protected Vector2I ScreenToWindowPos(Vector2I screenPos)
+        {
+            Vector2I windowPos;
+            Internal_ScreenToWindowPos(mCachedPtr, screenPos, out windowPos);
+            return windowPos;
+        }
+
+        protected Vector2I WindowToScreenPos(Vector2I windowPos)
+        {
+            Vector2I screenPos;
+            Internal_WindowToScreenPos(mCachedPtr, windowPos, out screenPos);
+            return screenPos;
+        }
+
         private void OnInitializeInternal()
         {
             GUI = new GUIPanel();
@@ -86,5 +100,11 @@ namespace BansheeEditor
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern int Internal_SetHeight(IntPtr nativeInstance, int value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_ScreenToWindowPos(IntPtr nativeInstance, Vector2I position, out Vector2I windowPos);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_WindowToScreenPos(IntPtr nativeInstance, Vector2I position, out Vector2I screenPos);
     }
 }

+ 10 - 3
MBansheeEngine/GUI/GUIArea.cs

@@ -29,10 +29,10 @@ namespace BansheeEngine
         }
 
         // Note: Should only ever be called by its parent GUIPanel
-        internal static GUIArea Create(GUIPanel parent, int x, int y, int width, int height, Int16 depth)
+        internal static GUIArea Create(GUIPanel parent, int x, int y, int width, int height, Int16 depth, GUILayoutType layoutType)
         {
             GUIArea newArea = new GUIArea();
-            Internal_CreateInstance(newArea, parent, x, y, width, height, depth);
+            Internal_CreateInstance(newArea, parent, x, y, width, height, depth, layoutType);
             newArea._layout = new GUILayoutX(newArea);
 
             return newArea;
@@ -63,7 +63,8 @@ namespace BansheeEngine
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIArea instance, GUIPanel parent, int x, int y, int width, int height, Int16 depth);
+        private static extern void Internal_CreateInstance(GUIArea instance, GUIPanel parent, int x, int y, 
+            int width, int height, Int16 depth, GUILayoutType layoutType);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetArea(IntPtr nativeInstance, int x, int y, int width, int height, Int16 depth);
@@ -74,4 +75,10 @@ namespace BansheeEngine
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetVisible(IntPtr nativeInstance, bool visible);
     }
+
+    // Note: Must have same layout as GUILayoutType
+    public enum GUILayoutType
+    {
+        X, Y, Explicit
+    }
 }

+ 0 - 22
MBansheeEngine/GUI/GUILayout.cs

@@ -156,22 +156,6 @@ namespace BansheeEngine
             return layoutY;
         }
 
-        public GUILayoutExplicit AddLayoutExplicit()
-        {
-            GUILayoutExplicit layoutY = new GUILayoutExplicit(this);
-            AddElementInternal(layoutY);
-
-            return layoutY;
-        }
-
-        public GUILayoutExplicit InsertLayoutExplicit(int index)
-        {
-            GUILayoutExplicit layoutY = new GUILayoutExplicit(this, index);
-            InsertElementInternal(index, layoutY);
-
-            return layoutY;
-        }
-
         public void Remove(GUIElement element)
         {
             if (children.Contains(element))
@@ -223,18 +207,12 @@ namespace BansheeEngine
         [MethodImpl(MethodImplOptions.InternalCall)]
         protected static extern void Internal_CreateInstanceYFromLayoutAdd(GUILayout instance, GUILayout parentLayout);
 
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        protected static extern void Internal_CreateInstanceExplicitFromLayoutAdd(GUILayout instance, GUILayout parentLayout);
-
         [MethodImpl(MethodImplOptions.InternalCall)]
         protected static extern void Internal_CreateInstanceXFromLayoutInsert(GUILayout instance, GUILayout parentLayout, int index);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         protected static extern void Internal_CreateInstanceYFromLayoutInsert(GUILayout instance, GUILayout parentLayout, int index);
 
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        protected static extern void Internal_CreateInstanceExplicitFromLayoutInsert(GUILayout instance, GUILayout parentLayout, int index);
-
         [MethodImpl(MethodImplOptions.InternalCall)]
         protected static extern void Internal_AddElement(IntPtr instance, IntPtr element);
 

+ 0 - 18
MBansheeEngine/GUI/GUILayoutExplicit.cs

@@ -1,18 +0,0 @@
-using System;
-using System.Runtime.CompilerServices;
-
-namespace BansheeEngine
-{
-    public sealed class GUILayoutExplicit : GUILayout
-    {
-        internal GUILayoutExplicit(GUILayout parentLayout)
-        {
-            Internal_CreateInstanceExplicitFromLayoutAdd(this, parentLayout);
-        }
-
-        internal GUILayoutExplicit(GUILayout parentLayout, int index)
-        {
-            Internal_CreateInstanceExplicitFromLayoutInsert(this, parentLayout, index);
-        }
-    }
-}

+ 2 - 2
MBansheeEngine/GUI/GUIPanel.cs

@@ -29,9 +29,9 @@ namespace BansheeEngine
             _mainLayout = mainArea.layout;
         }
 
-        public GUIArea AddArea(int x, int y, int width, int height, Int16 depth = 0)
+        public GUIArea AddArea(int x, int y, int width, int height, Int16 depth = 0, GUILayoutType layoutType = GUILayoutType.X)
         {
-            GUIArea area = GUIArea.Create(this, x, y, width, height, depth);
+            GUIArea area = GUIArea.Create(this, x, y, width, height, depth, layoutType);
             area.SetParent(this);
 
             return area;

+ 32 - 8
MBansheeEngine/Input.cs

@@ -26,7 +26,7 @@ namespace BansheeEngine
 	};
 
     // Do not change IDs, must match PointerEventButton C++ enum
-	public enum PointerEventButton
+	public enum PointerButton
 	{
 		Left, Middle, Right, Count
 	};
@@ -35,7 +35,7 @@ namespace BansheeEngine
     {
         internal Vector2I _screenPos;
         internal Vector2I _delta;
-        internal PointerEventButton _button;
+        internal PointerButton _button;
 
         internal bool _shift;
         internal bool _control;
@@ -43,7 +43,7 @@ namespace BansheeEngine
 
         internal float _mouseWheelScrollAmount;
 
-        internal PointerEvent(Vector2I screenPos, Vector2I delta, PointerEventButton button,
+        internal PointerEvent(Vector2I screenPos, Vector2I delta, PointerButton button,
             bool shift, bool control, bool alt, float mouseWheelScrollAmount)
         {
             _screenPos = screenPos;
@@ -59,7 +59,7 @@ namespace BansheeEngine
 
         public Vector2I screenPos { get { return _screenPos; } }
         public Vector2I delta { get { return _delta; } }
-        public PointerEventButton button { get { return _button; } }
+        public PointerButton button { get { return _button; } }
 
         public bool shift { get { return _shift; } }
         public bool control { get { return _control; } }
@@ -114,6 +114,21 @@ namespace BansheeEngine
             return Internal_IsButtonDown(code, deviceIdx);
         }
 
+        public static bool IsPointerButtonHeld(PointerButton code)
+        {
+            return Internal_IsPointerButtonHeld(code);
+        }
+
+        public static bool IsPointerButtonUp(PointerButton code, int deviceIdx)
+        {
+            return Internal_IsPointerButtonUp(code);
+        }
+
+        public static bool IsPointerButtonDown(PointerButton code, int deviceIdx)
+        {
+            return Internal_IsPointerButtonDown(code);
+        }
+
         public static Vector2I PointerPosition
         {
             get
@@ -158,7 +173,7 @@ namespace BansheeEngine
                 OnCharInput(ev);
         }
 
-        private static void Internal_TriggerPointerMove(Vector2I screenPos, Vector2I delta, PointerEventButton button, bool shift, 
+        private static void Internal_TriggerPointerMove(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift, 
             bool ctrl, bool alt, float scrollAmount)
         {
             PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
@@ -167,7 +182,7 @@ namespace BansheeEngine
                 OnPointerMoved(ev);
         }
 
-        private static void Internal_TriggerPointerPressed(Vector2I screenPos, Vector2I delta, PointerEventButton button, bool shift,
+        private static void Internal_TriggerPointerPressed(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift,
             bool ctrl, bool alt, float scrollAmount)
         {
             PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
@@ -176,7 +191,7 @@ namespace BansheeEngine
                 OnPointerPressed(ev);
         }
 
-        private static void Internal_TriggerPointerReleased(Vector2I screenPos, Vector2I delta, PointerEventButton button, bool shift,
+        private static void Internal_TriggerPointerReleased(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift,
             bool ctrl, bool alt, float scrollAmount)
         {
             PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
@@ -185,7 +200,7 @@ namespace BansheeEngine
                 OnPointerReleased(ev);
         }
 
-        private static void Internal_TriggerPointerDoubleClick(Vector2I screenPos, Vector2I delta, PointerEventButton button, bool shift,
+        private static void Internal_TriggerPointerDoubleClick(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift,
             bool ctrl, bool alt, float scrollAmount)
         {
             PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
@@ -206,6 +221,15 @@ namespace BansheeEngine
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern bool Internal_IsButtonDown(ButtonCode keyCode, int deviceIdx);
 
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern bool Internal_IsPointerButtonHeld(PointerButton keyCode);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern bool Internal_IsPointerButtonUp(PointerButton keyCode);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern bool Internal_IsPointerButtonDown(PointerButton keyCode);
+
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_GetPointerPosition(out Vector2I position);
 

+ 0 - 1
MBansheeEngine/MBansheeEngine.csproj

@@ -58,7 +58,6 @@
     <Compile Include="Font.cs" />
     <Compile Include="GameObject.cs" />
     <Compile Include="GUI\GUIArea.cs" />
-    <Compile Include="GUI\GUILayoutExplicit.cs" />
     <Compile Include="GUI\GUILayoutUtility.cs" />
     <Compile Include="GUI\GUIPanel.cs" />
     <Compile Include="GUI\GUIButton.cs" />

+ 2 - 0
SBansheeEditor/Include/BsScriptModalWindow.h

@@ -34,6 +34,8 @@ namespace BansheeEngine
 		static void internal_setHeight(ScriptModalWindow* thisPtr, UINT32 value);
 		static void internal_initializeGUIPanel(ScriptModalWindow* thisPtr, MonoObject* panel);
 		static void internal_setTitle(ScriptModalWindow* thisPtr, MonoObject* title);
+		static void internal_screenToWindowPos(ScriptModalWindow* thisPtr, Vector2I screenPos, Vector2I* windowPos);
+		static void internal_windowToScreenPos(ScriptModalWindow* thisPtr, Vector2I windowPos, Vector2I* screenPos);
 
 		void onAssemblyRefreshStarted();
 

+ 15 - 0
SBansheeEditor/Source/BsScriptModalWindow.cpp

@@ -9,6 +9,7 @@
 #include "BsMonoAssembly.h"
 #include "BsScriptObjectManager.h"
 #include "BsScriptHString.h"
+#include "BsRenderWindow.h"
 
 using namespace std::placeholders;
 
@@ -38,6 +39,8 @@ namespace BansheeEngine
 		metaData.scriptClass->addInternalCall("Internal_SetWidth", &ScriptModalWindow::internal_setWidth);
 		metaData.scriptClass->addInternalCall("Internal_SetHeight", &ScriptModalWindow::internal_setHeight);
 		metaData.scriptClass->addInternalCall("Internal_SetTitle", &ScriptModalWindow::internal_setTitle);
+		metaData.scriptClass->addInternalCall("Internal_ScreenToWindowPos", &ScriptModalWindow::internal_screenToWindowPos);
+		metaData.scriptClass->addInternalCall("Internal_WindowToScreenPos", &ScriptModalWindow::internal_windowToScreenPos);
 
 		onInitializedInternalMethod = metaData.scriptClass->getMethod("OnInitializeInternal", 0);
 		onDestroyInternalMethod = metaData.scriptClass->getMethod("OnDestroyInternal", 0);
@@ -179,6 +182,18 @@ namespace BansheeEngine
 		scriptGUIPanel->setParentWidget(thisPtr->mModalWindow->getGUIWidget().get());
 	}
 
+	void ScriptModalWindow::internal_screenToWindowPos(ScriptModalWindow* thisPtr, Vector2I screenPos, Vector2I* windowPos)
+	{
+		RenderWindowPtr parentRenderWindow = thisPtr->mModalWindow->getRenderWindow();
+		*windowPos = parentRenderWindow->screenToWindowPos(screenPos);
+	}
+
+	void ScriptModalWindow::internal_windowToScreenPos(ScriptModalWindow* thisPtr, Vector2I windowPos, Vector2I* screenPos)
+	{
+		RenderWindowPtr parentRenderWindow = thisPtr->mModalWindow->getRenderWindow();
+		*screenPos = parentRenderWindow->windowToScreenPos(windowPos);
+	}
+
 	ManagedModalWindow::ManagedModalWindow(bool allowCloseButton, MonoObject* managedInstance)
 		:ModalWindow(HString::dummy(), allowCloseButton), mUpdateThunk(nullptr), mManagedInstance(managedInstance),
 		mOnInitializeThunk(nullptr), mOnDestroyThunk(nullptr), mOnWindowResizedMethod(nullptr), mGCHandle(0),

+ 2 - 1
SBansheeEngine/Include/BsScriptGUIArea.h

@@ -17,7 +17,8 @@ namespace BansheeEngine
 		void updateArea();
 
 	private:
-		static void internal_createInstance(MonoObject* instance, MonoObject* parentGUI, INT32 x, INT32 y, UINT32 width, UINT32 height, UINT16 depth);
+		static void internal_createInstance(MonoObject* instance, MonoObject* parentGUI, INT32 x, INT32 y, UINT32 width, UINT32 height, 
+			UINT16 depth, GUILayoutType layoutType);
 
 		static void internal_destroy(ScriptGUIArea* thisPtr);
 		static void internal_setVisible(ScriptGUIArea* thisPtr, bool visible);

+ 0 - 2
SBansheeEngine/Include/BsScriptGUILayout.h

@@ -17,10 +17,8 @@ namespace BansheeEngine
 		static void internal_createInstanceXFromArea(MonoObject* instance, MonoObject* parentArea);
 		static void internal_createInstanceXFromLayoutAdd(MonoObject* instance, MonoObject* parentLayout);
 		static void internal_createInstanceYFromLayoutAdd(MonoObject* instance, MonoObject* parentLayout);
-		static void internal_createInstanceExplicitFromLayoutAdd(MonoObject* instance, MonoObject* parentLayout);
 		static void internal_createInstanceXFromLayoutInsert(MonoObject* instance, MonoObject* parentLayout, UINT32 index);
 		static void internal_createInstanceYFromLayoutInsert(MonoObject* instance, MonoObject* parentLayout, UINT32 index);
-		static void internal_createInstanceExplicitFromLayoutInsert(MonoObject* instance, MonoObject* parentLayout, UINT32 index);
 		static void internal_createInstanceYFromScrollArea(MonoObject* instance, MonoObject* parentScrollArea);
 		static void internal_addElement(ScriptGUILayout* instance, ScriptGUIElementTBase* element);
 		static void internal_insertElement(ScriptGUILayout* instance, UINT32 index, ScriptGUIElementTBase* element);

+ 3 - 0
SBansheeEngine/Include/BsScriptInput.h

@@ -26,6 +26,9 @@ namespace BansheeEngine
 		static bool internal_isButtonHeld(ButtonCode code, UINT32 deviceIdx);
 		static bool internal_isButtonDown(ButtonCode code, UINT32 deviceIdx);
 		static bool internal_isButtonUp(ButtonCode code, UINT32 deviceIdx);
+		static bool internal_isPointerButtonHeld(PointerEventButton code);
+		static bool internal_isPointerButtonDown(PointerEventButton code);
+		static bool internal_isPointerButtonUp(PointerEventButton code);
 		static float internal_getAxisValue(UINT32 axisType, UINT32 deviceIdx);
 		static void internal_getPointerPosition(Vector2I* position);
 		static void internal_getPointerDelta(Vector2I* position);

+ 3 - 2
SBansheeEngine/Source/BsScriptGUIArea.cpp

@@ -37,10 +37,11 @@ namespace BansheeEngine
 		}
 	}
 
-	void ScriptGUIArea::internal_createInstance(MonoObject* instance, MonoObject* panel, INT32 x, INT32 y, UINT32 width, UINT32 height, UINT16 depth)
+	void ScriptGUIArea::internal_createInstance(MonoObject* instance, MonoObject* panel, INT32 x, INT32 y, UINT32 width, 
+		UINT32 height, UINT16 depth, GUILayoutType layoutType)
 	{
 		ScriptGUIPanel* scriptGUIPanel = ScriptGUIPanel::toNative(panel);
-		GUIArea* nativeArea = GUIArea::create(scriptGUIPanel->getWidget(), x, y, width, height, depth);
+		GUIArea* nativeArea = GUIArea::create(scriptGUIPanel->getWidget(), x, y, width, height, depth, layoutType);
 
 		ScriptGUIArea* nativeInstance = new (bs_alloc<ScriptGUIArea>()) ScriptGUIArea(instance, nativeArea, scriptGUIPanel);
 	}

+ 0 - 22
SBansheeEngine/Source/BsScriptGUILayout.cpp

@@ -22,10 +22,8 @@ namespace BansheeEngine
 		metaData.scriptClass->addInternalCall("Internal_CreateInstanceXFromArea", &ScriptGUILayout::internal_createInstanceXFromArea);
 		metaData.scriptClass->addInternalCall("Internal_CreateInstanceXFromLayoutAdd", &ScriptGUILayout::internal_createInstanceXFromLayoutAdd);
 		metaData.scriptClass->addInternalCall("Internal_CreateInstanceYFromLayoutAdd", &ScriptGUILayout::internal_createInstanceYFromLayoutAdd);
-		metaData.scriptClass->addInternalCall("Internal_CreateInstanceExplicitFromLayoutAdd", &ScriptGUILayout::internal_createInstanceExplicitFromLayoutAdd);
 		metaData.scriptClass->addInternalCall("Internal_CreateInstanceXFromLayoutInsert", &ScriptGUILayout::internal_createInstanceXFromLayoutInsert);
 		metaData.scriptClass->addInternalCall("Internal_CreateInstanceYFromLayoutInsert", &ScriptGUILayout::internal_createInstanceYFromLayoutInsert);
-		metaData.scriptClass->addInternalCall("Internal_CreateInstanceExplicitFromLayoutInsert", &ScriptGUILayout::internal_createInstanceExplicitFromLayoutInsert);
 		metaData.scriptClass->addInternalCall("Internal_CreateInstanceYFromScrollArea", &ScriptGUILayout::internal_createInstanceYFromScrollArea);
 		metaData.scriptClass->addInternalCall("Internal_AddElement", &ScriptGUILayout::internal_addElement);
 		metaData.scriptClass->addInternalCall("Internal_InsertElement", &ScriptGUILayout::internal_insertElement);
@@ -64,16 +62,6 @@ namespace BansheeEngine
 			ScriptGUILayout(instance, &layout, nativeLayout);
 	}
 
-	void ScriptGUILayout::internal_createInstanceExplicitFromLayoutAdd(MonoObject* instance, MonoObject* parentLayout)
-	{
-		ScriptGUILayout* scriptLayout = ScriptGUILayout::toNative(parentLayout);
-		GUILayout* nativeLayout = scriptLayout->getInternalValue();
-		GUILayout& layout = nativeLayout->addLayoutExplicit();
-
-		ScriptGUILayout* nativeInstance = new (bs_alloc<ScriptGUILayout>())
-			ScriptGUILayout(instance, &layout, nativeLayout);
-	}
-
 	void ScriptGUILayout::internal_createInstanceYFromLayoutAdd(MonoObject* instance, MonoObject* parentLayout)
 	{
 		ScriptGUILayout* scriptLayout = ScriptGUILayout::toNative(parentLayout);
@@ -104,16 +92,6 @@ namespace BansheeEngine
 			ScriptGUILayout(instance, &layout, nativeLayout);
 	}
 
-	void ScriptGUILayout::internal_createInstanceExplicitFromLayoutInsert(MonoObject* instance, MonoObject* parentLayout, UINT32 index)
-	{
-		ScriptGUILayout* scriptLayout = ScriptGUILayout::toNative(parentLayout);
-		GUILayout* nativeLayout = scriptLayout->getInternalValue();
-		GUILayout& layout = nativeLayout->insertLayoutExplicit(index);
-
-		ScriptGUILayout* nativeInstance = new (bs_alloc<ScriptGUILayout>())
-			ScriptGUILayout(instance, &layout, nativeLayout);
-	}
-
 	void ScriptGUILayout::internal_createInstanceYFromScrollArea(MonoObject* instance, MonoObject* parentScrollArea)
 	{
 		ScriptGUIScrollArea* scriptScrollArea = ScriptGUIScrollArea::toNative(parentScrollArea);

+ 18 - 0
SBansheeEngine/Source/BsScriptInput.cpp

@@ -34,6 +34,9 @@ namespace BansheeEngine
 		metaData.scriptClass->addInternalCall("Internal_IsButtonHeld", &ScriptInput::internal_isButtonHeld);
 		metaData.scriptClass->addInternalCall("Internal_IsButtonDown", &ScriptInput::internal_isButtonDown);
 		metaData.scriptClass->addInternalCall("Internal_IsButtonUp", &ScriptInput::internal_isButtonUp);
+		metaData.scriptClass->addInternalCall("Internal_IsPointerButtonHeld", &ScriptInput::internal_isPointerButtonHeld);
+		metaData.scriptClass->addInternalCall("Internal_IsPointerButtonDown", &ScriptInput::internal_isPointerButtonDown);
+		metaData.scriptClass->addInternalCall("Internal_IsPointerButtonUp", &ScriptInput::internal_isPointerButtonUp);
 		metaData.scriptClass->addInternalCall("Internal_GetAxisValue", &ScriptInput::internal_getAxisValue);
 		metaData.scriptClass->addInternalCall("Internal_GetPointerPosition", &ScriptInput::internal_getPointerPosition);
 		metaData.scriptClass->addInternalCall("Internal_GetPointerDelta", &ScriptInput::internal_getPointerDelta);
@@ -154,6 +157,21 @@ namespace BansheeEngine
 		return Input::instance().isButtonUp(code, deviceIdx);
 	}
 
+	bool ScriptInput::internal_isPointerButtonHeld(PointerEventButton code)
+	{
+		return Input::instance().isPointerButtonHeld(code);
+	}
+
+	bool ScriptInput::internal_isPointerButtonDown(PointerEventButton code)
+	{
+		return Input::instance().isPointerButtonDown(code);
+	}
+
+	bool ScriptInput::internal_isPointerButtonUp(PointerEventButton code)
+	{
+		return Input::instance().isPointerButtonUp(code);
+	}
+
 	float ScriptInput::internal_getAxisValue(UINT32 axisType, UINT32 deviceIdx)
 	{
 		return Input::instance().getAxisValue(axisType, deviceIdx);