Fixed GUIComponent rects blocking input in the sub editor + Added Windows preprocessor directives
This commit is contained in:
@@ -52,14 +52,20 @@
|
|||||||
<PlatformTarget>x86</PlatformTarget>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWindows|x86' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWindows|x86' ">
|
||||||
<Optimize>false</Optimize>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>..\bin\ReleaseWindows\</OutputPath>
|
<OutputPath>..\bin\ReleaseWindows\</OutputPath>
|
||||||
|
<DefineConstants>TRACE;WINDOWS;CLIENT</DefineConstants>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWindows|x86' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWindows|x86' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>..\bin\DebugWindows\</OutputPath>
|
<OutputPath>..\bin\DebugWindows\</OutputPath>
|
||||||
|
<DefineConstants>TRACE;WINDOWS;CLIENT;DEBUG</DefineConstants>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -129,10 +129,41 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
get { return new Vector2(rect.Center.X, rect.Center.Y); }
|
get { return new Vector2(rect.Center.X, rect.Center.Y); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Rectangle ClampRect(Rectangle r)
|
||||||
|
{
|
||||||
|
if (parent == null) return r;
|
||||||
|
Rectangle parentRect = parent.ClampRect(parent.rect);
|
||||||
|
if (parentRect.Width <= 0 || parentRect.Height <= 0) return Rectangle.Empty;
|
||||||
|
if (parentRect.X > r.X)
|
||||||
|
{
|
||||||
|
int diff = parentRect.X - r.X;
|
||||||
|
r.X = parentRect.X;
|
||||||
|
r.Width -= diff;
|
||||||
|
}
|
||||||
|
if (parentRect.Y > r.Y)
|
||||||
|
{
|
||||||
|
int diff = parentRect.Y - r.Y;
|
||||||
|
r.Y = parentRect.Y;
|
||||||
|
r.Height -= diff;
|
||||||
|
}
|
||||||
|
if (parentRect.X + parentRect.Width < r.X + r.Width)
|
||||||
|
{
|
||||||
|
int diff = (r.X + r.Width) - (parentRect.X + parentRect.Width);
|
||||||
|
r.Width -= diff;
|
||||||
|
}
|
||||||
|
if (parentRect.Y + parentRect.Height < r.Y + r.Height)
|
||||||
|
{
|
||||||
|
int diff = (r.Y + r.Height) - (parentRect.Y + parentRect.Height);
|
||||||
|
r.Height -= diff;
|
||||||
|
}
|
||||||
|
if (r.Width <= 0 || r.Height <= 0) return Rectangle.Empty;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual Rectangle Rect
|
public virtual Rectangle Rect
|
||||||
{
|
{
|
||||||
get { return rect; }
|
get { return rect; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
int prevX = rect.X, prevY = rect.Y;
|
int prevX = rect.X, prevY = rect.Y;
|
||||||
@@ -162,7 +193,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public virtual Rectangle MouseRect
|
public virtual Rectangle MouseRect
|
||||||
{
|
{
|
||||||
get { return CanBeFocused ? rect : Rectangle.Empty; }
|
get { return CanBeFocused ? ClampRect(rect) : Rectangle.Empty; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<ComponentState, List<UISprite>> sprites;
|
public Dictionary<ComponentState, List<UISprite>> sprites;
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return rect;
|
return ClampRect(rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override Rectangle MouseRect
|
public override Rectangle MouseRect
|
||||||
{
|
{
|
||||||
get { return box.Rect; }
|
get { return ClampRect(box.Rect); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ScalableFont Font
|
public override ScalableFont Font
|
||||||
|
|||||||
@@ -51,14 +51,20 @@
|
|||||||
<PlatformTarget>x86</PlatformTarget>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWindows|x86' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWindows|x86' ">
|
||||||
<Optimize>false</Optimize>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\x86\ReleaseWindows</OutputPath>
|
<OutputPath>bin\x86\ReleaseWindows</OutputPath>
|
||||||
|
<DefineConstants>TRACE;SERVER</DefineConstants>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWindows|x86' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWindows|x86' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>bin\x86\DebugWindows</OutputPath>
|
<OutputPath>bin\x86\DebugWindows</OutputPath>
|
||||||
|
<DefineConstants>TRACE;SERVER;DEBUG</DefineConstants>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user