agate-svn-commit Mailing List for AgateLib (Page 4)
Status: Alpha
Brought to you by:
kanato
You can subscribe to this list here.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
(86) |
May
(77) |
Jun
|
Jul
(1) |
Aug
(31) |
Sep
(12) |
Oct
(31) |
Nov
(53) |
Dec
(39) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(53) |
Feb
(14) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
(7) |
Dec
(13) |
| 2011 |
Jan
(17) |
Feb
(5) |
Mar
(1) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
(21) |
Dec
|
| 2012 |
Jan
(6) |
Feb
(14) |
Mar
(5) |
Apr
(4) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
(1) |
Feb
(8) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(1) |
Oct
(5) |
Nov
(9) |
Dec
(5) |
| 2014 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(3) |
May
|
Jun
(5) |
Jul
(33) |
Aug
(69) |
Sep
(35) |
Oct
(4) |
Nov
(1) |
Dec
|
|
From: <ka...@us...> - 2014-08-15 19:27:40
|
Revision: 1462
http://sourceforge.net/p/agate/code/1462
Author: kanato
Date: 2014-08-15 19:27:26 +0000 (Fri, 15 Aug 2014)
Log Message:
-----------
Add new resource system.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/DisplayLib/BitmapFont/BitmapFontOptions.cs
trunk/AgateLib/DisplayLib/BitmapFont/FontMetrics.cs
trunk/AgateLib/DisplayLib/BitmapFont/GlyphMetrics.cs
trunk/AgateLib/DisplayLib/DisplayWindow.cs
trunk/AgateLib/DisplayLib/Font.cs
trunk/AgateLib/DisplayLib/FontSurface.cs
trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs
trunk/AgateLib/DisplayLib/Surface.cs
trunk/AgateLib/Drivers/IDisplayFactory.cs
trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs
trunk/AgateLib/Serialization/Xle/XleSerializer.cs
trunk/AgateLib/Sprites/Sprite.cs
trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/DesktopGLDisplay.cs
trunk/AgateLib.Platform.WindowsForms/WinForms/BitmapFontUtil.cs
trunk/Examples/BallBuster.Net/CImage.cs
trunk/Tests/CoreTests/Resources.cs
trunk/Tests/DisplayTests/ParticleTests/ParticleTests.cs
trunk/Tests/DisplayTests/SpriteTester/frmChooseSprite.cs
trunk/Tests/DisplayTests/SpriteTester/frmSpriteTester.cs
trunk/Tests/Fonts/BitmapFonts.cs
trunk/Tests/Fonts/FontAlignment.cs
trunk/Tests/UserInterfaceTests/GuiStuff.cs
trunk/Tools/FontCreator/FontCreator.cs
trunk/Tools/PackedSpriteCreator/SpriteEditor.cs
trunk/Tools/PackedSpriteCreator/frmNewSprite.cs
trunk/Tools/PackedSpriteCreator/frmSpriteCreator.cs
trunk/Tools/ResourceEditor/StringTable/StringTableEditor.cs
trunk/Tools/ResourceEditor/frmResourceEditor.cs
trunk/UnitTests/Display/FontTests.cs
trunk/UnitTests/Fakes/FakeDisplayDriver.cs
trunk/UnitTests/UnitTests.csproj
trunk/UnitTests/UserInterface/Css/LayoutTest.cs
Added Paths:
-----------
trunk/AgateLib/DisplayLib/FontSettings.cs
trunk/AgateLib/DisplayLib/FontStyles.cs
trunk/AgateLib/Drivers/NullDrivers/NullInputFactory.cs
trunk/AgateLib/Drivers/NullDrivers/NullSoundFactory.cs
trunk/AgateLib/Geometry/Polygon.cs
trunk/AgateLib/Resources/DC/
trunk/AgateLib/Resources/DC/AgateResource.cs
trunk/AgateLib/Resources/DC/AgateResourceCollection.cs
trunk/AgateLib/Resources/DC/FontResource.cs
trunk/AgateLib/Resources/DC/FontSurfaceResource.cs
trunk/AgateLib/Resources/DC/ResourceCollection.cs
trunk/AgateLib/Resources/DC/SpriteFrameResource.cs
trunk/AgateLib/Resources/DC/SpriteResource.cs
trunk/AgateLib/Resources/DC/SurfaceResource.cs
trunk/AgateLib/Resources/Legacy/
trunk/AgateLib/Resources/Legacy/AgateResource.cs
trunk/AgateLib/Resources/Legacy/AgateResourceCollection.cs
trunk/AgateLib/Resources/Legacy/AgateResourceLoader.cs
trunk/AgateLib/Resources/Legacy/BitmapFontResource.cs
trunk/AgateLib/Resources/Legacy/DisplayWindowResource.cs
trunk/AgateLib/Resources/Legacy/ImageResource.cs
trunk/AgateLib/Resources/Legacy/SpriteResource.cs
trunk/AgateLib/Resources/Legacy/StringTable.cs
trunk/AgateLib/Resources/Legacy/SurfaceResource.cs
trunk/AgateLib/Resources/Legacy/XmlHelper.cs
trunk/UnitTests/Fakes/FakeAgateFactory.cs
trunk/UnitTests/Fakes/FakePlatformFactory.cs
trunk/UnitTests/Fakes/FakePlatformInfo.cs
trunk/UnitTests/Resources/
trunk/UnitTests/Resources/SerializationTest.cs
Removed Paths:
-------------
trunk/AgateLib/Resources/AgateResource.cs
trunk/AgateLib/Resources/AgateResourceCollection.cs
trunk/AgateLib/Resources/AgateResourceLoader.cs
trunk/AgateLib/Resources/BitmapFontResource.cs
trunk/AgateLib/Resources/DisplayWindowResource.cs
trunk/AgateLib/Resources/ImageResource.cs
trunk/AgateLib/Resources/SpriteResource.cs
trunk/AgateLib/Resources/StringTable.cs
trunk/AgateLib/Resources/SurfaceResource.cs
trunk/AgateLib/Resources/XmlHelper.cs
trunk/AgateLib/Sprites/Polygon.cs
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-11 05:55:19 UTC (rev 1461)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-15 19:27:26 UTC (rev 1462)
@@ -84,6 +84,10 @@
<Compile Include="Algorithms\PathFinding\AStarNode.cs" />
<Compile Include="Algorithms\PathFinding\AStarState.cs" />
<Compile Include="Algorithms\Inverting.cs" />
+ <Compile Include="DisplayLib\FontSettings.cs" />
+ <Compile Include="DisplayLib\FontStyles.cs" />
+ <Compile Include="Drivers\NullDrivers\NullInputFactory.cs" />
+ <Compile Include="Drivers\NullDrivers\NullSoundFactory.cs" />
<Compile Include="Mathematics\MathHelper.cs" />
<Compile Include="Algorithms\PathFinding\IAStarMap.cs" />
<Compile Include="Algorithms\Pair.cs" />
@@ -96,9 +100,17 @@
<Compile Include="ApplicationModels\CoordinateSystems\FixedAspectRatioCoordinates.cs" />
<Compile Include="ApplicationModels\ICoordinateSystemCreator.cs" />
<Compile Include="ApplicationModels\ModelParameters.cs" />
+ <Compile Include="Resources\DC\AgateResource.cs" />
+ <Compile Include="Resources\DC\FontResource.cs" />
+ <Compile Include="Resources\DC\FontSurfaceResource.cs" />
+ <Compile Include="Resources\DC\ResourceCollection.cs" />
+ <Compile Include="Resources\DC\AgateResourceCollection.cs" />
+ <Compile Include="Resources\DC\SpriteFrameResource.cs" />
+ <Compile Include="Resources\DC\SpriteResource.cs" />
+ <Compile Include="Resources\DC\SurfaceResource.cs" />
<Compile Include="Sprites\CollisionRegion.cs" />
<Compile Include="Sprites\ISpriteContainer.cs" />
- <Compile Include="Sprites\Polygon.cs" />
+ <Compile Include="Geometry\Polygon.cs" />
<Compile Include="Sprites\SpriteContainer.cs" />
<Compile Include="UnitTesting\AssertThrows.cs" />
<Compile Include="AudioLib\AudioCapsInfo.cs" />
@@ -172,7 +184,7 @@
<Compile Include="Platform\IStopWatch.cs" />
<Compile Include="Platform\PlatformInfo.cs" />
<Compile Include="Platform\PlatformType.cs" />
- <Compile Include="Resources\ImageResource.cs" />
+ <Compile Include="Resources\Legacy\ImageResource.cs" />
<Compile Include="Serialization\Xle\CompressionMode.cs" />
<Compile Include="Serialization\Xle\CompressionType.cs" />
<Compile Include="Serialization\Xle\ITypeBinder.cs" />
@@ -456,34 +468,34 @@
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Resources\AgateResource.cs">
+ <Compile Include="Resources\Legacy\AgateResource.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Resources\AgateResourceCollection.cs">
+ <Compile Include="Resources\Legacy\AgateResourceCollection.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Resources\AgateResourceException.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Resources\AgateResourceLoader.cs">
+ <Compile Include="Resources\Legacy\AgateResourceLoader.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Resources\BitmapFontResource.cs">
+ <Compile Include="Resources\Legacy\BitmapFontResource.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Resources\DisplayWindowResource.cs">
+ <Compile Include="Resources\Legacy\DisplayWindowResource.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Resources\SpriteResource.cs">
+ <Compile Include="Resources\Legacy\SpriteResource.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Resources\StringTable.cs">
+ <Compile Include="Resources\Legacy\StringTable.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Resources\SurfaceResource.cs">
+ <Compile Include="Resources\Legacy\SurfaceResource.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Resources\XmlHelper.cs">
+ <Compile Include="Resources\Legacy\XmlHelper.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Sprites\FrameList.cs">
Modified: trunk/AgateLib/DisplayLib/BitmapFont/BitmapFontOptions.cs
===================================================================
--- trunk/AgateLib/DisplayLib/BitmapFont/BitmapFontOptions.cs 2014-08-11 05:55:19 UTC (rev 1461)
+++ trunk/AgateLib/DisplayLib/BitmapFont/BitmapFontOptions.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -93,7 +93,7 @@
private string mFamily;
private float mSize;
- private FontStyle mStyle;
+ private FontStyles mStyle;
private bool mUseTextRenderer = true;
private bool mCreateBorder;
private bool mMonospaceNumbers = true;
@@ -132,7 +132,7 @@
/// <param name="fontFamily"></param>
/// <param name="sizeInPoints"></param>
/// <param name="style"></param>
- public BitmapFontOptions(string fontFamily, float sizeInPoints, FontStyle style)
+ public BitmapFontOptions(string fontFamily, float sizeInPoints, FontStyles style)
: this(fontFamily, sizeInPoints)
{
mStyle = style;
@@ -240,7 +240,7 @@
/// <summary>
/// Style of the font to be generated.
/// </summary>
- public FontStyle FontStyle
+ public FontStyles FontStyle
{
get { return mStyle; }
set { mStyle = value; }
Modified: trunk/AgateLib/DisplayLib/BitmapFont/FontMetrics.cs
===================================================================
--- trunk/AgateLib/DisplayLib/BitmapFont/FontMetrics.cs 2014-08-11 05:55:19 UTC (rev 1461)
+++ trunk/AgateLib/DisplayLib/BitmapFont/FontMetrics.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -21,6 +21,7 @@
using System.Text;
using System.Xml;
using AgateLib.Geometry;
+using System.Runtime.Serialization;
namespace AgateLib.DisplayLib.BitmapFont
{
Modified: trunk/AgateLib/DisplayLib/BitmapFont/GlyphMetrics.cs
===================================================================
--- trunk/AgateLib/DisplayLib/BitmapFont/GlyphMetrics.cs 2014-08-11 05:55:19 UTC (rev 1461)
+++ trunk/AgateLib/DisplayLib/BitmapFont/GlyphMetrics.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -21,6 +21,7 @@
using System.Text;
using AgateLib.Geometry;
+using System.Runtime.Serialization;
namespace AgateLib.DisplayLib.BitmapFont
{
Modified: trunk/AgateLib/DisplayLib/DisplayWindow.cs
===================================================================
--- trunk/AgateLib/DisplayLib/DisplayWindow.cs 2014-08-11 05:55:19 UTC (rev 1461)
+++ trunk/AgateLib/DisplayLib/DisplayWindow.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -44,10 +44,10 @@
/// </summary>
/// <param name="resources"></param>
/// <param name="name"></param>
- public DisplayWindow(Resources.AgateResourceCollection resources, string name)
+ public DisplayWindow(Resources.Legacy.AgateResourceCollection resources, string name)
{
- Resources.AgateResource res = resources[name];
- Resources.DisplayWindowResource disp = res as Resources.DisplayWindowResource;
+ Resources.Legacy.AgateResource res = resources[name];
+ Resources.Legacy.DisplayWindowResource disp = res as Resources.Legacy.DisplayWindowResource;
if (disp == null)
throw new Resources.AgateResourceException("Resource " + name + " was found, but was of type " + name.GetType().ToString() + ", not DisplayWindowResource.");
Modified: trunk/AgateLib/DisplayLib/Font.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Font.cs 2014-08-11 05:55:19 UTC (rev 1461)
+++ trunk/AgateLib/DisplayLib/Font.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -19,7 +19,7 @@
Name = name;
}
- public void AddFont(FontSurface fontSurface, int size, FontStyle style)
+ public void AddFont(FontSurface fontSurface, int size, FontStyles style)
{
AddFont(new FontSettings(size, style), fontSurface);
}
@@ -33,11 +33,11 @@
public string Name { get; set; }
public int Size { get { return mSettings.Size; } set { mSettings.Size = value; } }
- public FontStyle Style { get { return mSettings.Style; } set { mSettings.Style = value; } }
+ public FontStyles Style { get { return mSettings.Style; } set { mSettings.Style = value; } }
public int FontHeight { get { return FontSurface.FontHeight; } }
- int MaxSize(FontStyle style)
+ int MaxSize(FontStyles style)
{
var keys = mFontSurfaces.Keys.Where(x => x.Style == style);
if (keys.Count() > 0)
@@ -58,7 +58,7 @@
#region --- Finding correctly sized font ---
- public FontSurface GetClosestFont(int size, FontStyle style)
+ public FontSurface GetClosestFont(int size, FontStyles style)
{
return GetClosestFont(new FontSettings(size, style));
}
@@ -74,7 +74,7 @@
return retval;
}
- internal FontSettings GetClosestFontSettings(int size, FontStyle style)
+ internal FontSettings GetClosestFontSettings(int size, FontStyles style)
{
return GetClosestFontSettings(new FontSettings(size, style));
}
@@ -88,16 +88,16 @@
// this happens if we have no font surfaces of this style.
if (maxSize <= 0)
{
- FontStyle newStyle;
+ FontStyles newStyle;
// OK remove styles until we find an actual font.
- if (TryRemoveStyle(settings.Style, FontStyle.Strikeout, out newStyle))
+ if (TryRemoveStyle(settings.Style, FontStyles.Strikeout, out newStyle))
return GetClosestFontSettings(settings.Size, newStyle);
- if (TryRemoveStyle(settings.Style, FontStyle.Italic, out newStyle))
+ if (TryRemoveStyle(settings.Style, FontStyles.Italic, out newStyle))
return GetClosestFontSettings(settings.Size, newStyle);
- if (TryRemoveStyle(settings.Style, FontStyle.Underline, out newStyle))
+ if (TryRemoveStyle(settings.Style, FontStyles.Underline, out newStyle))
return GetClosestFontSettings(settings.Size, newStyle);
- if (TryRemoveStyle(settings.Style, FontStyle.Bold, out newStyle))
+ if (TryRemoveStyle(settings.Style, FontStyles.Bold, out newStyle))
return GetClosestFontSettings(settings.Size, newStyle);
else
{
@@ -122,7 +122,7 @@
#endregion
- private bool TryRemoveStyle(FontStyle value, FontStyle remove, out FontStyle result)
+ private bool TryRemoveStyle(FontStyles value, FontStyles remove, out FontStyles result)
{
if ((value & remove) == remove)
{
@@ -167,28 +167,4 @@
}
}
- public struct FontSettings : IEquatable<FontSettings>
- {
- int mSize;
- FontStyle mStyle;
-
- public int Size { get { return mSize; } set { mSize = value; } }
- public FontStyle Style { get { return mStyle; } set { mStyle = value; } }
-
- public bool Equals(FontSettings other)
- {
- if (Size != other.Size)
- return false;
- if (Style != other.Style)
- return false;
-
- return true;
- }
-
- public FontSettings(int size, FontStyle style)
- {
- mSize = size;
- mStyle = style;
- }
- }
}
Added: trunk/AgateLib/DisplayLib/FontSettings.cs
===================================================================
--- trunk/AgateLib/DisplayLib/FontSettings.cs (rev 0)
+++ trunk/AgateLib/DisplayLib/FontSettings.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.DisplayLib
+{
+ /// <summary>
+ /// Structure which encapsulates font size and style.
+ /// </summary>
+ public struct FontSettings : IEquatable<FontSettings>
+ {
+ int mSize;
+ FontStyles mStyle;
+
+ /// <summary>
+ /// Size of the font in points.
+ /// </summary>
+ public int Size { get { return mSize; } set { mSize = value; } }
+ /// <summary>
+ /// Style(s) of the font. Combinations like bold&italic are possible.
+ /// </summary>
+ public FontStyles Style { get { return mStyle; } set { mStyle = value; } }
+
+ /// <summary>
+ /// Returns true if the two FontSettings objects are equal.
+ /// </summary>
+ /// <param name="other"></param>
+ /// <returns></returns>
+ public bool Equals(FontSettings other)
+ {
+ if (Size != other.Size)
+ return false;
+ if (Style != other.Style)
+ return false;
+
+ return true;
+ }
+
+ /// <summary>
+ /// Constructs a FontSettings object.
+ /// </summary>
+ /// <param name="size"></param>
+ /// <param name="style"></param>
+ public FontSettings(int size, FontStyles style)
+ {
+ mSize = size;
+ mStyle = style;
+ }
+
+ /// <summary>
+ /// Returns the full name of a font with these settings.
+ /// </summary>
+ /// <param name="family"></param>
+ /// <returns></returns>
+ public string FontName(string family)
+ {
+ return family + "-" + ToString();
+ }
+
+ /// <summary>
+ /// Converts to a string representation.
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString()
+ {
+ if (Style != FontStyles.None)
+ {
+ return string.Format("{0}-{1}", Size, Style);
+ }
+ else
+ return Size.ToString();
+ }
+ }
+}
Added: trunk/AgateLib/DisplayLib/FontStyles.cs
===================================================================
--- trunk/AgateLib/DisplayLib/FontStyles.cs (rev 0)
+++ trunk/AgateLib/DisplayLib/FontStyles.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.DisplayLib
+{
+ /// <summary>
+ /// Enumeration which allows selection of font styles when creating
+ /// a font from the OS. This enum has the FlagsAttribute, so its members
+ /// can be combined in a bitwise fashion.
+ /// </summary>
+ [Flags]
+ public enum FontStyles
+ {
+ /// <summary>
+ /// No style is applied.
+ /// </summary>
+ None = 0,
+ /// <summary>
+ /// Make the font bold.
+ /// </summary>
+ Bold = 1,
+ /// <summary>
+ /// Use italics.
+ /// </summary>
+ Italic = 2,
+ /// <summary>
+ /// Strikeout through the font glyphs.
+ /// </summary>
+ Strikeout = 4,
+ /// <summary>
+ /// Underline beneath the glyphs.
+ /// </summary>
+ Underline = 8,
+ }
+
+}
Modified: trunk/AgateLib/DisplayLib/FontSurface.cs
===================================================================
--- trunk/AgateLib/DisplayLib/FontSurface.cs 2014-08-11 05:55:19 UTC (rev 1461)
+++ trunk/AgateLib/DisplayLib/FontSurface.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -25,40 +25,11 @@
using AgateLib.DisplayLib.ImplementationBase;
using AgateLib.Geometry;
using AgateLib.Resources;
+using AgateLib.Resources.Legacy;
namespace AgateLib.DisplayLib
{
/// <summary>
- /// Enumeration which allows selection of font styles when creating
- /// a font from the OS. This enum has the FlagsAttribute, so its members
- /// can be combined in a bitwise fashion.
- /// </summary>
- [Flags]
- public enum FontStyle
- {
- /// <summary>
- /// No style is applied.
- /// </summary>
- None = 0,
- /// <summary>
- /// Make the font bold.
- /// </summary>
- Bold = 1,
- /// <summary>
- /// Use italics.
- /// </summary>
- Italic = 2,
- /// <summary>
- /// Strikeout through the font glyphs.
- /// </summary>
- Strikeout = 4,
- /// <summary>
- /// Underline beneath the glyphs.
- /// </summary>
- Underline = 8,
- }
-
- /// <summary>
/// Class which represents a font to draw on the screen.
/// <remarks>When creating a FontSurface, if you are going to be
/// scaling the font, it usually looks much better to make a large font
@@ -82,7 +53,7 @@
/// ones, like FontSurface.AgateSans14.
/// </remarks>
public FontSurface(string fontFamily, float sizeInPoints)
- : this(fontFamily, sizeInPoints, FontStyle.None)
+ : this(fontFamily, sizeInPoints, FontStyles.None)
{ }
/// <summary>
@@ -97,7 +68,7 @@
/// support, either create a bitmap font, or use one of the built-in
/// ones, like FontSurface.AgateSans14.
/// </remarks>
- public FontSurface(string fontFamily, float sizeInPoints, FontStyle style)
+ public FontSurface(string fontFamily, float sizeInPoints, FontStyles style)
{
if (sizeInPoints < 1)
throw new ArgumentOutOfRangeException("Font size must be positive and non-zero, but was " +
Modified: trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs 2014-08-11 05:55:19 UTC (rev 1461)
+++ trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -176,7 +176,7 @@
/// <param name="style"></param>
/// <returns></returns>
public abstract FontSurfaceImpl CreateFont(string fontFamily,
- float sizeInPoints, FontStyle style);
+ float sizeInPoints, FontStyles style);
/// <summary>
/// Creates a BitmapFontImpl object from the specified options.
Modified: trunk/AgateLib/DisplayLib/Surface.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Surface.cs 2014-08-11 05:55:19 UTC (rev 1461)
+++ trunk/AgateLib/DisplayLib/Surface.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -67,12 +67,12 @@
/// </summary>
/// <param name="resources"></param>
/// <param name="name"></param>
- public Surface(Resources.AgateResourceCollection resources, string name)
+ public Surface(Resources.Legacy.AgateResourceCollection resources, string name)
{
if (Display.Impl == null)
throw new AgateException("AgateLib's display system has not been initialized.");
- Resources.SurfaceResource surf = resources.Surfaces[name];
+ Resources.Legacy.SurfaceResource surf = resources.Surfaces[name];
mImpl = surf.CreateSurfaceImpl();
Modified: trunk/AgateLib/Drivers/IDisplayFactory.cs
===================================================================
--- trunk/AgateLib/Drivers/IDisplayFactory.cs 2014-08-11 05:55:19 UTC (rev 1461)
+++ trunk/AgateLib/Drivers/IDisplayFactory.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -1,4 +1,5 @@
-using System;
+using AgateLib.DisplayLib.ImplementationBase;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,6 +9,6 @@
{
public interface IDisplayFactory
{
- DisplayLib.ImplementationBase.DisplayImpl CreateDisplayImpl();
+ DisplayImpl CreateDisplayImpl();
}
}
Added: trunk/AgateLib/Drivers/NullDrivers/NullInputFactory.cs
===================================================================
--- trunk/AgateLib/Drivers/NullDrivers/NullInputFactory.cs (rev 0)
+++ trunk/AgateLib/Drivers/NullDrivers/NullInputFactory.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.Drivers.NullDrivers
+{
+ public class NullInputFactory : IInputFactory
+ {
+ public InputLib.ImplementationBase.InputImpl CreateJoystickInputImpl()
+ {
+ return new NullInputImpl();
+ }
+ }
+}
Added: trunk/AgateLib/Drivers/NullDrivers/NullSoundFactory.cs
===================================================================
--- trunk/AgateLib/Drivers/NullDrivers/NullSoundFactory.cs (rev 0)
+++ trunk/AgateLib/Drivers/NullDrivers/NullSoundFactory.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.Drivers.NullDrivers
+{
+ public class NullSoundFactory : IAudioFactory
+ {
+ public AudioLib.ImplementationBase.AudioImpl CreateAudioImpl()
+ {
+ return new NullSoundImpl();
+ }
+ }
+}
Copied: trunk/AgateLib/Geometry/Polygon.cs (from rev 1460, trunk/AgateLib/Sprites/Polygon.cs)
===================================================================
--- trunk/AgateLib/Geometry/Polygon.cs (rev 0)
+++ trunk/AgateLib/Geometry/Polygon.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -0,0 +1,179 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using AgateLib.Geometry;
+using System.Runtime.Serialization;
+
+namespace AgateLib.Geometry
+{
+ [DataContract]
+ public class Polygon
+ {
+ [DataMember]
+ List<Vector2> mPoints = new List<Vector2>();
+
+ public List<Vector2> Points
+ {
+ get { return mPoints; }
+ }
+
+ public Polygon Clone()
+ {
+ var retval = new Polygon();
+
+ retval.mPoints.AddRange(mPoints);
+
+ return retval;
+ }
+
+ public static Polygon FromRect(Rectangle rect)
+ {
+ Polygon retval = new Polygon();
+
+ retval.AddPoint(rect.X, rect.Y);
+ retval.AddPoint(rect.Right, rect.Y);
+ retval.AddPoint(rect.Right, rect.Bottom);
+ retval.AddPoint(rect.X, rect.Bottom);
+
+ return retval;
+ }
+
+ private void AddPoint(int x, int y)
+ {
+ mPoints.Add(new Vector2(x, y));
+ }
+
+ public Rectangle BoundingRect
+ {
+ get
+ {
+ if (Points.Count == 0)
+ throw new InvalidOperationException();
+
+ int left = int.MaxValue;
+ int right = int.MinValue;
+ int top = int.MaxValue;
+ int bottom = int.MinValue;
+
+ foreach (var pt in Points)
+ {
+ if (pt.X < left) left = (int)pt.X;
+ if (pt.X > right) right = (int)pt.X;
+ if (pt.Y < top) top = (int)pt.Y;
+ if (pt.Y > bottom) bottom = (int)pt.Y;
+ }
+
+ return Rectangle.FromLTRB(left, top, right, bottom);
+ }
+ }
+
+
+ #region --- Collision Checking ---
+
+ public static bool PolysIntersect(Polygon polyA, Polygon polyB)
+ {
+ return PolysIntersect(polyA, Vector2.Empty, polyB, Vector2.Empty);
+ }
+ public static bool PolysIntersect(
+ Polygon polyA, Vector2 offsetA,
+ Polygon polyB, Vector2 offsetB)
+ {
+ // do the separating axis test for each edge in each square.
+ if (FindSeparatingAxis(
+ polyA.mPoints, offsetA,
+ polyB.mPoints, offsetB))
+ return false;
+
+ if (FindSeparatingAxis(
+ polyB.mPoints, offsetB,
+ polyA.mPoints, offsetA))
+ return false;
+
+ return true;
+ }
+
+ /// <summary>
+ /// Checks to see if any of the lines in the first set of vectors groups
+ /// all the points in the second set of vectors entirely into one side.
+ /// This algorithm can be used to determine if two convex polygons intersect.
+ /// </summary>
+ /// <param name="va"></param>
+ /// <param name="vb"></param>
+ /// <returns></returns>
+ private static bool FindSeparatingAxis(
+ List<Vector2> va, Vector2 offsetA,
+ List<Vector2> vb, Vector2 offsetB)
+ {
+ for (int i = 0; i < va.Count; i++)
+ {
+ int next = i + 1;
+ if (next == va.Count) next = 0;
+
+ int nextnext = next + 1;
+ if (nextnext == va.Count) nextnext = 0;
+
+ Vector2 edge = va[next] - va[i];
+
+ bool separating = true;
+
+ // first check to see which side of the axis the points in
+ // va are on, stored in the inSide variable.
+ Vector2 indiff = va[nextnext] - va[i];
+
+ var indot = indiff.DotProduct(edge);
+ int inSide = Math.Sign(indot);
+ int lastSide = 0;
+
+ for (int j = 0; j < vb.Count; j++)
+ {
+ Vector2 diff = vb[j] - va[i];
+ diff += offsetB - offsetA;
+
+ var dot = diff.DotProduct(edge);
+ var side = Math.Sign(dot);
+
+ // this means points in vb are on the same side
+ // of the edge as points in va. Thus, it is not
+ // a separating axis.
+ if (side == inSide)
+ {
+ separating = false;
+ break;
+ }
+
+ if (lastSide == 0)
+ lastSide = side;
+ else if (lastSide != side)
+ {
+ // if we fail here, it means the axis goes right through
+ // the polygon defined in vb, so this is not a separating
+ // axis.
+ separating = false;
+ break;
+ }
+ }
+
+ if (separating)
+ return true;
+ }
+
+ return false;
+ }
+
+ #endregion
+
+
+ public bool IsAlignedRect
+ {
+ get
+ {
+ if (mPoints.Count != 4)
+ return false;
+
+ // TODO: actually implement this method.
+ return true;
+ }
+ }
+ }
+}
Deleted: trunk/AgateLib/Resources/AgateResource.cs
===================================================================
--- trunk/AgateLib/Resources/AgateResource.cs 2014-08-11 05:55:19 UTC (rev 1461)
+++ trunk/AgateLib/Resources/AgateResource.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -1,85 +0,0 @@
-// The contents of this file are subject to the Mozilla Public License
-// Version 1.1 (the "License"); you may not use this file except in
-// compliance with the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS"
-// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-// License for the specific language governing rights and limitations
-// under the License.
-//
-// The Original Code is AgateLib.
-//
-// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2014.
-// All Rights Reserved.
-//
-// Contributor(s): Erik Ylvisaker
-//
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Xml;
-using System.Xml.Linq;
-using System.Xml.Serialization;
-
-namespace AgateLib.Resources
-{
- /// <summary>
- /// Class which represents a resource.
- /// </summary>
- public abstract class AgateResource
- {
- private string mName;
- private string mLanguage = "Default";
-
- /// <summary>
- /// Constructs a base resource object.
- /// </summary>
- protected AgateResource()
- { }
- /// <summary>
- /// Constructs a base resource object.
- /// </summary>
- /// <param name="name"></param>
- protected AgateResource(string name)
- {
- mName = name;
- }
- /// <summary>
- /// Name of the resource
- /// </summary>
- public string Name
- {
- get { return mName; }
- set { mName = value; }
- }
- /// <summary>
- /// Language this resource is to be used for. If this is a language-independent
- /// resource, then the Language will be "Default".
- /// </summary>
- public string Language
- {
- get { return mLanguage; }
- private set { mLanguage = value; }
- }
-
- /// <summary>
- /// Serializes the AgateResource object to a subelement of parent.
- /// </summary>
- /// <param name="parent">The parent element of this resource.</param>
- /// <param name="doc">The XML document used to create elements.</param>
- internal abstract void BuildNodes(XElement parent);
-
- #region --- ICloneable Members ---
-
- /// <summary>
- /// Override to construct a copy of the resource.
- /// </summary>
- /// <returns></returns>
- protected abstract AgateResource Clone();
-
-
- #endregion
- }
-}
Deleted: trunk/AgateLib/Resources/AgateResourceCollection.cs
===================================================================
--- trunk/AgateLib/Resources/AgateResourceCollection.cs 2014-08-11 05:55:19 UTC (rev 1461)
+++ trunk/AgateLib/Resources/AgateResourceCollection.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -1,478 +0,0 @@
-// The contents of this file are subject to the Mozilla Public License
-// Version 1.1 (the "License"); you may not use this file except in
-// compliance with the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS"
-// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-// License for the specific language governing rights and limitations
-// under the License.
-//
-// The Original Code is AgateLib.
-//
-// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2014.
-// All Rights Reserved.
-//
-// Contributor(s): Erik Ylvisaker
-//
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Text;
-using System.Xml;
-using System.IO;
-using AgateLib.DisplayLib;
-using AgateLib.DisplayLib.ImplementationBase;
-using AgateLib.Utility;
-using AgateLib.IO;
-
-namespace AgateLib.Resources
-{
- /// <summary>
- /// Class which wraps an XML based resource file. This class provides methods for adding
- /// and extracting resources.
- /// </summary>
- public class AgateResourceCollection : IDictionary<string, AgateResource>, ICollection<AgateResource>
- {
- Dictionary<string, AgateResource> mStore = new Dictionary<string, AgateResource>();
-
- List<ImageResource> mImages = new List<ImageResource>();
- //List<GuiThemeResource> mGuiThemes = new List<GuiThemeResource>();
-
- const string mStringTableKey = "Strings";
- bool mOwnFileProvider;
- IReadFileProvider mFileProvider;
-
- SurfaceResourceList mSurfaceAccessor;
- //GuiThemeResourceList mGuiThemeAccessor;
-
- public class SurfaceResourceList
- {
- AgateResourceCollection mResources;
-
- internal SurfaceResourceList(AgateResourceCollection resources)
- {
- mResources = resources;
- }
-
- public SurfaceResource this[string key]
- {
- get
- {
- foreach (var img in mResources.mImages)
- {
- var retval = img.Surfaces.FirstOrDefault(x => x.Name == key);
-
- if (retval != null)
- return retval;
- }
-
- throw new AgateResourceException("Could not find the surface resource {0}.", key);
- }
- }
-
- public int Count
- {
- get { return mResources.mImages.Count; }
- }
- }
- // public class GuiThemeResourceList
- // {
- // AgateResourceCollection mResources;
- //
- // internal GuiThemeResourceList(AgateResourceCollection resources)
- // {
- // mResources = resources;
- // }
- //
- // public GuiThemeResource this[string key]
- // {
- // get
- // {
- // var retval = mResources.mGuiThemes.FirstOrDefault(x => x.Name == key);
- //
- // if (retval == null)
- // throw new AgateResourceException("Could not find the gui theme resource {0}.", key);
- //
- // return retval;
- // }
- // }
- // public GuiThemeResource this[int index]
- // {
- // get { return mResources.mGuiThemes[index]; }
- // }
- // public int Count
- // {
- // get { return mResources.mGuiThemes.Count; }
- // }
- // }
-
- /// <summary>
- /// Constructs a new AgateResourceCollection object.
- /// </summary>
- public AgateResourceCollection()
- {
- mSurfaceAccessor = new SurfaceResourceList(this);
- //mGuiThemeAccessor = new GuiThemeResourceList(this);
-
- this.mStore.Add(mStringTableKey, new StringTable());
- }
- /// <summary>
- /// Constructs a new AgateResourceCollection object.
- /// </summary>
- /// <param name="filename"></param>
- public AgateResourceCollection(string filename)
- {
- mSurfaceAccessor = new SurfaceResourceList(this);
- //mGuiThemeAccessor = new GuiThemeResourceList(this);
-
- RootDirectory = FileSystem.Path.GetDirectoryName(filename);
-
- Load(filename);
- }
-
- private void Load(string filename)
- {
- using (Stream s = FileProvider.OpenRead(filename))
- {
- AgateResourceLoader.LoadResources(this, s);
- }
- }
-
- /// <summary>
- /// Gets or sets the file provider used to laod resources.
- /// </summary>
- public IReadFileProvider FileProvider
- {
- get
- {
- if (mFileProvider == null)
- return AgateLib.IO.FileProvider.ResourceAssets;
-
- return mFileProvider;
- }
- set { mFileProvider = value; }
- }
-
- /// <summary>
- ///
- /// </summary>
- public string RootDirectory { get; set; }
-
- private IEnumerable<T> Enumerate<T>() where T : AgateResource
- {
- foreach (KeyValuePair<string, AgateResource> kvp in mStore)
- {
- if (kvp.Value is T)
- yield return kvp.Value as T;
- }
- }
- /// <summary>
- /// Enumerates through the SpriteResources contained in this group of resources.
- /// </summary>
- public IEnumerable<SpriteResource> Sprites
- {
- get
- {
- return Enumerate<SpriteResource>();
- }
- }
- /// <summary>
- /// Enumerates through the SurfaceResources contained in this group of resources.
- /// </summary>
- public SurfaceResourceList Surfaces
- {
- get
- {
- return mSurfaceAccessor;
- }
- }
- /// <summary>
- /// Gets the list of GuiThemeResource objects.
- /// </summary>
- // public GuiThemeResourceList GuiThemes
- // {
- // get { return mGuiThemeAccessor; }
- // }
- /// <summary>
- /// Enumerates through the DisplayWindowResources contained in this group of resources.
- /// </summary>
- public IEnumerable<DisplayWindowResource> DisplayWindows
- {
- get { return Enumerate<DisplayWindowResource>(); }
- }
- /// <summary>
- /// Enumerates through the BitmapFontResources contained in this group of resources.
- /// </summary>
- public IEnumerable<BitmapFontResource> BitmapFonts
- {
- get { return Enumerate<BitmapFontResource>(); }
- }
- /// <summary>
- /// Gets the StringTable for this langauge.
- /// </summary>
- public StringTable Strings
- {
- get
- {
- if (this.mStore.ContainsKey(mStringTableKey))
- return (StringTable)this.mStore[mStringTableKey];
- else
- return null;
- }
- }
-
- /// <summary>
- /// Adds a resource to this group. An exception is thrown if an item with the same name
- /// already exists in the group.
- /// </summary>
- /// <param name="item"></param>
- public void Add(AgateResource item)
- {
- if (item is StringTable)
- this.AddStringsTable((StringTable)item);
- else if (item is ImageResource)
- {
- ImageResource img = (ImageResource)item;
- img.FileProvider = FileProvider;
-
- mImages.Add(img);
- }
- // else if (item is GuiThemeResource)
- // {
- // mGuiThemes.Add((GuiThemeResource)item);
- // }
- else
- mStore.Add(item.Name, item);
- }
-
-
- /// <summary>
- /// Adds a strings
- /// </summary>
- /// <param name="table"></param>
- private void AddStringsTable(StringTable table)
- {
- if (Strings == null)
- this.mStore[mStringTableKey] = table;
- else if (Strings.Count != 0)
- throw new ArgumentException("The string table for this ResourceGroup is non-empty. Should you add your strings to the existing string table?");
- else
- this.mStore[mStringTableKey] = table;
- }
- /// <summary>
- ///
- /// </summary>
- public void Clear()
- {
- mStore.Clear();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="resourceName"></param>
- /// <returns></returns>
- public bool Contains(string resourceName)
- {
- return mStore.ContainsKey(resourceName);
- }
-
- /// <summary>
- ///
- /// </summary>
- public int Count
- {
- get { return mStore.Count; }
- }
-
- #region --- IDictionary<string,AgateResource> Members ---
-
- void IDictionary<string, AgateResource>.Add(string key, AgateResource value)
- {
- value.Name = key;
- this.Add(value);
- }
-
- /// <summary>
- /// Returns a collection of all the resource names.
- /// </summary>
- public ICollection<string> Keys
- {
- get { return mStore.Keys; }
- }
-
-
- bool IDictionary<string, AgateResource>.ContainsKey(string key)
- {
- return mStore.ContainsKey(key);
- }
- /// <summary>
- /// Removes a resource.
- /// </summary>
- /// <param name="resourceName"></param>
- /// <returns></returns>
- public bool Remove(string resourceName)
- {
- return mStore.Remove(resourceName);
- }
- /// <summary>
- /// Tries to find the resource in the collection. False is returned if
- /// the resource does not exist.
- /// </summary>
- /// <param name="key"></param>
- /// <param name="value"></param>
- /// <returns></returns>
- public bool TryGetValue(string key, out AgateResource value)
- {
- return mStore.TryGetValue(key, out value);
- }
- /// <summary>
- /// Gets a collection of all the AgateResource objects in the collection.
- /// </summary>
- public ICollection<AgateResource> Values
- {
- get { return mStore.Values; }
- }
- /// <summary>
- /// Gets or sets the resource with the specified key.
- /// </summary>
- /// <param name="key"></param>
- /// <returns></returns>
- public AgateResource this[string key]
- {
- get
- {
- if (mStore.ContainsKey(key))
- return mStore[key];
- else
- throw new KeyNotFoundException("The given resource was not found within the resource collection.");
- }
- set
- {
- mStore[key] = value;
- }
- }
-
- #endregion
- #region --- ICollection<KeyValuePair<string,AgateResource>> Members ---
-
- void ICollection<KeyValuePair<string, AgateResource>>.Add(KeyValuePair<string, AgateResource> item)
- {
- mStore.Add(item.Key, item.Value);
- }
- bool ICollection<KeyValuePair<string, AgateResource>>.Contains(KeyValuePair<string, AgateResource> item)
- {
- return (mStore as ICollection<KeyValuePair<string, AgateResource>>).Contains(item);
- }
- void ICollection<KeyValuePair<string, AgateResource>>.CopyTo(KeyValuePair<string, AgateResource>[] array, int arrayIndex)
- {
- (mStore as ICollection<KeyValuePair<string, AgateResource>>).CopyTo(array, arrayIndex);
- }
- bool ICollection<KeyValuePair<string, AgateResource>>.Remove(KeyValuePair<string, AgateResource> item)
- {
- return mStore.Remove(item.Key);
- }
- bool ICollection<KeyValuePair<string, AgateResource>>.IsReadOnly
- {
- get { return false; }
- }
-
- #endregion
- #region --- IEnumerable<KeyValuePair<string,AgateResource>> Members ---
-
- IEnumerator<KeyValuePair<string, AgateResource>> IEnumerable<KeyValuePair<string, AgateResource>>.GetEnumerator()
- {
- return mStore.GetEnumerator();
- }
-
- #endregion
-
- #region --- IEnumerable<AgateResource> Members ---
-
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public IEnumerator<AgateResource> GetEnumerator()
- {
- return mStore.Values.GetEnumerator();
- }
-
- #endregion
- #region --- IEnumerable Members ---
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- #endregion
-
- #region --- ICollection<AgateResource> Members ---
-
- /// <summary>
- /// Gets whether the item is part of the collection.
- /// </summary>
- /// <param name="item"></param>
- /// <returns></returns>
- public bool Contains(AgateResource item)
- {
- return mStore.ContainsValue(item);
- }
-
- void ICollection<AgateResource>.CopyTo(AgateResource[] array, int arrayIndex)
- {
- foreach (AgateResource res in mStore.Values)
- {
- array[arrayIndex] = res;
- arrayIndex++;
- }
- }
- bool ICollection<AgateResource>.IsReadOnly
- {
- get { return false; }
- }
-
- /// <summary>
- /// Removes a resource from the collection.
- /// </summary>
- /// <param name="item"></param>
- /// <returns></returns>
- public bool Remove(AgateResource item)
- {
- return mStore.Remove(item.Name);
- }
-
- #endregion
-
- Dictionary<string, SurfaceImpl> mOwnedSurfaces = new Dictionary<string, SurfaceImpl>();
-
- internal SurfaceImpl LoadSurfaceImpl(string filename)
- {
- if (mOwnedSurfaces.ContainsKey(filename) == false)
- {
- string path = string.IsNullOrEmpty(RootDirectory) ? filename :
- RootDirectory + "/" + filename;
- SurfaceImpl impl = Display.Impl.CreateSurface(FileProvider, path);
-
- mOwnedSurfaces.Add(filename, impl);
-
- return impl;
- }
- else
- {
- return mOwnedSurfaces[filename];
- }
- }
-
- internal string FullFileName(string filename)
- {
- if (string.IsNullOrEmpty(RootDirectory))
- return filename;
-
- return RootDirectory + "/" + filename;
- }
- }
-}
\ No newline at end of file
Deleted: trunk/AgateLib/Resources/AgateResourceLoader.cs
===================================================================
--- trunk/AgateLib/Resources/AgateResourceLoader.cs 2014-08-11 05:55:19 UTC (rev 1461)
+++ trunk/AgateLib/Resources/AgateResourceLoader.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -1,176 +0,0 @@
-// The contents of this file are subject to the Mozilla Public License
-// Version 1.1 (the "License"); you may not use this file except in
-// compliance with the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS"
-// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-// License for the specific language governing rights and limitations
-// under the License.
-//
-// The Original Code is AgateLib.
-//
-// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2014.
-// All Rights Reserved.
-//
-// Contributor(s): Erik Ylvisaker
-//
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.IO;
-using System.Xml;
-using AgateLib.Utility;
-using System.Diagnostics;
-using System.Xml.Linq;
-
-namespace AgateLib.Resources
-{
- /// <summary>
- /// Static class which loads and saves AgateResourceCollection objects to disk.
- /// </summary>
- public static class AgateResourceLoader
- {
- /// <summary>
- /// Saves the resources to a file located in the Filename property.
- /// </summary>
- public static void SaveResources(AgateResourceCollection resources, string filename)
- {
- XDocument doc = new XDocument();
- XElement root = new XElement("AgateResources",
- new XAttribute("Version", "1.0.0"));
-
- doc.Add(root);
-
- foreach (AgateResource res in resources)
- {
- res.BuildNodes(root);
- }
-
- //doc.Save(filename);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Static method which creates a resource manager based on the contents of a file.
- /// </summary>
- /// <param name="filename"></param>
- /// <returns></returns>
- [Obsolete("Use new AgateResourceCollection instead.")]
- public static AgateResourceCollection LoadResources(string filename)
- {
- return new AgateResourceCollection(filename);
- }
-
- /// <summary>
- /// Loads the resource information from a stream containing XML data.
- /// This erases all information in the current AgateResourceCollection.
- /// </summary>
- /// <param name="resources"></param>
- /// <param name="stream"></param>
- public static void LoadResources(AgateResourceCollection resources, Stream stream)
- {
- XDocument doc = new XDocument();
- try
- {
- doc = XDocument.Load(new StreamReader(stream));
- }
- catch (XmlException e)
- {
- throw new AgateResourceException("The XML resource file is malformed.", e);
- }
-
- XElement root = doc.Elements().First();
-
- if (root.Attribute("Version") == null)
- throw new AgateResourceException("XML resource file does not contain the required version attibute.");
-
- string version = root.Attribute("Version").Value;
-
- switch (version)
- {
- case "1.0.0":
- case "0.4.0":
- case "0.3.5":
- case "0.3.2":
- case "0.3.1":
- case "0.3.0":
- ReadVersion100(resources, root, version);
- break;
-
- default:
- throw new AgateResourceException("XML Resource file version " + version + " not supported.");
- }
- }
-
-
- private static void ReadVersion100(AgateResourceCollection resources, XElement root, string version)
- {
- foreach (var node in root.Elements())
- {
- try
- {
- resources.Add(ReadNode(node, version));
- }
- catch (Exception e)
- {
- throw new AgateResourceException("An error occurred while reading XML resource file: \r\n"
- + e.Message, e);
- }
- }
- }
-
- private static AgateResource ReadNode(XElement node, string version)
- {
- switch (node.Name.LocalName)
- {
- case "StringTable":
- return new StringTable(node, version);
-
- case "DisplayWindow":
- return new DisplayWindowResource(node, version);
-
- case "Image":
- return new ImageResource(node, version);
-
- case "Surface":
- return new SurfaceResource(node, version);
-
- case "Sprite":
- return new SpriteResource(node, version);
-
- case "BitmapFont":
- return new BitmapFontResource(node, version);
-
- default:
- ReadError("Unrecognized node " + node.Name + ".");
- return null;
- }
- }
- private static void ReadError(string message)
- {
- if (ThrowOnReadError)
- {
- throw new InvalidOperationException(message);
- }
- else
- Debug.WriteLine(message);
- }
-
- static bool mThrowOnReadError = true;
-
- /// <summary>
- /// Gets or sets a bool value indicating whether or not an exception
- /// is thrown if an unknown resource type is encountered when reading
- /// an XML file.
- /// </summary>
- public static bool ThrowOnReadError
- {
- get { return mThrowOnReadError; }
- set { mThrowOnReadError = value; }
- }
-
- }
-}
Deleted: trunk/AgateLib/Resources/BitmapFontResource.cs
===================================================================
--- trunk/AgateLib/Resources/BitmapFontResource.cs 2014-08-11 05:55:19 UTC (rev 1461)
+++ trunk/AgateLib/Resources/BitmapFontResource.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -1,226 +0,0 @@
-// The contents of this file are subject to the Mozilla Public License
-// Version 1.1 (the "License"); you may not use this file except in
-// compliance with the License. You may obtain a copy of the License at
-// http://www.mozilla.org/MPL/
-//
-// Software distributed under the License is distributed on an "AS IS"
-// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-// License for the specific language governing rights and limitations
-// under the License.
-//
-// The Original Code is AgateLib.
-//
-// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2014.
-// All Rights Reserved.
-//
-// Contributor(s): Erik Ylvisaker
-//
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Xml;
-using AgateLib.DisplayLib.BitmapFont;
-using AgateLib.Geometry;
-using System.Xml.Linq;
-
-namespace AgateLib.Resources
-{
- /// <summary>
- /// Resource representing a bitmap font.
- /// </summary>
- public class BitmapFontResource : AgateResource
- {
- string mImage;
- FontMetrics mMetrics = new FontMetrics();
-
- /// <summary>
- /// Constructs a BitmapFontResource.
- /// </summary>
- /// <param name="name"></param>
- public BitmapFontResource(string name)
- : base(name)
- { }
- internal BitmapFontResource(XElement node, string version)
- : base(string.Empty)
- {
- switch (version)
- {
- case "0.3.2":
- Name = node.Attribute("name").Value;
- mImage = XmlHelper.ReadAttributeString(node, "image", string.Empty);
-
- ReadMetrics032(node);
-
- break;
-
- case "0.3.1":
- case "0.3.0":
- Name = node.Attribute("name").Value;
- mImage = XmlHelper.ReadAttributeString(node, "image", string.Empty);
-
- ReadMetrics030(node);
-
- break;
-
- default:
- throw new AgateResourceException("Loading the BitmapFontResource is not supported for " +
- "version " + version + " yet. ");
- }
- }
-
- private void ReadMetrics032(XElement parent)
- {
- XElement root = null;
-
- // find metrics node
- foreach (XElement n in parent.Elements())
- {
- if (n.Name == "Metrics")
- {
- root = n;
- break;
- }
- }
-
- if (root == null)
- throw new AgateResourceException(string.Format(
- "Could not find Metrics node in bitmap font resource {0}.", Name));
-
- foreach (XElement node in root.Elements())
- {
- if (node.Name == "Glyph")
- {
- GlyphMetrics glyph = new GlyphMetrics();
-
- char key = (char)int.Parse(node.Attribute("char").Value);
- glyph.SourceRect = Rectangle.Parse(node.Attribute("source").Value);
-
- glyph.LeftOverhang = XmlHelper.ReadAttributeInt(node, "leftOverhang", 0);
- glyph.RightOverhang = XmlHelper.ReadAttributeInt(node, "rightOverhang", 0);
-
- mMetrics.Add(key, glyph);
- }
- else if (node.Name == "Kerning")
- {
- char left = (char)XmlHelper.ReadAttributeInt(node, "first");
- char right = (char)XmlHelper.ReadAttributeInt(node, "second");
- int value = XmlHelper.ReadAttributeInt(node, "value");
-
- mMetrics[left].KerningPairs.Add(right, value);
- }
- else
- {
- throw new AgateResourceException(string.Format(
- "Expected to find glyph node, but found {0} instead.", node.Name));
- }
- }
- }
-
- private void ReadMetrics030(XElement parent)
- {
- XElement root = null;
-
- // find metrics node
- foreach (XElement n in parent.Elements())
- {
- if (n.Name == "Metrics")
- {
- root = n;
- break;
- }
- }
-
- if (root == null)
- throw new AgateResourceException(string.Format(
- "Could not find Metrics node in bitmap font resource {0}.", Name));
-
- foreach (XElement node in root.Elements("Glyph"))
- {
- GlyphMetrics glyph = new GlyphMetrics();
-
- char key = (char)int.Parse(node.Attribute("char").Value);
- glyph.SourceRect = Rectangle.Parse(node.Attribute("source").Value);
-
- glyph.LeftOverhang = XmlHelper.ReadAttributeInt(node, "leftOverhang", 0);
- glyph.RightOverhang = XmlHelper.ReadAttributeInt(node, "rightOverhang", 0);
-
- mMetrics.Add(key, glyph);
- }
- }
-
- internal override void BuildNodes(XElement parent)
- {
- XElement root = new XElement("BitmapFont");
-
- root.Add(new XAttribute("name", Name));
- root.Add(new XAttribute("image", mImage));
-
- XElement metrics = new XElement("Metrics");
-
- foreach (char glyph in mMetrics.Keys)
- {
- XElement current = new XElement("Glyph");
- GlyphMetrics glyphMetrics = mMetrics[glyph];
-
- current.Add(new XAttribute("char", glyph));
- current.Add(new XAttribute("source", glyphMetrics.SourceRect.ToString()));
-
- if (glyphMetrics.LeftOverhang != 0)
- current.Add(new XAttribute("leftOverhang", glyphMetrics.LeftOverhang));
- if (glyphMetrics.RightOverhang != 0)
- current.Add(new XAttribute("rightOverhang", glyphMetrics.RightOverhang));
-
- metrics.Add(current);
- }
- foreach (char glyph in mMetrics.Keys)
- {
- foreach (var kern in mMetrics[glyph].KerningPairs)
- {
- XElement current = new XElement("Kerning");
-
- current.Add(new XAttribute("first", glyph));
- current.Add(new XAttribute("second", kern.Key));
- current.Add(new XAttribute("value", kern.Value));
-
- metrics.Add(current);
- }
- }
-
- root.Add(metrics);
- parent.Add(root);
- }
-
- /// <summary>
- /// Performs a deep copy.
- /// </summary>
- /// <returns></returns>
- protected override AgateResource Clone()
- {
- BitmapFontResource retval = new BitmapFontResource(Name);
-
- retval.mImage = mImage;
- retval.mMetrics = mMetrics.Clone();
-
- return retval;
- }
-
- /// <summary>
- /// Image file name.
- /// </summary>
- public string Image
- {
- get { return mImage; }
- set { mImage = value; }
- }
- /// <summary>
- /// Font metrics data.
- /// </summary>
- public FontMetrics FontMetrics
- {
- get { return mMetrics; }
- set { mMetrics = value; }
- }
-
- }
-}
Added: trunk/AgateLib/Resources/DC/AgateResource.cs
===================================================================
--- trunk/AgateLib/Resources/DC/AgateResource.cs (rev 0)
+++ trunk/AgateLib/Resources/DC/AgateResource.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace AgateLib.Resources.DC
+{
+ public class AgateResource
+ {
+ }
+}
Added: trunk/AgateLib/Resources/DC/AgateResourceCollection.cs
===================================================================
--- trunk/AgateLib/Resources/DC/AgateResourceCollection.cs (rev 0)
+++ trunk/AgateLib/Resources/DC/AgateResourceCollection.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -0,0 +1,104 @@
+using AgateLib.DisplayLib;
+using AgateLib.DisplayLib.BitmapFont;
+using AgateLib.IO;
+using AgateLib.Serialization.Xle;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace AgateLib.Resources.DC
+{
+ public class AgateResourceCollection
+ {
+ ResourceCollection mResources = new ResourceCollection();
+ Dictionary<string, Surface> mSurfaces = new Dictionary<string, Surface>();
+
+ public AgateResourceCollection()
+ {
+ FileProvider = AgateLib.IO.FileProvider.ResourceAssets;
+ }
+
+ public AgateResourceCollection(string filename, IReadFileProvider fileProvider = null)
+ : this()
+ {
+ if (fileProvider == null)
+ fileProvider = AgateLib.IO.FileProvider.ResourceAssets;
+
+ using (var stream = fileProvider.OpenRead(filename))
+ {
+ LoadFrom(stream);
+ }
+ }
+ public AgateResourceCollection(Stream stream)
+ {
+ LoadFrom(stream);
+ }
+
+ public IReadFileProvider FileProvider { get; set; }
+
+ public ResourceCollection Resources { get { return mResources; } }
+
+ public void LoadFrom(Stream stream)
+ {
+ var ser = CreateSerializer();
+
+ //mResources = (ResourceCollection)ser.Deserialize(stream);
+ mResources = (ResourceCollection)ser.ReadObject(stream);
+ }
+
+ public void SaveTo(Stream stream)
+ {
+ var ser = CreateSerializer();
+
+ //ser.Serialize(stream, mResources);
+ ser.WriteObject(stream, mResources);
+
+ }
+
+ private static DataContractSerializer CreateSerializer()
+ {
+ DataContractSerializer ser = new DataContractSerializer(typeof(ResourceCollection), KnownTypes);
+ return ser;
+
+ //XleSerializer ser = new XleSerializer(typeof(ResourceCollection));
+ //return ser;
+ }
+
+ public Font CreateFont(string name)
+ {
+ FontResource fr = (FontResource)mResources[name];
+
+ Font retval = new Font(fr.FontName);
+
+ foreach(var fs in fr.FontSurfaces)
+ {
+ FontSurface surf = FontSurface.FromImpl(new BitmapFontImpl(
+ GetSurface(fs.ImageFilename), fs.FontMetrics, fs.FontSettings.FontName(fr.FontName)));
+
+ retval.AddFont(fs.FontSettings, surf);
+ }
+
+ return retval;
+ }
+
+ private Surface GetSurface(string filename)
+ {
+ if (mSurfaces.ContainsKey(filename) == false)
+ mSurfaces.Add(filename, new Surface(filename, FileProvider));
+
+ return mSurfaces[filename];
+ }
+
+ public static IEnumerable<Type> KnownTypes
+ {
+ get
+ {
+ yield return typeof(FontResource);
+ yield return typeof(SpriteResource);
+ }
+ }
+ }
+}
Added: trunk/AgateLib/Resources/DC/FontResource.cs
===================================================================
--- trunk/AgateLib/Resources/DC/FontResource.cs (rev 0)
+++ trunk/AgateLib/Resources/DC/FontResource.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace AgateLib.Resources.DC
+{
+ public class FontResource : AgateResource
+ {
+ public FontResource()
+ {
+ FontSurfaces = new List<FontSurfaceResource>();
+ }
+ public FontResource(string name, params FontSurfaceResource[] contents )
+ :this()
+ {
+ FontName = name;
+
+ foreach (var c in contents)
+ FontSurfaces.Add(c);
+ }
+
+ public string FontName { get; set; }
+ public IList<FontSurfaceResource> FontSurfaces { get; set; }
+ }
+}
Added: trunk/AgateLib/Resources/DC/FontSurfaceResource.cs
===================================================================
--- trunk/AgateLib/Resources/DC/FontSurfaceResource.cs (rev 0)
+++ trunk/AgateLib/Resources/DC/FontSurfaceResource.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -0,0 +1,22 @@
+using AgateLib.DisplayLib;
+using AgateLib.DisplayLib.BitmapFont;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace AgateLib.Resources.DC
+{
+ public class FontSurfaceResource
+ {
+ public FontSurfaceResource()
+ {
+ FontMetrics = new FontMetrics();
+ }
+
+ public string ImageFilename { get; set; }
+ public FontMetrics FontMetrics { get; set; }
+ public FontSettings FontSettings { get; set; }
+ }
+}
Added: trunk/AgateLib/Resources/DC/ResourceCollection.cs
===================================================================
--- trunk/AgateLib/Resources/DC/ResourceCollection.cs (rev 0)
+++ trunk/AgateLib/Resources/DC/ResourceCollection.cs 2014-08-15 19:27:26 UTC (rev 1462)
@@ -0,0 +1,96 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace AgateLib.Resources.DC
+{
+ [DataContract(Namespace="")]
+ public class ResourceCollection : IDictionary<string, AgateReso...
[truncated message content] |
|
From: <ka...@us...> - 2014-08-11 05:55:24
|
Revision: 1461
http://sourceforge.net/p/agate/code/1461
Author: kanato
Date: 2014-08-11 05:55:19 +0000 (Mon, 11 Aug 2014)
Log Message:
-----------
Readd resource constructor for sprite.
Modified Paths:
--------------
trunk/AgateLib/Sprites/Sprite.cs
trunk/Tests/DisplayTests/BasicSprite.cs
Modified: trunk/AgateLib/Sprites/Sprite.cs
===================================================================
--- trunk/AgateLib/Sprites/Sprite.cs 2014-08-11 05:29:51 UTC (rev 1460)
+++ trunk/AgateLib/Sprites/Sprite.cs 2014-08-11 05:55:19 UTC (rev 1461)
@@ -138,6 +138,112 @@
}
/// <summary>
+ /// Constructs a sprite from a resource.
+ /// </summary>
+ /// <param name="resources"></param>
+ /// <param name="name"></param>
+ public Sprite(AgateResourceCollection resources, string name)
+ {
+ AgateResource generic_res = resources[name];
+ SpriteResource sprite_res = generic_res as SpriteResource;
+
+ if (sprite_res == null)
+ throw new AgateResourceException("Resource " + generic_res.Name + " is not a sprite.");
+
+ BuildSpriteFromResource(resources, resources.RootDirectory, sprite_res);
+ }
+
+ private void BuildSpriteFromResource(AgateResourceCollection resources,
+ string root, SpriteResource resource)
+ {
+ Surface defaultSurface = null;
+
+ if (string.IsNullOrEmpty(resource.Filename) == false)
+ {
+ defaultSurface = new Surface(resources.LoadSurfaceImpl(resource.Filename));
+ mOwnedSurfaces.Add(defaultSurface);
+ }
+
+ if (resource.HasSize)
+ mSpriteSize = resource.Size;
+ else if (defaultSurface != null)
+ mSpriteSize = defaultSurface.SurfaceSize;
+
+ for (int i = 0; i < resource.ChildElements.Count; i++)
+ {
+ SpriteResource.SpriteSubResource child = resource.ChildElements[i];
+ Surface thisSurface = defaultSurface;
+
+ if (child is SpriteResource.SpriteFrameResource)
+ {
+ SpriteResource.SpriteFrameResource frame = (SpriteResource.SpriteFrameResource)child;
+ if (string.IsNullOrEmpty(frame.Filename) == false)
+ {
+ thisSurface = new Surface(resources.LoadSurfaceImpl(frame.Filename));
+ mOwnedSurfaces.Add(thisSurface);
+
+ if (i == 0 && defaultSurface == null && resource.HasSize == false)
+ {
+ mSpriteSize = thisSurface.SurfaceSize;
+ }
+ }
+ if (thisSurface == null)
+ {
+ throw new AgateException(string.Format(
+ "The surface to create the sprite from in resource {0} was not specified.", resource.Name));
+ }
+
+ // we pass false to ownSurface here because the surface has already been added to the
+ // owned surfaces list.
+ AddFrame(thisSurface, false, frame.Bounds, frame.Offset);
+ }
+ else
+ {
+ var image = (SpriteResource.SpriteImageResource)child;
+
+ DisplayLib.ImplementationBase.SurfaceImpl thisImpl = resources.LoadSurfaceImpl(image.Filename);
+ if (i == 0 && defaultSurface == null && resource.HasSize == false)
+ {
+ mSpriteSize = thisImpl.SurfaceSize;
+ }
+
+ if (image.Grids.Count == 0)
+ {
+ AddFrame(new Surface(thisImpl), false,
+ new Rectangle(0, 0, mSpriteSize.Width, mSpriteSize.Height),
+ Point.Empty);
+ }
+ else
+ {
+ for (int j = 0; j < image.Grids.Count; j++)
+ {
+ AddFramesFromGrid(resources, thisImpl, image.Grids[j]);
+ }
+ }
+ }
+ }
+ }
+
+ private void AddFramesFromGrid(AgateResourceCollection resources, DisplayLib.ImplementationBase.SurfaceImpl thisImpl, SpriteResource.SpriteImageResource.Grid grid)
+ {
+ Point location = grid.Location;
+
+ for (int y = 0; y < grid.Array.Height; y++)
+ {
+ for (int x = 0; x < grid.Array.Width; x++)
+ {
+ var surfImpl = thisImpl.CarveSubSurface(new Rectangle(location, grid.Size));
+ AddFrame(new Surface(surfImpl), false, new Rectangle(0, 0, grid.Size.Width, grid.Size.Height), Point.Empty);
+
+ location.X += grid.Size.Width;
+ }
+
+ location.Y += grid.Size.Height;
+ location.X = grid.Location.X;
+ }
+ }
+
+ /// <summary>
/// Adds a surface as a frame to the sprite.
/// </summary>
/// <param name="surface"></param>
Modified: trunk/Tests/DisplayTests/BasicSprite.cs
===================================================================
--- trunk/Tests/DisplayTests/BasicSprite.cs 2014-08-11 05:29:51 UTC (rev 1460)
+++ trunk/Tests/DisplayTests/BasicSprite.cs 2014-08-11 05:55:19 UTC (rev 1461)
@@ -48,7 +48,7 @@
{
Display.Clear(Color.Blue);
- p.Draw();
+ p.Draw(0,0);
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-11 05:30:03
|
Revision: 1460
http://sourceforge.net/p/agate/code/1460
Author: kanato
Date: 2014-08-11 05:29:51 +0000 (Mon, 11 Aug 2014)
Log Message:
-----------
Add fonts for GUI test.
Added Paths:
-----------
trunk/Tests/Data/Resources/
trunk/Tests/Data/Resources/Fonts/
trunk/Tests/Data/Resources/Fonts/MedievalSharp14.png
trunk/Tests/Data/Resources/Fonts/MedievalSharp18.png
trunk/Tests/Data/Resources/Fonts/MedievalSharpBold14.png
trunk/Tests/Data/Resources/Fonts/MedievalSharpBold18.png
trunk/Tests/Data/Resources/Fonts/MedievalSharpBold22.png
trunk/Tests/Data/Resources/fonts.xml
Added: trunk/Tests/Data/Resources/Fonts/MedievalSharp14.png
===================================================================
(Binary files differ)
Index: trunk/Tests/Data/Resources/Fonts/MedievalSharp14.png
===================================================================
--- trunk/Tests/Data/Resources/Fonts/MedievalSharp14.png 2014-08-11 05:28:36 UTC (rev 1459)
+++ trunk/Tests/Data/Resources/Fonts/MedievalSharp14.png 2014-08-11 05:29:51 UTC (rev 1460)
Property changes on: trunk/Tests/Data/Resources/Fonts/MedievalSharp14.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Tests/Data/Resources/Fonts/MedievalSharp18.png
===================================================================
(Binary files differ)
Index: trunk/Tests/Data/Resources/Fonts/MedievalSharp18.png
===================================================================
--- trunk/Tests/Data/Resources/Fonts/MedievalSharp18.png 2014-08-11 05:28:36 UTC (rev 1459)
+++ trunk/Tests/Data/Resources/Fonts/MedievalSharp18.png 2014-08-11 05:29:51 UTC (rev 1460)
Property changes on: trunk/Tests/Data/Resources/Fonts/MedievalSharp18.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Tests/Data/Resources/Fonts/MedievalSharpBold14.png
===================================================================
(Binary files differ)
Index: trunk/Tests/Data/Resources/Fonts/MedievalSharpBold14.png
===================================================================
--- trunk/Tests/Data/Resources/Fonts/MedievalSharpBold14.png 2014-08-11 05:28:36 UTC (rev 1459)
+++ trunk/Tests/Data/Resources/Fonts/MedievalSharpBold14.png 2014-08-11 05:29:51 UTC (rev 1460)
Property changes on: trunk/Tests/Data/Resources/Fonts/MedievalSharpBold14.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Tests/Data/Resources/Fonts/MedievalSharpBold18.png
===================================================================
(Binary files differ)
Index: trunk/Tests/Data/Resources/Fonts/MedievalSharpBold18.png
===================================================================
--- trunk/Tests/Data/Resources/Fonts/MedievalSharpBold18.png 2014-08-11 05:28:36 UTC (rev 1459)
+++ trunk/Tests/Data/Resources/Fonts/MedievalSharpBold18.png 2014-08-11 05:29:51 UTC (rev 1460)
Property changes on: trunk/Tests/Data/Resources/Fonts/MedievalSharpBold18.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Tests/Data/Resources/Fonts/MedievalSharpBold22.png
===================================================================
(Binary files differ)
Index: trunk/Tests/Data/Resources/Fonts/MedievalSharpBold22.png
===================================================================
--- trunk/Tests/Data/Resources/Fonts/MedievalSharpBold22.png 2014-08-11 05:28:36 UTC (rev 1459)
+++ trunk/Tests/Data/Resources/Fonts/MedievalSharpBold22.png 2014-08-11 05:29:51 UTC (rev 1460)
Property changes on: trunk/Tests/Data/Resources/Fonts/MedievalSharpBold22.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Tests/Data/Resources/fonts.xml
===================================================================
--- trunk/Tests/Data/Resources/fonts.xml (rev 0)
+++ trunk/Tests/Data/Resources/fonts.xml 2014-08-11 05:29:51 UTC (rev 1460)
@@ -0,0 +1,973 @@
+<AgateResources Version="0.3.2">
+ <StringTable />
+ <BitmapFont name="MedievalSharp18" image="Fonts/MedievalSharp18.png">
+ <Metrics>
+ <Glyph char="32" source="{X=0,Y=2,Width=8,Height=30}" rightOverhang="1" />
+ <Glyph char="33" source="{X=10,Y=2,Width=8,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="34" source="{X=20,Y=2,Width=11,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="35" source="{X=33,Y=2,Width=18,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="36" source="{X=53,Y=2,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="37" source="{X=70,Y=2,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="38" source="{X=91,Y=2,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="39" source="{X=110,Y=2,Width=7,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="40" source="{X=119,Y=2,Width=11,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="41" source="{X=132,Y=2,Width=11,Height=30}" rightOverhang="1" />
+ <Glyph char="42" source="{X=145,Y=2,Width=16,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="43" source="{X=163,Y=2,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="44" source="{X=181,Y=2,Width=8,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="45" source="{X=191,Y=2,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="46" source="{X=209,Y=2,Width=7,Height=30}" rightOverhang="1" />
+ <Glyph char="47" source="{X=218,Y=2,Width=14,Height=30}" rightOverhang="1" />
+ <Glyph char="48" source="{X=234,Y=2,Width=17,Height=30}" leftOverhang="1" rightOverhang="2" />
+ <Glyph char="49" source="{X=0,Y=35,Width=10,Height=30}" leftOverhang="-2" rightOverhang="-2" />
+ <Glyph char="50" source="{X=12,Y=35,Width=15,Height=30}" rightOverhang="1" />
+ <Glyph char="51" source="{X=29,Y=35,Width=15,Height=30}" rightOverhang="1" />
+ <Glyph char="52" source="{X=46,Y=35,Width=16,Height=30}" leftOverhang="1" rightOverhang="1" />
+ <Glyph char="53" source="{X=64,Y=35,Width=15,Height=30}" rightOverhang="1" />
+ <Glyph char="54" source="{X=81,Y=35,Width=16,Height=30}" leftOverhang="1" rightOverhang="1" />
+ <Glyph char="55" source="{X=99,Y=35,Width=13,Height=30}" rightOverhang="-1" />
+ <Glyph char="56" source="{X=114,Y=35,Width=15,Height=30}" rightOverhang="1" />
+ <Glyph char="57" source="{X=131,Y=35,Width=16,Height=30}" leftOverhang="1" rightOverhang="1" />
+ <Glyph char="58" source="{X=149,Y=35,Width=7,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="59" source="{X=158,Y=35,Width=8,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="60" source="{X=168,Y=35,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="61" source="{X=187,Y=35,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="62" source="{X=205,Y=35,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="63" source="{X=224,Y=35,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="64" source="{X=241,Y=35,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="65" source="{X=0,Y=68,Width=16,Height=30}" rightOverhang="1" />
+ <Glyph char="66" source="{X=18,Y=68,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="67" source="{X=37,Y=68,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="68" source="{X=55,Y=68,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="69" source="{X=75,Y=68,Width=14,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="70" source="{X=91,Y=68,Width=13,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="71" source="{X=106,Y=68,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="72" source="{X=125,Y=68,Width=17,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="73" source="{X=144,Y=68,Width=8,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="74" source="{X=154,Y=68,Width=15,Height=30}" rightOverhang="1" />
+ <Glyph char="75" source="{X=171,Y=68,Width=16,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="76" source="{X=189,Y=68,Width=15,Height=30}" leftOverhang="-2" rightOverhang="5" />
+ <Glyph char="77" source="{X=206,Y=68,Width=21,Height=30}" rightOverhang="1" />
+ <Glyph char="78" source="{X=229,Y=68,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="79" source="{X=0,Y=101,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="80" source="{X=19,Y=101,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="81" source="{X=38,Y=101,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="82" source="{X=57,Y=101,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="83" source="{X=76,Y=101,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="84" source="{X=93,Y=101,Width=14,Height=30}" rightOverhang="1" />
+ <Glyph char="85" source="{X=109,Y=101,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="86" source="{X=129,Y=101,Width=16,Height=30}" rightOverhang="1" />
+ <Glyph char="87" source="{X=147,Y=101,Width=22,Height=30}" rightOverhang="1" />
+ <Glyph char="88" source="{X=171,Y=101,Width=15,Height=30}" rightOverhang="1" />
+ <Glyph char="89" source="{X=188,Y=101,Width=15,Height=30}" rightOverhang="1" />
+ <Glyph char="90" source="{X=205,Y=101,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="91" source="{X=222,Y=101,Width=11,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="92" source="{X=235,Y=101,Width=14,Height=30}" rightOverhang="1" />
+ <Glyph char="93" source="{X=0,Y=134,Width=11,Height=30}" rightOverhang="1" />
+ <Glyph char="94" source="{X=13,Y=134,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="95" source="{X=32,Y=134,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="96" source="{X=50,Y=134,Width=9,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="97" source="{X=61,Y=134,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="98" source="{X=77,Y=134,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="99" source="{X=94,Y=134,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="100" source="{X=109,Y=134,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="101" source="{X=125,Y=134,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="102" source="{X=140,Y=134,Width=13,Height=30}" leftOverhang="1" rightOverhang="2" />
+ <Glyph char="103" source="{X=155,Y=134,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="104" source="{X=172,Y=134,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="105" source="{X=189,Y=134,Width=7,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="106" source="{X=198,Y=134,Width=9,Height=30}" leftOverhang="1" rightOverhang="2" />
+ <Glyph char="107" source="{X=209,Y=134,Width=15,Height=30}" leftOverhang="-1" rightOverhang="4" />
+ <Glyph char="108" source="{X=226,Y=134,Width=7,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="109" source="{X=0,Y=167,Width=22,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="110" source="{X=24,Y=167,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="111" source="{X=41,Y=167,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="112" source="{X=57,Y=167,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="113" source="{X=73,Y=167,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="114" source="{X=90,Y=167,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="115" source="{X=105,Y=167,Width=12,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="116" source="{X=119,Y=167,Width=10,Height=30}" rightOverhang="1" />
+ <Glyph char="117" source="{X=131,Y=167,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="118" source="{X=148,Y=167,Width=13,Height=30}" rightOverhang="1" />
+ <Glyph char="119" source="{X=163,Y=167,Width=22,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="120" source="{X=187,Y=167,Width=14,Height=30}" rightOverhang="3" />
+ <Glyph char="121" source="{X=203,Y=167,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="122" source="{X=220,Y=167,Width=12,Height=30}" rightOverhang="1" />
+ <Glyph char="123" source="{X=234,Y=167,Width=13,Height=30}" rightOverhang="1" />
+ <Glyph char="124" source="{X=0,Y=200,Width=8,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="125" source="{X=10,Y=200,Width=13,Height=30}" rightOverhang="1" />
+ <Glyph char="126" source="{X=25,Y=200,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="161" source="{X=42,Y=200,Width=8,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="162" source="{X=52,Y=200,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="163" source="{X=67,Y=200,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="164" source="{X=84,Y=200,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="165" source="{X=105,Y=200,Width=16,Height=30}" rightOverhang="1" />
+ <Glyph char="166" source="{X=123,Y=200,Width=9,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="167" source="{X=134,Y=200,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="168" source="{X=150,Y=200,Width=11,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="169" source="{X=163,Y=200,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="170" source="{X=182,Y=200,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="171" source="{X=197,Y=200,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="172" source="{X=218,Y=200,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="173" source="{X=236,Y=200,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="174" source="{X=0,Y=233,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="175" source="{X=19,Y=233,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="176" source="{X=37,Y=233,Width=11,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="177" source="{X=50,Y=233,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="178" source="{X=68,Y=233,Width=11,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="179" source="{X=81,Y=233,Width=11,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="180" source="{X=94,Y=233,Width=9,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="181" source="{X=105,Y=233,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="182" source="{X=122,Y=233,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="183" source="{X=137,Y=233,Width=7,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="184" source="{X=146,Y=233,Width=8,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="185" source="{X=156,Y=233,Width=9,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="186" source="{X=167,Y=233,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="187" source="{X=182,Y=233,Width=19,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="188" source="{X=203,Y=233,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="189" source="{X=223,Y=233,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="190" source="{X=0,Y=266,Width=20,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="191" source="{X=22,Y=266,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="192" source="{X=39,Y=266,Width=16,Height=30}" rightOverhang="1" />
+ <Glyph char="193" source="{X=57,Y=266,Width=16,Height=30}" rightOverhang="1" />
+ <Glyph char="194" source="{X=75,Y=266,Width=16,Height=30}" rightOverhang="1" />
+ <Glyph char="195" source="{X=93,Y=266,Width=16,Height=30}" rightOverhang="1" />
+ <Glyph char="196" source="{X=111,Y=266,Width=18,Height=30}" rightOverhang="3" />
+ <Glyph char="197" source="{X=131,Y=266,Width=18,Height=30}" rightOverhang="3" />
+ <Glyph char="198" source="{X=151,Y=266,Width=22,Height=30}" rightOverhang="1" />
+ <Glyph char="199" source="{X=175,Y=266,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="200" source="{X=193,Y=266,Width=14,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="201" source="{X=209,Y=266,Width=14,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="202" source="{X=225,Y=266,Width=14,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="203" source="{X=241,Y=266,Width=14,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="204" source="{X=0,Y=299,Width=8,Height=30}" rightOverhang="1" />
+ <Glyph char="205" source="{X=10,Y=299,Width=8,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="206" source="{X=20,Y=299,Width=8,Height=30}" rightOverhang="1" />
+ <Glyph char="207" source="{X=30,Y=299,Width=8,Height=30}" rightOverhang="1" />
+ <Glyph char="208" source="{X=40,Y=299,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="209" source="{X=60,Y=299,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="210" source="{X=79,Y=299,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="211" source="{X=98,Y=299,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="212" source="{X=117,Y=299,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="213" source="{X=136,Y=299,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="214" source="{X=155,Y=299,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="215" source="{X=174,Y=299,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="216" source="{X=190,Y=299,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="217" source="{X=209,Y=299,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="218" source="{X=229,Y=299,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="219" source="{X=0,Y=332,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="220" source="{X=20,Y=332,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="221" source="{X=40,Y=332,Width=15,Height=30}" rightOverhang="1" />
+ <Glyph char="222" source="{X=57,Y=332,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="223" source="{X=74,Y=332,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="224" source="{X=91,Y=332,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="225" source="{X=107,Y=332,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="226" source="{X=123,Y=332,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="227" source="{X=139,Y=332,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="228" source="{X=155,Y=332,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="229" source="{X=171,Y=332,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="230" source="{X=187,Y=332,Width=21,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="231" source="{X=210,Y=332,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="232" source="{X=225,Y=332,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="233" source="{X=240,Y=332,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="234" source="{X=0,Y=365,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="235" source="{X=15,Y=365,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="236" source="{X=30,Y=365,Width=9,Height=30}" leftOverhang="1" rightOverhang="2" />
+ <Glyph char="237" source="{X=41,Y=365,Width=9,Height=30}" leftOverhang="-1" rightOverhang="4" />
+ <Glyph char="238" source="{X=52,Y=365,Width=7,Height=30}" rightOverhang="1" />
+ <Glyph char="239" source="{X=61,Y=365,Width=7,Height=30}" rightOverhang="1" />
+ <Glyph char="240" source="{X=70,Y=365,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="241" source="{X=87,Y=365,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="242" source="{X=104,Y=365,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="243" source="{X=120,Y=365,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="244" source="{X=136,Y=365,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="245" source="{X=152,Y=365,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="246" source="{X=168,Y=365,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="247" source="{X=184,Y=365,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="248" source="{X=202,Y=365,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="249" source="{X=218,Y=365,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="250" source="{X=235,Y=365,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="251" source="{X=0,Y=398,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="252" source="{X=17,Y=398,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="253" source="{X=34,Y=398,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="254" source="{X=51,Y=398,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="255" source="{X=67,Y=398,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ </Metrics>
+ </BitmapFont>
+ <BitmapFont name="MedievalSharp14" image="Fonts/MedievalSharp14.png">
+ <Metrics>
+ <Glyph char="32" source="{X=0,Y=2,Width=7,Height=24}" rightOverhang="1" />
+ <Glyph char="33" source="{X=9,Y=2,Width=7,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="34" source="{X=18,Y=2,Width=9,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="35" source="{X=29,Y=2,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="36" source="{X=45,Y=2,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="37" source="{X=59,Y=2,Width=15,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="38" source="{X=76,Y=2,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="39" source="{X=92,Y=2,Width=6,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="40" source="{X=100,Y=2,Width=9,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="41" source="{X=111,Y=2,Width=9,Height=24}" rightOverhang="1" />
+ <Glyph char="42" source="{X=122,Y=2,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="43" source="{X=136,Y=2,Width=13,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="44" source="{X=151,Y=2,Width=7,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="45" source="{X=160,Y=2,Width=13,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="46" source="{X=175,Y=2,Width=6,Height=24}" rightOverhang="1" />
+ <Glyph char="47" source="{X=183,Y=2,Width=11,Height=24}" rightOverhang="1" />
+ <Glyph char="48" source="{X=196,Y=2,Width=14,Height=24}" leftOverhang="1" rightOverhang="2" />
+ <Glyph char="49" source="{X=212,Y=2,Width=8,Height=24}" leftOverhang="-1" rightOverhang="-2" />
+ <Glyph char="50" source="{X=222,Y=2,Width=12,Height=24}" rightOverhang="1" />
+ <Glyph char="51" source="{X=236,Y=2,Width=12,Height=24}" rightOverhang="1" />
+ <Glyph char="52" source="{X=0,Y=29,Width=12,Height=24}" rightOverhang="1" />
+ <Glyph char="53" source="{X=14,Y=29,Width=12,Height=24}" rightOverhang="1" />
+ <Glyph char="54" source="{X=28,Y=29,Width=13,Height=24}" leftOverhang="1" rightOverhang="1" />
+ <Glyph char="55" source="{X=43,Y=29,Width=10,Height=24}" rightOverhang="-1" />
+ <Glyph char="56" source="{X=55,Y=29,Width=12,Height=24}" rightOverhang="1" />
+ <Glyph char="57" source="{X=69,Y=29,Width=13,Height=24}" leftOverhang="1" rightOverhang="1" />
+ <Glyph char="58" source="{X=84,Y=29,Width=6,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="59" source="{X=92,Y=29,Width=7,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="60" source="{X=101,Y=29,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="61" source="{X=117,Y=29,Width=13,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="62" source="{X=132,Y=29,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="63" source="{X=148,Y=29,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="64" source="{X=162,Y=29,Width=12,Height=24}" rightOverhang="1" />
+ <Glyph char="65" source="{X=176,Y=29,Width=13,Height=24}" rightOverhang="1" />
+ <Glyph char="66" source="{X=191,Y=29,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="67" source="{X=207,Y=29,Width=13,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="68" source="{X=222,Y=29,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="69" source="{X=238,Y=29,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="70" source="{X=0,Y=56,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="71" source="{X=13,Y=56,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="72" source="{X=29,Y=56,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="73" source="{X=45,Y=56,Width=7,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="74" source="{X=54,Y=56,Width=12,Height=24}" rightOverhang="1" />
+ <Glyph char="75" source="{X=68,Y=56,Width=13,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="76" source="{X=83,Y=56,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="77" source="{X=96,Y=56,Width=17,Height=24}" rightOverhang="1" />
+ <Glyph char="78" source="{X=115,Y=56,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="79" source="{X=131,Y=56,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="80" source="{X=147,Y=56,Width=13,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="81" source="{X=162,Y=56,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="82" source="{X=178,Y=56,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="83" source="{X=194,Y=56,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="84" source="{X=208,Y=56,Width=15,Height=24}" leftOverhang="1" rightOverhang="4" />
+ <Glyph char="85" source="{X=225,Y=56,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="86" source="{X=241,Y=56,Width=13,Height=24}" rightOverhang="1" />
+ <Glyph char="87" source="{X=0,Y=83,Width=18,Height=24}" rightOverhang="1" />
+ <Glyph char="88" source="{X=20,Y=83,Width=12,Height=24}" rightOverhang="1" />
+ <Glyph char="89" source="{X=34,Y=83,Width=12,Height=24}" rightOverhang="1" />
+ <Glyph char="90" source="{X=48,Y=83,Width=12,Height=24}" rightOverhang="1" />
+ <Glyph char="91" source="{X=62,Y=83,Width=9,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="92" source="{X=73,Y=83,Width=11,Height=24}" rightOverhang="1" />
+ <Glyph char="93" source="{X=86,Y=83,Width=9,Height=24}" rightOverhang="1" />
+ <Glyph char="94" source="{X=97,Y=83,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="95" source="{X=113,Y=83,Width=13,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="96" source="{X=128,Y=83,Width=8,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="97" source="{X=138,Y=83,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="98" source="{X=151,Y=83,Width=12,Height=24}" rightOverhang="1" />
+ <Glyph char="99" source="{X=165,Y=83,Width=10,Height=24}" rightOverhang="1" />
+ <Glyph char="100" source="{X=177,Y=83,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="101" source="{X=191,Y=83,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="102" source="{X=204,Y=83,Width=11,Height=24}" leftOverhang="1" rightOverhang="2" />
+ <Glyph char="103" source="{X=217,Y=83,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="104" source="{X=231,Y=83,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="105" source="{X=245,Y=83,Width=6,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="106" source="{X=0,Y=110,Width=6,Height=24}" rightOverhang="1" />
+ <Glyph char="107" source="{X=8,Y=110,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="108" source="{X=21,Y=110,Width=6,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="109" source="{X=29,Y=110,Width=18,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="110" source="{X=49,Y=110,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="111" source="{X=63,Y=110,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="112" source="{X=76,Y=110,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="113" source="{X=90,Y=110,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="114" source="{X=104,Y=110,Width=10,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="115" source="{X=116,Y=110,Width=10,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="116" source="{X=128,Y=110,Width=8,Height=24}" rightOverhang="1" />
+ <Glyph char="117" source="{X=138,Y=110,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="118" source="{X=152,Y=110,Width=11,Height=24}" rightOverhang="1" />
+ <Glyph char="119" source="{X=165,Y=110,Width=18,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="120" source="{X=185,Y=110,Width=10,Height=24}" rightOverhang="1" />
+ <Glyph char="121" source="{X=197,Y=110,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="122" source="{X=211,Y=110,Width=10,Height=24}" rightOverhang="1" />
+ <Glyph char="123" source="{X=223,Y=110,Width=10,Height=24}" rightOverhang="1" />
+ <Glyph char="124" source="{X=235,Y=110,Width=7,Height=24}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="125" source="{X=244,Y=110,Width=10,Height=24}" rightOverhang="1" />
+ <Glyph char="126" source="{X=0,Y=137,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="161" source="{X=14,Y=137,Width=7,Height=24}" rightOverhang="1" />
+ <Glyph char="162" source="{X=23,Y=137,Width=10,Height=24}" rightOverhang="1" />
+ <Glyph char="163" source="{X=35,Y=137,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="164" source="{X=49,Y=137,Width=15,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="165" source="{X=66,Y=137,Width=13,Height=24}" rightOverhang="1" />
+ <Glyph char="166" source="{X=81,Y=137,Width=7,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="167" source="{X=90,Y=137,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="168" source="{X=103,Y=137,Width=9,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="169" source="{X=114,Y=137,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="170" source="{X=130,Y=137,Width=10,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="171" source="{X=142,Y=137,Width=15,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="172" source="{X=159,Y=137,Width=13,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="173" source="{X=174,Y=137,Width=13,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="174" source="{X=189,Y=137,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="175" source="{X=205,Y=137,Width=13,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="176" source="{X=220,Y=137,Width=9,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="177" source="{X=231,Y=137,Width=13,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="178" source="{X=246,Y=137,Width=9,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="179" source="{X=0,Y=164,Width=9,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="180" source="{X=11,Y=164,Width=8,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="181" source="{X=21,Y=164,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="182" source="{X=35,Y=164,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="183" source="{X=48,Y=164,Width=6,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="184" source="{X=56,Y=164,Width=7,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="185" source="{X=65,Y=164,Width=7,Height=24}" rightOverhang="1" />
+ <Glyph char="186" source="{X=74,Y=164,Width=10,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="187" source="{X=86,Y=164,Width=15,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="188" source="{X=103,Y=164,Width=14,Height=24}" rightOverhang="1" />
+ <Glyph char="189" source="{X=119,Y=164,Width=15,Height=24}" rightOverhang="1" />
+ <Glyph char="190" source="{X=136,Y=164,Width=16,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="191" source="{X=154,Y=164,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="192" source="{X=168,Y=164,Width=13,Height=24}" rightOverhang="1" />
+ <Glyph char="193" source="{X=183,Y=164,Width=13,Height=24}" rightOverhang="1" />
+ <Glyph char="194" source="{X=198,Y=164,Width=13,Height=24}" rightOverhang="1" />
+ <Glyph char="195" source="{X=213,Y=164,Width=13,Height=24}" rightOverhang="1" />
+ <Glyph char="196" source="{X=228,Y=164,Width=13,Height=24}" rightOverhang="1" />
+ <Glyph char="197" source="{X=243,Y=164,Width=13,Height=24}" rightOverhang="1" />
+ <Glyph char="198" source="{X=0,Y=191,Width=18,Height=24}" rightOverhang="1" />
+ <Glyph char="199" source="{X=20,Y=191,Width=13,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="200" source="{X=35,Y=191,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="201" source="{X=48,Y=191,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="202" source="{X=61,Y=191,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="203" source="{X=74,Y=191,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="204" source="{X=87,Y=191,Width=7,Height=24}" rightOverhang="1" />
+ <Glyph char="205" source="{X=96,Y=191,Width=7,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="206" source="{X=105,Y=191,Width=7,Height=24}" rightOverhang="1" />
+ <Glyph char="207" source="{X=114,Y=191,Width=7,Height=24}" rightOverhang="1" />
+ <Glyph char="208" source="{X=123,Y=191,Width=14,Height=24}" rightOverhang="1" />
+ <Glyph char="209" source="{X=139,Y=191,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="210" source="{X=155,Y=191,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="211" source="{X=171,Y=191,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="212" source="{X=187,Y=191,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="213" source="{X=203,Y=191,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="214" source="{X=219,Y=191,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="215" source="{X=235,Y=191,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="216" source="{X=0,Y=218,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="217" source="{X=16,Y=218,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="218" source="{X=32,Y=218,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="219" source="{X=48,Y=218,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="220" source="{X=64,Y=218,Width=14,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="221" source="{X=80,Y=218,Width=12,Height=24}" rightOverhang="1" />
+ <Glyph char="222" source="{X=94,Y=218,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="223" source="{X=108,Y=218,Width=12,Height=24}" rightOverhang="1" />
+ <Glyph char="224" source="{X=122,Y=218,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="225" source="{X=135,Y=218,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="226" source="{X=148,Y=218,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="227" source="{X=161,Y=218,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="228" source="{X=174,Y=218,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="229" source="{X=187,Y=218,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="230" source="{X=200,Y=218,Width=17,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="231" source="{X=219,Y=218,Width=10,Height=24}" rightOverhang="1" />
+ <Glyph char="232" source="{X=231,Y=218,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="233" source="{X=244,Y=218,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="234" source="{X=0,Y=245,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="235" source="{X=13,Y=245,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="236" source="{X=26,Y=245,Width=6,Height=24}" rightOverhang="1" />
+ <Glyph char="237" source="{X=34,Y=245,Width=6,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="238" source="{X=42,Y=245,Width=6,Height=24}" rightOverhang="1" />
+ <Glyph char="239" source="{X=50,Y=245,Width=6,Height=24}" rightOverhang="1" />
+ <Glyph char="240" source="{X=58,Y=245,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="241" source="{X=72,Y=245,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="242" source="{X=86,Y=245,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="243" source="{X=99,Y=245,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="244" source="{X=112,Y=245,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="245" source="{X=125,Y=245,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="246" source="{X=138,Y=245,Width=11,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="247" source="{X=151,Y=245,Width=13,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="248" source="{X=166,Y=245,Width=11,Height=24}" rightOverhang="1" />
+ <Glyph char="249" source="{X=179,Y=245,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="250" source="{X=193,Y=245,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="251" source="{X=207,Y=245,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="252" source="{X=221,Y=245,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="253" source="{X=235,Y=245,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="254" source="{X=0,Y=272,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="255" source="{X=14,Y=272,Width=12,Height=24}" leftOverhang="-1" rightOverhang="2" />
+ </Metrics>
+ </BitmapFont>
+ <BitmapFont name="MedievalSharpBold18" image="Fonts/MedievalSharpBold18.png">
+ <Metrics>
+ <Glyph char="32" source="{X=0,Y=2,Width=8,Height=30}" rightOverhang="1" />
+ <Glyph char="33" source="{X=10,Y=2,Width=10,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="34" source="{X=22,Y=2,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="35" source="{X=38,Y=2,Width=21,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="36" source="{X=61,Y=2,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="37" source="{X=80,Y=2,Width=24,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="38" source="{X=106,Y=2,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="39" source="{X=127,Y=2,Width=9,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="40" source="{X=138,Y=2,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="41" source="{X=153,Y=2,Width=13,Height=30}" rightOverhang="1" />
+ <Glyph char="42" source="{X=168,Y=2,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="43" source="{X=188,Y=2,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="44" source="{X=208,Y=2,Width=10,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="45" source="{X=220,Y=2,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="46" source="{X=240,Y=2,Width=9,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="47" source="{X=0,Y=35,Width=16,Height=30}" rightOverhang="1" />
+ <Glyph char="48" source="{X=18,Y=35,Width=19,Height=30}" leftOverhang="1" rightOverhang="2" />
+ <Glyph char="49" source="{X=39,Y=35,Width=13,Height=30}" leftOverhang="-1" rightOverhang="-2" />
+ <Glyph char="50" source="{X=54,Y=35,Width=17,Height=30}" rightOverhang="1" />
+ <Glyph char="51" source="{X=73,Y=35,Width=18,Height=30}" leftOverhang="1" rightOverhang="1" />
+ <Glyph char="52" source="{X=93,Y=35,Width=16,Height=30}" />
+ <Glyph char="53" source="{X=111,Y=35,Width=17,Height=30}" rightOverhang="1" />
+ <Glyph char="54" source="{X=130,Y=35,Width=18,Height=30}" leftOverhang="1" rightOverhang="1" />
+ <Glyph char="55" source="{X=150,Y=35,Width=16,Height=30}" />
+ <Glyph char="56" source="{X=168,Y=35,Width=17,Height=30}" rightOverhang="1" />
+ <Glyph char="57" source="{X=187,Y=35,Width=18,Height=30}" leftOverhang="1" rightOverhang="1" />
+ <Glyph char="58" source="{X=207,Y=35,Width=9,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="59" source="{X=218,Y=35,Width=10,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="60" source="{X=230,Y=35,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="61" source="{X=0,Y=68,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="62" source="{X=20,Y=68,Width=18,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="63" source="{X=40,Y=68,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="64" source="{X=59,Y=68,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="65" source="{X=78,Y=68,Width=20,Height=30}" rightOverhang="3" />
+ <Glyph char="66" source="{X=100,Y=68,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="67" source="{X=121,Y=68,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="68" source="{X=141,Y=68,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="69" source="{X=162,Y=68,Width=16,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="70" source="{X=180,Y=68,Width=15,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="71" source="{X=197,Y=68,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="72" source="{X=218,Y=68,Width=19,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="73" source="{X=239,Y=68,Width=10,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="74" source="{X=0,Y=101,Width=17,Height=30}" rightOverhang="1" />
+ <Glyph char="75" source="{X=19,Y=101,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="76" source="{X=39,Y=101,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="77" source="{X=56,Y=101,Width=23,Height=30}" rightOverhang="1" />
+ <Glyph char="78" source="{X=81,Y=101,Width=20,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="79" source="{X=103,Y=101,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="80" source="{X=124,Y=101,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="81" source="{X=144,Y=101,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="82" source="{X=165,Y=101,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="83" source="{X=186,Y=101,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="84" source="{X=205,Y=101,Width=16,Height=30}" rightOverhang="1" />
+ <Glyph char="85" source="{X=223,Y=101,Width=19,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="86" source="{X=0,Y=134,Width=20,Height=30}" rightOverhang="3" />
+ <Glyph char="87" source="{X=22,Y=134,Width=25,Height=30}" rightOverhang="1" />
+ <Glyph char="88" source="{X=49,Y=134,Width=18,Height=30}" rightOverhang="1" />
+ <Glyph char="89" source="{X=69,Y=134,Width=17,Height=30}" rightOverhang="1" />
+ <Glyph char="90" source="{X=88,Y=134,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="91" source="{X=107,Y=134,Width=13,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="92" source="{X=122,Y=134,Width=16,Height=30}" rightOverhang="1" />
+ <Glyph char="93" source="{X=140,Y=134,Width=13,Height=30}" rightOverhang="1" />
+ <Glyph char="94" source="{X=155,Y=134,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="95" source="{X=175,Y=134,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="96" source="{X=195,Y=134,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="97" source="{X=210,Y=134,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="98" source="{X=228,Y=134,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="99" source="{X=0,Y=167,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="100" source="{X=17,Y=167,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="101" source="{X=36,Y=167,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="102" source="{X=53,Y=167,Width=15,Height=30}" leftOverhang="1" rightOverhang="2" />
+ <Glyph char="103" source="{X=70,Y=167,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="104" source="{X=88,Y=167,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="105" source="{X=107,Y=167,Width=9,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="106" source="{X=118,Y=167,Width=11,Height=30}" leftOverhang="1" rightOverhang="2" />
+ <Glyph char="107" source="{X=131,Y=167,Width=17,Height=30}" leftOverhang="-1" rightOverhang="4" />
+ <Glyph char="108" source="{X=150,Y=167,Width=9,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="109" source="{X=161,Y=167,Width=25,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="110" source="{X=188,Y=167,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="111" source="{X=207,Y=167,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="112" source="{X=224,Y=167,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="113" source="{X=0,Y=200,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="114" source="{X=18,Y=200,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="115" source="{X=35,Y=200,Width=14,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="116" source="{X=51,Y=200,Width=12,Height=30}" rightOverhang="1" />
+ <Glyph char="117" source="{X=65,Y=200,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="118" source="{X=84,Y=200,Width=15,Height=30}" rightOverhang="1" />
+ <Glyph char="119" source="{X=101,Y=200,Width=25,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="120" source="{X=128,Y=200,Width=15,Height=30}" rightOverhang="1" />
+ <Glyph char="121" source="{X=145,Y=200,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="122" source="{X=164,Y=200,Width=15,Height=30}" rightOverhang="1" />
+ <Glyph char="123" source="{X=181,Y=200,Width=15,Height=30}" rightOverhang="1" />
+ <Glyph char="124" source="{X=198,Y=200,Width=10,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="125" source="{X=210,Y=200,Width=15,Height=30}" rightOverhang="1" />
+ <Glyph char="126" source="{X=227,Y=200,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="161" source="{X=246,Y=200,Width=10,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="162" source="{X=0,Y=233,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="163" source="{X=17,Y=233,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="164" source="{X=36,Y=233,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="165" source="{X=57,Y=233,Width=18,Height=30}" rightOverhang="1" />
+ <Glyph char="166" source="{X=77,Y=233,Width=10,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="167" source="{X=89,Y=233,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="168" source="{X=106,Y=233,Width=12,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="169" source="{X=120,Y=233,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="170" source="{X=139,Y=233,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="171" source="{X=156,Y=233,Width=22,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="172" source="{X=180,Y=233,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="173" source="{X=200,Y=233,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="174" source="{X=220,Y=233,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="175" source="{X=0,Y=266,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="176" source="{X=20,Y=266,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="177" source="{X=35,Y=266,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="178" source="{X=55,Y=266,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="179" source="{X=70,Y=266,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="180" source="{X=85,Y=266,Width=13,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="181" source="{X=100,Y=266,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="182" source="{X=120,Y=266,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="183" source="{X=138,Y=266,Width=9,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="184" source="{X=149,Y=266,Width=10,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="185" source="{X=161,Y=266,Width=11,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="186" source="{X=174,Y=266,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="187" source="{X=191,Y=266,Width=22,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="188" source="{X=215,Y=266,Width=21,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="189" source="{X=0,Y=299,Width=21,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="190" source="{X=23,Y=299,Width=23,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="191" source="{X=48,Y=299,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="192" source="{X=67,Y=299,Width=20,Height=30}" rightOverhang="3" />
+ <Glyph char="193" source="{X=89,Y=299,Width=20,Height=30}" rightOverhang="3" />
+ <Glyph char="194" source="{X=111,Y=299,Width=20,Height=30}" rightOverhang="3" />
+ <Glyph char="195" source="{X=133,Y=299,Width=20,Height=30}" rightOverhang="3" />
+ <Glyph char="196" source="{X=155,Y=299,Width=20,Height=30}" rightOverhang="3" />
+ <Glyph char="197" source="{X=177,Y=299,Width=18,Height=30}" rightOverhang="1" />
+ <Glyph char="198" source="{X=197,Y=299,Width=23,Height=30}" rightOverhang="1" />
+ <Glyph char="199" source="{X=222,Y=299,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="200" source="{X=0,Y=332,Width=16,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="201" source="{X=18,Y=332,Width=16,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="202" source="{X=36,Y=332,Width=16,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="203" source="{X=54,Y=332,Width=16,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="204" source="{X=72,Y=332,Width=10,Height=30}" rightOverhang="1" />
+ <Glyph char="205" source="{X=84,Y=332,Width=10,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="206" source="{X=96,Y=332,Width=10,Height=30}" rightOverhang="1" />
+ <Glyph char="207" source="{X=108,Y=332,Width=12,Height=30}" rightOverhang="3" />
+ <Glyph char="208" source="{X=122,Y=332,Width=19,Height=30}" rightOverhang="1" />
+ <Glyph char="209" source="{X=143,Y=332,Width=20,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="210" source="{X=165,Y=332,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="211" source="{X=186,Y=332,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="212" source="{X=207,Y=332,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="213" source="{X=228,Y=332,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="214" source="{X=0,Y=365,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="215" source="{X=21,Y=365,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="216" source="{X=39,Y=365,Width=19,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="217" source="{X=60,Y=365,Width=19,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="218" source="{X=81,Y=365,Width=19,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="219" source="{X=102,Y=365,Width=19,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="220" source="{X=123,Y=365,Width=19,Height=30}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="221" source="{X=144,Y=365,Width=17,Height=30}" rightOverhang="1" />
+ <Glyph char="222" source="{X=163,Y=365,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="223" source="{X=182,Y=365,Width=18,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="224" source="{X=202,Y=365,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="225" source="{X=220,Y=365,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="226" source="{X=238,Y=365,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="227" source="{X=0,Y=398,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="228" source="{X=18,Y=398,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="229" source="{X=36,Y=398,Width=16,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="230" source="{X=54,Y=398,Width=23,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="231" source="{X=79,Y=398,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="232" source="{X=96,Y=398,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="233" source="{X=113,Y=398,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="234" source="{X=130,Y=398,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="235" source="{X=147,Y=398,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="236" source="{X=164,Y=398,Width=11,Height=30}" leftOverhang="1" rightOverhang="2" />
+ <Glyph char="237" source="{X=177,Y=398,Width=11,Height=30}" rightOverhang="3" />
+ <Glyph char="238" source="{X=190,Y=398,Width=13,Height=30}" leftOverhang="1" rightOverhang="4" />
+ <Glyph char="239" source="{X=205,Y=398,Width=11,Height=30}" rightOverhang="3" />
+ <Glyph char="240" source="{X=218,Y=398,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="241" source="{X=237,Y=398,Width=17,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="242" source="{X=0,Y=431,Width=15,Height=30}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="243" source="{...
[truncated message content] |
|
From: <ka...@us...> - 2014-08-11 05:28:45
|
Revision: 1459
http://sourceforge.net/p/agate/code/1459
Author: kanato
Date: 2014-08-11 05:28:36 +0000 (Mon, 11 Aug 2014)
Log Message:
-----------
Add updates to Sprite class.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/Algorithms/Inverting.cs
trunk/AgateLib/Algorithms/Pair.cs
trunk/AgateLib/Algorithms/PathFinding/AStar.cs
trunk/AgateLib/Algorithms/PathFinding/AStarNode.cs
trunk/AgateLib/Algorithms/PathFinding/AStarState.cs
trunk/AgateLib/Algorithms/PathFinding/IAStarMap.cs
trunk/AgateLib/Sprites/FrameList.cs
trunk/AgateLib/Sprites/ISprite.cs
trunk/AgateLib/Sprites/Sprite.cs
trunk/AgateLib/Sprites/SpriteFrame.cs
Added Paths:
-----------
trunk/AgateLib/Sprites/CollisionRegion.cs
trunk/AgateLib/Sprites/ISpriteContainer.cs
trunk/AgateLib/Sprites/Polygon.cs
trunk/AgateLib/Sprites/SpriteContainer.cs
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-11 05:13:00 UTC (rev 1458)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-11 05:28:36 UTC (rev 1459)
@@ -96,6 +96,10 @@
<Compile Include="ApplicationModels\CoordinateSystems\FixedAspectRatioCoordinates.cs" />
<Compile Include="ApplicationModels\ICoordinateSystemCreator.cs" />
<Compile Include="ApplicationModels\ModelParameters.cs" />
+ <Compile Include="Sprites\CollisionRegion.cs" />
+ <Compile Include="Sprites\ISpriteContainer.cs" />
+ <Compile Include="Sprites\Polygon.cs" />
+ <Compile Include="Sprites\SpriteContainer.cs" />
<Compile Include="UnitTesting\AssertThrows.cs" />
<Compile Include="AudioLib\AudioCapsInfo.cs" />
<Compile Include="AudioLib\ImplementationBase\MusicImpl.cs" />
Modified: trunk/AgateLib/Algorithms/Inverting.cs
===================================================================
--- trunk/AgateLib/Algorithms/Inverting.cs 2014-08-11 05:13:00 UTC (rev 1458)
+++ trunk/AgateLib/Algorithms/Inverting.cs 2014-08-11 05:28:36 UTC (rev 1459)
@@ -1,4 +1,22 @@
-using System;
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is AgateLib.
+//
+// The Initial Developer of the Original Code is Erik Ylvisaker.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2014.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Modified: trunk/AgateLib/Algorithms/Pair.cs
===================================================================
--- trunk/AgateLib/Algorithms/Pair.cs 2014-08-11 05:13:00 UTC (rev 1458)
+++ trunk/AgateLib/Algorithms/Pair.cs 2014-08-11 05:28:36 UTC (rev 1459)
@@ -1,3 +1,21 @@
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is AgateLib.
+//
+// The Initial Developer of the Original Code is Erik Ylvisaker.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2014.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
using System;
namespace AgateLib.Algorithms
Modified: trunk/AgateLib/Algorithms/PathFinding/AStar.cs
===================================================================
--- trunk/AgateLib/Algorithms/PathFinding/AStar.cs 2014-08-11 05:13:00 UTC (rev 1458)
+++ trunk/AgateLib/Algorithms/PathFinding/AStar.cs 2014-08-11 05:28:36 UTC (rev 1459)
@@ -1,3 +1,21 @@
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is AgateLib.
+//
+// The Initial Developer of the Original Code is Erik Ylvisaker.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2014.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
using System;
using System.Collections.Generic;
using System.Linq;
Modified: trunk/AgateLib/Algorithms/PathFinding/AStarNode.cs
===================================================================
--- trunk/AgateLib/Algorithms/PathFinding/AStarNode.cs 2014-08-11 05:13:00 UTC (rev 1458)
+++ trunk/AgateLib/Algorithms/PathFinding/AStarNode.cs 2014-08-11 05:28:36 UTC (rev 1459)
@@ -1,3 +1,21 @@
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is AgateLib.
+//
+// The Initial Developer of the Original Code is Erik Ylvisaker.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2014.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
using AgateLib.Geometry;
namespace AgateLib.Algorithms.PathFinding
Modified: trunk/AgateLib/Algorithms/PathFinding/AStarState.cs
===================================================================
--- trunk/AgateLib/Algorithms/PathFinding/AStarState.cs 2014-08-11 05:13:00 UTC (rev 1458)
+++ trunk/AgateLib/Algorithms/PathFinding/AStarState.cs 2014-08-11 05:28:36 UTC (rev 1459)
@@ -1,4 +1,22 @@
-using System;
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is AgateLib.
+//
+// The Initial Developer of the Original Code is Erik Ylvisaker.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2014.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Modified: trunk/AgateLib/Algorithms/PathFinding/IAStarMap.cs
===================================================================
--- trunk/AgateLib/Algorithms/PathFinding/IAStarMap.cs 2014-08-11 05:13:00 UTC (rev 1458)
+++ trunk/AgateLib/Algorithms/PathFinding/IAStarMap.cs 2014-08-11 05:28:36 UTC (rev 1459)
@@ -1,3 +1,21 @@
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is AgateLib.
+//
+// The Initial Developer of the Original Code is Erik Ylvisaker.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2014.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
using System.Collections.Generic;
using AgateLib.Geometry;
Added: trunk/AgateLib/Sprites/CollisionRegion.cs
===================================================================
--- trunk/AgateLib/Sprites/CollisionRegion.cs (rev 0)
+++ trunk/AgateLib/Sprites/CollisionRegion.cs 2014-08-11 05:28:36 UTC (rev 1459)
@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using AgateLib.Geometry;
+
+namespace AgateLib.Sprites
+{
+ public class CollisionRegion
+ {
+ Polygon mPoly;
+ Polygon mTransformedPoly;
+
+ public CollisionRegion(Polygon poly)
+ {
+ mPoly = poly;
+
+ mTransformedPoly = mPoly.Clone();
+ }
+ public CollisionRegion(Rectangle rect)
+ {
+ mPoly = Polygon.FromRect(rect);
+
+ mTransformedPoly = mPoly.Clone();
+ }
+
+ public Polygon Polygon
+ {
+ get { return mPoly; }
+ }
+
+ public void SetTransform(Vector2 translation, bool fliphorizontal, bool flipvertical)
+ {
+ for (int i = 0; i < mPoly.Points.Count; i++)
+ {
+ var pt = mPoly.Points[i];
+
+ if (fliphorizontal) pt.X *= -1;
+ if (flipvertical) pt.Y *= -1;
+
+ pt.X += translation.X;
+ pt.Y += translation.Y;
+
+ mTransformedPoly.Points[i] = pt;
+ }
+ }
+
+ public bool FlipHorizontal { get; set; }
+ public bool FlipVertical { get; set; }
+
+ public Rectangle BoundingRect
+ {
+ get
+ {
+ var retval = mTransformedPoly.BoundingRect;
+
+ return retval;
+ }
+ }
+
+ /// <summary>
+ /// Call this after calling SetTransformation.
+ /// </summary>
+ /// <param name="regionA"></param>
+ /// <param name="regionB"></param>
+ /// <returns></returns>
+ public static bool DoRegionsIntersect(CollisionRegion regionA, CollisionRegion regionB)
+ {
+ return Polygon.PolysIntersect(regionA.mTransformedPoly, regionB.mTransformedPoly);
+ }
+
+ public bool IsAlignedRect
+ {
+ get { return mPoly.IsAlignedRect; }
+ }
+ }
+}
Modified: trunk/AgateLib/Sprites/FrameList.cs
===================================================================
--- trunk/AgateLib/Sprites/FrameList.cs 2014-08-11 05:13:00 UTC (rev 1458)
+++ trunk/AgateLib/Sprites/FrameList.cs 2014-08-11 05:28:36 UTC (rev 1459)
@@ -159,7 +159,6 @@
#endregion
-
#region IFrameList Members
@@ -192,6 +191,5 @@
}
#endregion
-
}
}
Modified: trunk/AgateLib/Sprites/ISprite.cs
===================================================================
--- trunk/AgateLib/Sprites/ISprite.cs 2014-08-11 05:13:00 UTC (rev 1458)
+++ trunk/AgateLib/Sprites/ISprite.cs 2014-08-11 05:28:36 UTC (rev 1459)
@@ -93,7 +93,7 @@
/// <summary>
/// Gets the list of SpriteFrame objects in this sprite.
/// </summary>
- Sprites.IFrameList Frames { get; }
+ Sprites.FrameList<SpriteFrame> Frames { get; }
/// <summary>
/// The amount of time each frame should display, in milliseconds.
Added: trunk/AgateLib/Sprites/ISpriteContainer.cs
===================================================================
--- trunk/AgateLib/Sprites/ISpriteContainer.cs (rev 0)
+++ trunk/AgateLib/Sprites/ISpriteContainer.cs 2014-08-11 05:28:36 UTC (rev 1459)
@@ -0,0 +1,21 @@
+using AgateLib.Geometry;
+using System;
+using System.Collections.Generic;
+
+namespace AgateLib.Sprites
+{
+ public interface ISpriteContainer
+ {
+ Sprite CurrentSprite { get; }
+
+ void Draw(Vector2 screenPosition);
+ void Update(double seconds);
+
+ IEnumerable<Sprite> AllSprites { get; }
+
+ bool FlipHorizontal { get; set; }
+ bool FlipVertical { get; set; }
+
+ bool Locked { get; set; }
+ }
+}
Added: trunk/AgateLib/Sprites/Polygon.cs
===================================================================
--- trunk/AgateLib/Sprites/Polygon.cs (rev 0)
+++ trunk/AgateLib/Sprites/Polygon.cs 2014-08-11 05:28:36 UTC (rev 1459)
@@ -0,0 +1,176 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using AgateLib.Geometry;
+
+namespace AgateLib.Sprites
+{
+ public class Polygon
+ {
+ List<Vector2> mPoints = new List<Vector2>();
+
+ public List<Vector2> Points
+ {
+ get { return mPoints; }
+ }
+
+ public Polygon Clone()
+ {
+ var retval = new Polygon();
+
+ retval.mPoints.AddRange(mPoints);
+
+ return retval;
+ }
+
+ public static Polygon FromRect(Rectangle rect)
+ {
+ Polygon retval = new Polygon();
+
+ retval.AddPoint(rect.X, rect.Y);
+ retval.AddPoint(rect.Right, rect.Y);
+ retval.AddPoint(rect.Right, rect.Bottom);
+ retval.AddPoint(rect.X, rect.Bottom);
+
+ return retval;
+ }
+
+ private void AddPoint(int x, int y)
+ {
+ mPoints.Add(new Vector2(x, y));
+ }
+
+ public Rectangle BoundingRect
+ {
+ get
+ {
+ if (Points.Count == 0)
+ throw new InvalidOperationException();
+
+ int left = int.MaxValue;
+ int right = int.MinValue;
+ int top = int.MaxValue;
+ int bottom = int.MinValue;
+
+ foreach (var pt in Points)
+ {
+ if (pt.X < left) left = (int)pt.X;
+ if (pt.X > right) right = (int)pt.X;
+ if (pt.Y < top) top = (int)pt.Y;
+ if (pt.Y > bottom) bottom = (int)pt.Y;
+ }
+
+ return Rectangle.FromLTRB(left, top, right, bottom);
+ }
+ }
+
+
+ #region --- Collision Checking ---
+
+ public static bool PolysIntersect(Polygon polyA, Polygon polyB)
+ {
+ return PolysIntersect(polyA, Vector2.Empty, polyB, Vector2.Empty);
+ }
+ public static bool PolysIntersect(
+ Polygon polyA, Vector2 offsetA,
+ Polygon polyB, Vector2 offsetB)
+ {
+ // do the separating axis test for each edge in each square.
+ if (FindSeparatingAxis(
+ polyA.mPoints, offsetA,
+ polyB.mPoints, offsetB))
+ return false;
+
+ if (FindSeparatingAxis(
+ polyB.mPoints, offsetB,
+ polyA.mPoints, offsetA))
+ return false;
+
+ return true;
+ }
+
+ /// <summary>
+ /// Checks to see if any of the lines in the first set of vectors groups
+ /// all the points in the second set of vectors entirely into one side.
+ /// This algorithm can be used to determine if two convex polygons intersect.
+ /// </summary>
+ /// <param name="va"></param>
+ /// <param name="vb"></param>
+ /// <returns></returns>
+ private static bool FindSeparatingAxis(
+ List<Vector2> va, Vector2 offsetA,
+ List<Vector2> vb, Vector2 offsetB)
+ {
+ for (int i = 0; i < va.Count; i++)
+ {
+ int next = i + 1;
+ if (next == va.Count) next = 0;
+
+ int nextnext = next + 1;
+ if (nextnext == va.Count) nextnext = 0;
+
+ Vector2 edge = va[next] - va[i];
+
+ bool separating = true;
+
+ // first check to see which side of the axis the points in
+ // va are on, stored in the inSide variable.
+ Vector2 indiff = va[nextnext] - va[i];
+
+ var indot = indiff.DotProduct(edge);
+ int inSide = Math.Sign(indot);
+ int lastSide = 0;
+
+ for (int j = 0; j < vb.Count; j++)
+ {
+ Vector2 diff = vb[j] - va[i];
+ diff += offsetB - offsetA;
+
+ var dot = diff.DotProduct(edge);
+ var side = Math.Sign(dot);
+
+ // this means points in vb are on the same side
+ // of the edge as points in va. Thus, it is not
+ // a separating axis.
+ if (side == inSide)
+ {
+ separating = false;
+ break;
+ }
+
+ if (lastSide == 0)
+ lastSide = side;
+ else if (lastSide != side)
+ {
+ // if we fail here, it means the axis goes right through
+ // the polygon defined in vb, so this is not a separating
+ // axis.
+ separating = false;
+ break;
+ }
+ }
+
+ if (separating)
+ return true;
+ }
+
+ return false;
+ }
+
+ #endregion
+
+
+ public bool IsAlignedRect
+ {
+ get
+ {
+ if (mPoints.Count != 4)
+ return false;
+
+ // TODO: actually implement this method.
+ return true;
+ }
+ }
+ }
+}
Modified: trunk/AgateLib/Sprites/Sprite.cs
===================================================================
--- trunk/AgateLib/Sprites/Sprite.cs 2014-08-11 05:13:00 UTC (rev 1458)
+++ trunk/AgateLib/Sprites/Sprite.cs 2014-08-11 05:28:36 UTC (rev 1459)
@@ -20,6 +20,7 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
+using AgateLib;
using AgateLib.DisplayLib;
using AgateLib.Geometry;
using AgateLib.Resources;
@@ -46,6 +47,7 @@
private SurfaceState mState = new SurfaceState();
+
#region --- Construction / Destruction ---
/// <summary>
/// Constructs a Sprite object, of the specified width and height.
@@ -136,112 +138,6 @@
}
/// <summary>
- /// Constructs a sprite from a resource.
- /// </summary>
- /// <param name="resources"></param>
- /// <param name="name"></param>
- public Sprite(AgateResourceCollection resources, string name)
- {
- AgateResource generic_res = resources[name];
- SpriteResource sprite_res = generic_res as SpriteResource;
-
- if (sprite_res == null)
- throw new AgateResourceException("Resource " + generic_res.Name + " is not a sprite.");
-
- BuildSpriteFromResource(resources, resources.RootDirectory, sprite_res);
- }
-
- private void BuildSpriteFromResource(AgateResourceCollection resources,
- string root, SpriteResource resource)
- {
- Surface defaultSurface = null;
-
- if (string.IsNullOrEmpty(resource.Filename) == false)
- {
- defaultSurface = new Surface(resources.LoadSurfaceImpl(resource.Filename));
- mOwnedSurfaces.Add(defaultSurface);
- }
-
- if (resource.HasSize)
- mSpriteSize = resource.Size;
- else if (defaultSurface != null)
- mSpriteSize = defaultSurface.SurfaceSize;
-
- for (int i = 0; i < resource.ChildElements.Count; i++)
- {
- SpriteResource.SpriteSubResource child = resource.ChildElements[i];
- Surface thisSurface = defaultSurface;
-
- if (child is SpriteResource.SpriteFrameResource)
- {
- SpriteResource.SpriteFrameResource frame = (SpriteResource.SpriteFrameResource)child;
- if (string.IsNullOrEmpty(frame.Filename) == false)
- {
- thisSurface = new Surface(resources.LoadSurfaceImpl(frame.Filename));
- mOwnedSurfaces.Add(thisSurface);
-
- if (i == 0 && defaultSurface == null && resource.HasSize == false)
- {
- mSpriteSize = thisSurface.SurfaceSize;
- }
- }
- if (thisSurface == null)
- {
- throw new AgateException(string.Format(
- "The surface to create the sprite from in resource {0} was not specified.", resource.Name));
- }
-
- // we pass false to ownSurface here because the surface has already been added to the
- // owned surfaces list.
- AddFrame(thisSurface, false, frame.Bounds, frame.Offset);
- }
- else
- {
- var image = (SpriteResource.SpriteImageResource)child;
-
- DisplayLib.ImplementationBase.SurfaceImpl thisImpl = resources.LoadSurfaceImpl(image.Filename);
- if (i == 0 && defaultSurface == null && resource.HasSize == false)
- {
- mSpriteSize = thisImpl.SurfaceSize;
- }
-
- if (image.Grids.Count == 0)
- {
- AddFrame(new Surface(thisImpl), false,
- new Rectangle(0, 0, mSpriteSize.Width, mSpriteSize.Height),
- Point.Empty);
- }
- else
- {
- for (int j = 0; j < image.Grids.Count; j++)
- {
- AddFramesFromGrid(resources, thisImpl, image.Grids[j]);
- }
- }
- }
- }
- }
-
- private void AddFramesFromGrid(AgateResourceCollection resources, DisplayLib.ImplementationBase.SurfaceImpl thisImpl, SpriteResource.SpriteImageResource.Grid grid)
- {
- Point location = grid.Location;
-
- for (int y = 0; y < grid.Array.Height; y++)
- {
- for (int x = 0; x < grid.Array.Width; x++)
- {
- var surfImpl = thisImpl.CarveSubSurface(new Rectangle(location, grid.Size));
- AddFrame(new Surface(surfImpl), false, new Rectangle(0, 0, grid.Size.Width, grid.Size.Height), Point.Empty);
-
- location.X += grid.Size.Width;
- }
-
- location.Y += grid.Size.Height;
- location.X = grid.Location.X;
- }
- }
-
- /// <summary>
/// Adds a surface as a frame to the sprite.
/// </summary>
/// <param name="surface"></param>
@@ -249,9 +145,9 @@
{
SpriteFrame frame = new SpriteFrame(surface);
frame.SourceRect = new Rectangle(0, 0, surface.SurfaceWidth, surface.SurfaceHeight);
- frame.Offset = Point.Empty;
+ frame.Anchor = Point.Empty;
frame.SpriteSize = SpriteSize;
-
+
mFrames.Add(frame);
}
@@ -266,12 +162,18 @@
{
SpriteFrame frame = new SpriteFrame(surface);
frame.SourceRect = bounds;
- frame.Offset = offset;
+ frame.Anchor = offset;
frame.SpriteSize = SpriteSize;
mFrames.Add(frame);
}
+ public void AddFrame(SpriteFrame frame)
+ {
+ frame.DisplaySize = DisplaySize;
+ mFrames.Add(frame);
+ }
+
/// <summary>
/// Makes a copy of this sprite and returns it.
/// </summary>
@@ -388,33 +290,6 @@
#region --- Drawing the sprite to the screen ---
/// <summary>
- /// Draw the sprite to the given destination rectangle.
- /// Overrides scaling settings.
- /// </summary>
- /// <param name="destRect"></param>
- public void Draw(Rectangle destRect)
- {
- if (mFrames.Count == 0)
- return;
-
- SpriteFrame current = (SpriteFrame)CurrentFrame;
-
- current.DisplaySize = destRect.Size;
- Surface surf = current.Surface;
-
- PointF alignment = Origin.CalcF(DisplayAlignment, DisplaySize);
- PointF rotation = Origin.CalcF(RotationCenter, DisplaySize);
-
- surf.Alpha = Alpha;
- surf.DisplayAlignment = DisplayAlignment;
- surf.RotationAngle = RotationAngle;
- surf.RotationCenter = RotationCenter;
- surf.Color = Color;
-
- current.Draw(destRect.X - alignment.X, destRect.Y - alignment.Y,
- rotation.X, rotation.Y);
- }
- /// <summary>
/// Draws the sprite at the specified position on screen.
/// </summary>
/// <param name="destX"></param>
@@ -447,13 +322,16 @@
currentFrame.DisplaySize = DisplaySize;
PointF alignment = Origin.CalcF(DisplayAlignment, DisplaySize);
- PointF rotation = Origin.CalcF(RotationCenter, DisplaySize);
+ PointF rotation = new PointF();// Origin.CalcF(RotationCenter, DisplaySize);
surf.Alpha = Alpha;
surf.DisplayAlignment = OriginAlignment.TopLeft;
surf.RotationAngle = RotationAngle;
surf.Color = Color;
+ currentFrame.FlipHorizontal = FlipHorizontal;
+ currentFrame.FlipVertical = FlipVertical;
+
currentFrame.Draw(destX - alignment.X, destY - alignment.Y,
rotation.X, rotation.Y);
}
@@ -482,30 +360,7 @@
Draw(destPt.X, destPt.Y);
}
- /// <summary>
- /// Draws the sprite at all the specified positions on screen.
- /// </summary>
- /// <param name="dest_pts"></param>
- public void DrawPoints(Point[] dest_pts)
- {
- for (int i = 0; i < dest_pts.Length; i++)
- Draw(dest_pts[i]);
- }
- /// <summary>
- /// Draws the sprite at the origin.
- /// </summary>
- public void Draw() { Draw(0, 0); }
- /// <summary>
- /// Draws the sprite at the specified rectangles.
- /// </summary>
- /// <param name="dest_rects"></param>
- public void DrawRects(Rectangle[] dest_rects)
- {
- foreach (Rectangle r in dest_rects)
- Draw(r);
- }
-
#endregion
#region --- Queueing rects to draw to the screen ---
@@ -711,6 +566,9 @@
set { mVisible = value; }
}
+ public Point Anchor { get; set; }
+ public Rectangle InnerRect { get; set; }
+
#endregion
#region --- Animation Properties and Methods ---
@@ -747,10 +605,118 @@
/// </summary>
public void AdvanceFrame()
{
+ int newFrameIndex = CurrentFrameIndex;
+
if (PlayReverse)
- CurrentFrameIndex--;
+ newFrameIndex--;
else
- CurrentFrameIndex++;
+ newFrameIndex++;
+
+ switch (AnimationType)
+ {
+ case SpriteAnimType.Looping:
+ while (newFrameIndex < 0)
+ newFrameIndex += mFrames.Count;
+
+ newFrameIndex = newFrameIndex % mFrames.Count;
+
+ break;
+
+ case SpriteAnimType.Once:
+ if (PlayReverse && newFrameIndex == -1)
+ {
+ newFrameIndex = mFrames.Count - 1;
+ IsAnimating = false;
+ }
+ else if (PlayReverse == false && newFrameIndex == mFrames.Count)
+ {
+ newFrameIndex = 0;
+ IsAnimating = false;
+ }
+
+ break;
+
+ case SpriteAnimType.Twice:
+ if (PlayReverse && newFrameIndex == -1)
+ {
+ newFrameIndex = mFrames.Count - 1;
+ mAnimType = SpriteAnimType.Once;
+ }
+ else if (PlayReverse == false && newFrameIndex == mFrames.Count)
+ {
+ newFrameIndex = 0;
+ mAnimType = SpriteAnimType.Once;
+ }
+
+ break;
+
+ case SpriteAnimType.OnceHoldLast:
+ if (PlayReverse && newFrameIndex == -1)
+ {
+ newFrameIndex = 0;
+ IsAnimating = false;
+ }
+ else if (PlayReverse == false && newFrameIndex == mFrames.Count)
+ {
+ newFrameIndex = mFrames.Count - 1;
+ IsAnimating = false;
+ }
+
+ break;
+
+ case SpriteAnimType.PingPong:
+ /*
+ // this makes it so that you can have a 10 frame pingpong animation,
+ // set it to frame 12, and it will actually show frame 8, because of
+ // the reflection at the end.
+ newFrameIndex %= (mFrames.Count * 2);
+
+ if (newFrameIndex >= mFrames.Count)
+ newFrameIndex = 2 * mFrames.Count - 1 - newFrameIndex;
+
+ * // this is old stuff need to figure out how/whether to include it
+ * // in new implementation
+ * */
+
+ if (Frames.Count <= 1)
+ break;
+
+ // check for the ping-ponging.
+ if (PlayReverse && newFrameIndex == -1)
+ {
+ PlayReverse = false;
+ newFrameIndex = 1;
+ }
+ else if (PlayReverse == false && newFrameIndex == mFrames.Count)
+ {
+ PlayReverse = true;
+ newFrameIndex = mFrames.Count - 2;
+ }
+
+ break;
+
+ case SpriteAnimType.OnceDisappear:
+ if (PlayReverse && newFrameIndex == -1)
+ {
+ newFrameIndex = 0;
+ mVisible = false;
+ }
+ else if (PlayReverse == false && newFrameIndex == mFrames.Count)
+ {
+ newFrameIndex = mFrames.Count - 1;
+ mVisible = false;
+ }
+
+ break;
+
+ default:
+ throw new AgateException("Error: AnimationType not valid!");
+ }
+
+ CurrentFrameIndex = newFrameIndex;
+
+ if (mCurrentFrameIndex < 0 || mCurrentFrameIndex >= mFrames.Count)
+ throw new AgateException("Error: Frame Index is in the wrong place!");
}
@@ -780,119 +746,11 @@
return;
}
- switch (AnimationType)
- {
- case SpriteAnimType.Looping:
+ if (value < 0 || value >= mFrames.Count)
+ throw new ArgumentOutOfRangeException("CurrentFrameIndex must be between 0 and mFrames.Count - 1");
- while (value < 0)
- value += mFrames.Count;
+ mCurrentFrameIndex = value;
- mCurrentFrameIndex = value % mFrames.Count;
-
-
-
- break;
-
- case SpriteAnimType.Once:
- if (PlayReverse && value == 0)
- {
- mCurrentFrameIndex = mFrames.Count - 1;
- IsAnimating = false;
- }
- else if (PlayReverse == false && value == mFrames.Count - 1)
- {
- mCurrentFrameIndex = 0;
- IsAnimating = false;
- }
- else
- {
- mCurrentFrameIndex = value % mFrames.Count;
- }
-
- break;
-
- case SpriteAnimType.Twice:
- if (PlayReverse && value == 0)
- {
- mCurrentFrameIndex = mFrames.Count - 1;
- mAnimType = SpriteAnimType.Once;
- }
- else if (PlayReverse == false && value == mFrames.Count - 1)
- {
- mCurrentFrameIndex = 0;
- mAnimType = SpriteAnimType.Once;
- }
- else
- {
- mCurrentFrameIndex = value % mFrames.Count;
- }
-
- break;
- case SpriteAnimType.OnceHoldLast:
- if (PlayReverse && value == 0)
- {
- mCurrentFrameIndex = 0;
- mIsAnimating = false;
- }
- else if (PlayReverse == false && value == mFrames.Count - 1)
- {
- mCurrentFrameIndex = mFrames.Count - 1;
- mIsAnimating = false;
- }
- else
- {
- mCurrentFrameIndex = value % mFrames.Count;
- }
-
- break;
-
- case SpriteAnimType.PingPong:
- // this makes it so that you can have a 10 frame pingpong animation,
- // set it to frame 12, and it will actually show frame 8, because of
- // the reflection at the end.
- value %= (mFrames.Count * 2);
-
- if (value >= mFrames.Count)
- value = 2 * mFrames.Count - 1 - value;
-
- mCurrentFrameIndex = value;
-
- // check for the ping-ponging.
- if (PlayReverse && value == 0)
- {
- PlayReverse = false;
- }
- else if (PlayReverse == false && value == mFrames.Count - 1)
- {
- PlayReverse = true;
- }
-
- break;
-
- case SpriteAnimType.OnceDisappear:
- if (PlayReverse && value == 0)
- {
- mCurrentFrameIndex = value;
- mVisible = false;
- }
- else if (PlayReverse == false && value == mFrames.Count - 1)
- {
- mCurrentFrameIndex = value;
- mVisible = false;
- }
- else
- {
- mCurrentFrameIndex = value % mFrames.Count;
- }
-
- break;
-
- default:
- throw new AgateException("Error: AnimationType not valid!");
- }
-
- if (mCurrentFrameIndex < 0 || mCurrentFrameIndex >= mFrames.Count)
- throw new AgateException("Error: Frame Index is in the wrong place!");
}
}
/// <summary>
@@ -982,7 +840,7 @@
/// <summary>
/// Gets the list of frames in this sprite.
/// </summary>
- public IFrameList Frames
+ public FrameList<SpriteFrame> Frames
{
get { return mFrames; }
}
@@ -1039,5 +897,15 @@
}
public InterpolationMode InterpolationHint { get; set; }
+ public bool FlipHorizontal { get; set; }
+ public bool FlipVertical { get; set; }
+
+ /// <summary>
+ /// Returns the total animation time in milliseconds.
+ /// </summary>
+ public double TotalAnimTime
+ {
+ get { return TimePerFrame * Frames.Count; }
+ }
}
}
Added: trunk/AgateLib/Sprites/SpriteContainer.cs
===================================================================
--- trunk/AgateLib/Sprites/SpriteContainer.cs (rev 0)
+++ trunk/AgateLib/Sprites/SpriteContainer.cs 2014-08-11 05:28:36 UTC (rev 1459)
@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using AgateLib;
+using AgateLib.DisplayLib;
+using AgateLib.Geometry;
+
+namespace AgateLib.Sprites
+{
+ public class SpriteContainer<TKey> : ISpriteContainer
+ {
+ List<Surface> mOwnedSurfaces;
+ Dictionary<TKey, Sprite> mSprites = new Dictionary<TKey, Sprite>();
+ TKey mCurrent;
+
+ public bool Locked { get; set; }
+
+ public OriginAlignment DisplayAlignment
+ {
+ get { return mSprites[mCurrent].DisplayAlignment; }
+ set
+ {
+ foreach (var val in mSprites.Values)
+ {
+ val.DisplayAlignment = value;
+ }
+ }
+ }
+
+ internal void SetScale(double x, double y)
+ {
+ foreach (var val in mSprites.Values)
+ {
+ val.SetScale(x, y);
+ }
+ }
+
+ public bool FlipHorizontal { get; set; }
+ public bool FlipVertical { get; set; }
+
+ public void Update(double deltaTime)
+ {
+ //foreach (var val in mSprites.Values)
+ //{
+ // val.Update(deltaTime);
+ //}
+
+ CurrentSprite.Update(deltaTime);
+ }
+
+ public Sprite this[TKey key]
+ {
+ get { return mSprites[key]; }
+ }
+
+ internal void DisposeAllSprites()
+ {
+ foreach (var val in mSprites.Values)
+ {
+ val.Dispose();
+ }
+ }
+
+ internal void Add(TKey key, Sprite sprite)
+ {
+ mSprites.Add(key, sprite);
+
+ sprite.AnimationStopped += sprite_AnimationStopped;
+ }
+
+ void sprite_AnimationStopped(ISprite caller)
+ {
+ OnAnimationStopped();
+ }
+
+ void OnAnimationStopped()
+ {
+ if (AnimationStopped != null)
+ AnimationStopped(this, EventArgs.Empty);
+ }
+
+ public event EventHandler AnimationStopped;
+
+ public void Draw(double screenX, double screenY)
+ {
+ mSprites[mCurrent].FlipHorizontal = FlipHorizontal;
+ mSprites[mCurrent].FlipVertical = FlipVertical;
+
+ mSprites[mCurrent].Draw((int)screenX, (int)screenY);
+ }
+ public void Draw(Vector2 screenPosition)
+ {
+ Draw(screenPosition.X, screenPosition.Y);
+ }
+
+ internal void Clear()
+ {
+ mSprites.Clear();
+ }
+
+ public TKey CurrentSpriteKey
+ {
+ get { return mCurrent; }
+ set
+ {
+ if (mSprites.ContainsKey(value))
+ mCurrent = value;
+ }
+ }
+
+ internal void SetCurrentSprite(TKey spriteKey, bool restartAnim)
+ {
+ if (Locked)
+ return;
+
+ CurrentSpriteKey = spriteKey;
+
+ CurrentSprite.StartAnimation();
+ }
+
+ public Sprite CurrentSprite
+ {
+ get { return mSprites[mCurrent]; }
+ }
+
+ public IEnumerable<Sprite> AllSprites
+ {
+ get { return mSprites.Values; }
+ }
+ }
+}
Modified: trunk/AgateLib/Sprites/SpriteFrame.cs
===================================================================
--- trunk/AgateLib/Sprites/SpriteFrame.cs 2014-08-11 05:13:00 UTC (rev 1458)
+++ trunk/AgateLib/Sprites/SpriteFrame.cs 2014-08-11 05:28:36 UTC (rev 1459)
@@ -46,6 +46,7 @@
Rectangle mSrcRect;
Size mDisplaySize;
Size mSpriteSize;
+ Dictionary<string, CollisionRegion> mRegions = new Dictionary<string, CollisionRegion>();
internal SpriteFrame(Surface surface)
{
@@ -77,7 +78,7 @@
/// <summary>
/// Gets or sets the offset for drawing this frame.
/// </summary>
- public Point Offset
+ public Point Anchor
{
get { return mOffset; }
set { mOffset = value; }
@@ -91,8 +92,6 @@
return false;
}
-
-
internal Size SpriteSize
{
get { return mSpriteSize; }
@@ -115,11 +114,6 @@
// get { return mOriginalSize; }
//}
- internal Point FrameOffset
- {
- get { return mOffset; }
- }
-
#region ISpriteFrame Members
/// <summary>
@@ -135,11 +129,35 @@
float scaleX = mDisplaySize.Width / (float)SpriteSize.Width;
float scaleY = mDisplaySize.Height / (float)SpriteSize.Height;
+ PointF dest = new PointF(dest_x, dest_y);
+
+ if (FlipHorizontal)
+ {
+ dest.X -= (SourceRect.Width - mOffset.X) * scaleX;
+
+ scaleX *= -1;
+ }
+ else
+ {
+ dest.X -= mOffset.X * scaleX;
+ }
+ if (FlipVertical)
+ {
+ dest.Y -= (SourceRect.Height - mOffset.Y) * scaleY;
+
+ scaleY *= -1;
+ }
+ else
+ dest.Y -= mOffset.Y * scaleY;
+
+
mSurface.SetScale(scaleX, scaleY);
- mSurface.Draw(mSrcRect, new PointF(dest_x + (mOffset.X * scaleX),
- dest_y + (mOffset.Y * scaleY)), new PointF(rotationCenterX - (mOffset.X * scaleX),
- rotationCenterY - (mOffset.Y * scaleY)));
+ var rotationCenter =
+ new PointF(rotationCenterX + (mOffset.X * Math.Abs(scaleX)),
+ rotationCenterY + (mOffset.Y * Math.Abs(scaleY)));
+
+ mSurface.Draw(mSrcRect, dest, rotationCenter);
}
/// <summary>
@@ -148,7 +166,7 @@
/// <returns></returns>
public override string ToString()
{
- return "SpriteFrame: " + SourceRect.ToString() + " Offset: " + Offset.ToString();
+ return "SpriteFrame: " + SourceRect.ToString() + " Anchor: " + Anchor.ToString();
}
/// <summary>
@@ -160,6 +178,15 @@
}
#endregion
+
+ internal bool FlipVertical { get; set; }
+ internal bool FlipHorizontal { get; set; }
+
+
+ public Dictionary<string, CollisionRegion> Regions
+ {
+ get { return mRegions; }
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-11 05:13:10
|
Revision: 1458
http://sourceforge.net/p/agate/code/1458
Author: kanato
Date: 2014-08-11 05:13:00 +0000 (Mon, 11 Aug 2014)
Log Message:
-----------
Include fix for A* unit test.
Modified Paths:
--------------
trunk/UnitTests/Algorithms/AStarTest.cs
Modified: trunk/UnitTests/Algorithms/AStarTest.cs
===================================================================
--- trunk/UnitTests/Algorithms/AStarTest.cs 2014-08-11 05:01:12 UTC (rev 1457)
+++ trunk/UnitTests/Algorithms/AStarTest.cs 2014-08-11 05:13:00 UTC (rev 1458)
@@ -9,9 +9,9 @@
[TestClass]
public class AStarTest
{
- class FakeMap : IAStarMap
+ class FakeMap : IAStarMap<Point>
{
- public void ReportProgress(AStarTask task)
+ public void ReportProgress(AStarState<Point> task)
{
}
@@ -23,7 +23,7 @@
{
int minval = int.MaxValue;
- foreach(var dest in destination)
+ foreach (var dest in destination)
{
int val = CalculateHeuristic(location, dest);
if (val < minval) minval = val;
@@ -32,20 +32,20 @@
return minval;
}
- public IEnumerable<Point> GetAvailableSteps(AStarTask task, Point location)
+ public IEnumerable<Point> GetAvailableSteps(AStarState<Point> task, Point location)
{
for (int j = -1; j <= 1; j++)
{
- for (int i = -1; i <= 1; i++)
- {
- if (i == j || i == -j) continue;
+ for (int i = -1; i <= 1; i++)
+ {
+ if (i == j || i == -j) continue;
- Point trial = new Point(location.X + i, location.Y + j);
+ Point trial = new Point(location.X + i, location.Y + j);
- if (IsAvailable(trial))
- yield return trial;
+ if (IsAvailable(trial))
+ yield return trial;
+ }
}
- }
}
private bool IsAvailable(Point trial)
@@ -73,13 +73,14 @@
[TestMethod]
public void AStarPath()
{
- AStarTask task = new AStarTask();
+ AStarState<Point> task = new AStarState<Point>();
task.Start = new AgateLib.Geometry.Point(4, 2);
task.EndPoints.Add(new AgateLib.Geometry.Point(5, 15));
- AStar.SetMap(new FakeMap());
- AStar.FindPathSync(task);
+ var astar = new AStar<Point>(new FakeMap());
+ astar.FindPathSync(task);
+
// two steps to the left to get to (2, 2)
// 13 steps down to get to (2, 15)
// 3 steps to the right to get to (5, 15)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-11 05:01:15
|
Revision: 1457
http://sourceforge.net/p/agate/code/1457
Author: kanato
Date: 2014-08-11 05:01:12 +0000 (Mon, 11 Aug 2014)
Log Message:
-----------
Make A* algorithm non-static and generic.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/Algorithms/PathFinding/AStar.cs
trunk/AgateLib/Algorithms/PathFinding/AStarNode.cs
trunk/AgateLib/Algorithms/PathFinding/IAStarMap.cs
Added Paths:
-----------
trunk/AgateLib/Algorithms/PathFinding/AStarState.cs
Removed Paths:
-------------
trunk/AgateLib/Algorithms/PathFinding/AStarTask.cs
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-10 05:26:13 UTC (rev 1456)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-11 05:01:12 UTC (rev 1457)
@@ -82,7 +82,7 @@
</Compile>
<Compile Include="Algorithms\PathFinding\AStar.cs" />
<Compile Include="Algorithms\PathFinding\AStarNode.cs" />
- <Compile Include="Algorithms\PathFinding\AStarTask.cs" />
+ <Compile Include="Algorithms\PathFinding\AStarState.cs" />
<Compile Include="Algorithms\Inverting.cs" />
<Compile Include="Mathematics\MathHelper.cs" />
<Compile Include="Algorithms\PathFinding\IAStarMap.cs" />
Modified: trunk/AgateLib/Algorithms/PathFinding/AStar.cs
===================================================================
--- trunk/AgateLib/Algorithms/PathFinding/AStar.cs 2014-08-10 05:26:13 UTC (rev 1456)
+++ trunk/AgateLib/Algorithms/PathFinding/AStar.cs 2014-08-11 05:01:12 UTC (rev 1457)
@@ -7,16 +7,30 @@
namespace AgateLib.Algorithms.PathFinding
{
- public static class AStar
+ public class AStar<T>
{
const int maxSteps = 200;
- static IAStarMap sMap;
- static bool mAbort;
- static int mActiveTasks;
+ IAStarMap<T> mMap;
+ bool mAbort;
+ int mActiveTasks;
- [Obsolete("Do something about this. It should be replaced by the async implementation.")]
- public static void SetMap(IAStarMap map)
+ Func<T, T, bool> mEquals;
+
+ public AStar(IAStarMap<T> map)
+ : this(map, (x, y) => x.Equals(y))
+ { }
+ public AStar(IAStarMap<T> map, IEqualityComparer<T> comparer)
+ : this(map, (x, y) => comparer.Equals(x, y))
+ { }
+ public AStar(IAStarMap<T> map, Func<T, T, bool> comparison)
{
+ mMap = map;
+ mEquals = comparison;
+ }
+
+ [Obsolete("Set map in constructor.", true)]
+ public void SetMap(IAStarMap<T> map)
+ {
mAbort = true;
while (mActiveTasks > 0)
@@ -25,13 +39,13 @@
Core.KeepAlive();
}
- sMap = map;
+ mMap = map;
mAbort = false;
}
-
- public static void QueueFindPath(AStarTask task)
+
+ public void QueueFindPath(AStarState<T> task)
{
System.Diagnostics.Debug.Assert(task.Tag != null);
@@ -45,7 +59,7 @@
/// task.CompletedCallBack is ignored.
/// </summary>
/// <param name="task"></param>
- public static void FindPathSync(AStarTask task)
+ public void FindPathSync(AStarState<T> task)
{
try
{
@@ -59,21 +73,18 @@
}
}
- static void FindPathThreadPoolCallback(object _task)
+ void FindPathThreadPoolCallback(object _task)
{
- AStarTask task = null;
+ AStarState<T> task = null;
try
{
- task = (AStarTask)_task;
+ task = (AStarState<T>)_task;
FindPath(task);
task.Complete = true;
- if (task.CompletedCallBack != null)
- {
- task.CompletedCallBack(task);
- }
+ task.OnCompleted();
}
finally
{
@@ -82,69 +93,69 @@
}
}
- static void FindPath(AStarTask task)
+ public void FindPath(AStarState<T> task)
{
- List<AStarNode> openNodes = task.openNodes;
- List<AStarNode> closedNodes = task.closedNodes;
+ var openNodes = task.openNodes;
+ var closedNodes = task.closedNodes;
openNodes.Clear();
closedNodes.Clear();
task.Path.Clear();
task.AbortOperation = false;
- var node = new AStarNode
+ var node = new AStarNode<T>
{
- Location = task.Start,
- Parent = null,
- Heuristic = sMap.CalculateHeuristic(task.Start, task.EndPoints),
+ Location = task.Start,
+ Parent = null,
+ Heuristic = mMap.CalculateHeuristic(task.Start, task.EndPoints),
PaidCost = 0
};
task.openNodes.Add(node);
-
+
bool found = false;
int steps = 0;
-
+
do
{
SortOpenNodes(openNodes);
-
+
//sMap.ReportProgress(openNodes, closedNodes, end);
-
+
node = openNodes[0];
openNodes.RemoveAt(0);
closedNodes.Add(node);
-
+
if (task.EndPoints.Contains(node.Location))
{
found = true;
break;
}
-
- steps ++;
+
+ steps++;
if (steps > maxSteps)
break;
-
- foreach(Point test in sMap.GetAvailableSteps(task, node.Location))
+
+ foreach (T test in mMap.GetAvailableSteps(task, node.Location))
{
if (mAbort)
return;
if (task.AbortOperation)
return;
- if (PointInClosedNodes(closedNodes, test))
+ if (LocationIn(closedNodes, test))
continue;
-
- int deltaCost = sMap.GetStepCost(test, node.Location);
-
+
+ int deltaCost = mMap.GetStepCost(test, node.Location);
+
int index = FindPointInOpenNodes(openNodes, test);
-
+
if (index >= 0)
{
if (node.PaidCost + deltaCost < openNodes[index].PaidCost)
{
- AStarNode target = openNodes[index];
-
+ var target = openNodes[index];
+
target.Parent = node;
target.PaidCost = node.PaidCost + deltaCost;
@@ -153,13 +164,13 @@
}
else
{
- var newtarget = new AStarNode
- {
- Location = test,
- Parent = node,
- PaidCost = node.PaidCost + deltaCost,
- Heuristic = sMap.CalculateHeuristic(test, task.EndPoints)
- };
+ var newtarget = new AStarNode<T>
+ {
+ Location = test,
+ Parent = node,
+ PaidCost = node.PaidCost + deltaCost,
+ Heuristic = mMap.CalculateHeuristic(test, task.EndPoints)
+ };
if (newtarget.Heuristic < 0)
{
@@ -167,28 +178,28 @@
}
openNodes.Add(newtarget);
-
+
if (newtarget.Heuristic == 0)
{
node = newtarget;
found = true;
}
}
-
+
if (found)
break;
}
} while (openNodes.Count > 0 && found == false);
-
+
if (!found)
{
task.FoundPath = false;
return;
}
-
+
task.Path.Add(node.Location);
-
+
while (node.Parent != null && node.Parent != node)
{
if (mAbort)
@@ -201,26 +212,33 @@
task.FoundPath = true;
}
- static int FindPointInOpenNodes(List<AStarNode> openNodes, Point location)
+ int FindPointInOpenNodes(List<AStarNode<T>> openNodes, T location)
{
- for(int i = 0; i < openNodes.Count; i++)
+ for (int i = 0; i < openNodes.Count; i++)
{
- if (openNodes[i].Location == location)
+ if (mEquals(openNodes[i].Location, location))
return i;
}
-
+
return -1;
}
- static bool PointInOpenNodes(List<AStarNode> openNodes, Point location)
+ [Obsolete("Use LocationIn", true)]
+ bool PointInOpenNodes(List<AStarNode<T>> openNodes, T location)
{
- return openNodes.Any(x => x.Location == location);
+ return LocationIn(openNodes, location);
}
- static bool PointInClosedNodes(List<AStarNode> closedNodes, Point location)
+ [Obsolete("Use LocationIn", true)]
+ bool PointInClosedNodes(List<AStarNode<T>> closedNodes, T location)
{
- return closedNodes.Any(x => x.Location == location);
+ return LocationIn(closedNodes, location);
}
- static void SortOpenNodes(List<AStarNode> openNodes)
+ bool LocationIn(List<AStarNode<T>> nodeList, T location)
{
+ return nodeList.Any(x => mEquals(x.Location, location));
+ }
+
+ void SortOpenNodes(List<AStarNode<T>> openNodes)
+ {
openNodes.Sort((x, y) =>
{
int retval = x.TotalCost.CompareTo(y.TotalCost);
Modified: trunk/AgateLib/Algorithms/PathFinding/AStarNode.cs
===================================================================
--- trunk/AgateLib/Algorithms/PathFinding/AStarNode.cs 2014-08-10 05:26:13 UTC (rev 1456)
+++ trunk/AgateLib/Algorithms/PathFinding/AStarNode.cs 2014-08-11 05:01:12 UTC (rev 1457)
@@ -2,10 +2,10 @@
namespace AgateLib.Algorithms.PathFinding
{
- public class AStarNode
+ public class AStarNode<T>
{
- public Point Location;
- public AStarNode Parent;
+ public T Location;
+ public AStarNode<T> Parent;
public int PaidCost;
public int Heuristic;
Copied: trunk/AgateLib/Algorithms/PathFinding/AStarState.cs (from rev 1456, trunk/AgateLib/Algorithms/PathFinding/AStarTask.cs)
===================================================================
--- trunk/AgateLib/Algorithms/PathFinding/AStarState.cs (rev 0)
+++ trunk/AgateLib/Algorithms/PathFinding/AStarState.cs 2014-08-11 05:01:12 UTC (rev 1457)
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using AgateLib.Geometry;
+
+namespace AgateLib.Algorithms.PathFinding
+{
+ public class AStarState<T>
+ {
+ List<T> mEndPoints = new List<T>();
+ List<T> mPath = new List<T>();
+
+ public T Start { get; set; }
+
+ public List<T> EndPoints
+ {
+ get { return mEndPoints; }
+ }
+
+ public List<T> Path
+ {
+ get { return mPath; }
+ }
+
+ public List<AStarNode<T>> openNodes = new List<AStarNode<T>>();
+ public List<AStarNode<T>> closedNodes = new List<AStarNode<T>>();
+
+ internal void OnCompleted()
+ {
+ if (Completed != null)
+ Completed(this, EventArgs.Empty);
+ }
+ public event EventHandler Completed;
+
+ public bool SearchingPath { get; set; }
+ public bool Complete { get; set; }
+ public bool FoundPath { get; set; }
+
+ public object Tag { get; set; }
+
+ public bool AbortOperation { get; set; }
+ }
+}
Deleted: trunk/AgateLib/Algorithms/PathFinding/AStarTask.cs
===================================================================
--- trunk/AgateLib/Algorithms/PathFinding/AStarTask.cs 2014-08-10 05:26:13 UTC (rev 1456)
+++ trunk/AgateLib/Algorithms/PathFinding/AStarTask.cs 2014-08-11 05:01:12 UTC (rev 1457)
@@ -1,41 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using AgateLib.Geometry;
-
-namespace AgateLib.Algorithms.PathFinding
-{
- public class AStarTask
- {
- List<Point> mEndPoints = new List<Point>();
- List<Point> mPath = new List<Point>();
-
- public Point Start { get; set; }
-
- public List<Point> EndPoints
- {
- get { return mEndPoints; }
- }
-
- public List<Point> Path
- {
- get { return mPath; }
- }
-
- public List<AStarNode> openNodes = new List<AStarNode>();
- public List<AStarNode> closedNodes = new List<AStarNode>();
-
- public delegate void AStarTaskCompletedHandler(AStarTask task);
-
- public AStarTaskCompletedHandler CompletedCallBack { get; set; }
-
- public bool SearchingPath { get; set; }
- public bool Complete { get; set; }
- public bool FoundPath { get; set; }
-
- public object Tag { get; set; }
-
- public bool AbortOperation { get; set; }
- }
-}
Modified: trunk/AgateLib/Algorithms/PathFinding/IAStarMap.cs
===================================================================
--- trunk/AgateLib/Algorithms/PathFinding/IAStarMap.cs 2014-08-10 05:26:13 UTC (rev 1456)
+++ trunk/AgateLib/Algorithms/PathFinding/IAStarMap.cs 2014-08-11 05:01:12 UTC (rev 1457)
@@ -3,9 +3,9 @@
namespace AgateLib.Algorithms.PathFinding
{
- public interface IAStarMap
+ public interface IAStarMap<T>
{
- void ReportProgress(AStarTask task);
+ void ReportProgress(AStarState<T> task);
/// <summary>
/// Calculate the heuristic for reaching the destination.
@@ -15,18 +15,12 @@
/// If this method returns a negative number, the A* algorithm
/// assumes that this point is invalid.
/// </summary>
- /// <param name="location">
- /// A <see cref="Point"/>
- /// </param>
- /// <param name="destination">
- /// A <see cref="Point"/>
- /// </param>
- /// <returns>
- /// A <see cref="System.Int32"/>
- /// </returns>
- int CalculateHeuristic(Point location, List<Point> destination);
- IEnumerable<Point> GetAvailableSteps(AStarTask task, Point location);
- int GetStepCost(Point target, Point start);
+ /// <param name="location"></param>
+ /// <param name="destination"></param>
+ /// <returns></returns>
+ int CalculateHeuristic(T location, List<T> destination);
+ IEnumerable<T> GetAvailableSteps(AStarState<T> task, T location);
+ int GetStepCost(T target, T start);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-10 05:26:28
|
Revision: 1456
http://sourceforge.net/p/agate/code/1456
Author: kanato
Date: 2014-08-10 05:26:13 +0000 (Sun, 10 Aug 2014)
Log Message:
-----------
Add algorithms and GUI from Zodiac project.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/ApplicationModels/AssetLocations.cs
trunk/AgateLib/IO/FileProvider.cs
trunk/Tests/TestLauncher.cs
trunk/Tests/Tests.csproj
trunk/Tests/frmLauncher.cs
trunk/UnitTests/UnitTests.csproj
Added Paths:
-----------
trunk/AgateLib/Algorithms/
trunk/AgateLib/Algorithms/Inverting.cs
trunk/AgateLib/Algorithms/Pair.cs
trunk/AgateLib/Algorithms/PathFinding/
trunk/AgateLib/Algorithms/PathFinding/AStar.cs
trunk/AgateLib/Algorithms/PathFinding/AStarNode.cs
trunk/AgateLib/Algorithms/PathFinding/AStarTask.cs
trunk/AgateLib/Algorithms/PathFinding/IAStarMap.cs
trunk/AgateLib/Mathematics/
trunk/AgateLib/Mathematics/MathHelper.cs
trunk/AgateLib/UnitTesting/
trunk/AgateLib/UnitTesting/AssertThrows.cs
trunk/AgateLib/UserInterface/
trunk/AgateLib/UserInterface/Css/
trunk/AgateLib/UserInterface/Css/Binders/
trunk/AgateLib/UserInterface/Css/Binders/Binding.cs
trunk/AgateLib/UserInterface/Css/Binders/CssAlias.cs
trunk/AgateLib/UserInterface/Css/Binders/CssBindingMapper.cs
trunk/AgateLib/UserInterface/Css/Binders/CssPropertyMap.cs
trunk/AgateLib/UserInterface/Css/Binders/CssTypeConverter.cs
trunk/AgateLib/UserInterface/Css/Binders/PropertyChain.cs
trunk/AgateLib/UserInterface/Css/Binders/ReflectionPropertyBinder.cs
trunk/AgateLib/UserInterface/Css/Cache/
trunk/AgateLib/UserInterface/Css/Cache/StyleCache.cs
trunk/AgateLib/UserInterface/Css/CssAdapter.cs
trunk/AgateLib/UserInterface/Css/CssBackground.cs
trunk/AgateLib/UserInterface/Css/CssBorder.cs
trunk/AgateLib/UserInterface/Css/CssBorderImage.cs
trunk/AgateLib/UserInterface/Css/CssBoxComponent.cs
trunk/AgateLib/UserInterface/Css/CssDisplay.cs
trunk/AgateLib/UserInterface/Css/CssDistance.cs
trunk/AgateLib/UserInterface/Css/CssDocument.cs
trunk/AgateLib/UserInterface/Css/CssFont.cs
trunk/AgateLib/UserInterface/Css/CssLayout.cs
trunk/AgateLib/UserInterface/Css/CssMedia.cs
trunk/AgateLib/UserInterface/Css/CssPseudoClass.cs
trunk/AgateLib/UserInterface/Css/CssRectangle.cs
trunk/AgateLib/UserInterface/Css/CssRuleBlock.cs
trunk/AgateLib/UserInterface/Css/CssStyle.cs
trunk/AgateLib/UserInterface/Css/CssStyleData.cs
trunk/AgateLib/UserInterface/Css/CssTransition.cs
trunk/AgateLib/UserInterface/Css/Extensions.cs
trunk/AgateLib/UserInterface/Css/ICssBoxComponent.cs
trunk/AgateLib/UserInterface/Css/ICssCanSelect.cs
trunk/AgateLib/UserInterface/Css/ICssPropertyFromText.cs
trunk/AgateLib/UserInterface/Css/Layout/
trunk/AgateLib/UserInterface/Css/Layout/CssBox.cs
trunk/AgateLib/UserInterface/Css/Layout/CssBoxModel.cs
trunk/AgateLib/UserInterface/Css/Layout/CssLayoutEngine.cs
trunk/AgateLib/UserInterface/Css/Layout/Defaults/
trunk/AgateLib/UserInterface/Css/Layout/Defaults/BlankDefaultStyle.cs
trunk/AgateLib/UserInterface/Css/Layout/Defaults/DefaultStyleCollection.cs
trunk/AgateLib/UserInterface/Css/Layout/Defaults/IDefaultStyleSetter.cs
trunk/AgateLib/UserInterface/Css/Layout/Defaults/MenuDefaultStyle.cs
trunk/AgateLib/UserInterface/Css/Layout/Defaults/WindowDefaultStyle.cs
trunk/AgateLib/UserInterface/Css/Parser/
trunk/AgateLib/UserInterface/Css/Parser/CssParser.cs
trunk/AgateLib/UserInterface/Css/Parser/CssPromoteProperties.cs
trunk/AgateLib/UserInterface/Css/Parser/Lexer/
trunk/AgateLib/UserInterface/Css/Parser/Lexer/EnumParser.cs
trunk/AgateLib/UserInterface/Css/Parser/Lexer/ITokenTypeConverter.cs
trunk/AgateLib/UserInterface/Css/Parser/Lexer/Token.cs
trunk/AgateLib/UserInterface/Css/Parser/Lexer/Tokenizer.cs
trunk/AgateLib/UserInterface/Css/ReflectionExtensions.cs
trunk/AgateLib/UserInterface/Css/Rendering/
trunk/AgateLib/UserInterface/Css/Rendering/CssDefaultImageProvider.cs
trunk/AgateLib/UserInterface/Css/Rendering/CssRenderer.cs
trunk/AgateLib/UserInterface/Css/Rendering/ICssImageProvider.cs
trunk/AgateLib/UserInterface/Css/Rendering/Transitions/
trunk/AgateLib/UserInterface/Css/Rendering/Transitions/IWidgetTransition.cs
trunk/AgateLib/UserInterface/Css/Rendering/Transitions/NullTransition.cs
trunk/AgateLib/UserInterface/Css/Rendering/Transitions/SlideTransition.cs
trunk/AgateLib/UserInterface/Css/Rendering/Transitions/TransitionFactory.cs
trunk/AgateLib/UserInterface/Css/Rendering/WidgetAnimator.cs
trunk/AgateLib/UserInterface/Css/Selectors/
trunk/AgateLib/UserInterface/Css/Selectors/CssSelector.cs
trunk/AgateLib/UserInterface/Css/Selectors/CssSelectorChain.cs
trunk/AgateLib/UserInterface/Css/Selectors/CssSelectorGroup.cs
trunk/AgateLib/UserInterface/Css/Selectors/ICssSelector.cs
trunk/AgateLib/UserInterface/IAudioPlayer.cs
trunk/AgateLib/UserInterface/ISurfaceProvider.cs
trunk/AgateLib/UserInterface/Margin.cs
trunk/AgateLib/UserInterface/Widgets/
trunk/AgateLib/UserInterface/Widgets/Container.cs
trunk/AgateLib/UserInterface/Widgets/Desktop.cs
trunk/AgateLib/UserInterface/Widgets/Gui.cs
trunk/AgateLib/UserInterface/Widgets/GuiInput.cs
trunk/AgateLib/UserInterface/Widgets/GuiSound.cs
trunk/AgateLib/UserInterface/Widgets/IGuiLayoutEngine.cs
trunk/AgateLib/UserInterface/Widgets/IGuiRenderer.cs
trunk/AgateLib/UserInterface/Widgets/ImageDisplay.cs
trunk/AgateLib/UserInterface/Widgets/InputMap.cs
trunk/AgateLib/UserInterface/Widgets/KeyboardEventArgs.cs
trunk/AgateLib/UserInterface/Widgets/Label.cs
trunk/AgateLib/UserInterface/Widgets/Linq/
trunk/AgateLib/UserInterface/Widgets/Linq/WidgetExtensions.cs
trunk/AgateLib/UserInterface/Widgets/Menu.cs
trunk/AgateLib/UserInterface/Widgets/MenuItem.cs
trunk/AgateLib/UserInterface/Widgets/MouseEventArgs.cs
trunk/AgateLib/UserInterface/Widgets/Panel.cs
trunk/AgateLib/UserInterface/Widgets/ProgressBar.cs
trunk/AgateLib/UserInterface/Widgets/Widget.cs
trunk/AgateLib/UserInterface/Widgets/WidgetList.cs
trunk/AgateLib/UserInterface/Widgets/Window.cs
trunk/AgateLib/UserInterface/WindowTransition.cs
trunk/Tests/Data/Images/
trunk/Tests/Data/Images/ui_back_1.png
trunk/Tests/Data/Images/ui_border_1.png
trunk/Tests/Data/Images/ui_border_2.png
trunk/Tests/Data/Images/ui_widget.png
trunk/Tests/Data/Style.css
trunk/Tests/Data/settings_list.txt
trunk/Tests/UserInterfaceTests/
trunk/Tests/UserInterfaceTests/Form1.Designer.cs
trunk/Tests/UserInterfaceTests/Form1.cs
trunk/Tests/UserInterfaceTests/Form1.resx
trunk/Tests/UserInterfaceTests/GuiStuff.cs
trunk/Tests/UserInterfaceTests/GuiTest.cs
trunk/UnitTests/Algorithms/
trunk/UnitTests/Algorithms/AStarTest.cs
trunk/UnitTests/Algorithms/EMathTest.cs
trunk/UnitTests/UserInterface/
trunk/UnitTests/UserInterface/Css/
trunk/UnitTests/UserInterface/Css/AdapterTest.cs
trunk/UnitTests/UserInterface/Css/BindingTest.cs
trunk/UnitTests/UserInterface/Css/CssTestBase.cs
trunk/UnitTests/UserInterface/Css/LayoutTest.cs
trunk/UnitTests/UserInterface/Css/ParseTest.cs
trunk/UnitTests/UserInterface/Widgets/
trunk/UnitTests/UserInterface/Widgets/ConversionTests.cs
Removed Paths:
-------------
trunk/Tests/settings_list.txt
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-09 18:07:20 UTC (rev 1455)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-10 05:26:13 UTC (rev 1456)
@@ -80,6 +80,13 @@
<Compile Include="AgateGame.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Algorithms\PathFinding\AStar.cs" />
+ <Compile Include="Algorithms\PathFinding\AStarNode.cs" />
+ <Compile Include="Algorithms\PathFinding\AStarTask.cs" />
+ <Compile Include="Algorithms\Inverting.cs" />
+ <Compile Include="Mathematics\MathHelper.cs" />
+ <Compile Include="Algorithms\PathFinding\IAStarMap.cs" />
+ <Compile Include="Algorithms\Pair.cs" />
<Compile Include="AppInitParameters.cs">
<SubType>Code</SubType>
</Compile>
@@ -89,6 +96,7 @@
<Compile Include="ApplicationModels\CoordinateSystems\FixedAspectRatioCoordinates.cs" />
<Compile Include="ApplicationModels\ICoordinateSystemCreator.cs" />
<Compile Include="ApplicationModels\ModelParameters.cs" />
+ <Compile Include="UnitTesting\AssertThrows.cs" />
<Compile Include="AudioLib\AudioCapsInfo.cs" />
<Compile Include="AudioLib\ImplementationBase\MusicImpl.cs" />
<Compile Include="AudioLib\ImplementationBase\SoundBufferImpl.cs" />
@@ -493,6 +501,86 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="Settings\PersistantSettings.cs" />
+ <Compile Include="UserInterface\Css\Binders\Binding.cs" />
+ <Compile Include="UserInterface\Css\Binders\CssAlias.cs" />
+ <Compile Include="UserInterface\Css\Binders\CssBindingMapper.cs" />
+ <Compile Include="UserInterface\Css\Binders\CssPropertyMap.cs" />
+ <Compile Include="UserInterface\Css\Binders\CssTypeConverter.cs" />
+ <Compile Include="UserInterface\Css\Binders\PropertyChain.cs" />
+ <Compile Include="UserInterface\Css\Binders\ReflectionPropertyBinder.cs" />
+ <Compile Include="UserInterface\Css\Cache\StyleCache.cs" />
+ <Compile Include="UserInterface\Css\CssAdapter.cs" />
+ <Compile Include="UserInterface\Css\CssBackground.cs" />
+ <Compile Include="UserInterface\Css\CssBorder.cs" />
+ <Compile Include="UserInterface\Css\CssBorderImage.cs" />
+ <Compile Include="UserInterface\Css\CssBoxComponent.cs" />
+ <Compile Include="UserInterface\Css\CssDisplay.cs" />
+ <Compile Include="UserInterface\Css\CssDistance.cs" />
+ <Compile Include="UserInterface\Css\CssDocument.cs" />
+ <Compile Include="UserInterface\Css\CssFont.cs" />
+ <Compile Include="UserInterface\Css\CssLayout.cs" />
+ <Compile Include="UserInterface\Css\CssMedia.cs" />
+ <Compile Include="UserInterface\Css\CssPseudoClass.cs" />
+ <Compile Include="UserInterface\Css\CssRectangle.cs" />
+ <Compile Include="UserInterface\Css\CssRuleBlock.cs" />
+ <Compile Include="UserInterface\Css\CssStyle.cs" />
+ <Compile Include="UserInterface\Css\CssStyleData.cs" />
+ <Compile Include="UserInterface\Css\CssTransition.cs" />
+ <Compile Include="UserInterface\Css\Extensions.cs" />
+ <Compile Include="UserInterface\Css\ICssBoxComponent.cs" />
+ <Compile Include="UserInterface\Css\ICssCanSelect.cs" />
+ <Compile Include="UserInterface\Css\ICssPropertyFromText.cs" />
+ <Compile Include="UserInterface\Css\Layout\CssBox.cs" />
+ <Compile Include="UserInterface\Css\Layout\CssBoxModel.cs" />
+ <Compile Include="UserInterface\Css\Layout\CssLayoutEngine.cs" />
+ <Compile Include="UserInterface\Css\Layout\Defaults\BlankDefaultStyle.cs" />
+ <Compile Include="UserInterface\Css\Layout\Defaults\DefaultStyleCollection.cs" />
+ <Compile Include="UserInterface\Css\Layout\Defaults\IDefaultStyleSetter.cs" />
+ <Compile Include="UserInterface\Css\Layout\Defaults\MenuDefaultStyle.cs" />
+ <Compile Include="UserInterface\Css\Layout\Defaults\WindowDefaultStyle.cs" />
+ <Compile Include="UserInterface\Css\Parser\CssParser.cs" />
+ <Compile Include="UserInterface\Css\Parser\CssPromoteProperties.cs" />
+ <Compile Include="UserInterface\Css\Parser\Lexer\EnumParser.cs" />
+ <Compile Include="UserInterface\Css\Parser\Lexer\ITokenTypeConverter.cs" />
+ <Compile Include="UserInterface\Css\Parser\Lexer\Token.cs" />
+ <Compile Include="UserInterface\Css\Parser\Lexer\Tokenizer.cs" />
+ <Compile Include="UserInterface\Css\ReflectionExtensions.cs" />
+ <Compile Include="UserInterface\Css\Rendering\CssDefaultImageProvider.cs" />
+ <Compile Include="UserInterface\Css\Rendering\CssRenderer.cs" />
+ <Compile Include="UserInterface\Css\Rendering\ICssImageProvider.cs" />
+ <Compile Include="UserInterface\Css\Rendering\Transitions\IWidgetTransition.cs" />
+ <Compile Include="UserInterface\Css\Rendering\Transitions\NullTransition.cs" />
+ <Compile Include="UserInterface\Css\Rendering\Transitions\SlideTransition.cs" />
+ <Compile Include="UserInterface\Css\Rendering\Transitions\TransitionFactory.cs" />
+ <Compile Include="UserInterface\Css\Rendering\WidgetAnimator.cs" />
+ <Compile Include="UserInterface\Css\Selectors\CssSelector.cs" />
+ <Compile Include="UserInterface\Css\Selectors\CssSelectorChain.cs" />
+ <Compile Include="UserInterface\Css\Selectors\CssSelectorGroup.cs" />
+ <Compile Include="UserInterface\Css\Selectors\ICssSelector.cs" />
+ <Compile Include="UserInterface\IAudioPlayer.cs" />
+ <Compile Include="UserInterface\ISurfaceProvider.cs" />
+ <Compile Include="UserInterface\Margin.cs" />
+ <Compile Include="UserInterface\Widgets\Container.cs" />
+ <Compile Include="UserInterface\Widgets\Desktop.cs" />
+ <Compile Include="UserInterface\Widgets\Gui.cs" />
+ <Compile Include="UserInterface\Widgets\GuiInput.cs" />
+ <Compile Include="UserInterface\Widgets\GuiSound.cs" />
+ <Compile Include="UserInterface\Widgets\IGuiLayoutEngine.cs" />
+ <Compile Include="UserInterface\Widgets\IGuiRenderer.cs" />
+ <Compile Include="UserInterface\Widgets\ImageDisplay.cs" />
+ <Compile Include="UserInterface\Widgets\InputMap.cs" />
+ <Compile Include="UserInterface\Widgets\KeyboardEventArgs.cs" />
+ <Compile Include="UserInterface\Widgets\Label.cs" />
+ <Compile Include="UserInterface\Widgets\Linq\WidgetExtensions.cs" />
+ <Compile Include="UserInterface\Widgets\Menu.cs" />
+ <Compile Include="UserInterface\Widgets\MenuItem.cs" />
+ <Compile Include="UserInterface\Widgets\MouseEventArgs.cs" />
+ <Compile Include="UserInterface\Widgets\Panel.cs" />
+ <Compile Include="UserInterface\Widgets\ProgressBar.cs" />
+ <Compile Include="UserInterface\Widgets\Widget.cs" />
+ <Compile Include="UserInterface\Widgets\WidgetList.cs" />
+ <Compile Include="UserInterface\Widgets\Window.cs" />
+ <Compile Include="UserInterface\WindowTransition.cs" />
<Compile Include="Utility\Ref.cs">
<SubType>Code</SubType>
</Compile>
Added: trunk/AgateLib/Algorithms/Inverting.cs
===================================================================
--- trunk/AgateLib/Algorithms/Inverting.cs (rev 0)
+++ trunk/AgateLib/Algorithms/Inverting.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,102 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.Algorithms
+{
+ public class Inverting
+ {
+ public static double IterateInvert(Func<double, double> func, double targetVal)
+ {
+ return IterateInvert(func, targetVal, 0);
+ }
+ public static double IterateInvert(Func<double, double> func, double targetVal, double initialPt)
+ {
+ bool hasLower = false;
+ bool hasUpper = false;
+ int iter = 0;
+ const int itermax = 500;
+
+ var p1 = new Pair<double, double>(initialPt, func(initialPt));
+ Pair<double, double> lowerVal, upperVal;
+
+ int sign;
+
+ if (p1.Second < targetVal)
+ {
+ hasLower = true;
+ upperVal = lowerVal = p1;
+
+ sign = 1;
+ }
+ else if (p1.Second > targetVal)
+ {
+ hasUpper = true;
+ lowerVal = upperVal = p1;
+
+ sign = -1;
+ }
+ else
+ return initialPt;
+
+ int step = 1 * sign;
+
+ while ((hasUpper && hasLower) == false)
+ {
+ p1.First += step;
+ p1.Second = func(p1.First);
+
+ if (p1.Second < targetVal)
+ {
+ lowerVal = p1;
+ hasLower = true;
+ }
+ else if (p1.Second > targetVal)
+ {
+ upperVal = p1;
+ hasUpper = true;
+ }
+ else
+ return p1.First;
+
+ iter++;
+ step *= 2;
+
+ if (iter > itermax)
+ throw new Exception("No solution found.");
+
+ }
+
+ while (Math.Abs(p1.Second - targetVal) > 1e-7)
+ {
+ if (iter % 3 == 0)
+ {
+ p1.First = (upperVal.First + lowerVal.First) / 2;
+ p1.Second = func(p1.First);
+ }
+ else
+ {
+ double invslope = (upperVal.First - lowerVal.First) /
+ (upperVal.Second - lowerVal.Second);
+
+ p1.First = lowerVal.First + invslope * (targetVal - lowerVal.Second);
+ p1.Second = func(p1.First);
+ }
+
+ if (p1.Second < targetVal)
+ lowerVal = p1;
+ else if (p1.Second > targetVal)
+ upperVal = p1;
+ else
+ return p1.First;
+
+ iter++;
+ if (iter > itermax)
+ throw new Exception("No solution found.");
+ }
+
+ return p1.First;
+ }
+ }
+}
Added: trunk/AgateLib/Algorithms/Pair.cs
===================================================================
--- trunk/AgateLib/Algorithms/Pair.cs (rev 0)
+++ trunk/AgateLib/Algorithms/Pair.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,23 @@
+using System;
+
+namespace AgateLib.Algorithms
+{
+ /// <summary>
+ /// This structure is used instead of the generic .NET Tuple<> classes because
+ /// the Tuple classes are immutable, and this is needed internally by the iterating algorithms.
+ /// </summary>
+ /// <typeparam name="T1"></typeparam>
+ /// <typeparam name="T2"></typeparam>
+ [Obsolete("Is this still used? Or should it be replaced?", false)]
+ public struct Pair<T1, T2>
+ {
+ public T1 First;
+ public T2 Second;
+
+ public Pair(T1 f, T2 s)
+ {
+ First = f;
+ Second = s;
+ }
+ }
+}
\ No newline at end of file
Added: trunk/AgateLib/Algorithms/PathFinding/AStar.cs
===================================================================
--- trunk/AgateLib/Algorithms/PathFinding/AStar.cs (rev 0)
+++ trunk/AgateLib/Algorithms/PathFinding/AStar.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,235 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using AgateLib.Geometry;
+using System.Threading.Tasks;
+
+namespace AgateLib.Algorithms.PathFinding
+{
+ public static class AStar
+ {
+ const int maxSteps = 200;
+ static IAStarMap sMap;
+ static bool mAbort;
+ static int mActiveTasks;
+
+ [Obsolete("Do something about this. It should be replaced by the async implementation.")]
+ public static void SetMap(IAStarMap map)
+ {
+ mAbort = true;
+
+ while (mActiveTasks > 0)
+ {
+ //Thread.Sleep(0);
+ Core.KeepAlive();
+ }
+
+ sMap = map;
+
+ mAbort = false;
+ }
+
+
+ public static void QueueFindPath(AStarTask task)
+ {
+ System.Diagnostics.Debug.Assert(task.Tag != null);
+
+ task.SearchingPath = true;
+ mActiveTasks++;
+
+ ThreadPool.QueueUserWorkItem(FindPathThreadPoolCallback, task);
+ }
+ /// <summary>
+ /// Finds a path on the current thread and returns.
+ /// task.CompletedCallBack is ignored.
+ /// </summary>
+ /// <param name="task"></param>
+ public static void FindPathSync(AStarTask task)
+ {
+ try
+ {
+ task.SearchingPath = true;
+
+ FindPath(task);
+ }
+ finally
+ {
+ task.SearchingPath = false;
+ }
+ }
+
+ static void FindPathThreadPoolCallback(object _task)
+ {
+ AStarTask task = null;
+
+ try
+ {
+ task = (AStarTask)_task;
+
+ FindPath(task);
+ task.Complete = true;
+
+ if (task.CompletedCallBack != null)
+ {
+ task.CompletedCallBack(task);
+ }
+ }
+ finally
+ {
+ task.SearchingPath = false;
+ mActiveTasks--;
+ }
+ }
+
+ static void FindPath(AStarTask task)
+ {
+ List<AStarNode> openNodes = task.openNodes;
+ List<AStarNode> closedNodes = task.closedNodes;
+
+ openNodes.Clear();
+ closedNodes.Clear();
+ task.Path.Clear();
+ task.AbortOperation = false;
+
+ var node = new AStarNode
+ {
+ Location = task.Start,
+ Parent = null,
+ Heuristic = sMap.CalculateHeuristic(task.Start, task.EndPoints),
+ PaidCost = 0
+ };
+
+ task.openNodes.Add(node);
+
+ bool found = false;
+ int steps = 0;
+
+ do
+ {
+ SortOpenNodes(openNodes);
+
+ //sMap.ReportProgress(openNodes, closedNodes, end);
+
+ node = openNodes[0];
+ openNodes.RemoveAt(0);
+ closedNodes.Add(node);
+
+ if (task.EndPoints.Contains(node.Location))
+ {
+ found = true;
+ break;
+ }
+
+ steps ++;
+ if (steps > maxSteps)
+ break;
+
+ foreach(Point test in sMap.GetAvailableSteps(task, node.Location))
+ {
+ if (mAbort)
+ return;
+ if (task.AbortOperation)
+ return;
+
+ if (PointInClosedNodes(closedNodes, test))
+ continue;
+
+ int deltaCost = sMap.GetStepCost(test, node.Location);
+
+ int index = FindPointInOpenNodes(openNodes, test);
+
+ if (index >= 0)
+ {
+ if (node.PaidCost + deltaCost < openNodes[index].PaidCost)
+ {
+ AStarNode target = openNodes[index];
+
+ target.Parent = node;
+ target.PaidCost = node.PaidCost + deltaCost;
+
+ openNodes[index] = target;
+ }
+ }
+ else
+ {
+ var newtarget = new AStarNode
+ {
+ Location = test,
+ Parent = node,
+ PaidCost = node.PaidCost + deltaCost,
+ Heuristic = sMap.CalculateHeuristic(test, task.EndPoints)
+ };
+
+ if (newtarget.Heuristic < 0)
+ {
+ continue;
+ }
+
+ openNodes.Add(newtarget);
+
+ if (newtarget.Heuristic == 0)
+ {
+ node = newtarget;
+ found = true;
+ }
+ }
+
+ if (found)
+ break;
+ }
+
+ } while (openNodes.Count > 0 && found == false);
+
+ if (!found)
+ {
+ task.FoundPath = false;
+ return;
+ }
+
+ task.Path.Add(node.Location);
+
+ while (node.Parent != null && node.Parent != node)
+ {
+ if (mAbort)
+ return;
+
+ node = node.Parent;
+ task.Path.Add(node.Location);
+ }
+
+ task.FoundPath = true;
+ }
+
+ static int FindPointInOpenNodes(List<AStarNode> openNodes, Point location)
+ {
+ for(int i = 0; i < openNodes.Count; i++)
+ {
+ if (openNodes[i].Location == location)
+ return i;
+ }
+
+ return -1;
+ }
+ static bool PointInOpenNodes(List<AStarNode> openNodes, Point location)
+ {
+ return openNodes.Any(x => x.Location == location);
+ }
+ static bool PointInClosedNodes(List<AStarNode> closedNodes, Point location)
+ {
+ return closedNodes.Any(x => x.Location == location);
+ }
+ static void SortOpenNodes(List<AStarNode> openNodes)
+ {
+ openNodes.Sort((x, y) =>
+ {
+ int retval = x.TotalCost.CompareTo(y.TotalCost);
+ if (retval == 0)
+ retval = -x.PaidCost.CompareTo(y.PaidCost);
+ return retval;
+ });
+ }
+
+ }
+}
+
Added: trunk/AgateLib/Algorithms/PathFinding/AStarNode.cs
===================================================================
--- trunk/AgateLib/Algorithms/PathFinding/AStarNode.cs (rev 0)
+++ trunk/AgateLib/Algorithms/PathFinding/AStarNode.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,24 @@
+using AgateLib.Geometry;
+
+namespace AgateLib.Algorithms.PathFinding
+{
+ public class AStarNode
+ {
+ public Point Location;
+ public AStarNode Parent;
+
+ public int PaidCost;
+ public int Heuristic;
+
+ public int TotalCost
+ {
+ get { return PaidCost + Heuristic; }
+ }
+
+ public override string ToString()
+ {
+ return string.Format("{0} : F={1} G={2} H={3}",
+ Location, TotalCost, PaidCost, Heuristic);
+ }
+ }
+}
\ No newline at end of file
Added: trunk/AgateLib/Algorithms/PathFinding/AStarTask.cs
===================================================================
--- trunk/AgateLib/Algorithms/PathFinding/AStarTask.cs (rev 0)
+++ trunk/AgateLib/Algorithms/PathFinding/AStarTask.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using AgateLib.Geometry;
+
+namespace AgateLib.Algorithms.PathFinding
+{
+ public class AStarTask
+ {
+ List<Point> mEndPoints = new List<Point>();
+ List<Point> mPath = new List<Point>();
+
+ public Point Start { get; set; }
+
+ public List<Point> EndPoints
+ {
+ get { return mEndPoints; }
+ }
+
+ public List<Point> Path
+ {
+ get { return mPath; }
+ }
+
+ public List<AStarNode> openNodes = new List<AStarNode>();
+ public List<AStarNode> closedNodes = new List<AStarNode>();
+
+ public delegate void AStarTaskCompletedHandler(AStarTask task);
+
+ public AStarTaskCompletedHandler CompletedCallBack { get; set; }
+
+ public bool SearchingPath { get; set; }
+ public bool Complete { get; set; }
+ public bool FoundPath { get; set; }
+
+ public object Tag { get; set; }
+
+ public bool AbortOperation { get; set; }
+ }
+}
Added: trunk/AgateLib/Algorithms/PathFinding/IAStarMap.cs
===================================================================
--- trunk/AgateLib/Algorithms/PathFinding/IAStarMap.cs (rev 0)
+++ trunk/AgateLib/Algorithms/PathFinding/IAStarMap.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,32 @@
+using System.Collections.Generic;
+using AgateLib.Geometry;
+
+namespace AgateLib.Algorithms.PathFinding
+{
+ public interface IAStarMap
+ {
+ void ReportProgress(AStarTask task);
+
+ /// <summary>
+ /// Calculate the heuristic for reaching the destination.
+ /// If this method returns zero, the A* algorithm assumes
+ /// this point is equivalent to the destination and ends
+ /// successfully.
+ /// If this method returns a negative number, the A* algorithm
+ /// assumes that this point is invalid.
+ /// </summary>
+ /// <param name="location">
+ /// A <see cref="Point"/>
+ /// </param>
+ /// <param name="destination">
+ /// A <see cref="Point"/>
+ /// </param>
+ /// <returns>
+ /// A <see cref="System.Int32"/>
+ /// </returns>
+ int CalculateHeuristic(Point location, List<Point> destination);
+ IEnumerable<Point> GetAvailableSteps(AStarTask task, Point location);
+ int GetStepCost(Point target, Point start);
+ }
+}
+
Modified: trunk/AgateLib/ApplicationModels/AssetLocations.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/AssetLocations.cs 2014-08-09 18:07:20 UTC (rev 1455)
+++ trunk/AgateLib/ApplicationModels/AssetLocations.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -15,7 +15,7 @@
public string Surfaces { get; set; }
public string Sound { get; set; }
public string Music { get; set; }
-
public string Resources { get; set; }
+ public string UserInterface { get; set; }
}
}
Modified: trunk/AgateLib/IO/FileProvider.cs
===================================================================
--- trunk/AgateLib/IO/FileProvider.cs 2014-08-09 18:07:20 UTC (rev 1455)
+++ trunk/AgateLib/IO/FileProvider.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -22,6 +22,7 @@
SoundAssets = NewProviderFromSubdirectory(Assets, assetLocations.Sound);
MusicAssets = NewProviderFromSubdirectory(Assets, assetLocations.Music);
ResourceAssets = NewProviderFromSubdirectory(Assets, assetLocations.Resources);
+ UserInterfaceAssets = NewProviderFromSubdirectory(Assets, assetLocations.UserInterface);
}
public static IReadFileProvider Assets { get; set; }
@@ -30,6 +31,7 @@
public static IReadFileProvider ResourceAssets { get; set; }
public static IReadFileProvider MusicAssets { get; set; }
public static IReadFileProvider SoundAssets { get; set; }
+ public static IReadFileProvider UserInterfaceAssets { get; set; }
public static IReadWriteFileProvider UserFiles { get; set; }
@@ -40,5 +42,6 @@
return new SubdirectoryProvider(parent, subdir);
}
+
}
}
Added: trunk/AgateLib/Mathematics/MathHelper.cs
===================================================================
--- trunk/AgateLib/Mathematics/MathHelper.cs (rev 0)
+++ trunk/AgateLib/Mathematics/MathHelper.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.Mathematics
+{
+ public static class MathFunctions
+ {
+ /// <summary>
+ /// Computes the error function erf(x).
+ /// </summary>
+ /// <param name="x"></param>
+ /// <returns></returns>
+ public static double Erf(double x)
+ {
+ // Approximate form given on
+ // http://en.wikipedia.org/wiki/Error_function
+ // constants
+ const double a1 = 0.254829592;
+ const double a2 = -0.284496736;
+ const double a3 = 1.421413741;
+ const double a4 = -1.453152027;
+ const double a5 = 1.061405429;
+ const double p = 0.3275911;
+
+ //# Save the sign of x
+ int sign = Math.Sign(x);
+ x = sign * x;
+
+ // A & S 7.1.26
+ double t = 1.0/(1.0 + p*x);
+ double y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*Math.Exp(-x*x);
+
+ return sign * y;
+ }
+ public static double Erfc(double x)
+ {
+ return 1 - Erf(x);
+ }
+
+ public static double IntegratedGaussian(double x)
+ {
+ return 0.5 + 0.5 * Erf(x);
+ }
+ }
+}
Added: trunk/AgateLib/UnitTesting/AssertThrows.cs
===================================================================
--- trunk/AgateLib/UnitTesting/AssertThrows.cs (rev 0)
+++ trunk/AgateLib/UnitTesting/AssertThrows.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.UnitTesting
+{
+ public static class AssertThrows
+ {
+ public static void Throws<T>(Action expression) where T:Exception
+ {
+ try
+ {
+ expression();
+ }
+ catch (T)
+ {
+ return;
+ }
+
+ throw new Exception("Expression did not throw " + typeof(T).Name);
+ }
+ }
+}
Added: trunk/AgateLib/UserInterface/Css/Binders/Binding.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/Binding.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Css/Binders/Binding.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.UserInterface.Css.Binders
+{
+ public class Binding
+ {
+ private string name;
+ private string value;
+ PropertyChain chain;
+ object convertedValue;
+
+ public Binding(CssPropertyMap map, string name, string value)
+ {
+ // TODO: Complete member initialization
+ this.name = name;
+ this.value = value;
+
+ chain = map[name];
+
+ var property = FinalProperty;
+
+ if (typeof(ICssPropertyFromText).IsAssignableFrom(property.PropertyType))
+ {
+ convertedValue = value;
+ }
+ else
+ {
+ convertedValue = CssTypeConverter.ChangeType(property.PropertyType, value);
+ }
+ }
+
+ PropertyInfo FinalProperty { get { return chain[chain.Count - 1]; } }
+
+ public void Apply(CssStyleData cssStyleData)
+ {
+ object obj = cssStyleData;
+
+ for (int i = 0; i < chain.Count - 1; i++)
+ {
+ obj = chain[i].GetValue(obj, null);
+ }
+
+ var property = chain[chain.Count - 1];
+
+ if (typeof(ICssPropertyFromText).IsAssignableFrom(property.PropertyType))
+ {
+ var rfs = (ICssPropertyFromText)property.GetValue(obj, null);
+ rfs.SetValueFromText(value);
+ }
+ else
+ {
+ property.SetValue(obj, convertedValue, null);
+ }
+ }
+ }
+}
Added: trunk/AgateLib/UserInterface/Css/Binders/CssAlias.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/CssAlias.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Css/Binders/CssAlias.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.UserInterface.Css.Binders
+{
+ public class CssAliasAttribute : Attribute
+ {
+ public CssAliasAttribute(string alias)
+ {
+ this.Alias = alias;
+ }
+
+ public string Alias { get; set; }
+ }
+}
Added: trunk/AgateLib/UserInterface/Css/Binders/CssBindingMapper.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/CssBindingMapper.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Css/Binders/CssBindingMapper.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.UserInterface.Css.Binders
+{
+ public class CssBindingMapper
+ {
+ Dictionary<Type, ReflectionPropertyBinder> mPropertyBinders = new Dictionary<Type, ReflectionPropertyBinder>();
+ private CssPropertyMap map;
+
+ public CssBindingMapper(CssPropertyMap destMap)
+ {
+ map = destMap;
+ }
+ public ReflectionPropertyBinder GetPropertyBinder(Type type)
+ {
+ if (mPropertyBinders.ContainsKey(type) == false)
+ mPropertyBinders.Add(type, CreatePropertyBinder(type));
+
+ return mPropertyBinders[type];
+ }
+
+ private ReflectionPropertyBinder CreatePropertyBinder(Type type)
+ {
+ return new ReflectionPropertyBinder(type, this);
+ }
+
+ public PropertyChain GetCssPropertyChain(Type objType, string name)
+ {
+ var binder = GetPropertyBinder(objType);
+
+ return binder.GetCssPropertyChain(objType, name);
+ }
+
+ public bool FindPropertyChain(string property)
+ {
+ if (map.ContainsKey(property))
+ return true;
+
+ var result = GetCssPropertyChain(typeof(CssStyleData), property);
+
+ if (result == null)
+ return false;
+
+ if (result.Count > 0)
+ {
+ map.AddChain(property, result);
+ return true;
+ }
+
+ return false;
+ }
+ }
+}
Added: trunk/AgateLib/UserInterface/Css/Binders/CssPropertyMap.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/CssPropertyMap.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Css/Binders/CssPropertyMap.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.UserInterface.Css.Binders
+{
+ public class CssPropertyMap
+ {
+ Dictionary<string, PropertyChain> mPropertyBinding = new Dictionary<string, PropertyChain>();
+
+ public PropertyChain this[string prop]
+ {
+ get { return mPropertyBinding[prop]; }
+ }
+
+ public void AddChain(string name, PropertyChain chain)
+ {
+ mPropertyBinding.Add(name, chain);
+ }
+
+ public bool ContainsKey(string property)
+ {
+ return mPropertyBinding.ContainsKey(property);
+ }
+ }
+}
Added: trunk/AgateLib/UserInterface/Css/Binders/CssTypeConverter.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/CssTypeConverter.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Css/Binders/CssTypeConverter.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,118 @@
+using AgateLib.Geometry;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.UserInterface.Css.Binders
+{
+ public static class CssTypeConverter
+ {
+ public static object ChangeType(Type targetType, string value)
+ {
+ if (targetType == typeof(string))
+ return value;
+ if (targetType == typeof(Color))
+ return ParseColor(value);
+ if (targetType == typeof(CssDistance))
+ return CssDistance.FromString(value);
+ if (targetType.IsEnum)
+ return Enum.Parse(targetType, value.Replace("-", "_"), true);
+
+ throw new NotImplementedException();
+ }
+
+ public static bool TryParseColor(string value, out Color clr)
+ {
+ clr = Color.FromArgb(0, 0, 0, 0);
+
+ if (Color.IsNamedColor(value))
+ {
+ clr = Color.GetNamedColor(value);
+ return true;
+ }
+
+ if (value.StartsWith("#"))
+ {
+ string subtext = value.Substring(1);
+
+ if (subtext.Length == 3)
+ {
+ StringBuilder builder = new StringBuilder();
+
+ for (int i = 0; i < 3; i++)
+ {
+ builder.Append(subtext[i]);
+ builder.Append(subtext[i]);
+ }
+ subtext = builder.ToString();
+ }
+
+ if (subtext.Length != 6)
+ return false;
+
+ int r, g, b;
+
+ if (int.TryParse(subtext.Substring(0, 2), System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.CurrentCulture, out r) == false) return false;
+ if (int.TryParse(subtext.Substring(2, 2), System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.CurrentCulture, out g) == false) return false;
+ if (int.TryParse(subtext.Substring(4, 2), System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.CurrentCulture, out b) == false) return false;
+
+ clr = Color.FromArgb(r, g, b);
+ return true;
+ }
+ else if (value.StartsWith("rgb") || value.StartsWith("rgba"))
+ {
+ bool hasAlpha = value.StartsWith("rgba");
+
+ int start = value.IndexOf("(");
+ int end = value.IndexOf(")");
+
+ if (end <= start) return false;
+ if (start == -1) return false;
+
+ string[] values = value.Substring(start + 1, end - start - 1).Split(',');
+
+ if (hasAlpha && values.Length != 4) return false;
+ else if (hasAlpha == false && values.Length != 3) return false;
+
+ int r = ParseColorIntegerOrPercent(values[0]);
+ int g = ParseColorIntegerOrPercent(values[1]);
+ int b = ParseColorIntegerOrPercent(values[2]);
+ int a = 255;
+ if (values.Length > 3)
+ a = (int)(255 * double.Parse(values[3]));
+
+ clr = Color.FromArgb(a, r, g, b);
+ return true;
+ }
+ else
+ return false;
+ }
+
+ public static Color ParseColor(string value)
+ {
+ Color clr;
+
+ if (TryParseColor(value, out clr))
+ return clr;
+ else
+ throw new FormatException("Could not understand color value.");
+ }
+
+ private static int ParseColorIntegerOrPercent(string value)
+ {
+ value = value.Trim();
+
+ if (value.EndsWith("%"))
+ {
+ value = value.Substring(0, value.Length - 1);
+ int percent = int.Parse(value);
+
+ return (255 * percent + 99) / 100;
+ }
+
+ return int.Parse(value);
+ }
+ }
+}
Added: trunk/AgateLib/UserInterface/Css/Binders/PropertyChain.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/PropertyChain.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Css/Binders/PropertyChain.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.UserInterface.Css.Binders
+{
+ public class PropertyChain : IList<PropertyInfo>
+ {
+ List<PropertyInfo> mProperties = new List<PropertyInfo>();
+
+
+ public int IndexOf(PropertyInfo item)
+ {
+ return mProperties.IndexOf(item);
+ }
+
+ public void Insert(int index, PropertyInfo item)
+ {
+ mProperties.Insert(index, item);
+ }
+
+ public void RemoveAt(int index)
+ {
+ mProperties.RemoveAt(index);
+ }
+
+ public PropertyInfo this[int index]
+ {
+ get { return mProperties[index]; }
+ set { mProperties[index] = value; }
+ }
+
+ public void Add(PropertyInfo item)
+ {
+ mProperties.Add(item);
+ }
+ public void AddRange(IEnumerable<PropertyInfo> items)
+ {
+ mProperties.AddRange(items);
+ }
+
+ public void Clear()
+ {
+ mProperties.Clear();
+ }
+
+ public bool Contains(PropertyInfo item)
+ {
+ return mProperties.Contains(item);
+ }
+
+ public void CopyTo(PropertyInfo[] array, int arrayIndex)
+ {
+ mProperties.CopyTo(array, arrayIndex);
+ }
+
+ public int Count
+ {
+ get { return mProperties.Count; }
+ }
+
+ public bool IsReadOnly
+ {
+ get { return false; }
+ }
+
+ public bool Remove(PropertyInfo item)
+ {
+ return mProperties.Remove(item);
+ }
+
+ public IEnumerator<PropertyInfo> GetEnumerator()
+ {
+ return mProperties.GetEnumerator();
+ }
+
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
+}
Added: trunk/AgateLib/UserInterface/Css/Binders/ReflectionPropertyBinder.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/ReflectionPropertyBinder.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Css/Binders/ReflectionPropertyBinder.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,75 @@
+using AgateLib.Geometry;
+using AgateLib.UserInterface.Css.Parser;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.UserInterface.Css.Binders
+{
+ public class ReflectionPropertyBinder
+ {
+ Type theType;
+ PropertyInfo[] properties;
+ private CssBindingMapper mMap;
+
+ public ReflectionPropertyBinder(Type type, CssBindingMapper map)
+ {
+ mMap = map;
+ theType = type;
+ properties = theType.GetProperties();
+ }
+
+ public PropertyChain GetCssPropertyChain(Type type, string name)
+ {
+ if (type != theType) throw new ArgumentException("Wrong type of object passed!");
+ PropertyChain retval = new PropertyChain();
+
+ var property = properties.FirstOrDefault(
+ p =>
+ {
+ var a = p.GetCustomAttribute<CssAliasAttribute>(true);
+ if (a != null)
+ return a.Alias.Equals(name, StringComparison.OrdinalIgnoreCase);
+ else
+ return p.Name.Equals(name, StringComparison.OrdinalIgnoreCase);
+ });
+
+ if (property != null)
+ {
+ retval.Add(property);
+ return retval;
+ }
+
+ foreach (var prop in properties)
+ {
+ var attr = prop.GetCustomAttribute<CssPromotePropertiesAttribute>(true);
+
+ if (attr != null)
+ {
+ if (string.IsNullOrEmpty(attr.Prefix) == false)
+ {
+ if (name.StartsWith(attr.Prefix + "-") == false)
+ continue;
+
+ name = name.Substring(attr.Prefix.Length + 1);
+ }
+
+ var newprops = mMap.GetCssPropertyChain(prop.PropertyType, name);
+
+ if (newprops != null)
+ {
+ retval.Add(prop);
+ retval.AddRange(newprops);
+ return retval;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ }
+}
Added: trunk/AgateLib/UserInterface/Css/Cache/StyleCache.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Cache/StyleCache.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Css/Cache/StyleCache.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.UserInterface.Css.Cache
+{
+ class StyleCache
+ {
+ public StyleCache()
+ {
+ CssClasses = new List<string>();
+ }
+
+ public List<string> CssClasses { get; private set; }
+ public string ObjectType { get; set; }
+ public string Id { get; set; }
+
+ public CssPseudoClass PseudoClass { get; set; }
+ }
+}
Added: trunk/AgateLib/UserInterface/Css/CssAdapter.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssAdapter.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Css/CssAdapter.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,315 @@
+using AgateLib.DisplayLib;
+using AgateLib.UserInterface.Css.Layout;
+using AgateLib.UserInterface.Css.Layout.Defaults;
+using AgateLib.UserInterface.Css.Selectors;
+using AgateLib.UserInterface.Widgets;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.UserInterface.Css
+{
+ public class CssAdapter
+ {
+ Dictionary<Widget, CssStyle> mObjectStyles = new Dictionary<Widget, CssStyle>();
+ DefaultStyleCollection mDefaultStyles = new DefaultStyleCollection();
+ private CssDocument mDocument;
+
+ internal CssAdapter(CssDocument doc)
+ {
+ Document = doc;
+ }
+
+ public CssAdapter(CssDocument doc, Font defaultFont) : this(doc)
+ {
+ this.DefaultFont = defaultFont;
+ }
+
+ public Font DefaultFont { get; set; }
+
+ public CssDocument Document
+ {
+ get { return mDocument; }
+ set
+ {
+ mDocument = value;
+
+ CurrentMedium = mDocument.DefaultMedium;
+
+ foreach (var style in mObjectStyles.Values)
+ {
+ style.AppliedBlocks.Clear();
+ style.Widget.LayoutDirty = true;
+ }
+ }
+ }
+ public DefaultStyleCollection DefaultStyles
+ {
+ get { return mDefaultStyles; }
+ }
+
+ public CssStyle GetStyle(Widget control)
+ {
+ if (mObjectStyles.ContainsKey(control) == false)
+ {
+ mObjectStyles.Add(control, new CssStyle(control));
+ }
+
+ bool refresh = NeedStyleRefresh(control);
+
+ if (refresh)
+ {
+ RebuildStyle(control);
+ }
+
+ var style = mObjectStyles[control];
+
+ UpdateBoxModel(style);
+ return style;
+ }
+
+ public int CssDistanceToPixels(Widget widget, CssDistance distance, bool width)
+ {
+ return CssDistanceToPixels(GetStyle(widget), distance, width);
+ }
+ public int CssDistanceToPixels(CssStyle style, CssDistance distance, bool width)
+ {
+ int scale = 1;
+ double amount = distance.Amount;
+
+ switch (distance.DistanceUnit)
+ {
+ case DistanceUnit.Pixels: break;
+ case DistanceUnit.Percent:
+ amount /= 100.0;
+
+ if (style.Widget.Parent == null)
+ scale = 0;
+ else
+ {
+ if (width)
+ scale = style.Widget.Parent.Width;
+ else
+ scale = style.Widget.Parent.Height;
+ }
+
+ break;
+
+ case DistanceUnit.FontHeight:
+ var font = style.Widget.Font;
+
+ if (font != null)
+ scale = font.FontHeight;
+ else
+ scale = 0;
+
+ break;
+
+ default:
+ throw new NotImplementedException();
+ }
+
+ return (int)(amount * scale);
+ }
+
+ private void UpdateBoxModel(CssStyle style)
+ {
+ CssBoxModel model = style.BoxModel;
+
+ model.Border = GetBox(style, style.Data.Border);
+ model.Padding = GetBox(style, style.Data.Padding);
+ model.Margin = GetBox(style, style.Data.Margin);
+ }
+ private CssBox GetBox(CssStyle style, ICssBoxComponent box)
+ {
+ CssBox retval = new CssBox();
+
+ retval.Left = CssDistanceToPixels(style, box.Left, true);
+ retval.Right = CssDistanceToPixels(style, box.Right, true);
+ retval.Top = CssDistanceToPixels(style, box.Top, true);
+ retval.Bottom = CssDistanceToPixels(style, box.Bottom, true);
+
+ return retval;
+ }
+
+ private void RebuildStyle(Widget control)
+ {
+ var style = mObjectStyles[control];
+
+ AssignApplicableBlocks(style);
+
+ ResetStyleToDefault(style);
+ CopyInheritedProperties(style);
+
+ SaveCachedValues(style);
+
+ foreach (var block in style.AppliedBlocks)
+ {
+ foreach (var prop in block.Properties)
+ {
+ try
+ {
+ block.ApplyProperties(style.Data);
+ //mDocument.Binding.ApplyProperty(style.Data, prop.Key, prop.Value);
+ }
+ catch
+ {
+ ReportError(string.Format(
+ "Failed to apply property {0} with value {1}", prop.Key, prop.Value));
+ }
+ }
+ }
+
+ SetStyleFont(style);
+ }
+
+ private void SetStyleFont(CssStyle style)
+ {
+ style.Font = DefaultFont;
+ }
+
+ private void SaveCachedValues(CssStyle style)
+ {
+ var control = style.Widget;
+
+ style.Cache.Id = control.Name;
+ style.Cache.PseudoClass = GetPseudoClass(control);
+
+ var classes = GetCssClasses(style);
+
+ style.Cache.CssClasses.Clear();
+
+ if (classes != null)
+ style.Cache.CssClasses.AddRange(classes);
+
+ control.LayoutDirty = false;
+ }
+ private bool NeedStyleRefresh(Widget control)
+ {
+ CssStyle style = mObjectStyles[control];
+
+ if (control.LayoutDirty) return true;
+
+ string id = control.Name;
+ IEnumerable<string> classes = GetCssClasses(style);
+
+ if (style.Cache.Id != id) return true;
+ if (style.Cache.PseudoClass != GetPseudoClass(control)) return true;
+ if (classes != null)
+ {
+ if (style.Cache.CssClasses.All(x => classes.Contains(x)) == false) return true;
+ if (classes.All(x => style.Cache.CssClasses.Contains(x)) == false) return true;
+ }
+ else
+ if (style.Cache.CssClasses.Count > 0) return true;
+
+ return false;
+ }
+
+ private void CopyInheritedProperties(CssStyle style)
+ {
+ if (style.Widget.Parent == null)
+ return;
+
+ mDefaultStyles[style.Widget.GetType()].InheritParentProperties(style, GetStyle(style.Widget.Parent));
+
+ }
+
+ private void ReportError(string p)
+ {
+ }
+
+ private void ResetStyleToDefault(CssStyle style)
+ {
+ style.Data.Clear();
+
+ mDefaultStyles[style.Widget.GetType()].SetDefaultStyle(style);
+ }
+
+
+ private void AssignApplicableBlocks(CssStyle style)
+ {
+ var control = style.Widget;
+ string id = control.Name;
+ IEnumerable<string> classes = GetCssClasses(style);
+
+ foreach (var block in CurrentMedium.RuleBlocks)
+ {
+ if (BlockAppliesTo(block, control, id, classes))
+ {
+ if (style.AppliedBlocks.Contains(block) == false)
+ {
+ style.AppliedBlocks.Add(block);
+ }
+ }
+ else
+ {
+ if (style.AppliedBlocks.Contains(block))
+ {
+ style.AppliedBlocks.Remove(block);
+ }
+ }
+ }
+ }
+
+ private bool BlockAppliesTo(CssRuleBlock block, Widget control, string id,
+ IEnumerable<string> classes)
+ {
+ CssPseudoClass pseudoClass = GetPseudoClass(control);
+
+ foreach (var selector in block.Selector.IndividualSelectors)
+ {
+ if (SelectorAppliesTo(selector, control, id, pseudoClass, classes))
+ return true;
+ }
+
+ return false;
+ }
+
+ private CssPseudoClass GetPseudoClass(Widget control)
+ {
+ if (control.MouseIn)
+ return CssPseudoClass.Hover;
+ if (control is Container)
+ {
+ Container container = (Container)control;
+
+ if (container.ChildHasMouseIn)
+ return CssPseudoClass.Hover;
+ }
+ if (control is MenuItem)
+ {
+ MenuItem mnuit = (MenuItem)control;
+
+ if (mnuit.Selected)
+ return CssPseudoClass.Selected;
+ }
+
+ return CssPseudoClass.None;
+ }
+
+ private bool SelectorAppliesTo(ICssSelector selector, Widget control,
+ string id, CssPseudoClass pseudoClass, IEnumerable<string> classes)
+ {
+ return selector.Matches(control, id, pseudoClass, classes);
+ }
+
+ private IEnumerable<string> GetCssClasses(CssStyle style)
+ {
+ Widget control = style.Widget;
+
+ if (control.Style != style.ObjectClass)
+ {
+ style.ObjectClass = control.Style;
+ }
+
+ return style.SplitClasses;
+ }
+
+
+
+ CssMedia CurrentMedium { get; set; }
+ }
+}
Added: trunk/AgateLib/UserInterface/Css/CssBackground.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssBackground.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Css/CssBackground.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,68 @@
+using AgateLib.Geometry;
+using AgateLib.UserInterface.Css.Parser;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.UserInterface.Css
+{
+ public class CssBackground
+ {
+ public CssBackground()
+ {
+ Color = Color.FromArgb(0, 0, 0, 0);
+ Position = new CssBackgroundPosition();
+ }
+
+ public Color Color { get; set; }
+ public string Image { get; set; }
+ public CssBackgroundRepeat Repeat { get; set; }
+ public CssBackgroundClip Clip { get; set; }
+ public CssBackgroundPosition Position { get; set; }
+ }
+
+ public class CssBackgroundPosition : ICssPropertyFromText
+ {
+ public CssBackgroundPosition()
+ {
+ Left = new CssDistance();
+ Top = new CssDistance();
+ }
+
+ public CssDistance Left;
+ public CssDistance Top;
+
+ public void SetValueFromText(string value)
+ {
+ int index = value.IndexOf(' ');
+
+ if (index >= 0)
+ {
+ Left = CssDistance.FromString(value.Substring(0, index));
+ Top = CssDistance.FromString(value.Substring(index+1));
+ }
+ else
+ {
+ Left = CssDistance.FromString(value);
+ Top = Left;
+ }
+ }
+ }
+ public enum CssBackgroundRepeat
+ {
+ Repeat,
+ Repeat_X,
+ Repeat_Y,
+ Space,
+ Round,
+ No_Repeat,
+ }
+ public enum CssBackgroundClip
+ {
+ Border_Box,
+ Padding_Box,
+ Content_Box,
+ }
+}
Added: trunk/AgateLib/UserInterface/Css/CssBorder.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssBorder.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Css/CssBorder.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,115 @@
+using AgateLib.Geometry;
+using AgateLib.UserInterface.Css.Parser;
+using AgateLib.UserInterface.Css.Binders;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.ComponentModel;
+
+namespace AgateLib.UserInterface.Css
+{
+ public class CssBorder : ICssPropertyFromText, ICssBoxComponent
+ {
+ public CssBorder()
+ {
+ Top = new CssBorderData();
+ Left = new CssBorderData();
+ Right = new CssBorderData();
+ Bottom = new CssBorderData();
+
+ Image = new CssBorderImage();
+ }
+
+ public CssBorderData Top { get; set; }
+ public CssBorderData Right { get; set; }
+ public CssBorderData Bottom { get; set; }
+ public CssBorderData Left { get; set; }
+
+ [CssPromoteProperties(prefix: "image")]
+ public CssBorderImage Image { get; set; }
+
+ IEnumerable<CssBorderData> AllBorders
+ {
+ get
+ {
+ yield return Top;
+ yield return Right;
+ yield return Bottom;
+ yield return Left;
+ }
+ }
+
+ public void SetValueFromText(string value)
+ {
+ foreach (var b in AllBorders)
+ {
+ b.SetValueFromText(value);
+ }
+ }
+
+ CssDistance ICssBoxComponent.Bottom
+ {
+ get { return Bottom.Width; }
+ set { Bottom.Width = value; }
+ }
+
+ CssDistance ICssBoxComponent.Left
+ {
+ get { return Left.Width; }
+ set { Left.Width = value; }
+ }
+
+ CssDistance ICssBoxComponent.Right
+ {
+ get { return Right.Width; }
+ set { Right.Width = value; }
+ }
+
+ CssDistance ICssBoxComponent.Top
+ {
+ get { return Top.Width; }
+ set { Top.Width = value; }
+ }
+ }
+
+ public class CssBorderData : ICssPropertyFromText
+ {
+ public CssBorderStyle Style { get; set; }
+
+ public CssDistance Width { get; set; }
+
+ public Color Color { get; set; }
+
+ public void SetValueFromText(string value)
+ {
+ string[] values = value.Split(Extensions.WhiteSpace);
+
+ foreach (var v in values)
+ {
+ Color clr;
+ CssBorderStyle stl;
+
+ if (v[0] >= '0' && v[0] <= '9')
+ {
+ Width = CssDistance.FromString(v);
+ }
+ if (Enum.TryParse(v, out stl))
+ {
+ Style = stl;
+ }
+ if (CssTypeConverter.TryParseColor(v, out clr))
+ {
+ Color = clr;
+ }
+ }
+ }
+ }
+
+ public enum CssBorderStyle
+ {
+ None,
+ Single,
+ Double,
+ }
+}
Added: trunk/AgateLib/UserInterface/Css/CssBorderImage.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssBorderImage.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Css/CssBorderImage.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.UserInterface.Css
+{
+ public class CssBorderImage : ICssPropertyFromText
+ {
+ public CssBorderImage()
+ {
+ Slice = new CssBorderImageComponent();
+ Width = new CssBorderImageComponent();
+ Outset = new CssBorderImageComponent();
+ }
+
+ public string Source { get; set; }
+ public CssBorderImageComponent Slice { get; set; }
+ public CssBorderImageComponent Width { get; set; }
+ public CssBorderImageComponent Outset { get; set; }
+ public CssBorderImageRepeat Repeat { get; set; }
+
+ public void SetValueFromText(string value)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public class CssBorderImageComponent : CssBoxComponent
+ {
+
+ }
+
+ public enum CssBorderImageRepeat
+ {
+ Initial,
+ Inherit,
+ Stretch,
+ Repeat,
+ Round,
+ }
+}
Added: trunk/AgateLib/UserInterface/Css/CssBoxComponent.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssBoxComponent.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Css/CssBoxComponent.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,39 @@
+using AgateLib.UserInterface.Css.Parser;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.UserInterface.Css
+{
+ public class CssBoxComponent : ICssPropertyFromText, AgateLib.UserInterface.Css.ICssBoxComponent
+ {
+ public CssDistance Top { get; set; }
+ public CssDistance Bottom { get; set; }
+ public CssDistance Left { get; set; }
+ public CssDistance Right { get; set; }
+
+ public CssBoxComponent()
+ {
+ Top = new CssDistance(false);
+ Bottom = new CssDistance(false);
+ Right = new CssDistance(false);
+ Left = new CssDistance(false);
+ }
+
+ static char[] sep = new char[] { '\t', '\n', '\r', ' ' };
+ static int[,] indices = new int[4, 4] { { 0, 0, 0, 0 }, {0, 1, 0, 1}, {0, 1, 2, 1}, {0, 1, 2, 3} };
+
+ public void SetValueFromText(string value)
+ {
+ string[] values = value.Split(sep, StringSplitOptions.RemoveEmptyEntries);
+
+ Top = CssDistance.FromString(values[indices[values.Length-1, 0]]);
+ Right = CssDistance.FromString(values[indices[values.Length-1, 1]]);
+ Bottom = CssDistance.FromString(values[indices[values.Length-1, 2]]);
+ Left = CssDistance.FromString(values[indices[values.Length-1, 3]]);
+ }
+ }
+}
Added: trunk/AgateLib/UserInterface/Css/CssDisplay.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssDisplay.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Css/CssDisplay.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.UserInterface.Css
+{
+ public enum CssDisplay
+ {
+ Initial,
+ None,
+ }
+}
Added: trunk/AgateLib/UserInterface/Css/CssDistance.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssDistance.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Css/CssDistance.cs 2014-08-10 05:26:13 UTC (rev 1456)
@@ -0,0 +1,142 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.UserInterface.Css
+{
+ public struct CssDistance : IEquatable<CssDistance>
+ {
+ public double Amount { get; set; }
+ public DistanceUnit DistanceUnit { get; set; }
+ public bool Automatic { get; set; }
+
+ static Dictionary<string, DistanceUnit> UnitMap = new Dictionary<string, DistanceUnit>();
+
+ static CssDistance()
+ {
+ UnitMap.Add("px", DistanceUnit.Pixels);
+ UnitMap.Add("%", DistanceUnit.Percent);
+ UnitMap.Add("em", DistanceUnit.FontHeight);
+ UnitMap.Add("ex", DistanceUnit.FontAverageWidth);
+ UnitMap.Add("ch", DistanceUnit.FontNumericWidth);
+ UnitMap.Add("vw", DistanceUnit.ViewportWidthFrac);
+ UnitMap.Add("vh", DistanceUnit.ViewportHeightFrac);
+ UnitMap.Add("vmin", DistanceUnit.ViewportMinFrac);
+ UnitMap.Add("vmax", DistanceUnit.ViewportMaxFrac);
+ }
+ public static CssDistance FromString(string value)
+ {
+ int numberLength = 0;
+ int start = 0;
+
+ if (value.Equals("auto", StringComparison.OrdinalIgnoreCase))
+ {
+ return new CssDistance(true);
+ }
+
+ if ("+-".Contains(value[0].ToString()))
+ start++;
+
+ for (int i = start; i < value.Length; i++, numberLength++)
+ {
+ if ("0123456789.".Contains(value[i].ToString()) == false)
+ break;
+ }
+
+ CssDistance retval = new CssDistance(false);
+
+ retval.Amount = double.Parse(value.Substring(0, numberLength));
+
+ if (value.Length > numberLength)
+ {
+ string unit...
[truncated message content] |
|
From: <ka...@us...> - 2014-08-09 18:07:26
|
Revision: 1455
http://sourceforge.net/p/agate/code/1455
Author: kanato
Date: 2014-08-09 18:07:20 +0000 (Sat, 09 Aug 2014)
Log Message:
-----------
Add Font object.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/UnitTests/UnitTests.csproj
Added Paths:
-----------
trunk/AgateLib/DisplayLib/Font.cs
trunk/UnitTests/Display/FontTests.cs
trunk/UnitTests/Fakes/FakeFontSurface.cs
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-09 01:18:06 UTC (rev 1454)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-09 18:07:20 UTC (rev 1455)
@@ -107,6 +107,7 @@
<Compile Include="Diagnostics\ConsoleSupport\DescriptionAttribute.cs" />
<Compile Include="Diagnostics\ConsoleSupport\ICommandProcessor.cs" />
<Compile Include="Diagnostics\Log.cs" />
+ <Compile Include="DisplayLib\Font.cs" />
<Compile Include="DisplayLib\FrameBuffer.cs" />
<Compile Include="DisplayLib\IFrameBuffer.cs" />
<Compile Include="DisplayLib\Shaders\AgateBuiltInShaders.cs" />
Added: trunk/AgateLib/DisplayLib/Font.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Font.cs (rev 0)
+++ trunk/AgateLib/DisplayLib/Font.cs 2014-08-09 18:07:20 UTC (rev 1455)
@@ -0,0 +1,194 @@
+using AgateLib.Geometry;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.DisplayLib
+{
+ public class Font
+ {
+ Dictionary<FontSettings, FontSurface> mFontSurfaces = new Dictionary<FontSettings, FontSurface>();
+ FontSettings mSettings;
+ FontState mState = new FontState();
+
+ public Font(string name)
+ {
+ Name = name;
+ }
+
+ public void AddFont(FontSurface fontSurface, int size, FontStyle style)
+ {
+ AddFont(new FontSettings(size, style), fontSurface);
+ }
+ public void AddFont(FontSettings settings, FontSurface fontSurface)
+ {
+ if (Size == 0)
+ mSettings = settings;
+
+ mFontSurfaces[settings] = fontSurface;
+ }
+
+ public string Name { get; set; }
+ public int Size { get { return mSettings.Size; } set { mSettings.Size = value; } }
+ public FontStyle Style { get { return mSettings.Style; } set { mSettings.Style = value; } }
+
+ public int FontHeight { get { return FontSurface.FontHeight; } }
+
+ int MaxSize(FontStyle style)
+ {
+ var keys = mFontSurfaces.Keys.Where(x => x.Style == style);
+ if (keys.Count() > 0)
+ return keys.Max(x => x.Size);
+ else
+ return -1;
+ }
+
+ public FontSurface FontSurface
+ {
+ get
+ {
+ var font = GetClosestFont(mSettings);
+ font.State = mState;
+ return font;
+ }
+ }
+
+ #region --- Finding correctly sized font ---
+
+ public FontSurface GetClosestFont(int size, FontStyle style)
+ {
+ return GetClosestFont(new FontSettings(size, style));
+ }
+ public FontSurface GetClosestFont(FontSettings fontSettings)
+ {
+ var settings = GetClosestFontSettings(fontSettings);
+ var retval = mFontSurfaces[settings];
+
+ var ratio = fontSettings.Size / (double)settings.Size;
+
+ retval.SetScale(ratio, ratio);
+
+ return retval;
+ }
+
+ internal FontSettings GetClosestFontSettings(int size, FontStyle style)
+ {
+ return GetClosestFontSettings(new FontSettings(size, style));
+ }
+ internal FontSettings GetClosestFontSettings(FontSettings settings)
+ {
+ if (mFontSurfaces.ContainsKey(settings))
+ return settings;
+
+ int maxSize = MaxSize(settings.Style);
+
+ // this happens if we have no font surfaces of this style.
+ if (maxSize <= 0)
+ {
+ FontStyle newStyle;
+
+ // OK remove styles until we find an actual font.
+ if (TryRemoveStyle(settings.Style, FontStyle.Strikeout, out newStyle))
+ return GetClosestFontSettings(settings.Size, newStyle);
+ if (TryRemoveStyle(settings.Style, FontStyle.Italic, out newStyle))
+ return GetClosestFontSettings(settings.Size, newStyle);
+ if (TryRemoveStyle(settings.Style, FontStyle.Underline, out newStyle))
+ return GetClosestFontSettings(settings.Size, newStyle);
+ if (TryRemoveStyle(settings.Style, FontStyle.Bold, out newStyle))
+ return GetClosestFontSettings(settings.Size, newStyle);
+ else
+ {
+ Debug.Assert(mFontSurfaces.Count == 0);
+ throw new AgateException("There are no font styles defined.");
+ }
+ }
+
+ if (settings.Size > maxSize)
+ return GetClosestFontSettings(maxSize, settings.Style);
+
+ for (int i = settings.Size; i <= maxSize; i++)
+ {
+ settings.Size = i;
+
+ if (mFontSurfaces.ContainsKey(settings))
+ return settings;
+ }
+
+ throw new AgateException("Could not find a valid font.");
+ }
+
+ #endregion
+
+ private bool TryRemoveStyle(FontStyle value, FontStyle remove, out FontStyle result)
+ {
+ if ((value & remove) == remove)
+ {
+ result = ~(~value | remove);
+ return true;
+ }
+ else
+ {
+ result = 0;
+ return false;
+ }
+ }
+
+
+ public Color Color
+ {
+ get { return mState.Color; }
+ set { mState.Color = value; }
+ }
+ public OriginAlignment DisplayAlignment
+ {
+ get { return mState.DisplayAlignment; }
+ set { mState.DisplayAlignment = value; }
+ }
+
+ public void DrawText(Point dest, string text)
+ {
+ FontSurface.DrawText(dest, text);
+ }
+ public void DrawText(int x, int y, string text)
+ {
+ FontSurface.DrawText(x, y, text);
+ }
+ public void DrawText(int x, int y, string text, params object[] Parameters)
+ {
+ FontSurface.DrawText(x, y, text, Parameters);
+ }
+
+ public Size MeasureString(string text)
+ {
+ return FontSurface.MeasureString(text);
+ }
+ }
+
+ public struct FontSettings : IEquatable<FontSettings>
+ {
+ int mSize;
+ FontStyle mStyle;
+
+ public int Size { get { return mSize; } set { mSize = value; } }
+ public FontStyle Style { get { return mStyle; } set { mStyle = value; } }
+
+ public bool Equals(FontSettings other)
+ {
+ if (Size != other.Size)
+ return false;
+ if (Style != other.Style)
+ return false;
+
+ return true;
+ }
+
+ public FontSettings(int size, FontStyle style)
+ {
+ mSize = size;
+ mStyle = style;
+ }
+ }
+}
Added: trunk/UnitTests/Display/FontTests.cs
===================================================================
--- trunk/UnitTests/Display/FontTests.cs (rev 0)
+++ trunk/UnitTests/Display/FontTests.cs 2014-08-09 18:07:20 UTC (rev 1455)
@@ -0,0 +1,70 @@
+using AgateLib;
+using AgateLib.DisplayLib;
+using AgateLib.DisplayLib.ImplementationBase;
+using AgateLib.Geometry;
+using AgateLib.Platform.WindowsForms.ApplicationModels;
+using AgateLib.UnitTests.Fakes;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.UnitTests.Display
+{
+ [TestClass]
+ public class FontTests
+ {
+ Font ff;
+
+ [TestInitialize]
+ public void Init()
+ {
+ ff = new Font("times");
+
+ ff.AddFont(new FontSettings(8, FontStyle.None),
+ FontSurface.FromImpl(new FakeFontSurface { Height = 8 }));
+
+ ff.AddFont(new FontSettings(8, FontStyle.Bold),
+ FontSurface.FromImpl(new FakeFontSurface { Height = 8 }));
+
+ ff.AddFont(new FontSettings(10, FontStyle.None),
+ FontSurface.FromImpl(new FakeFontSurface { Height = 10 }));
+
+ ff.AddFont(new FontSettings(10, FontStyle.Bold),
+ FontSurface.FromImpl(new FakeFontSurface { Height = 10 }));
+ }
+ [TestCleanup]
+ public void Terminate()
+ {
+ }
+
+ [TestMethod]
+ public void FFBasicRetrieval()
+ {
+ Assert.AreEqual(new FontSettings(8, FontStyle.None), ff.GetClosestFontSettings(new FontSettings(8, FontStyle.None)));
+ Assert.AreEqual(new FontSettings(10, FontStyle.None), ff.GetClosestFontSettings(new FontSettings(10, FontStyle.None)));
+
+ Assert.AreEqual(new FontSettings(8, FontStyle.None), ff.GetClosestFontSettings(new FontSettings(7, FontStyle.None)));
+ Assert.AreEqual(new FontSettings(10, FontStyle.None), ff.GetClosestFontSettings(new FontSettings(9, FontStyle.None)));
+ Assert.AreEqual(new FontSettings(10, FontStyle.None), ff.GetClosestFontSettings(new FontSettings(11, FontStyle.None)));
+ }
+
+ [TestMethod]
+ public void FFAutoScale()
+ {
+ var font = ff.GetClosestFont(9, FontStyle.None);
+
+ Assert.AreEqual(0.9, font.ScaleHeight, 0.00001);
+ }
+
+ [TestMethod]
+ public void FFRemoveStyleRetrieval()
+ {
+ Assert.AreEqual(new FontSettings(10, FontStyle.None), ff.GetClosestFontSettings(new FontSettings(9, FontStyle.Italic)));
+ Assert.AreEqual(new FontSettings(10, FontStyle.Bold), ff.GetClosestFontSettings(new FontSettings(9, FontStyle.Italic | FontStyle.Bold)));
+
+ }
+ }
+}
Added: trunk/UnitTests/Fakes/FakeFontSurface.cs
===================================================================
--- trunk/UnitTests/Fakes/FakeFontSurface.cs (rev 0)
+++ trunk/UnitTests/Fakes/FakeFontSurface.cs 2014-08-09 18:07:20 UTC (rev 1455)
@@ -0,0 +1,35 @@
+using AgateLib.DisplayLib;
+using AgateLib.DisplayLib.ImplementationBase;
+using AgateLib.Geometry;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.UnitTests.Fakes
+{
+ public class FakeFontSurface : FontSurfaceImpl
+ {
+ public int Height { get; set; }
+
+ public override int FontHeight
+ {
+ get { return Height; }
+ }
+
+ public override void DrawText(FontState state)
+ {
+ }
+
+ public override void Dispose()
+ {
+ }
+
+ public override Size MeasureString(FontState state, string text)
+ {
+ return new Size(Height * text.Length, Height);
+ }
+ }
+
+}
Modified: trunk/UnitTests/UnitTests.csproj
===================================================================
--- trunk/UnitTests/UnitTests.csproj 2014-08-09 01:18:06 UTC (rev 1454)
+++ trunk/UnitTests/UnitTests.csproj 2014-08-09 18:07:20 UTC (rev 1455)
@@ -91,9 +91,11 @@
<Compile Include="ApplicationModels\CoordinateSystemTest.cs" />
<Compile Include="Core\ConsoleTests.cs" />
<Compile Include="Display\DisplayTests.cs" />
+ <Compile Include="Display\FontTests.cs" />
<Compile Include="Extensions\ListExtensions.cs" />
<Compile Include="Fakes\FakeDisplayDriver.cs" />
<Compile Include="Fakes\FakeDisplayWindow.cs" />
+ <Compile Include="Fakes\FakeFontSurface.cs" />
<Compile Include="Fakes\FakeFrameBuffer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PlatformTests.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-09 01:18:09
|
Revision: 1454
http://sourceforge.net/p/agate/code/1454
Author: kanato
Date: 2014-08-09 01:18:06 +0000 (Sat, 09 Aug 2014)
Log Message:
-----------
Fixes to SDL joystick implementation.
Modified Paths:
--------------
trunk/AgateLib/InputLib/ImplementationBase/JoystickImpl.cs
trunk/AgateLib/InputLib/Joystick.cs
trunk/AgateLib.AgateSDL/AgateLib.AgateSDL.csproj
trunk/AgateLib.AgateSDL/Input/SDL_Input.cs
trunk/AgateLib.AgateSDL/Sdl2/ISDL.cs
trunk/AgateLib.AgateSDL/Sdl2/SDL32.cs
trunk/AgateLib.AgateSDL/Sdl2/SDL64.cs
Added Paths:
-----------
trunk/AgateLib.AgateSDL/Input/Joysitck_SDL.cs
Modified: trunk/AgateLib/InputLib/ImplementationBase/JoystickImpl.cs
===================================================================
--- trunk/AgateLib/InputLib/ImplementationBase/JoystickImpl.cs 2014-08-09 01:15:49 UTC (rev 1453)
+++ trunk/AgateLib/InputLib/ImplementationBase/JoystickImpl.cs 2014-08-09 01:18:06 UTC (rev 1454)
@@ -46,6 +46,11 @@
public abstract string Name { get; }
/// <summary>
+ /// Gets the GUID identifying the hardware of this joystick
+ /// </summary>
+ public abstract Guid Guid { get; }
+
+ /// <summary>
/// Gets the state of the specified button.
/// </summary>
/// <param name="buttonIndex">Index of the button to check. Valid values are
@@ -90,5 +95,6 @@
/// </summary>
public abstract void Poll();
+
}
}
\ No newline at end of file
Modified: trunk/AgateLib/InputLib/Joystick.cs
===================================================================
--- trunk/AgateLib/InputLib/Joystick.cs 2014-08-09 01:15:49 UTC (rev 1453)
+++ trunk/AgateLib/InputLib/Joystick.cs 2014-08-09 01:18:06 UTC (rev 1454)
@@ -49,6 +49,10 @@
/// Returns the name of the joystick.
/// </summary>
public string Name { get { return impl.Name; } }
+ /// <summary>
+ /// Returns the GUID that identifies this joystick hardware.
+ /// </summary>
+ public Guid Guid { get { return impl.Guid; } }
/// <summary>
/// Gets how many axes are available on this joystick.
@@ -63,6 +67,7 @@
/// </summary>
public int HatCount { get { return impl.HatCount; } }
+
/// <summary>
/// Gets the state of the specified POV hat.
/// </summary>
Modified: trunk/AgateLib.AgateSDL/AgateLib.AgateSDL.csproj
===================================================================
--- trunk/AgateLib.AgateSDL/AgateLib.AgateSDL.csproj 2014-08-09 01:15:49 UTC (rev 1453)
+++ trunk/AgateLib.AgateSDL/AgateLib.AgateSDL.csproj 2014-08-09 01:18:06 UTC (rev 1454)
@@ -85,6 +85,7 @@
<Compile Include="Audio\SDL_Music.cs" />
<Compile Include="Audio\SDL_SoundBuffer.cs" />
<Compile Include="Audio\SDL_SoundBufferSession.cs" />
+ <Compile Include="Input\Joysitck_SDL.cs" />
<Compile Include="Input\SDL_Input.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sdl2\ISDL.cs" />
Added: trunk/AgateLib.AgateSDL/Input/Joysitck_SDL.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Input/Joysitck_SDL.cs (rev 0)
+++ trunk/AgateLib.AgateSDL/Input/Joysitck_SDL.cs 2014-08-09 01:18:06 UTC (rev 1454)
@@ -0,0 +1,133 @@
+using AgateLib.AgateSDL.Sdl2;
+using AgateLib.InputLib.ImplementationBase;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.AgateSDL.Input
+{
+ public class Joystick_SDL : JoystickImpl
+ {
+ ISDL sdl;
+
+ IntPtr joystick;
+ int joystickIndex;
+ double axisTheshold = 0.04f;
+ bool[] buttons;
+ int buttonCount = -1;
+
+ public Joystick_SDL(int index)
+ {
+ sdl = SdlFactory.CreateSDL();
+
+ this.joystickIndex = index;
+ this.joystick = sdl.SDL_JoystickOpen(index);
+ buttons = new bool[ButtonCount];
+ }
+
+ public override string Name
+ {
+ get
+ {
+ string retval = sdl.SDL_JoystickNameForIndex(joystickIndex);
+
+ if (retval == null)
+ return "";
+
+ return retval;
+ }
+ }
+ public override Guid Guid
+ {
+ get { return sdl.SDL_JoystickGetDeviceGUID(joystickIndex); }
+ }
+
+ public override int AxisCount
+ {
+ get { return sdl.SDL_JoystickNumAxes(joystick); }
+ }
+ public override int HatCount
+ {
+ get { return sdl.SDL_JoystickNumHats(joystick); }
+ }
+
+ public override double AxisThreshold
+ {
+ get
+ {
+ return axisTheshold;
+ }
+ set
+ {
+ axisTheshold = value;
+ }
+ }
+
+ public override int ButtonCount
+ {
+ get
+ {
+ if (buttonCount == -1)
+ buttonCount = sdl.SDL_JoystickNumButtons(joystick);
+
+ return buttonCount;
+ }
+ }
+
+ public override bool GetButtonState(int buttonIndex)
+ {
+ return buttons[buttonIndex];
+ }
+ public override AgateLib.InputLib.HatState GetHatState(int hatIndex)
+ {
+ switch (sdl.SDL_JoystickGetHat(joystick, hatIndex))
+ {
+ case SDLConstants.SDL_HAT_RIGHTUP: return AgateLib.InputLib.HatState.UpRight;
+ case SDLConstants.SDL_HAT_RIGHT: return AgateLib.InputLib.HatState.Right;
+ case SDLConstants.SDL_HAT_RIGHTDOWN: return AgateLib.InputLib.HatState.DownRight;
+ case SDLConstants.SDL_HAT_LEFTUP: return AgateLib.InputLib.HatState.UpLeft;
+ case SDLConstants.SDL_HAT_LEFT: return AgateLib.InputLib.HatState.Left;
+ case SDLConstants.SDL_HAT_LEFTDOWN: return AgateLib.InputLib.HatState.DownLeft;
+ case SDLConstants.SDL_HAT_DOWN: return AgateLib.InputLib.HatState.Down;
+ case SDLConstants.SDL_HAT_UP: return AgateLib.InputLib.HatState.Up;
+
+ case SDLConstants.SDL_HAT_CENTERED:
+ default:
+ return AgateLib.InputLib.HatState.None;
+ }
+ }
+ public override double GetAxisValue(int axisIndex)
+ {
+ // Convert joystick coordinate to the agatelib coordinate system of -1..1.
+ double value = sdl.SDL_JoystickGetAxis(joystick, axisIndex) / 32767.0;
+
+ if (value < -1) value = -1;
+ else if (value > 1) value = 1;
+
+ if (Math.Abs(value) < AxisThreshold)
+ value = 0;
+
+ return value;
+ }
+
+ public override bool PluggedIn
+ {
+ get { return true; }
+ }
+
+ public override void Poll()
+ {
+ for (int i = 0; i < ButtonCount; i++)
+ {
+ buttons[i] = (sdl.SDL_JoystickGetButton(joystick, i) != 0) ? true : false;
+ }
+ }
+
+ public override void Recalibrate()
+ {
+
+ }
+ }
+}
Modified: trunk/AgateLib.AgateSDL/Input/SDL_Input.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Input/SDL_Input.cs 2014-08-09 01:15:49 UTC (rev 1453)
+++ trunk/AgateLib.AgateSDL/Input/SDL_Input.cs 2014-08-09 01:18:06 UTC (rev 1454)
@@ -43,8 +43,12 @@
{
for (int i = 0; i < JoystickCount; i++)
{
- Debug.Print(sdl.SDL_JoystickName((IntPtr)i));
- yield return new Joystick_SDL(i);
+ var result = new Joystick_SDL(i);
+
+ Debug.Print("Created joystick: {0} : {1}",
+ result.Guid, result.Name);
+
+ yield return result;
}
}
@@ -72,124 +76,4 @@
sdl.CallPollEvent();
}
}
-
- public class Joystick_SDL : JoystickImpl
- {
- ISDL sdl;
-
- IntPtr joystick;
- IntPtr joystickIndex;
- double axisTheshold = 0.04f;
- bool[] buttons;
- int buttonCount = -1;
-
- public Joystick_SDL(int index)
- {
- sdl = SdlFactory.CreateSDL();
-
- this.joystickIndex = (IntPtr) index;
- this.joystick = sdl.SDL_JoystickOpen(index);
- buttons = new bool[ButtonCount];
- }
-
- public override string Name
- {
- get
- {
- string retval = sdl.SDL_JoystickName(joystickIndex);
-
- if (retval == null)
- return "";
-
- return retval;
- }
- }
-
- public override int AxisCount
- {
- get { return sdl.SDL_JoystickNumAxes(joystick); }
- }
- public override int HatCount
- {
- get { return sdl.SDL_JoystickNumHats(joystick); }
- }
-
- public override double AxisThreshold
- {
- get
- {
- return axisTheshold;
- }
- set
- {
- axisTheshold = value;
- }
- }
-
- public override int ButtonCount
- {
- get
- {
- if (buttonCount == -1)
- buttonCount = sdl.SDL_JoystickNumButtons(joystick);
-
- return buttonCount;
- }
- }
-
- public override bool GetButtonState(int buttonIndex)
- {
- return buttons[buttonIndex];
- }
- public override AgateLib.InputLib.HatState GetHatState(int hatIndex)
- {
- switch(sdl.SDL_JoystickGetHat(joystick, hatIndex))
- {
- case SDLConstants.SDL_HAT_RIGHTUP: return AgateLib.InputLib.HatState.UpRight;
- case SDLConstants.SDL_HAT_RIGHT: return AgateLib.InputLib.HatState.Right;
- case SDLConstants.SDL_HAT_RIGHTDOWN: return AgateLib.InputLib.HatState.DownRight;
- case SDLConstants.SDL_HAT_LEFTUP: return AgateLib.InputLib.HatState.UpLeft;
- case SDLConstants.SDL_HAT_LEFT: return AgateLib.InputLib.HatState.Left;
- case SDLConstants.SDL_HAT_LEFTDOWN: return AgateLib.InputLib.HatState.DownLeft;
- case SDLConstants.SDL_HAT_DOWN: return AgateLib.InputLib.HatState.Down;
- case SDLConstants.SDL_HAT_UP: return AgateLib.InputLib.HatState.Up;
-
- case SDLConstants.SDL_HAT_CENTERED:
- default:
- return AgateLib.InputLib.HatState.None;
- }
- }
- public override double GetAxisValue(int axisIndex)
- {
- // Convert joystick coordinate to the agatelib coordinate system of -1..1.
- double value = sdl.SDL_JoystickGetAxis(joystick, axisIndex) / 32767.0;
-
- if (value < -1) value = -1;
- else if (value > 1) value = 1;
-
- if (Math.Abs(value) < AxisThreshold)
- value = 0;
-
- return value;
- }
-
- public override bool PluggedIn
- {
- get { return true; }
- }
-
- public override void Poll()
- {
- for (int i = 0; i < ButtonCount; i++)
- {
- buttons[i] = (sdl.SDL_JoystickGetButton(joystick, i) != 0) ? true : false;
- }
- }
-
- public override void Recalibrate()
- {
-
- }
-
- }
}
Modified: trunk/AgateLib.AgateSDL/Sdl2/ISDL.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Sdl2/ISDL.cs 2014-08-09 01:15:49 UTC (rev 1453)
+++ trunk/AgateLib.AgateSDL/Sdl2/ISDL.cs 2014-08-09 01:18:06 UTC (rev 1454)
@@ -15,8 +15,10 @@
int SDL_NumJoysticks();
- string SDL_JoystickName(IntPtr joystick);
+ string SDL_JoystickNameForIndex(int device_index);
+ Guid SDL_JoystickGetDeviceGUID(int device_index);
+
IntPtr SDL_JoystickOpen(int index);
int SDL_JoystickNumAxes(IntPtr joystick);
Modified: trunk/AgateLib.AgateSDL/Sdl2/SDL32.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Sdl2/SDL32.cs 2014-08-09 01:15:49 UTC (rev 1453)
+++ trunk/AgateLib.AgateSDL/Sdl2/SDL32.cs 2014-08-09 01:18:06 UTC (rev 1454)
@@ -56,10 +56,14 @@
return SDL.SDL_NumJoysticks();
}
- public string SDL_JoystickName(IntPtr joystick)
+ public string SDL_JoystickNameForIndex(int device_index)
{
- return SDL.SDL_JoystickName(joystick);
+ return SDL.SDL_JoystickNameForIndex(device_index);
}
+ public Guid SDL_JoystickGetDeviceGUID(int device_index)
+ {
+ return SDL.SDL_JoystickGetDeviceGUID(device_index);
+ }
public IntPtr SDL_JoystickOpen(int index)
Modified: trunk/AgateLib.AgateSDL/Sdl2/SDL64.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Sdl2/SDL64.cs 2014-08-09 01:15:49 UTC (rev 1453)
+++ trunk/AgateLib.AgateSDL/Sdl2/SDL64.cs 2014-08-09 01:18:06 UTC (rev 1454)
@@ -54,9 +54,9 @@
return SDL.SDL_NumJoysticks();
}
- public string SDL_JoystickName(IntPtr joystick)
+ public string SDL_JoystickNameForIndex(int device_index)
{
- return SDL.SDL_JoystickName(joystick);
+ return SDL.SDL_JoystickNameForIndex(device_index);
}
public IntPtr SDL_JoystickOpen(int index)
{
@@ -106,6 +106,12 @@
{
return SDL.SDL_GetError();
}
+
+
+ public Guid SDL_JoystickGetDeviceGUID(int device_index)
+ {
+ return SDL.SDL_JoystickGetDeviceGUID(device_index);
+ }
}
class SDLMixer64 : ISDLMixer
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-09 01:15:58
|
Revision: 1453
http://sourceforge.net/p/agate/code/1453
Author: kanato
Date: 2014-08-09 01:15:49 +0000 (Sat, 09 Aug 2014)
Log Message:
-----------
Fix initialization of coordinate system for frame buffer.
Modified Paths:
--------------
trunk/AgateLib/DisplayLib/FrameBuffer.cs
Modified: trunk/AgateLib/DisplayLib/FrameBuffer.cs
===================================================================
--- trunk/AgateLib/DisplayLib/FrameBuffer.cs 2014-08-08 03:27:29 UTC (rev 1452)
+++ trunk/AgateLib/DisplayLib/FrameBuffer.cs 2014-08-09 01:15:49 UTC (rev 1453)
@@ -64,6 +64,7 @@
internal FrameBuffer(FrameBufferImpl impl)
{
this.impl = impl;
+ CoordinateSystem = new Rectangle(Point.Empty, impl.Size);
}
/// <summary>
/// Disposes of unmanaged resources.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-08 03:27:38
|
Revision: 1452
http://sourceforge.net/p/agate/code/1452
Author: kanato
Date: 2014-08-08 03:27:29 +0000 (Fri, 08 Aug 2014)
Log Message:
-----------
Add CoordinateSystem property to IFrameBuffer.
Modified Paths:
--------------
trunk/AgateLib/DisplayLib/IFrameBuffer.cs
Modified: trunk/AgateLib/DisplayLib/IFrameBuffer.cs
===================================================================
--- trunk/AgateLib/DisplayLib/IFrameBuffer.cs 2014-08-08 02:00:52 UTC (rev 1451)
+++ trunk/AgateLib/DisplayLib/IFrameBuffer.cs 2014-08-08 03:27:29 UTC (rev 1452)
@@ -21,5 +21,10 @@
/// Size of the IFrameBuffer object. Should equal new Size(Width, Height).
/// </summary>
Size Size { get; }
+
+ /// <summary>
+ /// Gets or sets the coordinate system for the render target.
+ /// </summary>
+ Rectangle CoordinateSystem { get; set; }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-08 02:00:59
|
Revision: 1451
http://sourceforge.net/p/agate/code/1451
Author: kanato
Date: 2014-08-08 02:00:52 +0000 (Fri, 08 Aug 2014)
Log Message:
-----------
Make ActivatorConstructor public.
Modified Paths:
--------------
trunk/AgateLib.Platform.WindowsForms/Factories/ActivatorConstructor.cs
Modified: trunk/AgateLib.Platform.WindowsForms/Factories/ActivatorConstructor.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/Factories/ActivatorConstructor.cs 2014-08-08 01:53:54 UTC (rev 1450)
+++ trunk/AgateLib.Platform.WindowsForms/Factories/ActivatorConstructor.cs 2014-08-08 02:00:52 UTC (rev 1451)
@@ -6,7 +6,7 @@
namespace AgateLib.Platform.WindowsForms.Factories
{
- class ActivatorConstructor : IObjectConstructor
+ public class ActivatorConstructor : IObjectConstructor
{
public object CreateInstance(Type t)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-08 01:54:03
|
Revision: 1450
http://sourceforge.net/p/agate/code/1450
Author: kanato
Date: 2014-08-08 01:53:54 +0000 (Fri, 08 Aug 2014)
Log Message:
-----------
Fix unit test.
Fix initialization of bbx and sprite creator.
Modified Paths:
--------------
trunk/AgateLib-Everything.sln
trunk/Examples/BallBuster.Net/Program.cs
trunk/Examples/BallBuster.Net/main.cs
trunk/Tools/PackedSpriteCreator/frmSpriteCreator.cs
trunk/UnitTests/Serialization/Xle/XSTests.cs
Modified: trunk/AgateLib-Everything.sln
===================================================================
--- trunk/AgateLib-Everything.sln 2014-08-08 01:31:59 UTC (rev 1449)
+++ trunk/AgateLib-Everything.sln 2014-08-08 01:53:54 UTC (rev 1450)
@@ -40,397 +40,92 @@
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
- Debug|Mixed Platforms = Debug|Mixed Platforms
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
Public|Any CPU = Public|Any CPU
- Public|Mixed Platforms = Public|Mixed Platforms
- Public|Win32 = Public|Win32
- Public|x64 = Public|x64
- Public|x86 = Public|x86
Release|Any CPU = Release|Any CPU
- Release|Mixed Platforms = Release|Mixed Platforms
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Win32.ActiveCfg = Debug|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|x64.ActiveCfg = Debug|x64
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|x64.Build.0 = Debug|x64
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|x86.ActiveCfg = Debug|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|x86.Build.0 = Debug|x86
{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|Any CPU.ActiveCfg = Release|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|Mixed Platforms.ActiveCfg = Release|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|Mixed Platforms.Build.0 = Release|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|Win32.ActiveCfg = Release|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|x64.ActiveCfg = Release|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|x86.ActiveCfg = Release|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|x86.Build.0 = Release|x86
{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Any CPU.Build.0 = Release|Any CPU
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Mixed Platforms.Build.0 = Release|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Win32.ActiveCfg = Release|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|x64.ActiveCfg = Release|x64
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|x64.Build.0 = Release|x64
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|x86.ActiveCfg = Release|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|x86.Build.0 = Release|x86
{9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Win32.ActiveCfg = Debug|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x64.ActiveCfg = Debug|Any CPU
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x86.ActiveCfg = Debug|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x86.Build.0 = Debug|x86
{9490B719-829E-43A7-A5FE-8001F8A81759}.Public|Any CPU.ActiveCfg = Release|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|Mixed Platforms.ActiveCfg = Release|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|Mixed Platforms.Build.0 = Release|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|Win32.ActiveCfg = Release|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|x64.ActiveCfg = Release|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|x86.ActiveCfg = Release|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|x86.Build.0 = Release|x86
{9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.Build.0 = Release|Any CPU
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Mixed Platforms.Build.0 = Release|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Win32.ActiveCfg = Release|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x64.ActiveCfg = Release|Any CPU
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x86.ActiveCfg = Release|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x86.Build.0 = Release|x86
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|Win32.ActiveCfg = Debug|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|x64.ActiveCfg = Debug|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|x86.ActiveCfg = Debug|Any CPU
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|Any CPU.ActiveCfg = Release|Any CPU
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|Any CPU.Build.0 = Release|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|Mixed Platforms.ActiveCfg = Release|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|Mixed Platforms.Build.0 = Release|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|Win32.ActiveCfg = Release|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|x64.ActiveCfg = Release|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|x86.ActiveCfg = Release|Any CPU
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|Any CPU.Build.0 = Release|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|Win32.ActiveCfg = Release|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|x64.ActiveCfg = Release|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|x86.ActiveCfg = Release|Any CPU
{FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|Win32.ActiveCfg = Debug|x86
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|Win32.Build.0 = Debug|x86
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|x64.ActiveCfg = Debug|x64
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|x64.Build.0 = Debug|x64
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|x86.ActiveCfg = Debug|x86
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|x86.Build.0 = Debug|x86
{FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Public|Any CPU.ActiveCfg = Release|Any CPU
{FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Public|Any CPU.Build.0 = Release|Any CPU
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Public|Mixed Platforms.ActiveCfg = Release|x86
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Public|Mixed Platforms.Build.0 = Release|x86
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Public|Win32.ActiveCfg = Release|x86
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Public|Win32.Build.0 = Release|x86
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Public|x64.ActiveCfg = Release|x64
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Public|x64.Build.0 = Release|x64
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Public|x86.ActiveCfg = Release|x86
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Public|x86.Build.0 = Release|x86
{FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|Any CPU.Build.0 = Release|Any CPU
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|Mixed Platforms.Build.0 = Release|x86
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|Win32.ActiveCfg = Release|x86
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|Win32.Build.0 = Release|x86
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|x64.ActiveCfg = Release|x64
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|x64.Build.0 = Release|x64
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|x86.ActiveCfg = Release|x86
- {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|x86.Build.0 = Release|x86
{C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|Win32.ActiveCfg = Debug|x86
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|Win32.Build.0 = Debug|x86
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|x64.ActiveCfg = Debug|x64
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|x64.Build.0 = Debug|x64
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|x86.ActiveCfg = Debug|x86
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|x86.Build.0 = Debug|x86
{C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Public|Any CPU.ActiveCfg = Release|Any CPU
{C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Public|Any CPU.Build.0 = Release|Any CPU
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Public|Mixed Platforms.ActiveCfg = Release|x86
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Public|Mixed Platforms.Build.0 = Release|x86
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Public|Win32.ActiveCfg = Release|x86
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Public|Win32.Build.0 = Release|x86
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Public|x64.ActiveCfg = Release|x64
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Public|x64.Build.0 = Release|x64
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Public|x86.ActiveCfg = Release|x86
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Public|x86.Build.0 = Release|x86
{C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|Any CPU.Build.0 = Release|Any CPU
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|Mixed Platforms.Build.0 = Release|x86
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|Win32.ActiveCfg = Release|x86
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|Win32.Build.0 = Release|x86
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|x64.ActiveCfg = Release|x64
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|x64.Build.0 = Release|x64
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|x86.ActiveCfg = Release|x86
- {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|x86.Build.0 = Release|x86
{A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|Win32.ActiveCfg = Debug|x86
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|Win32.Build.0 = Debug|x86
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|x64.ActiveCfg = Debug|x64
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|x64.Build.0 = Debug|x64
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|x86.ActiveCfg = Debug|x86
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|x86.Build.0 = Debug|x86
{A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Public|Any CPU.ActiveCfg = Release|Any CPU
{A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Public|Any CPU.Build.0 = Release|Any CPU
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Public|Mixed Platforms.ActiveCfg = Release|x86
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Public|Mixed Platforms.Build.0 = Release|x86
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Public|Win32.ActiveCfg = Release|x86
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Public|Win32.Build.0 = Release|x86
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Public|x64.ActiveCfg = Release|x64
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Public|x64.Build.0 = Release|x64
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Public|x86.ActiveCfg = Release|x86
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Public|x86.Build.0 = Release|x86
{A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|Any CPU.Build.0 = Release|Any CPU
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|Mixed Platforms.Build.0 = Release|x86
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|Win32.ActiveCfg = Release|x86
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|Win32.Build.0 = Release|x86
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|x64.ActiveCfg = Release|x64
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|x64.Build.0 = Release|x64
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|x86.ActiveCfg = Release|x86
- {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|x86.Build.0 = Release|x86
{91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|Win32.ActiveCfg = Debug|x86
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|Win32.Build.0 = Debug|x86
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|x64.ActiveCfg = Debug|x64
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|x64.Build.0 = Debug|x64
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|x86.ActiveCfg = Debug|x86
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|x86.Build.0 = Debug|x86
{91F57346-B574-4D52-9EB0-AA191B552C94}.Public|Any CPU.ActiveCfg = Release|Any CPU
{91F57346-B574-4D52-9EB0-AA191B552C94}.Public|Any CPU.Build.0 = Release|Any CPU
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Public|Mixed Platforms.ActiveCfg = Release|x86
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Public|Mixed Platforms.Build.0 = Release|x86
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Public|Win32.ActiveCfg = Release|x86
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Public|Win32.Build.0 = Release|x86
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Public|x64.ActiveCfg = Release|x64
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Public|x64.Build.0 = Release|x64
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Public|x86.ActiveCfg = Release|x86
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Public|x86.Build.0 = Release|x86
{91F57346-B574-4D52-9EB0-AA191B552C94}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91F57346-B574-4D52-9EB0-AA191B552C94}.Release|Any CPU.Build.0 = Release|Any CPU
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Release|Mixed Platforms.Build.0 = Release|x86
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Release|Win32.ActiveCfg = Release|x86
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Release|Win32.Build.0 = Release|x86
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Release|x64.ActiveCfg = Release|x64
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Release|x64.Build.0 = Release|x64
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Release|x86.ActiveCfg = Release|x86
- {91F57346-B574-4D52-9EB0-AA191B552C94}.Release|x86.Build.0 = Release|x86
{DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Debug|Win32.ActiveCfg = Debug|x86
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Debug|Win32.Build.0 = Debug|x86
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Debug|x64.ActiveCfg = Debug|x64
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Debug|x64.Build.0 = Debug|x64
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Debug|x86.ActiveCfg = Debug|x86
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Debug|x86.Build.0 = Debug|x86
{DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Public|Any CPU.ActiveCfg = Release|Any CPU
{DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Public|Any CPU.Build.0 = Release|Any CPU
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Public|Mixed Platforms.ActiveCfg = Release|x86
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Public|Mixed Platforms.Build.0 = Release|x86
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Public|Win32.ActiveCfg = Release|x86
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Public|Win32.Build.0 = Release|x86
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Public|x64.ActiveCfg = Release|x64
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Public|x64.Build.0 = Release|x64
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Public|x86.ActiveCfg = Release|x86
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Public|x86.Build.0 = Release|x86
{DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Release|Any CPU.Build.0 = Release|Any CPU
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Release|Mixed Platforms.Build.0 = Release|x86
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Release|Win32.ActiveCfg = Release|x86
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Release|Win32.Build.0 = Release|x86
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Release|x64.ActiveCfg = Release|x64
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Release|x64.Build.0 = Release|x64
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Release|x86.ActiveCfg = Release|x86
- {DD3CF4AA-02CC-4881-AFB1-6F10DFA1F8AF}.Release|x86.Build.0 = Release|x86
{50743D1B-A19E-42F1-842F-65FAD6D168C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50743D1B-A19E-42F1-842F-65FAD6D168C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Debug|Win32.ActiveCfg = Debug|x86
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Debug|Win32.Build.0 = Debug|x86
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Debug|x64.ActiveCfg = Debug|x64
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Debug|x64.Build.0 = Debug|x64
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Debug|x86.ActiveCfg = Debug|x86
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Debug|x86.Build.0 = Debug|x86
{50743D1B-A19E-42F1-842F-65FAD6D168C3}.Public|Any CPU.ActiveCfg = Release|Any CPU
{50743D1B-A19E-42F1-842F-65FAD6D168C3}.Public|Any CPU.Build.0 = Release|Any CPU
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Public|Mixed Platforms.ActiveCfg = Release|x86
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Public|Mixed Platforms.Build.0 = Release|x86
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Public|Win32.ActiveCfg = Release|x86
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Public|Win32.Build.0 = Release|x86
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Public|x64.ActiveCfg = Release|x64
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Public|x64.Build.0 = Release|x64
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Public|x86.ActiveCfg = Release|x86
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Public|x86.Build.0 = Release|x86
{50743D1B-A19E-42F1-842F-65FAD6D168C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50743D1B-A19E-42F1-842F-65FAD6D168C3}.Release|Any CPU.Build.0 = Release|Any CPU
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Release|Mixed Platforms.Build.0 = Release|x86
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Release|Win32.ActiveCfg = Release|x86
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Release|Win32.Build.0 = Release|x86
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Release|x64.ActiveCfg = Release|x64
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Release|x64.Build.0 = Release|x64
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Release|x86.ActiveCfg = Release|x86
- {50743D1B-A19E-42F1-842F-65FAD6D168C3}.Release|x86.Build.0 = Release|x86
{436641C4-846C-42D0-8E8F-95F70E211D22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{436641C4-846C-42D0-8E8F-95F70E211D22}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Debug|Win32.ActiveCfg = Debug|x86
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Debug|Win32.Build.0 = Debug|x86
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Debug|x64.ActiveCfg = Debug|x64
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Debug|x64.Build.0 = Debug|x64
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Debug|x86.ActiveCfg = Debug|x86
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Debug|x86.Build.0 = Debug|x86
{436641C4-846C-42D0-8E8F-95F70E211D22}.Public|Any CPU.ActiveCfg = Release|Any CPU
{436641C4-846C-42D0-8E8F-95F70E211D22}.Public|Any CPU.Build.0 = Release|Any CPU
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Public|Mixed Platforms.ActiveCfg = Release|x86
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Public|Mixed Platforms.Build.0 = Release|x86
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Public|Win32.ActiveCfg = Release|x86
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Public|Win32.Build.0 = Release|x86
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Public|x64.ActiveCfg = Release|x64
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Public|x64.Build.0 = Release|x64
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Public|x86.ActiveCfg = Release|x86
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Public|x86.Build.0 = Release|x86
{436641C4-846C-42D0-8E8F-95F70E211D22}.Release|Any CPU.ActiveCfg = Release|Any CPU
{436641C4-846C-42D0-8E8F-95F70E211D22}.Release|Any CPU.Build.0 = Release|Any CPU
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Release|Mixed Platforms.Build.0 = Release|x86
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Release|Win32.ActiveCfg = Release|x86
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Release|Win32.Build.0 = Release|x86
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Release|x64.ActiveCfg = Release|x64
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Release|x64.Build.0 = Release|x64
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Release|x86.ActiveCfg = Release|x86
- {436641C4-846C-42D0-8E8F-95F70E211D22}.Release|x86.Build.0 = Release|x86
{8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Debug|Win32.ActiveCfg = Debug|Any CPU
- {8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Debug|x64.ActiveCfg = Debug|Any CPU
- {8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Debug|x86.ActiveCfg = Debug|Any CPU
{8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Public|Any CPU.ActiveCfg = Release|Any CPU
{8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Public|Any CPU.Build.0 = Release|Any CPU
- {8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Public|Mixed Platforms.ActiveCfg = Release|Any CPU
- {8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Public|Mixed Platforms.Build.0 = Release|Any CPU
- {8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Public|Win32.ActiveCfg = Release|Any CPU
- {8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Public|x64.ActiveCfg = Release|Any CPU
- {8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Public|x86.ActiveCfg = Release|Any CPU
{8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Release|Any CPU.Build.0 = Release|Any CPU
- {8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Release|Win32.ActiveCfg = Release|Any CPU
- {8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Release|x64.ActiveCfg = Release|Any CPU
- {8299274E-05DD-49E0-ACB8-70C2BBAC69D1}.Release|x86.ActiveCfg = Release|Any CPU
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|Win32.ActiveCfg = Debug|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|Win32.Build.0 = Debug|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|x64.ActiveCfg = Debug|Any CPU
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|x86.ActiveCfg = Debug|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|x86.Build.0 = Debug|x86
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|Any CPU.ActiveCfg = Release|Any CPU
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|Any CPU.Build.0 = Release|Any CPU
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|Mixed Platforms.ActiveCfg = Release|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|Mixed Platforms.Build.0 = Release|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|Win32.ActiveCfg = Release|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|Win32.Build.0 = Release|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|x64.ActiveCfg = Release|Any CPU
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|x86.ActiveCfg = Release|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|x86.Build.0 = Release|x86
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|Any CPU.Build.0 = Release|Any CPU
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|Mixed Platforms.Build.0 = Release|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|Win32.ActiveCfg = Release|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|Win32.Build.0 = Release|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|x64.ActiveCfg = Release|Any CPU
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|x86.ActiveCfg = Release|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|x86.Build.0 = Release|x86
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|Win32.ActiveCfg = Debug|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|Win32.Build.0 = Debug|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|x64.ActiveCfg = Debug|Any CPU
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|x86.ActiveCfg = Debug|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|x86.Build.0 = Debug|x86
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|Any CPU.ActiveCfg = Release|Any CPU
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|Any CPU.Build.0 = Release|Any CPU
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|Mixed Platforms.ActiveCfg = Release|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|Mixed Platforms.Build.0 = Release|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|Win32.ActiveCfg = Release|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|Win32.Build.0 = Release|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|x64.ActiveCfg = Release|Any CPU
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|x86.ActiveCfg = Release|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|x86.Build.0 = Release|x86
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|Any CPU.Build.0 = Release|Any CPU
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|Mixed Platforms.Build.0 = Release|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|Win32.ActiveCfg = Release|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|Win32.Build.0 = Release|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|x64.ActiveCfg = Release|Any CPU
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|x86.ActiveCfg = Release|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|x86.Build.0 = Release|x86
{935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Debug|Win32.ActiveCfg = Debug|Any CPU
- {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Debug|x64.ActiveCfg = Debug|Any CPU
- {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Debug|x86.ActiveCfg = Debug|Any CPU
{935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Public|Any CPU.ActiveCfg = Release|Any CPU
{935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Public|Any CPU.Build.0 = Release|Any CPU
- {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Public|Mixed Platforms.ActiveCfg = Release|Any CPU
- {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Public|Mixed Platforms.Build.0 = Release|Any CPU
- {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Public|Win32.ActiveCfg = Release|Any CPU
- {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Public|x64.ActiveCfg = Release|Any CPU
- {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Public|x86.ActiveCfg = Release|Any CPU
{935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Release|Any CPU.Build.0 = Release|Any CPU
- {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Release|Win32.ActiveCfg = Release|Any CPU
- {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Release|x64.ActiveCfg = Release|Any CPU
- {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Modified: trunk/Examples/BallBuster.Net/Program.cs
===================================================================
--- trunk/Examples/BallBuster.Net/Program.cs 2014-08-08 01:31:59 UTC (rev 1449)
+++ trunk/Examples/BallBuster.Net/Program.cs 2014-08-08 01:53:54 UTC (rev 1450)
@@ -31,12 +31,17 @@
[STAThread]
static void Main(string[] args)
{
- new PassiveModel(args).Run(() =>
- {
- BBX bbx = new BBX();
+ var parameters = new PassiveModelParameters(args);
- bbx.Main(args);
- });
+ parameters.AssetLocations.Surfaces = "imgs";
+ var model = new PassiveModel(parameters);
+
+ model.Run(() =>
+ {
+ BBX bbx = new BBX();
+
+ bbx.Main(args);
+ });
}
}
}
\ No newline at end of file
Modified: trunk/Examples/BallBuster.Net/main.cs
===================================================================
--- trunk/Examples/BallBuster.Net/main.cs 2014-08-08 01:31:59 UTC (rev 1449)
+++ trunk/Examples/BallBuster.Net/main.cs 2014-08-08 01:53:54 UTC (rev 1450)
@@ -310,8 +310,6 @@
Mouse.Hide();
// load the images, initiation frame rate counter, and register signals
- Configuration.Images.AddPath("imgs");
-
splash();
img.load();
Modified: trunk/Tools/PackedSpriteCreator/frmSpriteCreator.cs
===================================================================
--- trunk/Tools/PackedSpriteCreator/frmSpriteCreator.cs 2014-08-08 01:31:59 UTC (rev 1449)
+++ trunk/Tools/PackedSpriteCreator/frmSpriteCreator.cs 2014-08-08 01:53:54 UTC (rev 1450)
@@ -1,4 +1,5 @@
using AgateLib.Platform.WindowsForms;
+using AgateLib.Utility;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -44,8 +45,7 @@
System.IO.Directory.SetCurrentDirectory(
System.IO.Path.GetDirectoryName(openDialog.FileName));
- Configuration.Images.Clear();
- Configuration.Images.AddPath(".");
+ AgateLib.IO.FileProvider.SurfaceAssets = new FileSystemProvider(".");
}
private void closeResourceFileToolStripMenuItem_Click(object sender, EventArgs e)
Modified: trunk/UnitTests/Serialization/Xle/XSTests.cs
===================================================================
--- trunk/UnitTests/Serialization/Xle/XSTests.cs 2014-08-08 01:31:59 UTC (rev 1449)
+++ trunk/UnitTests/Serialization/Xle/XSTests.cs 2014-08-08 01:53:54 UTC (rev 1450)
@@ -1,4 +1,5 @@
-using AgateLib.Geometry;
+using AgateLib.Drivers;
+using AgateLib.Geometry;
using AgateLib.Serialization.Xle;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
@@ -13,9 +14,16 @@
[TestClass]
public class XSTests
{
+ class Initializer : IObjectConstructor
+ {
+ public object CreateInstance(Type t)
+ {
+ return Activator.CreateInstance(t, true);
+ }
+ }
private static Serializable RoundTrip(Serializable obj)
{
- XleSerializer ser = new XleSerializer(obj.GetType());
+ XleSerializer ser = new XleSerializer(obj.GetType(), new Initializer());
var memory = new MemoryStream();
ser.Serialize(memory, obj);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-08 01:32:02
|
Revision: 1449
http://sourceforge.net/p/agate/code/1449
Author: kanato
Date: 2014-08-08 01:31:59 +0000 (Fri, 08 Aug 2014)
Log Message:
-----------
Add implementation for IObjectConstructor to WindowsForms Platform.
Modified Paths:
--------------
trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj
trunk/AgateLib.Platform.WindowsForms/Factories/PlatformFactory.cs
Added Paths:
-----------
trunk/AgateLib.Platform.WindowsForms/Factories/ActivatorConstructor.cs
Modified: trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj 2014-08-08 01:28:13 UTC (rev 1448)
+++ trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj 2014-08-08 01:31:59 UTC (rev 1449)
@@ -120,6 +120,7 @@
<Compile Include="DisplayImplementation\GL_GameWindow.cs" />
<Compile Include="DisplayImplementation\GL_Surface.cs" />
<Compile Include="DisplayImplementation\IPrimaryWindow.cs" />
+ <Compile Include="Factories\ActivatorConstructor.cs" />
<Compile Include="Factories\DisplayFactory.cs" />
<Compile Include="Factories\FormsFactory.cs" />
<Compile Include="Factories\PlatformFactory.cs" />
Added: trunk/AgateLib.Platform.WindowsForms/Factories/ActivatorConstructor.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/Factories/ActivatorConstructor.cs (rev 0)
+++ trunk/AgateLib.Platform.WindowsForms/Factories/ActivatorConstructor.cs 2014-08-08 01:31:59 UTC (rev 1449)
@@ -0,0 +1,16 @@
+using AgateLib.Drivers;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.Platform.WindowsForms.Factories
+{
+ class ActivatorConstructor : IObjectConstructor
+ {
+ public object CreateInstance(Type t)
+ {
+ return Activator.CreateInstance(t, true);
+ }
+ }
+}
Modified: trunk/AgateLib.Platform.WindowsForms/Factories/PlatformFactory.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/Factories/PlatformFactory.cs 2014-08-08 01:28:13 UTC (rev 1448)
+++ trunk/AgateLib.Platform.WindowsForms/Factories/PlatformFactory.cs 2014-08-08 01:31:59 UTC (rev 1449)
@@ -78,5 +78,11 @@
yield return ass;
}
}
+
+
+ public IObjectConstructor CreateDefaultSerializationConstructor()
+ {
+ return new ActivatorConstructor();
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-08 01:28:22
|
Revision: 1448
http://sourceforge.net/p/agate/code/1448
Author: kanato
Date: 2014-08-08 01:28:13 +0000 (Fri, 08 Aug 2014)
Log Message:
-----------
Refactor object construction during serialization into a platform specific object.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/Drivers/IPlatformFactory.cs
trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs
trunk/AgateLib/Serialization/Xle/XleSerializer.cs
Added Paths:
-----------
trunk/AgateLib/Drivers/IObjectConstructor.cs
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-07 06:15:12 UTC (rev 1447)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-08 01:28:13 UTC (rev 1448)
@@ -128,6 +128,7 @@
<Compile Include="Drivers\IAudioFactory.cs" />
<Compile Include="Drivers\IDisplayFactory.cs" />
<Compile Include="Drivers\IInputFactory.cs" />
+ <Compile Include="Drivers\IObjectConstructor.cs" />
<Compile Include="Drivers\IPlatformFactory.cs" />
<Compile Include="Drivers\TypeRegistry.cs" />
<Compile Include="ApplicationModels\ExitGameException.cs" />
Added: trunk/AgateLib/Drivers/IObjectConstructor.cs
===================================================================
--- trunk/AgateLib/Drivers/IObjectConstructor.cs (rev 0)
+++ trunk/AgateLib/Drivers/IObjectConstructor.cs 2014-08-08 01:28:13 UTC (rev 1448)
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.Drivers
+{
+ public interface IObjectConstructor
+ {
+ object CreateInstance(Type t);
+ }
+}
Modified: trunk/AgateLib/Drivers/IPlatformFactory.cs
===================================================================
--- trunk/AgateLib/Drivers/IPlatformFactory.cs 2014-08-07 06:15:12 UTC (rev 1447)
+++ trunk/AgateLib/Drivers/IPlatformFactory.cs 2014-08-08 01:28:13 UTC (rev 1448)
@@ -21,5 +21,7 @@
IEnumerable<System.Reflection.Assembly> GetSerializationSearchAssemblies(Type objectType);
IReadFileProvider CreateAssetFileProvider();
+
+ IObjectConstructor CreateDefaultSerializationConstructor();
}
}
Modified: trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs
===================================================================
--- trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs 2014-08-07 06:15:12 UTC (rev 1447)
+++ trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs 2014-08-08 01:28:13 UTC (rev 1448)
@@ -25,6 +25,7 @@
using System.Runtime.InteropServices;
using System.Globalization;
using System.Reflection;
+using AgateLib.Drivers;
namespace AgateLib.Serialization.Xle
{
@@ -38,12 +39,13 @@
Stack<XElement> nodes = new Stack<XElement>();
XleTypeSerializerCollection TypeSerializers;
- internal XleSerializationInfo(ITypeBinder Binder1, XleTypeSerializerCollection TypeSerializers, XDocument document = null)
+ internal XleSerializationInfo(ITypeBinder Binder1, XleTypeSerializerCollection TypeSerializers, IObjectConstructor constructor = null, XDocument document = null)
{
this.Binder = Binder1;
this.TypeSerializers = TypeSerializers;
this.doc = document;
+ this.ObjectConstructor = constructor;
if (this.doc == null)
this.doc = new XDocument();
@@ -54,6 +56,7 @@
get { return doc; }
}
+ IObjectConstructor ObjectConstructor { get; set; }
XElement CurrentNode
{
get
@@ -1592,7 +1595,7 @@
try
{
- obj = (IXleSerializable)Activator.CreateInstance(type);
+ obj = (IXleSerializable)ObjectConstructor.CreateInstance(type);
}
catch (Exception e)
{
Modified: trunk/AgateLib/Serialization/Xle/XleSerializer.cs
===================================================================
--- trunk/AgateLib/Serialization/Xle/XleSerializer.cs 2014-08-07 06:15:12 UTC (rev 1447)
+++ trunk/AgateLib/Serialization/Xle/XleSerializer.cs 2014-08-08 01:28:13 UTC (rev 1448)
@@ -24,6 +24,7 @@
using System.Linq;
using System.Xml.Linq;
using System.Xml;
+using AgateLib.Drivers;
namespace AgateLib.Serialization.Xle
{
@@ -35,6 +36,7 @@
Type objectType;
XleTypeSerializerCollection mTypeSerializers = new XleTypeSerializerCollection();
+ public IObjectConstructor ObjectConstructor { get; set; }
/// <summary>
/// An object which implements the AgateLib.Serialization.Xle.ITypeBinder interface.
/// This object is used to convert strings to System.Type objects. The default value
@@ -53,11 +55,16 @@
/// implement the IXleSerializable interface.
/// </summary>
/// <param name="objectType">The type of the object to serialize.</param>
- public XleSerializer(Type objectType)
+ public XleSerializer(Type objectType, IObjectConstructor objectConstructor = null)
{
if (objectType.GetInterfaces().Contains(typeof(IXleSerializable)) == false)
throw new ArgumentException("Object type is not IXleSerializable.");
+ if (objectConstructor == null)
+ objectConstructor = Core.Factory.PlatformFactory.CreateDefaultSerializationConstructor();
+
+ ObjectConstructor = objectConstructor;
+
var typeBinder = new TypeBinder();
typeBinder.AddAssembly(objectType.Assembly);
@@ -101,7 +108,7 @@
{
XDocument doc = XDocument.Load(XmlReader.Create(inStream));
- XleSerializationInfo info = new XleSerializationInfo(Binder, TypeSerializers, doc);
+ XleSerializationInfo info = new XleSerializationInfo(Binder, TypeSerializers, ObjectConstructor, doc);
return info.BeginDeserialize();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-07 06:15:22
|
Revision: 1447
http://sourceforge.net/p/agate/code/1447
Author: kanato
Date: 2014-08-07 06:15:12 +0000 (Thu, 07 Aug 2014)
Log Message:
-----------
Add Display.CoordinateSystem property.
Modified Paths:
--------------
trunk/AgateLib/DisplayLib/Display.cs
Modified: trunk/AgateLib/DisplayLib/Display.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Display.cs 2014-08-07 05:44:58 UTC (rev 1446)
+++ trunk/AgateLib/DisplayLib/Display.cs 2014-08-07 06:15:12 UTC (rev 1447)
@@ -189,6 +189,14 @@
}
/// <summary>
+ /// Gets the coordinate system for the current render target. Equivalent to Display.RenderTarget.CoordinateSystem.
+ /// </summary>
+ public static Rectangle CoordinateSystem
+ {
+ get { return RenderTarget.CoordinateSystem; }
+ }
+
+ /// <summary>
/// Gets the last render target used which was a DisplayWindow.
/// </summary>
public static DisplayWindow CurrentWindow
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-07 05:45:08
|
Revision: 1446
http://sourceforge.net/p/agate/code/1446
Author: kanato
Date: 2014-08-07 05:44:58 +0000 (Thu, 07 Aug 2014)
Log Message:
-----------
Some fixes to make Zodiac work.
Modified Paths:
--------------
trunk/AgateLib/ApplicationModels/AgateAppModel.cs
trunk/AgateLib/DisplayLib/FontSurface.cs
trunk/AgateLib/DisplayLib/Surface.cs
trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs
trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_Surface.cs
Modified: trunk/AgateLib/ApplicationModels/AgateAppModel.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/AgateAppModel.cs 2014-08-07 05:03:41 UTC (rev 1445)
+++ trunk/AgateLib/ApplicationModels/AgateAppModel.cs 2014-08-07 05:44:58 UTC (rev 1446)
@@ -233,7 +233,7 @@
return Display.Caps.NativeScreenResolution;
}
- protected DisplayWindow AutoCreatedWindow { get { return window; } }
+ public DisplayWindow AutoCreatedWindow { get { return window; } }
public ModelParameters Parameters { get; set; }
Modified: trunk/AgateLib/DisplayLib/FontSurface.cs
===================================================================
--- trunk/AgateLib/DisplayLib/FontSurface.cs 2014-08-07 05:03:41 UTC (rev 1445)
+++ trunk/AgateLib/DisplayLib/FontSurface.cs 2014-08-07 05:44:58 UTC (rev 1446)
@@ -121,7 +121,7 @@
if (res is BitmapFontResource)
{
- Surface surf = new Surface(resources.FullFileName(bmpFont.Image));
+ Surface surf = new Surface(resources.FullFileName(bmpFont.Image), AgateLib.IO.FileProvider.ResourceAssets);
mImpl = new BitmapFontImpl(surf, bmpFont.FontMetrics, resourceName);
}
Modified: trunk/AgateLib/DisplayLib/Surface.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Surface.cs 2014-08-07 05:03:41 UTC (rev 1445)
+++ trunk/AgateLib/DisplayLib/Surface.cs 2014-08-07 05:44:58 UTC (rev 1446)
@@ -83,15 +83,18 @@
/// Creates a surface object, from the specified image file.
/// </summary>
/// <param name="filename">Path and file name for the image file to load.</param>
- public Surface(string filename)
+ public Surface(string filename, IReadFileProvider fileprovider = null)
{
if (Display.Impl == null)
throw new AgateException("AgateLib's display system has not been initialized.");
if (string.IsNullOrEmpty(filename))
throw new ArgumentNullException("You must supply a file name.");
- mImpl = Display.Impl.CreateSurface(filename);
+ if (fileprovider == null)
+ fileprovider = AgateLib.IO.FileProvider.SurfaceAssets;
+ mImpl = Display.Impl.CreateSurface(fileprovider.ResolveFile(filename));
+
Display.DisposeDisplay += new Display.DisposeDisplayHandler(Dispose);
Display.PackAllSurfacesEvent += new EventHandler(Display_PackAllSurfacesEvent);
}
Modified: trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs
===================================================================
--- trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs 2014-08-07 05:03:41 UTC (rev 1445)
+++ trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs 2014-08-07 05:44:58 UTC (rev 1446)
@@ -24,6 +24,7 @@
using System.Xml.Linq;
using System.Runtime.InteropServices;
using System.Globalization;
+using System.Reflection;
namespace AgateLib.Serialization.Xle
{
@@ -1171,7 +1172,7 @@
{
XElement element = CurrentNode.Element(name);
- string value = element.Value;
+ string value = element.Value.Trim();
string[] vals = value.Split(new char[] { ',' },
StringSplitOptions.RemoveEmptyEntries);
Modified: trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_Surface.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_Surface.cs 2014-08-07 05:03:41 UTC (rev 1445)
+++ trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_Surface.cs 2014-08-07 05:44:58 UTC (rev 1446)
@@ -71,7 +71,7 @@
mDisplay = Display.Impl as DesktopGLDisplay;
mDrawBuffer = mDisplay.DrawBuffer;
- mFilename = AgateLib.IO.FileProvider.SurfaceAssets.ResolveFile(filename);
+ mFilename = filename;
Load();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-07 05:03:51
|
Revision: 1445
http://sourceforge.net/p/agate/code/1445
Author: kanato
Date: 2014-08-07 05:03:41 +0000 (Thu, 07 Aug 2014)
Log Message:
-----------
Added unit tests to expose bugs in coordinate system creators.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/ApplicationModels/AgateAppModel.cs
trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs
trunk/AgateLib/ApplicationModels/ICoordinateSystemCreator.cs
trunk/AgateLib/Geometry/Size.cs
trunk/AgateLib/Geometry/SizeF.cs
trunk/UnitTests/UnitTests.csproj
Added Paths:
-----------
trunk/AgateLib/ApplicationModels/CoordinateSystems/FixedAspectRatioCoordinates.cs
trunk/UnitTests/ApplicationModels/CoordinateSystemTest.cs
Removed Paths:
-------------
trunk/AgateLib/ApplicationModels/CoordinateSystems/FixedAreaCoordinates.cs
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-07 02:34:40 UTC (rev 1444)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-07 05:03:41 UTC (rev 1445)
@@ -86,7 +86,7 @@
<Compile Include="ApplicationModels\AgateAppModel.cs" />
<Compile Include="ApplicationModels\AssetLocations.cs" />
<Compile Include="ApplicationModels\CoordinateSystems\NaturalCoordinates.cs" />
- <Compile Include="ApplicationModels\CoordinateSystems\FixedAreaCoordinates.cs" />
+ <Compile Include="ApplicationModels\CoordinateSystems\FixedAspectRatioCoordinates.cs" />
<Compile Include="ApplicationModels\ICoordinateSystemCreator.cs" />
<Compile Include="ApplicationModels\ModelParameters.cs" />
<Compile Include="AudioLib\AudioCapsInfo.cs" />
Modified: trunk/AgateLib/ApplicationModels/AgateAppModel.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/AgateAppModel.cs 2014-08-07 02:34:40 UTC (rev 1444)
+++ trunk/AgateLib/ApplicationModels/AgateAppModel.cs 2014-08-07 05:03:41 UTC (rev 1445)
@@ -190,8 +190,7 @@
}
window.FrameBuffer.CoordinateSystem =
- Parameters.CoordinateSystem.DetermineCoordinateSystem(
- window.Size, window.Width / (double)window.Height);
+ Parameters.CoordinateSystem.DetermineCoordinateSystem(window.Size);
Display.RenderState.WaitForVerticalBlank = Parameters.VerticalSync;
Deleted: trunk/AgateLib/ApplicationModels/CoordinateSystems/FixedAreaCoordinates.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/CoordinateSystems/FixedAreaCoordinates.cs 2014-08-07 02:34:40 UTC (rev 1444)
+++ trunk/AgateLib/ApplicationModels/CoordinateSystems/FixedAreaCoordinates.cs 2014-08-07 05:03:41 UTC (rev 1445)
@@ -1,95 +0,0 @@
-using AgateLib.Geometry;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace AgateLib.ApplicationModels.CoordinateSystems
-{
- /// <summary>
- /// Constructs a coordinate system that gives a render area constrained to a
- /// specified range of sizes. This optionally (by default) preserves the aspect
- /// ratio of the display, providing extra space outside the requested render area
- /// which the application must fill in somehow.
- /// </summary>
- public class FixedAreaCoordinates : ICoordinateSystemCreator
- {
- public FixedAreaCoordinates()
- {
- PreserveDisplayAspectRatio = true;
- }
-
- public Rectangle DetermineCoordinateSystem(Size displayWindowSize, double aspectRatio)
- {
- var retval = GetUnshiftedRectangle(displayWindowSize, aspectRatio);
-
- retval.X += Origin.X;
- retval.Y += Origin.Y;
-
- return retval;
- }
-
- private Rectangle GetUnshiftedRectangle(Size displayWindowSize, double aspectRatio)
- {
- Size desiredArea = displayWindowSize;
-
- desiredArea = AdjustToRange(aspectRatio, desiredArea);
-
- if (PreserveDisplayAspectRatio)
- {
- double desiredAspectRatio = desiredArea.Width / (double)desiredArea.Height;
-
- if (desiredAspectRatio < aspectRatio)
- {
- int width = (int)(desiredArea.Height * aspectRatio);
- int extraWidth = width - desiredArea.Width;
-
- return Rectangle.FromLTRB(
- -extraWidth / 2,
- 0,
- desiredArea.Width + extraWidth / 2,
- desiredArea.Height);
- }
- else if (desiredAspectRatio > aspectRatio)
- {
- int height = (int)(desiredArea.Width / aspectRatio);
- int extraHeight = height - desiredArea.Height;
-
- return Rectangle.FromLTRB(
- 0,
- -extraHeight / 2,
- desiredArea.Width,
- desiredArea.Height + extraHeight / 2);
- }
- }
-
- return new Rectangle(0, 0, desiredArea.Width, desiredArea.Height);
- }
-
- private Size AdjustToRange(double aspectRatio, Size area)
- {
- if (MinWidth != null && (int)MinWidth > area.Height)
- area.Width = MinWidth.Value;
- if (MaxWidth != null && (int)MaxWidth < area.Height)
- area.Width = MaxWidth.Value;
- if (MinHeight != null && (int)MinHeight > area.Height)
- area.Height = MinHeight.Value;
- if (MaxHeight != null && (int)MaxHeight < area.Height)
- area.Height = MaxHeight.Value;
-
- return area;
- }
-
- public bool PreserveDisplayAspectRatio { get; set; }
- public int? MinHeight { get; set; }
- public int? MaxHeight { get; set; }
- public int? MinWidth { get; set; }
- public int? MaxWidth { get; set; }
-
- /// <summary>
- /// The value of the coordinate system in the upper left corner of
- /// the display area.
- /// </summary>
- public Point Origin { get; set; }
- }
-}
Copied: trunk/AgateLib/ApplicationModels/CoordinateSystems/FixedAspectRatioCoordinates.cs (from rev 1443, trunk/AgateLib/ApplicationModels/CoordinateSystems/FixedAreaCoordinates.cs)
===================================================================
--- trunk/AgateLib/ApplicationModels/CoordinateSystems/FixedAspectRatioCoordinates.cs (rev 0)
+++ trunk/AgateLib/ApplicationModels/CoordinateSystems/FixedAspectRatioCoordinates.cs 2014-08-07 05:03:41 UTC (rev 1445)
@@ -0,0 +1,111 @@
+using AgateLib.Geometry;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.ApplicationModels.CoordinateSystems
+{
+ /// <summary>
+ /// Constructs a coordinate system that gives a render area constrained to a
+ /// specified range of sizes. This optionally (by default) preserves the aspect
+ /// ratio of the display, providing extra space outside the requested render area
+ /// which the application must fill in somehow.
+ /// </summary>
+ public class FixedAspectRatioCoordinates : ICoordinateSystemCreator
+ {
+ public FixedAspectRatioCoordinates()
+ {
+ PreserveDisplayAspectRatio = true;
+ AspectRatio = 16 / (double)9;
+ }
+
+ public Rectangle DetermineCoordinateSystem(Size displayWindowSize)
+ {
+ var retval = GetUnshiftedRectangle(displayWindowSize);
+
+ retval.X += Origin.X;
+ retval.Y += Origin.Y;
+
+ return retval;
+ }
+
+ private Rectangle GetUnshiftedRectangle(Size displayWindowSize)
+ {
+ var desiredArea = AdjustToRange(displayWindowSize);
+
+ if (PreserveDisplayAspectRatio)
+ {
+ double desiredAspectRatio = desiredArea.AspectRatio;
+
+ if (AspectRatio < displayWindowSize.AspectRatio)
+ {
+ int logicalWindowWidth = (int)(desiredArea.Height / (double)displayWindowSize.Height * displayWindowSize.Width);
+ int extraWidth = logicalWindowWidth - desiredArea.Width;
+
+ return Rectangle.FromLTRB(
+ -extraWidth / 2,
+ 0,
+ desiredArea.Width + extraWidth / 2,
+ desiredArea.Height);
+ }
+ else if (AspectRatio > displayWindowSize.AspectRatio)
+ {
+ int logicalWindowHeight = (int)(desiredArea.Width / (double)displayWindowSize.Width * displayWindowSize.Height);
+ int extraHeight = logicalWindowHeight - desiredArea.Height;
+
+ return Rectangle.FromLTRB(
+ 0,
+ -extraHeight / 2,
+ desiredArea.Width,
+ desiredArea.Height + extraHeight / 2);
+ }
+ }
+
+ return new Rectangle(0, 0, desiredArea.Width, desiredArea.Height);
+ }
+
+ private Size AdjustToRange(Size area)
+ {
+ area.Width = (int)(AspectRatio * area.Height);
+
+ if (MinHeight != null && (int)MinHeight > area.Height)
+ {
+ area.Height = MinHeight.Value;
+ area.Width = (int)(area.Height * AspectRatio);
+ }
+ if (MaxHeight != null && (int)MaxHeight < area.Height)
+ {
+ area.Height = MaxHeight.Value;
+ area.Width = (int)(area.Height * AspectRatio);
+ }
+
+ if (MinWidth != null && (int)MinWidth > area.Width)
+ {
+ area.Width = MinWidth.Value;
+ area.Height = (int)(area.Width / AspectRatio);
+ }
+ if (MaxWidth != null && (int)MaxWidth < area.Width)
+ {
+ area.Width = MaxWidth.Value;
+ area.Height = (int)(area.Width / AspectRatio);
+ }
+
+ return area;
+ }
+
+ public bool PreserveDisplayAspectRatio { get; set; }
+ public int? MinHeight { get; set; }
+ public int? MaxHeight { get; set; }
+ public int? MinWidth { get; set; }
+ public int? MaxWidth { get; set; }
+
+ public double AspectRatio { get; set; }
+
+ /// <summary>
+ /// The value of the coordinate system in the upper left corner of
+ /// the display area.
+ /// </summary>
+ public Point Origin { get; set; }
+ }
+}
Modified: trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs 2014-08-07 02:34:40 UTC (rev 1444)
+++ trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs 2014-08-07 05:03:41 UTC (rev 1445)
@@ -12,7 +12,7 @@
/// </summary>
public class NaturalCoordinates : ICoordinateSystemCreator
{
- public Rectangle DetermineCoordinateSystem(Size displayWindowSize, double aspectRatio)
+ public Rectangle DetermineCoordinateSystem(Size displayWindowSize)
{
return new Rectangle(0, 0, displayWindowSize.Width, displayWindowSize.Height);
}
Modified: trunk/AgateLib/ApplicationModels/ICoordinateSystemCreator.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/ICoordinateSystemCreator.cs 2014-08-07 02:34:40 UTC (rev 1444)
+++ trunk/AgateLib/ApplicationModels/ICoordinateSystemCreator.cs 2014-08-07 05:03:41 UTC (rev 1445)
@@ -8,6 +8,15 @@
{
public interface ICoordinateSystemCreator
{
- Rectangle DetermineCoordinateSystem(Size displayWindowSize, double aspectRatio);
+ Rectangle DetermineCoordinateSystem(Size displayWindowSize);
}
+
+ public static class CoordinateSystemCreatorExtensions
+ {
+ public static Rectangle DetermineCoordinateSystem(
+ this ICoordinateSystemCreator csc, Size displayWindowSize)
+ {
+ return csc.DetermineCoordinateSystem(displayWindowSize);
+ }
+ }
}
Modified: trunk/AgateLib/Geometry/Size.cs
===================================================================
--- trunk/AgateLib/Geometry/Size.cs 2014-08-07 02:34:40 UTC (rev 1444)
+++ trunk/AgateLib/Geometry/Size.cs 2014-08-07 05:03:41 UTC (rev 1445)
@@ -76,6 +76,13 @@
get { return width == 0 && height == 0; }
}
+ /// <summary>
+ /// Gets the aspect ratio (width / height) of this Size object.
+ /// </summary>
+ public double AspectRatio
+ {
+ get { return width / (double)height; }
+ }
#region --- Operator Overloads ---
Modified: trunk/AgateLib/Geometry/SizeF.cs
===================================================================
--- trunk/AgateLib/Geometry/SizeF.cs 2014-08-07 02:34:40 UTC (rev 1444)
+++ trunk/AgateLib/Geometry/SizeF.cs 2014-08-07 05:03:41 UTC (rev 1445)
@@ -69,6 +69,14 @@
}
/// <summary>
+ /// Gets the aspect ratio (width / height) of this Size object.
+ /// </summary>
+ public double AspectRatio
+ {
+ get { return width / height; }
+ }
+
+ /// <summary>
/// True if width and height are zero.
/// </summary>
Added: trunk/UnitTests/ApplicationModels/CoordinateSystemTest.cs
===================================================================
--- trunk/UnitTests/ApplicationModels/CoordinateSystemTest.cs (rev 0)
+++ trunk/UnitTests/ApplicationModels/CoordinateSystemTest.cs 2014-08-07 05:03:41 UTC (rev 1445)
@@ -0,0 +1,88 @@
+using AgateLib.ApplicationModels;
+using AgateLib.ApplicationModels.CoordinateSystems;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using AgateLib.Geometry;
+
+namespace AgateLib.UnitTests.ApplicationModels
+{
+ [TestClass]
+ public class CoordinateSystemTest
+ {
+ [TestMethod]
+ public void FixedAspectRatioNoPreserveTest()
+ {
+ var fac = new FixedAspectRatioCoordinates();
+ fac.PreserveDisplayAspectRatio = false;
+
+ Assert.AreEqual(new Rectangle(0, 0, 1280, 720),
+ fac.DetermineCoordinateSystem(new Size(1280, 720)));
+
+ Assert.AreEqual(new Rectangle(0, 0, 1422, 800),
+ fac.DetermineCoordinateSystem(new Size(1500, 800)));
+
+ fac.Origin = new Point(-21, -52);
+
+ Assert.AreEqual(new Rectangle(-21, -52, 1280, 720),
+ fac.DetermineCoordinateSystem(new Size(1280, 720)));
+
+ fac.MinWidth = 1280;
+ fac.MaxWidth = 1920;
+
+ fac.MinHeight = 720;
+ fac.MaxHeight = 1080;
+
+ Assert.AreEqual(new Rectangle(-21, -52, 1280, 720),
+ fac.DetermineCoordinateSystem(new Size(1000, 500)));
+
+ Assert.AreEqual(new Rectangle(-21, -52, 1280, 720),
+ fac.DetermineCoordinateSystem(new Size(1280, 720)));
+
+ Assert.AreEqual(new Rectangle(-21, -52, 1422, 800),
+ fac.DetermineCoordinateSystem(new Size(1500, 800)));
+
+ Assert.AreEqual(new Rectangle(-21, -52, 1920, 1080),
+ fac.DetermineCoordinateSystem(new Size(2000, 2000)));
+
+ Assert.AreEqual(new Rectangle(-21, -52, 1920, 1080),
+ fac.DetermineCoordinateSystem(new Size(1920, 1080)));
+ }
+
+ [TestMethod]
+ public void FixedAspectRatioPreserveTest()
+ {
+ var fac = new FixedAspectRatioCoordinates();
+
+ Assert.AreEqual(new Rectangle(0, 0, 1280, 720),
+ fac.DetermineCoordinateSystem(new Size(1280, 720)));
+
+ fac.MinWidth = 1280;
+ fac.MaxWidth = 1920;
+
+ fac.MinHeight = 720;
+ fac.MaxHeight = 1080;
+
+ // the width will be fit to 500 pixels, so 1280 logical points = 500 pixels wide.
+ // We want to preserve aspect ratio, so since the window is 500 pixels tall the
+ // total height in logical units will also be 1280.
+ // But the range from 0 to 720 will be centered
+ // so the vertical axis will split the difference above and below that.
+ Assert.AreEqual(Rectangle.FromLTRB(0, -280, 1280, 1000),
+ fac.DetermineCoordinateSystem(new Size(500, 500)));
+
+
+ // the height will be fit to 500 pixels, so 720 logical points = 500 pixels high.
+ // We want to preserve aspect ratio, so since the window is 1500 pixels wide the
+ // total width in logical units will be 720*3 = 2160.
+ // But the range from 0 to 1280 will be centered
+ // so the horizontal axis will split the difference of 880 to the left and right
+ // of that.
+ Assert.AreEqual(Rectangle.FromLTRB(-440, 0, 1720, 720),
+ fac.DetermineCoordinateSystem(new Size(1500, 500)));
+ }
+ }
+}
Modified: trunk/UnitTests/UnitTests.csproj
===================================================================
--- trunk/UnitTests/UnitTests.csproj 2014-08-07 02:34:40 UTC (rev 1444)
+++ trunk/UnitTests/UnitTests.csproj 2014-08-07 05:03:41 UTC (rev 1445)
@@ -88,6 +88,7 @@
</Choose>
<ItemGroup>
<Compile Include="ApplicationModels\ArgumentProcessing.cs" />
+ <Compile Include="ApplicationModels\CoordinateSystemTest.cs" />
<Compile Include="Core\ConsoleTests.cs" />
<Compile Include="Display\DisplayTests.cs" />
<Compile Include="Extensions\ListExtensions.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-07 02:34:45
|
Revision: 1444
http://sourceforge.net/p/agate/code/1444
Author: kanato
Date: 2014-08-07 02:34:40 +0000 (Thu, 07 Aug 2014)
Log Message:
-----------
Update solution file.
Modified Paths:
--------------
trunk/AgateLib-Windows.sln
Modified: trunk/AgateLib-Windows.sln
===================================================================
--- trunk/AgateLib-Windows.sln 2014-08-07 02:28:43 UTC (rev 1443)
+++ trunk/AgateLib-Windows.sln 2014-08-07 02:34:40 UTC (rev 1444)
@@ -28,47 +28,145 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgateLib.Platform.WindowsForms", "AgateLib.Platform.WindowsForms\AgateLib.Platform.WindowsForms.csproj", "{4B12561E-D37B-48A1-B6DB-218E94906C22}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgateLib.AgateSDL", "AgateLib.AgateSDL\AgateLib.AgateSDL.csproj", "{935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
Public|Any CPU = Public|Any CPU
+ Public|x64 = Public|x64
+ Public|x86 = Public|x86
Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|x64.ActiveCfg = Debug|x64
+ {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|x64.Build.0 = Debug|x64
+ {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|x86.ActiveCfg = Debug|x86
+ {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|x86.Build.0 = Debug|x86
{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|Any CPU.ActiveCfg = Release|x86
+ {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|x64.ActiveCfg = Release|x64
+ {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|x64.Build.0 = Release|x64
+ {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|x86.ActiveCfg = Debug|x86
+ {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|x86.Build.0 = Debug|x86
{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|x64.ActiveCfg = Release|x64
+ {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|x64.Build.0 = Release|x64
+ {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|x86.ActiveCfg = Release|x86
+ {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|x86.Build.0 = Release|x86
{9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x64.ActiveCfg = Debug|x64
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x64.Build.0 = Debug|x64
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x86.ActiveCfg = Debug|x86
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x86.Build.0 = Debug|x86
{9490B719-829E-43A7-A5FE-8001F8A81759}.Public|Any CPU.ActiveCfg = Release|x86
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|x64.ActiveCfg = Release|x64
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|x64.Build.0 = Release|x64
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|x86.ActiveCfg = Debug|x86
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|x86.Build.0 = Debug|x86
{9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x64.ActiveCfg = Release|x64
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x64.Build.0 = Release|x64
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x86.ActiveCfg = Release|x86
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x86.Build.0 = Release|x86
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|x64.ActiveCfg = Debug|x64
+ {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|x64.Build.0 = Debug|x64
+ {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|x86.ActiveCfg = Debug|x86
+ {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|x86.Build.0 = Debug|x86
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|Any CPU.ActiveCfg = Release|Any CPU
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|Any CPU.Build.0 = Release|Any CPU
+ {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|x64.ActiveCfg = Release|x64
+ {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|x64.Build.0 = Release|x64
+ {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|x86.ActiveCfg = Release|x86
+ {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|x86.Build.0 = Release|x86
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|x64.ActiveCfg = Release|x64
+ {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|x64.Build.0 = Release|x64
+ {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|x86.ActiveCfg = Release|x86
+ {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|x86.Build.0 = Release|x86
{796D3B53-8828-475C-B5FF-5CA09F423C8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{796D3B53-8828-475C-B5FF-5CA09F423C8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Debug|x64.ActiveCfg = Debug|x64
+ {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Debug|x64.Build.0 = Debug|x64
+ {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Debug|x86.ActiveCfg = Debug|x86
+ {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Debug|x86.Build.0 = Debug|x86
{796D3B53-8828-475C-B5FF-5CA09F423C8A}.Public|Any CPU.ActiveCfg = Release|Any CPU
{796D3B53-8828-475C-B5FF-5CA09F423C8A}.Public|Any CPU.Build.0 = Release|Any CPU
+ {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Public|x64.ActiveCfg = Release|x64
+ {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Public|x64.Build.0 = Release|x64
+ {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Public|x86.ActiveCfg = Release|x86
+ {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Public|x86.Build.0 = Release|x86
{796D3B53-8828-475C-B5FF-5CA09F423C8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{796D3B53-8828-475C-B5FF-5CA09F423C8A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Release|x64.ActiveCfg = Release|x64
+ {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Release|x64.Build.0 = Release|x64
+ {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Release|x86.ActiveCfg = Release|x86
+ {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Release|x86.Build.0 = Release|x86
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|x64.ActiveCfg = Debug|x64
+ {94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|x64.Build.0 = Debug|x64
+ {94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|x86.ActiveCfg = Debug|x86
+ {94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|x86.Build.0 = Debug|x86
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|Any CPU.ActiveCfg = Release|Any CPU
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|Any CPU.Build.0 = Release|Any CPU
+ {94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|x64.ActiveCfg = Release|x64
+ {94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|x64.Build.0 = Release|x64
+ {94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|x86.ActiveCfg = Release|x86
+ {94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|x86.Build.0 = Release|x86
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|Any CPU.Build.0 = Release|Any CPU
+ {94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|x64.ActiveCfg = Release|x64
+ {94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|x64.Build.0 = Release|x64
+ {94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|x86.ActiveCfg = Release|x86
+ {94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|x86.Build.0 = Release|x86
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|x64.ActiveCfg = Debug|x64
+ {4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|x64.Build.0 = Debug|x64
+ {4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|x86.ActiveCfg = Debug|x86
+ {4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|x86.Build.0 = Debug|x86
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|Any CPU.ActiveCfg = Release|Any CPU
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|Any CPU.Build.0 = Release|Any CPU
+ {4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|x64.ActiveCfg = Release|x64
+ {4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|x64.Build.0 = Release|x64
+ {4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|x86.ActiveCfg = Release|x86
+ {4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|x86.Build.0 = Release|x86
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|x64.ActiveCfg = Release|x64
+ {4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|x64.Build.0 = Release|x64
+ {4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|x86.ActiveCfg = Release|x86
+ {4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|x86.Build.0 = Release|x86
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Debug|x64.ActiveCfg = Debug|x64
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Debug|x64.Build.0 = Debug|x64
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Debug|x86.ActiveCfg = Debug|x86
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Debug|x86.Build.0 = Debug|x86
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Public|Any CPU.ActiveCfg = Release|Any CPU
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Public|Any CPU.Build.0 = Release|Any CPU
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Public|x64.ActiveCfg = Release|x64
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Public|x64.Build.0 = Release|x64
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Public|x86.ActiveCfg = Release|x86
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Public|x86.Build.0 = Release|x86
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Release|x64.ActiveCfg = Release|x64
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Release|x64.Build.0 = Release|x64
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Release|x86.ActiveCfg = Release|x86
+ {935D67A0-931E-46DE-9F6A-2D6DBC99AFF3}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-07 02:28:46
|
Revision: 1443
http://sourceforge.net/p/agate/code/1443
Author: kanato
Date: 2014-08-07 02:28:43 +0000 (Thu, 07 Aug 2014)
Log Message:
-----------
Minor fix to SDL_Input.
Modified Paths:
--------------
trunk/AgateLib.AgateSDL/Input/SDL_Input.cs
Modified: trunk/AgateLib.AgateSDL/Input/SDL_Input.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Input/SDL_Input.cs 2014-08-07 02:23:04 UTC (rev 1442)
+++ trunk/AgateLib.AgateSDL/Input/SDL_Input.cs 2014-08-07 02:28:43 UTC (rev 1443)
@@ -98,6 +98,9 @@
{
string retval = sdl.SDL_JoystickName(joystickIndex);
+ if (retval == null)
+ return "";
+
return retval;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-07 02:23:12
|
Revision: 1442
http://sourceforge.net/p/agate/code/1442
Author: kanato
Date: 2014-08-07 02:23:04 +0000 (Thu, 07 Aug 2014)
Log Message:
-----------
Fix unit tests.
Modified Paths:
--------------
trunk/AgateLib/Diagnostics/AgateConsole.cs
trunk/AgateLib-Windows.sln
trunk/UnitTests/Core/ConsoleTests.cs
trunk/UnitTests/Fakes/FakeDisplayDriver.cs
Modified: trunk/AgateLib/Diagnostics/AgateConsole.cs
===================================================================
--- trunk/AgateLib/Diagnostics/AgateConsole.cs 2014-08-07 02:15:39 UTC (rev 1441)
+++ trunk/AgateLib/Diagnostics/AgateConsole.cs 2014-08-07 02:23:04 UTC (rev 1442)
@@ -249,14 +249,14 @@
{
if (args.InputEventType == InputEventType.KeyDown)
{
- ProcessKeyPress(args.KeyCode, args.KeyString);
+ ProcessKeyDown(args.KeyCode, args.KeyString);
}
args.Handled = true;
}
}
- private void ProcessKeyPress(KeyCode keyCode, string keystring)
+ public void ProcessKeyDown(KeyCode keyCode, string keystring)
{
if (keyCode == KeyCode.Up)
{
@@ -308,11 +308,6 @@
}
}
- private void ProcessKeyDown(KeyCode key)
- {
-
- }
-
/// <summary>
/// Sends the key string to the console as if the user typed it.
/// </summary>
@@ -333,7 +328,7 @@
while (index > -1)
{
mCurrentLine += keys.Substring(0, index);
- ProcessKeyPress(KeyCode.Enter, "\n");
+ ProcessKeyDown(KeyCode.Enter, "\n");
keys = keys.Substring(index + 1);
index = keys.IndexOf('\n');
Modified: trunk/AgateLib-Windows.sln
===================================================================
--- trunk/AgateLib-Windows.sln 2014-08-07 02:15:39 UTC (rev 1441)
+++ trunk/AgateLib-Windows.sln 2014-08-07 02:23:04 UTC (rev 1442)
@@ -31,83 +31,44 @@
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
- Debug|x86 = Debug|x86
Public|Any CPU = Public|Any CPU
- Public|x86 = Public|x86
Release|Any CPU = Release|Any CPU
- Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|x86.ActiveCfg = Debug|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|x86.Build.0 = Debug|x86
{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|Any CPU.ActiveCfg = Release|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|x86.ActiveCfg = Release|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|x86.Build.0 = Release|x86
{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Any CPU.Build.0 = Release|Any CPU
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|x86.ActiveCfg = Release|x86
- {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|x86.Build.0 = Release|x86
{9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x86.ActiveCfg = Debug|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x86.Build.0 = Debug|x86
{9490B719-829E-43A7-A5FE-8001F8A81759}.Public|Any CPU.ActiveCfg = Release|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|x86.ActiveCfg = Release|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|x86.Build.0 = Release|x86
{9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.Build.0 = Release|Any CPU
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x86.ActiveCfg = Release|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x86.Build.0 = Release|x86
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|x86.ActiveCfg = Debug|x86
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Debug|x86.Build.0 = Debug|x86
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|Any CPU.ActiveCfg = Release|Any CPU
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|Any CPU.Build.0 = Release|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|x86.ActiveCfg = Release|x86
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Public|x86.Build.0 = Release|x86
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|Any CPU.Build.0 = Release|Any CPU
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|x86.ActiveCfg = Release|x86
- {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|x86.Build.0 = Release|x86
{796D3B53-8828-475C-B5FF-5CA09F423C8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{796D3B53-8828-475C-B5FF-5CA09F423C8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Debug|x86.ActiveCfg = Debug|x86
- {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Debug|x86.Build.0 = Debug|x86
{796D3B53-8828-475C-B5FF-5CA09F423C8A}.Public|Any CPU.ActiveCfg = Release|Any CPU
{796D3B53-8828-475C-B5FF-5CA09F423C8A}.Public|Any CPU.Build.0 = Release|Any CPU
- {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Public|x86.ActiveCfg = Release|x86
- {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Public|x86.Build.0 = Release|x86
{796D3B53-8828-475C-B5FF-5CA09F423C8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{796D3B53-8828-475C-B5FF-5CA09F423C8A}.Release|Any CPU.Build.0 = Release|Any CPU
- {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Release|x86.ActiveCfg = Release|x86
- {796D3B53-8828-475C-B5FF-5CA09F423C8A}.Release|x86.Build.0 = Release|x86
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|x86.ActiveCfg = Debug|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Debug|x86.Build.0 = Debug|x86
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|Any CPU.ActiveCfg = Release|Any CPU
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|Any CPU.Build.0 = Release|Any CPU
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|x86.ActiveCfg = Release|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Public|x86.Build.0 = Release|x86
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|Any CPU.Build.0 = Release|Any CPU
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|x86.ActiveCfg = Release|x86
- {94734E5A-0344-43E8-BB30-E32E3F57F611}.Release|x86.Build.0 = Release|x86
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|x86.ActiveCfg = Debug|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Debug|x86.Build.0 = Debug|x86
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|Any CPU.ActiveCfg = Release|Any CPU
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|Any CPU.Build.0 = Release|Any CPU
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|x86.ActiveCfg = Release|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Public|x86.Build.0 = Release|x86
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|Any CPU.Build.0 = Release|Any CPU
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|x86.ActiveCfg = Release|x86
- {4B12561E-D37B-48A1-B6DB-218E94906C22}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Modified: trunk/UnitTests/Core/ConsoleTests.cs
===================================================================
--- trunk/UnitTests/Core/ConsoleTests.cs 2014-08-07 02:15:39 UTC (rev 1441)
+++ trunk/UnitTests/Core/ConsoleTests.cs 2014-08-07 02:23:04 UTC (rev 1442)
@@ -29,16 +29,16 @@
public void HelpCommand()
{
console.ProcessKeys("help");
- console.ProcessKeyDown(new InputEventArgs(KeyCode.Enter, new KeyModifiers()));
+ console.ProcessKeyDown(KeyCode.Enter, "\n");
Assert.AreEqual(0, describeCallCount);
console.ProcessKeys("help help");
- console.ProcessKeyDown(new InputEventArgs(KeyCode.Enter, new KeyModifiers()));
+ console.ProcessKeyDown(KeyCode.Enter, "\n");
Assert.AreEqual(1, describeCallCount);
console.ProcessKeys("help unknown_command");
- console.ProcessKeyDown(new InputEventArgs(KeyCode.Enter, new KeyModifiers()));
+ console.ProcessKeyDown(KeyCode.Enter, "\n");
Assert.AreEqual(1, describeCallCount);
}
@@ -46,7 +46,7 @@
public void KeystrokeEditing()
{
console.ProcessKeys("help");
- console.ProcessKeyDown(new InputEventArgs(KeyCode.BackSpace, new KeyModifiers()));
+ console.ProcessKeyDown(KeyCode.BackSpace, "");
Assert.AreEqual("hel", console.CurrentLine);
@@ -58,17 +58,17 @@
public void HistoryBrowsing()
{
console.ProcessKeys("help\nhelp help\nhelp unknown_command\n");
- console.ProcessKeyDown(new InputEventArgs(KeyCode.Up, new KeyModifiers()));
+ console.ProcessKeyDown(KeyCode.Up, "");
console.ProcessKeys("x");
Assert.AreEqual("help unknown_commandx", console.CurrentLine);
console.ProcessKeys("\n");
Assert.AreEqual("", console.CurrentLine);
- console.ProcessKeyDown(new InputEventArgs(KeyCode.Up, new KeyModifiers()));
- console.ProcessKeyDown(new InputEventArgs(KeyCode.Up, new KeyModifiers()));
- console.ProcessKeyDown(new InputEventArgs(KeyCode.Up, new KeyModifiers()));
- console.ProcessKeyDown(new InputEventArgs(KeyCode.BackSpace, new KeyModifiers()));
+ console.ProcessKeyDown(KeyCode.Up, "");
+ console.ProcessKeyDown(KeyCode.Up, "");
+ console.ProcessKeyDown(KeyCode.Up, "");
+ console.ProcessKeyDown(KeyCode.BackSpace, "");
Assert.AreEqual("help hel", console.CurrentLine);
}
Modified: trunk/UnitTests/Fakes/FakeDisplayDriver.cs
===================================================================
--- trunk/UnitTests/Fakes/FakeDisplayDriver.cs 2014-08-07 02:15:39 UTC (rev 1441)
+++ trunk/UnitTests/Fakes/FakeDisplayDriver.cs 2014-08-07 02:23:04 UTC (rev 1442)
@@ -1,4 +1,5 @@
-using AgateLib.DisplayLib.ImplementationBase;
+using AgateLib.DisplayLib.BitmapFont;
+using AgateLib.DisplayLib.ImplementationBase;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -67,7 +68,7 @@
throw new NotImplementedException();
}
- public override FontSurfaceImpl CreateFont(AgateLib.BitmapFont.BitmapFontOptions bitmapOptions)
+ public override FontSurfaceImpl CreateFont(BitmapFontOptions bitmapOptions)
{
throw new NotImplementedException();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-07 02:15:44
|
Revision: 1441
http://sourceforge.net/p/agate/code/1441
Author: kanato
Date: 2014-08-07 02:15:39 +0000 (Thu, 07 Aug 2014)
Log Message:
-----------
Remove obsolete projects.
Removed Paths:
-------------
trunk/Drivers/AgateLib.WinForms/
trunk/Drivers/AgateOTK/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-07 02:09:29
|
Revision: 1440
http://sourceforge.net/p/agate/code/1440
Author: kanato
Date: 2014-08-07 02:09:20 +0000 (Thu, 07 Aug 2014)
Log Message:
-----------
Make tests build.
Modified Paths:
--------------
trunk/Tests/AudioTests/AudioPlayer/frmAudioPlayer.cs
trunk/Tests/CoreTests/Resources.cs
trunk/Tests/DisplayTests/SpriteTester/frmSpriteTester.cs
trunk/Tests/Fonts/BitmapFonts.cs
trunk/Tests/Fonts/Kerning.cs
trunk/Tests/Fonts/TextLayout.cs
trunk/Tests/Tests.csproj
trunk/Tools/FontCreator/CreateFont.cs
trunk/Tools/FontCreator/EditGlyphs.cs
trunk/Tools/FontCreator/FontCreator.cs
trunk/Tools/FontCreator/FontCreatorProgram.cs
trunk/Tools/FontCreator/frmFontCreator.cs
Added Paths:
-----------
trunk/Tests/TestLauncher.cs
Removed Paths:
-------------
trunk/Tests/Launcher.cs
Modified: trunk/Tests/AudioTests/AudioPlayer/frmAudioPlayer.cs
===================================================================
--- trunk/Tests/AudioTests/AudioPlayer/frmAudioPlayer.cs 2014-08-07 01:57:11 UTC (rev 1439)
+++ trunk/Tests/AudioTests/AudioPlayer/frmAudioPlayer.cs 2014-08-07 02:09:20 UTC (rev 1440)
@@ -10,6 +10,7 @@
using System.Text;
using System.Windows.Forms;
using AgateLib;
+using AgateLib.ApplicationModels;
namespace Tests.AudioTester
{
@@ -170,6 +171,9 @@
private void timer1_Tick(object sender, EventArgs e)
{
+ if (AgateAppModel.Instance == null)
+ return;
+
AgateLib.Core.KeepAlive();
}
Modified: trunk/Tests/CoreTests/Resources.cs
===================================================================
--- trunk/Tests/CoreTests/Resources.cs 2014-08-07 01:57:11 UTC (rev 1439)
+++ trunk/Tests/CoreTests/Resources.cs 2014-08-07 02:09:20 UTC (rev 1440)
@@ -15,10 +15,8 @@
{
public void Main(string[] args)
{
- new PassiveModel(args).Run( () =>
+ new PassiveModel(TestLauncher.PassiveParameters).Run( () =>
{
- Configuration.Resources.AddPath("Data");
-
AgateResourceCollection resources = new AgateResourceCollection("TestResourceFile.xml");
DisplayWindow wind = new DisplayWindow(resources, "main_window");
Modified: trunk/Tests/DisplayTests/SpriteTester/frmSpriteTester.cs
===================================================================
--- trunk/Tests/DisplayTests/SpriteTester/frmSpriteTester.cs 2014-08-07 01:57:11 UTC (rev 1439)
+++ trunk/Tests/DisplayTests/SpriteTester/frmSpriteTester.cs 2014-08-07 02:09:20 UTC (rev 1440)
@@ -14,6 +14,7 @@
using AgateLib.Resources;
using AgateLib.Sprites;
using AgateLib.Platform.WindowsForms;
+using AgateLib.Utility;
namespace Tests.SpriteTester
{
@@ -247,8 +248,8 @@
// since loading the sprite from the file failed, try it as a resource file.
AgateResourceCollection resources = new AgateResourceCollection(filename);
- Configuration.Images.Clear();
- Configuration.Images.AddPath(System.IO.Path.GetDirectoryName(filename));
+ AgateLib.IO.FileProvider.SurfaceAssets = new FileSystemProvider
+ (System.IO.Path.GetDirectoryName(filename));
if (resources.Sprites.ToArray().Length == 1)
{
Modified: trunk/Tests/Fonts/BitmapFonts.cs
===================================================================
--- trunk/Tests/Fonts/BitmapFonts.cs 2014-08-07 01:57:11 UTC (rev 1439)
+++ trunk/Tests/Fonts/BitmapFonts.cs 2014-08-07 02:09:20 UTC (rev 1440)
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using AgateLib;
-using AgateLib.BitmapFont;
+using AgateLib.DisplayLib.BitmapFont;
using AgateLib.DisplayLib;
using AgateLib.Geometry;
using AgateLib.InputLib;
Modified: trunk/Tests/Fonts/Kerning.cs
===================================================================
--- trunk/Tests/Fonts/Kerning.cs 2014-08-07 01:57:11 UTC (rev 1439)
+++ trunk/Tests/Fonts/Kerning.cs 2014-08-07 02:09:20 UTC (rev 1440)
@@ -3,7 +3,7 @@
using System.Linq;
using System.Text;
using AgateLib;
-using AgateLib.BitmapFont;
+using AgateLib.DisplayLib.BitmapFont;
using AgateLib.Geometry;
using AgateLib.DisplayLib;
using AgateLib.InputLib;
@@ -69,7 +69,7 @@
private FontSurface ConstructUnkernedFont(FontSurface font)
{
- var bmp = font.Impl as AgateLib.BitmapFont.BitmapFontImpl;
+ var bmp = font.Impl as AgateLib.DisplayLib.BitmapFont.BitmapFontImpl;
FontMetrics metrics = bmp.FontMetrics.Clone();
@@ -84,7 +84,7 @@
private static string ConstructKerningText(DisplayWindow wind, FontSurface font)
{
- var bmp = font.Impl as AgateLib.BitmapFont.BitmapFontImpl;
+ var bmp = font.Impl as AgateLib.DisplayLib.BitmapFont.BitmapFontImpl;
FontMetrics metrics = bmp.FontMetrics.Clone();
Modified: trunk/Tests/Fonts/TextLayout.cs
===================================================================
--- trunk/Tests/Fonts/TextLayout.cs 2014-08-07 01:57:11 UTC (rev 1439)
+++ trunk/Tests/Fonts/TextLayout.cs 2014-08-07 02:09:20 UTC (rev 1440)
@@ -16,10 +16,6 @@
[STAThread]
static void Main(string[] args)
{
- // These two lines are used by AgateLib tests to locate
- // driver plugins and images.
- Configuration.Images.AddPath("Images");
-
new TextLayout().Run(args);
}
Deleted: trunk/Tests/Launcher.cs
===================================================================
--- trunk/Tests/Launcher.cs 2014-08-07 01:57:11 UTC (rev 1439)
+++ trunk/Tests/Launcher.cs 2014-08-07 02:09:20 UTC (rev 1440)
@@ -1,29 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using AgateLib;
-using AgateLib.Platform.WindowsForms.ApplicationModels;
-using AgateLib.Platform.WindowsForms;
-
-namespace Tests
-{
- class Launcher
- {
- [STAThread]
- public static void Main(string[] args)
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
-
- Configuration.Initialize();
- Configuration.Images.AddPath("Data");
- Configuration.Sounds.AddPath("Data");
-
- Application.Run(new frmLauncher());
-
- Core.Settings.SaveSettings();
- }
- }
-}
Copied: trunk/Tests/TestLauncher.cs (from rev 1439, trunk/Tests/Launcher.cs)
===================================================================
--- trunk/Tests/TestLauncher.cs (rev 0)
+++ trunk/Tests/TestLauncher.cs 2014-08-07 02:09:20 UTC (rev 1440)
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using AgateLib;
+using AgateLib.Platform.WindowsForms.ApplicationModels;
+using AgateLib.Platform.WindowsForms;
+
+namespace Tests
+{
+ class TestLauncher
+ {
+ [STAThread]
+ public static void Main(string[] args)
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+
+ PassiveParameters = new PassiveModelParameters(args);
+ PassiveParameters.AssetPath = "Data";
+
+ new PassiveModel(PassiveParameters).Run(() =>
+ {
+ Application.Run(new frmLauncher());
+ });
+
+ Core.Settings.SaveSettings();
+ }
+
+ public static PassiveModelParameters PassiveParameters { get; private set; }
+ }
+}
Modified: trunk/Tests/Tests.csproj
===================================================================
--- trunk/Tests/Tests.csproj 2014-08-07 01:57:11 UTC (rev 1439)
+++ trunk/Tests/Tests.csproj 2014-08-07 02:09:20 UTC (rev 1440)
@@ -19,7 +19,7 @@
<AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>Tests</RootNamespace>
- <StartupObject>Tests.Launcher</StartupObject>
+ <StartupObject>Tests.TestLauncher</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
@@ -168,7 +168,7 @@
<Compile Include="IAgateTest.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Launcher.cs">
+ <Compile Include="TestLauncher.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="AudioTests\AudioPlayer\AudioPlayer.cs">
Modified: trunk/Tools/FontCreator/CreateFont.cs
===================================================================
--- trunk/Tools/FontCreator/CreateFont.cs 2014-08-07 01:57:11 UTC (rev 1439)
+++ trunk/Tools/FontCreator/CreateFont.cs 2014-08-07 02:09:20 UTC (rev 1440)
@@ -6,7 +6,7 @@
using System.Windows.Forms;
using System.IO;
using AgateLib;
-using AgateLib.BitmapFont;
+using AgateLib.DisplayLib.BitmapFont;
namespace FontCreator
{
Modified: trunk/Tools/FontCreator/EditGlyphs.cs
===================================================================
--- trunk/Tools/FontCreator/EditGlyphs.cs 2014-08-07 01:57:11 UTC (rev 1439)
+++ trunk/Tools/FontCreator/EditGlyphs.cs 2014-08-07 02:09:20 UTC (rev 1440)
@@ -6,7 +6,7 @@
using System.Text;
using System.Windows.Forms;
using System.Xml;
-using AgateLib.BitmapFont;
+using AgateLib.DisplayLib.BitmapFont;
using AgateLib.Platform.WindowsForms.WinForms;
using AgateLib.Resources;
Modified: trunk/Tools/FontCreator/FontCreator.cs
===================================================================
--- trunk/Tools/FontCreator/FontCreator.cs 2014-08-07 01:57:11 UTC (rev 1439)
+++ trunk/Tools/FontCreator/FontCreator.cs 2014-08-07 02:09:20 UTC (rev 1440)
@@ -6,7 +6,7 @@
using AgateLib;
using AgateLib.DisplayLib;
using AgateLib.DisplayLib.ImplementationBase;
-using AgateLib.BitmapFont;
+using AgateLib.DisplayLib.BitmapFont;
using AgateLib.Geometry;
using AgateLib.Resources;
using AgateLib.Platform.WindowsForms;
Modified: trunk/Tools/FontCreator/FontCreatorProgram.cs
===================================================================
--- trunk/Tools/FontCreator/FontCreatorProgram.cs 2014-08-07 01:57:11 UTC (rev 1439)
+++ trunk/Tools/FontCreator/FontCreatorProgram.cs 2014-08-07 02:09:20 UTC (rev 1440)
@@ -20,12 +20,14 @@
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
- new PassiveModel(args).Run(() =>
+ var parameters = new PassiveModelParameters(args);
+
+ parameters.AssetLocations.Surfaces = "images";
+
+ new PassiveModel(parameters).Run(() =>
{
Directory.CreateDirectory("./images");
- Configuration.Images.AddPath("./images");
-
frmFontCreator frm = new frmFontCreator();
frm.Show();
Modified: trunk/Tools/FontCreator/frmFontCreator.cs
===================================================================
--- trunk/Tools/FontCreator/frmFontCreator.cs 2014-08-07 01:57:11 UTC (rev 1439)
+++ trunk/Tools/FontCreator/frmFontCreator.cs 2014-08-07 02:09:20 UTC (rev 1440)
@@ -6,7 +6,7 @@
using System.IO;
using System.Text;
using System.Windows.Forms;
-using AgateLib.BitmapFont;
+using AgateLib.DisplayLib.BitmapFont;
using AgateLib.Platform.WindowsForms;
namespace FontCreator
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-07 01:57:26
|
Revision: 1439
http://sourceforge.net/p/agate/code/1439
Author: kanato
Date: 2014-08-07 01:57:11 +0000 (Thu, 07 Aug 2014)
Log Message:
-----------
Several fixes to audio and input.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/ApplicationModels/AgateAppModel.cs
trunk/AgateLib/ApplicationModels/ModelParameters.cs
trunk/AgateLib/Diagnostics/AgateConsole.cs
trunk/AgateLib/DisplayLib/BitmapFont/BitmapFontImpl.cs
trunk/AgateLib/DisplayLib/BitmapFont/BitmapFontOptions.cs
trunk/AgateLib/DisplayLib/BitmapFont/FontMetrics.cs
trunk/AgateLib/DisplayLib/BitmapFont/GlyphMetrics.cs
trunk/AgateLib/DisplayLib/Display.cs
trunk/AgateLib/DisplayLib/FontState.cs
trunk/AgateLib/DisplayLib/FontSurface.cs
trunk/AgateLib/DisplayLib/FrameBuffer.cs
trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs
trunk/AgateLib/Drivers/IAgateFactory.cs
trunk/AgateLib/IO/FileProvider.cs
trunk/AgateLib/IO/SubDirectoryProvider.cs
trunk/AgateLib/InputLib/AgateInputEventArgs.cs
trunk/AgateLib/InputLib/Input.cs
trunk/AgateLib/InputLib/Legacy/Keyboard.cs
trunk/AgateLib/Resources/BitmapFontResource.cs
trunk/AgateLib.AgateSDL/Sdl2/ISDL.cs
trunk/AgateLib.AgateSDL/Sdl2/SDL32.cs
trunk/AgateLib.AgateSDL/Sdl2/SDL64.cs
trunk/AgateLib.AgateSDL/Sdl2/SdlFactory.cs
trunk/AgateLib.GL/ContextFB.cs
trunk/AgateLib.GL/GL3/FrameBuffer.cs
trunk/AgateLib.GL/GL_FrameBuffer.cs
trunk/AgateLib.GL/Legacy/FrameBufferExt.cs
trunk/AgateLib.GL/Legacy/FrameBufferReadPixels.cs
trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj
trunk/AgateLib.Platform.WindowsForms/ApplicationModels/FormsModelBase.cs
trunk/AgateLib.Platform.WindowsForms/ApplicationModels/PassiveModelParameters.cs
trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SerialModel.cs
trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SerialModelParameters.cs
trunk/AgateLib.Platform.WindowsForms/Configuration.cs
trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/DesktopGLDisplay.cs
trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_DisplayControl.cs
trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_GameWindow.cs
trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_Surface.cs
trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/IPrimaryWindow.cs
trunk/AgateLib.Platform.WindowsForms/Factories/FormsFactory.cs
trunk/AgateLib.Platform.WindowsForms/WinForms/BitmapFontUtil.cs
trunk/AgateLib.Platform.WindowsForms/WinForms/BitmapFontUtilRenderers.cs
Added Paths:
-----------
trunk/AgateLib/ApplicationModels/AssetLocations.cs
trunk/AgateLib/ApplicationModels/CoordinateSystems/
trunk/AgateLib/ApplicationModels/CoordinateSystems/FixedAreaCoordinates.cs
trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs
trunk/AgateLib/ApplicationModels/ICoordinateSystemCreator.cs
trunk/AgateLib/DisplayLib/BitmapFont/
trunk/AgateLib.Platform.WindowsForms/ApplicationModels/FormsModelParameters.cs
trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/ContextInfo.cs
Removed Paths:
-------------
trunk/AgateLib/BitmapFont/
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-07 01:57:11 UTC (rev 1439)
@@ -84,6 +84,10 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="ApplicationModels\AgateAppModel.cs" />
+ <Compile Include="ApplicationModels\AssetLocations.cs" />
+ <Compile Include="ApplicationModels\CoordinateSystems\NaturalCoordinates.cs" />
+ <Compile Include="ApplicationModels\CoordinateSystems\FixedAreaCoordinates.cs" />
+ <Compile Include="ApplicationModels\ICoordinateSystemCreator.cs" />
<Compile Include="ApplicationModels\ModelParameters.cs" />
<Compile Include="AudioLib\AudioCapsInfo.cs" />
<Compile Include="AudioLib\ImplementationBase\MusicImpl.cs" />
@@ -189,16 +193,16 @@
<Compile Include="AudioLib\SoundBufferSession.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="BitmapFont\BitmapFontImpl.cs">
+ <Compile Include="DisplayLib\BitmapFont\BitmapFontImpl.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="BitmapFont\BitmapFontOptions.cs">
+ <Compile Include="DisplayLib\BitmapFont\BitmapFontOptions.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="BitmapFont\FontMetrics.cs">
+ <Compile Include="DisplayLib\BitmapFont\FontMetrics.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="BitmapFont\GlyphMetrics.cs">
+ <Compile Include="DisplayLib\BitmapFont\GlyphMetrics.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="DisplayLib\CreateWindowParams.cs">
Modified: trunk/AgateLib/ApplicationModels/AgateAppModel.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/AgateAppModel.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/ApplicationModels/AgateAppModel.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -149,19 +149,12 @@
}
}
- private Size ParseSize(string parm)
- {
- Size.FromString(parm);
- throw new NotImplementedException();
- }
-
protected int RunModel(Func<int> entryPoint)
{
try
{
Initialize();
AutoCreateDisplayWindow();
- //Display.RenderState.WaitForVerticalBlank = Parameters.VerticalSync;
int retval = BeginModel(entryPoint);
@@ -195,8 +188,20 @@
Parameters.ApplicationName,
GetWindowedScreenSize());
}
+
+ window.FrameBuffer.CoordinateSystem =
+ Parameters.CoordinateSystem.DetermineCoordinateSystem(
+ window.Size, window.Width / (double)window.Height);
+
+ Display.RenderState.WaitForVerticalBlank = Parameters.VerticalSync;
+
+ window.Closing += window_Closing;
}
+ protected virtual void window_Closing(object sender, ref bool cancel)
+ {
+ }
+
private Size GetWindowedScreenSize()
{
if (Parameters.DisplayWindowSize.IsEmpty)
@@ -235,7 +240,7 @@
public virtual void KeepAlive()
{
- Input.DispatchEvents();
+ Input.DispatchQueuedEvents();
}
}
}
Added: trunk/AgateLib/ApplicationModels/AssetLocations.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/AssetLocations.cs (rev 0)
+++ trunk/AgateLib/ApplicationModels/AssetLocations.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.ApplicationModels
+{
+ public class AssetLocations
+ {
+ public AssetLocations()
+ {
+ }
+
+ public string Surfaces { get; set; }
+ public string Sound { get; set; }
+ public string Music { get; set; }
+
+ public string Resources { get; set; }
+ }
+}
Added: trunk/AgateLib/ApplicationModels/CoordinateSystems/FixedAreaCoordinates.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/CoordinateSystems/FixedAreaCoordinates.cs (rev 0)
+++ trunk/AgateLib/ApplicationModels/CoordinateSystems/FixedAreaCoordinates.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -0,0 +1,95 @@
+using AgateLib.Geometry;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.ApplicationModels.CoordinateSystems
+{
+ /// <summary>
+ /// Constructs a coordinate system that gives a render area constrained to a
+ /// specified range of sizes. This optionally (by default) preserves the aspect
+ /// ratio of the display, providing extra space outside the requested render area
+ /// which the application must fill in somehow.
+ /// </summary>
+ public class FixedAreaCoordinates : ICoordinateSystemCreator
+ {
+ public FixedAreaCoordinates()
+ {
+ PreserveDisplayAspectRatio = true;
+ }
+
+ public Rectangle DetermineCoordinateSystem(Size displayWindowSize, double aspectRatio)
+ {
+ var retval = GetUnshiftedRectangle(displayWindowSize, aspectRatio);
+
+ retval.X += Origin.X;
+ retval.Y += Origin.Y;
+
+ return retval;
+ }
+
+ private Rectangle GetUnshiftedRectangle(Size displayWindowSize, double aspectRatio)
+ {
+ Size desiredArea = displayWindowSize;
+
+ desiredArea = AdjustToRange(aspectRatio, desiredArea);
+
+ if (PreserveDisplayAspectRatio)
+ {
+ double desiredAspectRatio = desiredArea.Width / (double)desiredArea.Height;
+
+ if (desiredAspectRatio < aspectRatio)
+ {
+ int width = (int)(desiredArea.Height * aspectRatio);
+ int extraWidth = width - desiredArea.Width;
+
+ return Rectangle.FromLTRB(
+ -extraWidth / 2,
+ 0,
+ desiredArea.Width + extraWidth / 2,
+ desiredArea.Height);
+ }
+ else if (desiredAspectRatio > aspectRatio)
+ {
+ int height = (int)(desiredArea.Width / aspectRatio);
+ int extraHeight = height - desiredArea.Height;
+
+ return Rectangle.FromLTRB(
+ 0,
+ -extraHeight / 2,
+ desiredArea.Width,
+ desiredArea.Height + extraHeight / 2);
+ }
+ }
+
+ return new Rectangle(0, 0, desiredArea.Width, desiredArea.Height);
+ }
+
+ private Size AdjustToRange(double aspectRatio, Size area)
+ {
+ if (MinWidth != null && (int)MinWidth > area.Height)
+ area.Width = MinWidth.Value;
+ if (MaxWidth != null && (int)MaxWidth < area.Height)
+ area.Width = MaxWidth.Value;
+ if (MinHeight != null && (int)MinHeight > area.Height)
+ area.Height = MinHeight.Value;
+ if (MaxHeight != null && (int)MaxHeight < area.Height)
+ area.Height = MaxHeight.Value;
+
+ return area;
+ }
+
+ public bool PreserveDisplayAspectRatio { get; set; }
+ public int? MinHeight { get; set; }
+ public int? MaxHeight { get; set; }
+ public int? MinWidth { get; set; }
+ public int? MaxWidth { get; set; }
+
+ /// <summary>
+ /// The value of the coordinate system in the upper left corner of
+ /// the display area.
+ /// </summary>
+ public Point Origin { get; set; }
+ }
+}
Added: trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs (rev 0)
+++ trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -0,0 +1,20 @@
+using AgateLib.Geometry;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.ApplicationModels.CoordinateSystems
+{
+ /// <summary>
+ /// Constructs a coordinate system that provides a one-to-one mapping to the pixels
+ /// in the display window.
+ /// </summary>
+ public class NaturalCoordinates : ICoordinateSystemCreator
+ {
+ public Rectangle DetermineCoordinateSystem(Size displayWindowSize, double aspectRatio)
+ {
+ return new Rectangle(0, 0, displayWindowSize.Width, displayWindowSize.Height);
+ }
+ }
+}
Added: trunk/AgateLib/ApplicationModels/ICoordinateSystemCreator.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/ICoordinateSystemCreator.cs (rev 0)
+++ trunk/AgateLib/ApplicationModels/ICoordinateSystemCreator.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -0,0 +1,13 @@
+using AgateLib.Geometry;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.ApplicationModels
+{
+ public interface ICoordinateSystemCreator
+ {
+ Rectangle DetermineCoordinateSystem(Size displayWindowSize, double aspectRatio);
+ }
+}
Modified: trunk/AgateLib/ApplicationModels/ModelParameters.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/ModelParameters.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/ApplicationModels/ModelParameters.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -1,4 +1,5 @@
-using AgateLib.Geometry;
+using AgateLib.ApplicationModels.CoordinateSystems;
+using AgateLib.Geometry;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -9,10 +10,11 @@
{
public class ModelParameters
{
- string[] args;
-
public ModelParameters()
{
+ AssetLocations = new AssetLocations();
+ CoordinateSystem = new NaturalCoordinates();
+
AutoCreateDisplayWindow = true;
CreateFullScreenWindow = true;
ApplicationName = "AgateLib Application";
@@ -32,5 +34,14 @@
public bool VerticalSync { get; set; }
public string[] Arguments { get; set; }
+
+ public AssetLocations AssetLocations { get; set; }
+
+ /// <summary>
+ /// Gets or sets the object which determines how to set the coordinate
+ /// system for the automatically created display window. If
+ /// AutoCreateDisplayWindow is false, this property is not used.
+ /// </summary>
+ public ICoordinateSystemCreator CoordinateSystem { get; set; }
}
}
Modified: trunk/AgateLib/Diagnostics/AgateConsole.cs
===================================================================
--- trunk/AgateLib/Diagnostics/AgateConsole.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/Diagnostics/AgateConsole.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -13,7 +13,7 @@
namespace AgateLib.Diagnostics
{
- public abstract class AgateConsole : IDisposable
+ public abstract class AgateConsole : IDisposable, IInputHandler
{
#region --- Static Members ---
@@ -54,6 +54,8 @@
return;
sInstance = Core.Factory.PlatformFactory.CreateConsole();
+ InputLib.Input.InputHandlers.Add(sInstance);
+
PrivateInitialize();
}
@@ -76,28 +78,11 @@
if (sInstance == null) return;
if (Font == null)
- Font = new FontSurface("Arial", 10);
+ Font = Core.Factory.DefaultFont;
sInstance.DrawImpl();
}
- internal static void Keyboard_KeyDown(InputEventArgs e)
- {
- if (e.KeyCode == VisibleToggleKey)
- {
- sInstance.mVisible = !sInstance.mVisible;
- sInstance.mHeight = Display.RenderTarget.Height * 5 / 12;
- }
- else if (sInstance.mVisible)
- {
- sInstance.ProcessKeyDown(e);
- }
- }
- internal static void Keyboard_KeyUp(InputEventArgs eventArgs)
- {
- }
-
-
/// <summary>
/// Writes a line to the output part of the console window.
/// </summary>
@@ -238,55 +223,56 @@
protected abstract void WriteLineImpl(string text);
protected abstract void WriteImpl(string text);
- /// <summary>
- /// Sends the key string to the console as if the user typed it.
- /// </summary>
- /// <param name="keys"></param>
- /// <remarks>
- /// Control characters are treated specially. A line feed (\n) is
- /// treated as the end of line. \r is ignored.
- /// \t is converted to a space.
- /// </remarks>
- public void ProcessKeys(string keys)
+ #region --- Input Handling ---
+
+
+ void IInputHandler.ProcessEvent(AgateInputEventArgs args)
{
- keys = keys.Replace('\t', ' ');
- keys = keys.Replace("\r", "");
+ ProcessEvent(args);
+ }
+ bool IInputHandler.ForwardUnhandledEvents
+ {
+ get { return true; }
+ }
- ModifyHistoryLine();
+ private void ProcessEvent(AgateInputEventArgs args)
+ {
+ if (args.InputEventType == InputEventType.KeyDown &&
+ VisibleToggleKey == args.KeyCode)
+ {
+ IsVisible = !IsVisible;
+ args.Handled = true;
- int index = keys.IndexOf('\n');
- while (index > -1)
+ sInstance.mHeight = Display.RenderTarget.CoordinateSystem.Height * 5 / 12;
+ }
+ else if (IsVisible)
{
- mCurrentLine += keys.Substring(0, index);
- ProcessKeyDown(new InputEventArgs(KeyCode.Enter, new KeyModifiers()));
+ if (args.InputEventType == InputEventType.KeyDown)
+ {
+ ProcessKeyPress(args.KeyCode, args.KeyString);
+ }
- keys = keys.Substring(index + 1);
- index = keys.IndexOf('\n');
+ args.Handled = true;
}
+ }
- mCurrentLine += keys;
- }
- /// <summary>
- /// Processes an input key.
- /// </summary>
- /// <param name="e"></param>
- public void ProcessKeyDown(InputEventArgs e)
+ private void ProcessKeyPress(KeyCode keyCode, string keystring)
{
- if (e.KeyCode == KeyCode.Up)
+ if (keyCode == KeyCode.Up)
{
mHistoryIndex++;
if (mHistoryIndex > mInputHistory.Count)
mHistoryIndex = mInputHistory.Count;
}
- else if (e.KeyCode == KeyCode.Down)
+ else if (keyCode == KeyCode.Down)
{
mHistoryIndex--;
if (mHistoryIndex < 0)
mHistoryIndex = 0;
}
- else if (e.KeyCode == KeyCode.Enter || e.KeyCode == KeyCode.Return)
+ else if (keyCode == KeyCode.Enter || keyCode == KeyCode.Return)
{
ModifyHistoryLine();
@@ -301,17 +287,17 @@
mInputHistory.Add(input);
ExecuteCommand();
- }
- else if (string.IsNullOrEmpty(e.KeyString) == false)
+ }
+ else if (string.IsNullOrEmpty(keystring) == false)
{
ModifyHistoryLine();
- if (e.KeyCode == KeyCode.Tab)
+ if (keyCode == KeyCode.Tab)
mCurrentLine += " ";
else
- mCurrentLine += e.KeyString;
- }
- else if (e.KeyCode == KeyCode.BackSpace)
+ mCurrentLine += keystring;
+ }
+ else if (keyCode == KeyCode.BackSpace)
{
ModifyHistoryLine();
@@ -322,6 +308,42 @@
}
}
+ private void ProcessKeyDown(KeyCode key)
+ {
+
+ }
+
+ /// <summary>
+ /// Sends the key string to the console as if the user typed it.
+ /// </summary>
+ /// <param name="keys"></param>
+ /// <remarks>
+ /// Control characters are treated specially. A line feed (\n) is
+ /// treated as the end of line. \r is ignored.
+ /// \t is converted to a space.
+ /// </remarks>
+ public void ProcessKeys(string keys)
+ {
+ keys = keys.Replace('\t', ' ');
+ keys = keys.Replace("\r", "");
+
+ ModifyHistoryLine();
+
+ int index = keys.IndexOf('\n');
+ while (index > -1)
+ {
+ mCurrentLine += keys.Substring(0, index);
+ ProcessKeyPress(KeyCode.Enter, "\n");
+
+ keys = keys.Substring(index + 1);
+ index = keys.IndexOf('\n');
+ }
+
+ mCurrentLine += keys;
+ }
+
+ #endregion
+
private void ExecuteCommand()
{
if (string.IsNullOrEmpty(mCurrentLine))
@@ -369,5 +391,6 @@
protected abstract long CurrentTime { get; }
+
}
}
Modified: trunk/AgateLib/DisplayLib/BitmapFont/BitmapFontImpl.cs
===================================================================
--- trunk/AgateLib/BitmapFont/BitmapFontImpl.cs 2014-08-03 17:32:32 UTC (rev 1434)
+++ trunk/AgateLib/DisplayLib/BitmapFont/BitmapFontImpl.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -28,7 +28,7 @@
using AgateLib.DisplayLib.Cache;
using AgateLib.IO;
-namespace AgateLib.BitmapFont
+namespace AgateLib.DisplayLib.BitmapFont
{
/// <summary>
/// Provides a basic implementation for the use of non-system fonts provided
@@ -339,6 +339,7 @@
RefreshCache(state, cache);
+ mSurface.InterpolationHint = state.InterpolationHint;
mSurface.Color = state.Color;
mSurface.DrawRects(cache.SrcRects, cache.DestRects, 0, cache.DisplayTextLength);
}
Modified: trunk/AgateLib/DisplayLib/BitmapFont/BitmapFontOptions.cs
===================================================================
--- trunk/AgateLib/BitmapFont/BitmapFontOptions.cs 2014-08-03 17:32:32 UTC (rev 1434)
+++ trunk/AgateLib/DisplayLib/BitmapFont/BitmapFontOptions.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -22,7 +22,7 @@
using AgateLib.DisplayLib;
using AgateLib.Geometry;
-namespace AgateLib.BitmapFont
+namespace AgateLib.DisplayLib.BitmapFont
{
/// <summary>
/// Class which indicates how a bitmap font should be generated
Modified: trunk/AgateLib/DisplayLib/BitmapFont/FontMetrics.cs
===================================================================
--- trunk/AgateLib/BitmapFont/FontMetrics.cs 2014-08-03 17:32:32 UTC (rev 1434)
+++ trunk/AgateLib/DisplayLib/BitmapFont/FontMetrics.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -22,7 +22,7 @@
using System.Xml;
using AgateLib.Geometry;
-namespace AgateLib.BitmapFont
+namespace AgateLib.DisplayLib.BitmapFont
{
/// <summary>
/// FontMetrics is a class which describes everything needed to render a font
Modified: trunk/AgateLib/DisplayLib/BitmapFont/GlyphMetrics.cs
===================================================================
--- trunk/AgateLib/BitmapFont/GlyphMetrics.cs 2014-08-03 17:32:32 UTC (rev 1434)
+++ trunk/AgateLib/DisplayLib/BitmapFont/GlyphMetrics.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -22,7 +22,7 @@
using AgateLib.Geometry;
-namespace AgateLib.BitmapFont
+namespace AgateLib.DisplayLib.BitmapFont
{
/// <summary>
/// GlyphMetrics defines the metrics for a particular glyph in a font, including
Modified: trunk/AgateLib/DisplayLib/Display.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Display.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/DisplayLib/Display.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -80,12 +80,7 @@
get { return sImpl; }
}
/// <summary>
- /// Initializes the display by instantiating the driver with the given
- /// DisplayTypeID. The display driver must be registered with the Registrar
- /// class.
- ///
- /// It is recommended that you instantiate a SetupDisplay object from within
- /// a using block, to ensure that the Display is disposed of properly.
+ /// Initializes the display with the passed object implementing DisplayImpl.
/// </summary>
/// <param name="displayType"></param>
public static void Initialize(DisplayImpl impl)
@@ -284,7 +279,8 @@
sImpl.BeginFrame();
- AgateBuiltInShaders.Basic2DShader.CoordinateSystem = new Rectangle(Point.Empty, RenderTarget.Size);
+ AgateBuiltInShaders.Basic2DShader.CoordinateSystem =
+ RenderTarget.CoordinateSystem;
AgateBuiltInShaders.Basic2DShader.Activate();
sCurrentClipRect = new Rectangle(Point.Empty, RenderTarget.Size);
Modified: trunk/AgateLib/DisplayLib/FontState.cs
===================================================================
--- trunk/AgateLib/DisplayLib/FontState.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/DisplayLib/FontState.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -162,6 +162,10 @@
set { mCache = value; }
}
+ /// <summary>
+ /// Gets or sets a value indicating how the font should be scaled when drawn.
+ /// </summary>
+ public InterpolationMode InterpolationHint { get; set; }
#region --- ICloneable Members ---
/// <summary>
@@ -178,6 +182,7 @@
retval.mScaleHeight = mScaleHeight;
retval.mLocation = mLocation;
retval.mText = mText;
+ retval.InterpolationHint = InterpolationHint;
if (mCache != null)
{
Modified: trunk/AgateLib/DisplayLib/FontSurface.cs
===================================================================
--- trunk/AgateLib/DisplayLib/FontSurface.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/DisplayLib/FontSurface.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -21,7 +21,7 @@
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
-using AgateLib.BitmapFont;
+using AgateLib.DisplayLib.BitmapFont;
using AgateLib.DisplayLib.ImplementationBase;
using AgateLib.Geometry;
using AgateLib.Resources;
@@ -304,37 +304,15 @@
x = ScaleWidth;
y = ScaleHeight;
}
-
+
/// <summary>
- /// Measures the display width of the specified string.
+ /// Gets or sets a value indicating how the font should be scaled when drawn.
/// </summary>
- /// <param name="text"></param>
- /// <returns></returns>
- [Obsolete("Use MeasureString instead.", true)]
- public int StringDisplayWidth(string text)
+ public InterpolationMode InterpolationHint
{
- return MeasureString(text).Width;
+ get { return mState.InterpolationHint; }
+ set { mState.InterpolationHint = value; }
}
- /// <summary>
- /// Measures the display height of the specified string.
- /// </summary>
- /// <param name="text"></param>
- /// <returns></returns>
- [Obsolete("Use MeasureString instead.", true)]
- public int StringDisplayHeight(string text)
- {
- return MeasureString(text).Height;
- }
- /// <summary>
- /// Measures the display size of the specified string.
- /// </summary>
- /// <param name="text"></param>
- /// <returns></returns>
- [Obsolete("Use MeasureString instead.", true)]
- public Size StringDisplaySize(string text)
- {
- return mImpl.MeasureString(mState, text);
- }
/// <summary>
/// Measures the display size of the specified string.
Modified: trunk/AgateLib/DisplayLib/FrameBuffer.cs
===================================================================
--- trunk/AgateLib/DisplayLib/FrameBuffer.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/DisplayLib/FrameBuffer.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -45,6 +45,7 @@
public FrameBuffer(Size size)
{
impl = Display.Impl.CreateFrameBuffer(size);
+ CoordinateSystem = new Rectangle(Point.Empty, size);
}
/// <summary>
/// Constructs a frame buffer to be used as a render target. FrameBuffers constructed
@@ -149,5 +150,13 @@
return mRenderTarget;
}
}
+
+ /// <summary>
+ /// Gets or sets the default coordinate system that is used for
+ /// this framebuffer. When Display.BeginFrame is called with this
+ /// framebuffer as a render target, this coordinate system is automatically
+ /// loaded.
+ /// </summary>
+ public Rectangle CoordinateSystem { get; set; }
}
}
Modified: trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -20,8 +20,8 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
-using AgateLib.BitmapFont;
using AgateLib.DisplayLib;
+using AgateLib.DisplayLib.BitmapFont;
using AgateLib.DisplayLib.Shaders;
using AgateLib.DisplayLib.Shaders.Implementation;
using AgateLib.Drivers;
Modified: trunk/AgateLib/Drivers/IAgateFactory.cs
===================================================================
--- trunk/AgateLib/Drivers/IAgateFactory.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/Drivers/IAgateFactory.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -12,5 +12,7 @@
IAudioFactory AudioFactory { get; }
IInputFactory InputFactory { get; }
IPlatformFactory PlatformFactory { get; }
+
+ DisplayLib.FontSurface DefaultFont { get; set; }
}
}
Modified: trunk/AgateLib/IO/FileProvider.cs
===================================================================
--- trunk/AgateLib/IO/FileProvider.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/IO/FileProvider.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -1,4 +1,5 @@
-using AgateLib.Drivers;
+using AgateLib.ApplicationModels;
+using AgateLib.Drivers;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -8,42 +9,35 @@
{
public static class FileProvider
{
- static IReadFileProvider mSurfaceAssets;
- static IReadFileProvider mResourceAssets;
- static IReadFileProvider mMusicAssets;
- static IReadFileProvider mSoundAssets;
-
internal static void Initialize(IPlatformFactory platformFactory)
{
Assets = platformFactory.CreateAssetFileProvider();
}
- public static IReadFileProvider Assets { get; private set; }
- public static IReadFileProvider SurfaceAssets
+ public static void Initialize(IReadFileProvider assetProvider, AssetLocations assetLocations)
{
- get { return mSurfaceAssets ?? Assets; }
- set { mSurfaceAssets = value; }
+ Assets = assetProvider;
+
+ SurfaceAssets = NewProviderFromSubdirectory(Assets, assetLocations.Surfaces);
+ SoundAssets = NewProviderFromSubdirectory(Assets, assetLocations.Sound);
+ MusicAssets = NewProviderFromSubdirectory(Assets, assetLocations.Music);
+ ResourceAssets = NewProviderFromSubdirectory(Assets, assetLocations.Resources);
}
- public static IReadFileProvider ResourceAssets
+
+ public static IReadFileProvider Assets { get; set; }
+
+ public static IReadFileProvider SurfaceAssets { get; set; }
+ public static IReadFileProvider ResourceAssets { get; set; }
+ public static IReadFileProvider MusicAssets { get; set; }
+ public static IReadFileProvider SoundAssets { get; set; }
+
+ public static IReadWriteFileProvider UserFiles { get; set; }
+
+ static IReadFileProvider NewProviderFromSubdirectory(IReadFileProvider parent, string subdir)
{
- get { return mResourceAssets ?? Assets; }
- set { mResourceAssets = value; }
- }
- public static IReadFileProvider MusicAssets
- {
- get { return mMusicAssets ?? Assets; }
- set { mMusicAssets = value; }
- }
- public static IReadFileProvider SoundAssets
- {
- get { return mSoundAssets ?? Assets; }
- set { mSoundAssets = value; }
- }
-
- public static IReadWriteFileProvider UserFiles { get; private set; }
+ if (string.IsNullOrWhiteSpace(subdir) || subdir == ".")
+ return parent;
- public static IReadFileProvider NewProviderFromSubdirectory(IReadFileProvider parent, string subdir)
- {
return new SubdirectoryProvider(parent, subdir);
}
}
Modified: trunk/AgateLib/IO/SubDirectoryProvider.cs
===================================================================
--- trunk/AgateLib/IO/SubDirectoryProvider.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/IO/SubDirectoryProvider.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -52,7 +52,23 @@
public string ResolveFile(string filename)
{
+ if (IsRooted(filename))
+ return parent.ResolveFile(filename);
+
return parent.ResolveFile(subdir + filename);
}
+
+ private bool IsRooted(string filename)
+ {
+ if (char.IsLetter(filename[0]) && filename[1] == ':')
+ return true;
+ if (filename.StartsWith("/"))
+ return true;
+ if (Core.Platform.PlatformType == Platform.PlatformType.Windows &&
+ filename.StartsWith("\\"))
+ return true;
+
+ return false;
+ }
}
}
Modified: trunk/AgateLib/InputLib/AgateInputEventArgs.cs
===================================================================
--- trunk/AgateLib/InputLib/AgateInputEventArgs.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/InputLib/AgateInputEventArgs.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -1,4 +1,5 @@
using AgateLib.Geometry;
+using AgateLib.InputLib.Legacy;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -22,22 +23,24 @@
public int MouseWheelDelta { get; set; }
- internal static AgateInputEventArgs KeyDown(KeyCode code, KeyModifiers modifiers)
+ public static AgateInputEventArgs KeyDown(KeyCode code, KeyModifiers modifiers)
{
return new AgateInputEventArgs
{
InputEventType = InputEventType.KeyDown,
KeyCode = code,
+ KeyString = Keyboard.GetKeyString(code, modifiers),
KeyModifiers = modifiers,
};
}
- internal static AgateInputEventArgs KeyUp(KeyCode code, KeyModifiers modifiers)
+ public static AgateInputEventArgs KeyUp(KeyCode code, KeyModifiers modifiers)
{
return new AgateInputEventArgs
{
InputEventType = InputEventType.KeyUp,
KeyCode = code,
+ KeyString = Keyboard.GetKeyString(code, modifiers),
KeyModifiers = modifiers,
};
}
@@ -46,7 +49,6 @@
public enum InputEventType
{
KeyDown,
- KeyPress,
KeyUp,
MouseDown,
@@ -57,6 +59,5 @@
JoystickButton,
JoystickPovHat,
MouseWheel,
-
}
}
Modified: trunk/AgateLib/InputLib/Input.cs
===================================================================
--- trunk/AgateLib/InputLib/Input.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/InputLib/Input.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -12,29 +12,32 @@
public static void QueueInputEvent(AgateInputEventArgs args)
{
- lock(mEvents)
+ lock (mEvents)
{
mEvents.Add(args);
}
}
- public static void DispatchEvents()
+ public static void DispatchQueuedEvents()
{
while (mEvents.Count > 0)
{
AgateInputEventArgs args;
- lock(mEvents)
+ lock (mEvents)
{
+ if (mEvents.Count == 0)
+ return;
+
args = mEvents[0];
mEvents.RemoveAt(0);
}
-
- DispatchEvents(args);
+
+ DispatchEvent(args);
}
}
- private static void DispatchEvents(AgateInputEventArgs args)
+ private static void DispatchEvent(AgateInputEventArgs args)
{
mInputHandlers.Dispatch(args);
}
Modified: trunk/AgateLib/InputLib/Legacy/Keyboard.cs
===================================================================
--- trunk/AgateLib/InputLib/Legacy/Keyboard.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/InputLib/Legacy/Keyboard.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -102,7 +102,7 @@
}
}
- private KeyModifiers CurrentModifiers
+ public KeyModifiers CurrentModifiers
{
get { return new KeyModifiers(this[KeyCode.Alt], this[KeyCode.Control], this[KeyCode.Shift]); }
}
@@ -229,12 +229,7 @@
{
var eventArgs = new InputEventArgs(id, mods);
- if (AgateConsole.IsInitialized &&
- (AgateConsole.IsVisible || id == AgateConsole.VisibleToggleKey))
- {
- AgateConsole.Keyboard_KeyDown(eventArgs);
- }
- else if (KeyDown != null)
+ if (KeyDown != null)
KeyDown(eventArgs);
}
[Obsolete("Use Input.QueueInputEvent instead.", true)]
@@ -242,11 +237,7 @@
{
var eventArgs = new InputEventArgs(id, mods);
- if (AgateConsole.IsVisible)
- {
- AgateConsole.Keyboard_KeyUp(eventArgs);
- }
- else if (KeyUp != null)
+ if (KeyUp != null)
KeyUp(eventArgs);
}
Modified: trunk/AgateLib/Resources/BitmapFontResource.cs
===================================================================
--- trunk/AgateLib/Resources/BitmapFontResource.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib/Resources/BitmapFontResource.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -20,7 +20,7 @@
using System.Collections.Generic;
using System.Text;
using System.Xml;
-using AgateLib.BitmapFont;
+using AgateLib.DisplayLib.BitmapFont;
using AgateLib.Geometry;
using System.Xml.Linq;
Modified: trunk/AgateLib.AgateSDL/Sdl2/ISDL.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Sdl2/ISDL.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.AgateSDL/Sdl2/ISDL.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -38,5 +38,7 @@
string GetError();
void SDL_Init(uint flags);
+
+ void PreloadLibrary(string name);
}
}
Modified: trunk/AgateLib.AgateSDL/Sdl2/SDL32.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Sdl2/SDL32.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.AgateSDL/Sdl2/SDL32.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using SDL2.ThirtyTwo;
+using System.Runtime.InteropServices;
namespace AgateLib.AgateSDL.Sdl2
{
@@ -10,6 +11,19 @@
{
SDLMixer32 mixer = new SDLMixer32();
+ [DllImport("kernel32.dll")]
+ static extern IntPtr LoadLibrary(string dllToLoad);
+
+ public SDL32()
+ {
+ }
+
+ public void PreloadLibrary(string name)
+ {
+ LoadLibrary("lib32/" + name);
+ }
+
+
ISDLMixer ISDL.Mixer
{
get { return mixer; }
Modified: trunk/AgateLib.AgateSDL/Sdl2/SDL64.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Sdl2/SDL64.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.AgateSDL/Sdl2/SDL64.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -10,21 +10,19 @@
class SDL64 : ISDL
{
[DllImport("kernel32.dll")]
- public static extern IntPtr LoadLibrary(string dllToLoad);
+ static extern IntPtr LoadLibrary(string dllToLoad);
SDLMixer64 mixer = new SDLMixer64();
public SDL64()
{
- LoadLibrary("lib64/libogg-0.dll");
- LoadLibrary("lib64/libvorbis-0.dll");
- LoadLibrary("lib64/libvorbisfile-3.dll");
- LoadLibrary("lib64/libFLAC-8.dll");
- LoadLibrary("lib64/smepg2.dll");
- LoadLibrary("lib64/libmikmod-2.dll");
- LoadLibrary("lib64/libmodplug-1.dll");
}
+ public void PreloadLibrary(string name)
+ {
+ LoadLibrary("lib64/" + name);
+ }
+
ISDLMixer ISDL.Mixer
{
get { return mixer; }
Modified: trunk/AgateLib.AgateSDL/Sdl2/SdlFactory.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Sdl2/SdlFactory.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.AgateSDL/Sdl2/SdlFactory.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -19,6 +19,14 @@
else
sdl = new SDL32();
+ sdl.PreloadLibrary("libogg-0.dll");
+ sdl.PreloadLibrary("libvorbis-0.dll");
+ sdl.PreloadLibrary("libvorbisfile-3.dll");
+ sdl.PreloadLibrary("libFLAC-8.dll");
+ sdl.PreloadLibrary("smepg2.dll");
+ sdl.PreloadLibrary("libmikmod-2.dll");
+ sdl.PreloadLibrary("libmodplug-1.dll");
+
sdl.SDL_Init(SDLConstants.SDL_INIT_AUDIO | SDLConstants.SDL_INIT_GAMECONTROLLER | SDLConstants.SDL_INIT_JOYSTICK);
}
Modified: trunk/AgateLib.GL/ContextFB.cs
===================================================================
--- trunk/AgateLib.GL/ContextFB.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.GL/ContextFB.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -24,30 +24,63 @@
using OpenTK.Graphics.OpenGL;
using OpenTK.Platform;
using AgateLib.Geometry;
+using System.Threading;
+using System.Diagnostics;
namespace AgateLib.OpenGL
{
- public class ContextFB : GL_FrameBuffer
+ public class ContextFB : GL_FrameBuffer
{
- IGraphicsContext mContext;
+ Dictionary<Thread, GraphicsContext> mContexts = new Dictionary<Thread, GraphicsContext>();
+
+ GraphicsMode mGraphicsMode;
IWindowInfo mWindowInfo;
Size mSize;
AgateLib.DisplayLib.DisplayWindow mAttachedWindow;
- public ContextFB(AgateLib.DisplayLib.DisplayWindow attachedWindow,
- IGraphicsContext context, IWindowInfo window, Size size,
+ public ContextFB(AgateLib.DisplayLib.DisplayWindow attachedWindow,
+ GraphicsMode graphicsMode, IWindowInfo window, Size size,
bool depthBuffer, bool stencilBuffer)
{
+ mGraphicsMode = graphicsMode;
mAttachedWindow = attachedWindow;
- mContext = context;
mWindowInfo = window;
mSize = size;
mHasDepth = depthBuffer;
mHasStencil = stencilBuffer;
+
+ CreateContextForThread();
+
+ InitializeDrawBuffer();
}
+ public void CreateContextForThread()
+ {
+ if (mContexts.ContainsKey(Thread.CurrentThread))
+ return;
+
+ var context = new GraphicsContext(mGraphicsMode, mWindowInfo);
+ mContexts.Add(Thread.CurrentThread, context);
+
+ context.LoadAll();
+ context.MakeCurrent(mWindowInfo);
+
+ Debug.WriteLine(string.Format("Created context {0} for thread {1}",
+ context.ToString(), Thread.CurrentThread.ManagedThreadId));
+ }
+
+ GraphicsContext CurrentContext
+ {
+ get
+ {
+ if (mContexts.ContainsKey(Thread.CurrentThread) == false)
+ return null;
+
+ return mContexts[Thread.CurrentThread];
+ }
+ }
public override void Dispose()
{
}
@@ -68,9 +101,9 @@
}
public override void MakeCurrent()
{
- if (mContext.IsCurrent == false)
+ if (CurrentContext.IsCurrent == false)
{
- mContext.MakeCurrent(mWindowInfo);
+ CurrentContext.MakeCurrent(mWindowInfo);
}
GL.Viewport(0, 0, Width, Height);
@@ -84,10 +117,10 @@
public override void EndRender()
{
bool vsync = AgateLib.DisplayLib.Display.RenderState.WaitForVerticalBlank;
- if (mContext.VSync != vsync)
- mContext.VSync = vsync;
+ if (CurrentContext.VSync != vsync)
+ CurrentContext.VSync = vsync;
- mContext.SwapBuffers();
+ CurrentContext.SwapBuffers();
}
}
Modified: trunk/AgateLib.GL/GL3/FrameBuffer.cs
===================================================================
--- trunk/AgateLib.GL/GL3/FrameBuffer.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.GL/GL3/FrameBuffer.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -84,6 +84,8 @@
GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
+
+ InitializeDrawBuffer();
}
public override void Dispose()
{
Modified: trunk/AgateLib.GL/GL_FrameBuffer.cs
===================================================================
--- trunk/AgateLib.GL/GL_FrameBuffer.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.GL/GL_FrameBuffer.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -28,12 +28,16 @@
{
public abstract class GL_FrameBuffer: FrameBufferImpl
{
- readonly GLDrawBuffer mDrawBuffer;
+ GLDrawBuffer mDrawBuffer;
protected bool mHasDepth;
protected bool mHasStencil;
protected GL_FrameBuffer()
{
+ }
+
+ protected void InitializeDrawBuffer()
+ {
mDrawBuffer = ((IGL_Display)Display.Impl).CreateDrawBuffer();
}
Modified: trunk/AgateLib.GL/Legacy/FrameBufferExt.cs
===================================================================
--- trunk/AgateLib.GL/Legacy/FrameBufferExt.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.GL/Legacy/FrameBufferExt.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -105,6 +105,8 @@
}
sDepthSupported = false;
sStencilSupported = false;
+
+ InitializeDrawBuffer();
}
void InitializeFramebuffer(bool depth, bool stencil)
Modified: trunk/AgateLib.GL/Legacy/FrameBufferReadPixels.cs
===================================================================
--- trunk/AgateLib.GL/Legacy/FrameBufferReadPixels.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.GL/Legacy/FrameBufferReadPixels.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -40,6 +40,9 @@
this.size = surf.SurfaceSize;
surface.FlipVertical = true;
+
+
+ InitializeDrawBuffer();
}
public override void MakeCurrent()
Modified: trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj 2014-08-07 01:57:11 UTC (rev 1439)
@@ -90,6 +90,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ApplicationModels\FormsModelBase.cs" />
+ <Compile Include="ApplicationModels\FormsModelParameters.cs" />
<Compile Include="ApplicationModels\PassiveModel.cs" />
<Compile Include="ApplicationModels\PassiveModelParameters.cs" />
<Compile Include="ApplicationModels\SceneModel.cs" />
@@ -107,6 +108,7 @@
<Compile Include="Data\FieldType.cs" />
<Compile Include="Diagnostics\AgateConsoleImpl.cs" />
<Compile Include="Diagnostics\AgateConsoleTraceListener.cs" />
+ <Compile Include="DisplayImplementation\ContextInfo.cs" />
<Compile Include="DisplayImplementation\frmFullScreen.cs">
<SubType>Form</SubType>
</Compile>
Modified: trunk/AgateLib.Platform.WindowsForms/ApplicationModels/FormsModelBase.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/ApplicationModels/FormsModelBase.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.Platform.WindowsForms/ApplicationModels/FormsModelBase.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -1,4 +1,6 @@
using AgateLib.ApplicationModels;
+using AgateLib.Platform.WindowsForms.Factories;
+using AgateLib.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,15 +13,26 @@
public abstract class FormsModelBase : AgateAppModel
{
public FormsModelBase(ModelParameters parameters)
- :base (parameters)
+ : base(parameters)
{
}
+ public new FormsModelParameters Parameters
+ {
+ get { return (FormsModelParameters)base.Parameters; }
+ }
+
protected override void InitializeImpl()
{
- Configuration.Initialize();
+ Core.Initialize(new FormsFactory());
+
+ var assetProvider = new FileSystemProvider(System.IO.Path.GetFullPath(Parameters.AssetPath));
+ AgateLib.IO.FileProvider.Initialize(assetProvider, Parameters.AssetLocations);
+
+ System.IO.Directory.SetCurrentDirectory(assetProvider.SearchPath);
}
+
protected override void Dispose(bool disposing)
{
}
Added: trunk/AgateLib.Platform.WindowsForms/ApplicationModels/FormsModelParameters.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/ApplicationModels/FormsModelParameters.cs (rev 0)
+++ trunk/AgateLib.Platform.WindowsForms/ApplicationModels/FormsModelParameters.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -0,0 +1,19 @@
+using AgateLib.ApplicationModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.Platform.WindowsForms.ApplicationModels
+{
+ public class FormsModelParameters : ModelParameters
+ {
+ public FormsModelParameters()
+ {
+ AssetPath = ".";
+ }
+
+ public string AssetPath { get; set; }
+ }
+}
Modified: trunk/AgateLib.Platform.WindowsForms/ApplicationModels/PassiveModelParameters.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/ApplicationModels/PassiveModelParameters.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.Platform.WindowsForms/ApplicationModels/PassiveModelParameters.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -7,11 +7,16 @@
namespace AgateLib.Platform.WindowsForms.ApplicationModels
{
- public class PassiveModelParameters : ModelParameters
+ public class PassiveModelParameters : FormsModelParameters
{
public PassiveModelParameters()
{
AutoCreateDisplayWindow = false;
}
+
+ public PassiveModelParameters(string[] args) : this()
+ {
+ Arguments = args;
+ }
}
}
Modified: trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SerialModel.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SerialModel.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SerialModel.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -22,6 +22,10 @@
#endregion
+ Thread gameThread;
+ bool exit;
+ bool threadRunning;
+
public SerialModel() : this(DefaultParameters)
{ }
@@ -45,10 +49,12 @@
{
try
{
+ threadRunning = true;
+
OpenTK.Graphics.GraphicsContext.ShareContexts = true;
var window = AutoCreatedWindow.Impl as IPrimaryWindow;
- window.ReinitializeFramebuffer();
+ window.CreateContextForThread();
try
{
@@ -63,14 +69,16 @@
{
var primaryWindow = AutoCreatedWindow.Impl as IPrimaryWindow;
primaryWindow.ExitMessageLoop();
+
+ threadRunning = false;
}
}
protected override int BeginModel(Func<int> entryPoint)
{
int retval = 0;
- Thread thread = new Thread(() => { retval = ExecuteEntry(entryPoint); });
- thread.Start();
+ gameThread = new Thread(() => { retval = ExecuteEntry(entryPoint); });
+ gameThread.Start();
var primaryWindow = AutoCreatedWindow.Impl as IPrimaryWindow;
primaryWindow.RunApplication();
@@ -78,9 +86,25 @@
return retval;
}
-
public override void KeepAlive()
{
+ if (exit)
+ {
+ throw new ExitGameException();
+ }
+
+ base.KeepAlive();
}
+
+ protected override void window_Closing(object sender, ref bool cancel)
+ {
+ if (Thread.CurrentThread == gameThread)
+ return;
+
+ exit = true;
+
+ while (threadRunning)
+ Thread.Sleep(0);
+ }
}
}
Modified: trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SerialModelParameters.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SerialModelParameters.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SerialModelParameters.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -7,7 +7,16 @@
namespace AgateLib.Platform.WindowsForms.ApplicationModels
{
- public class SerialModelParameters : ModelParameters
+ public class SerialModelParameters : FormsModelParameters
{
+ public SerialModelParameters()
+ {
+ }
+
+ public SerialModelParameters(string[] args)
+ : this()
+ {
+ Arguments = args;
+ }
}
}
Modified: trunk/AgateLib.Platform.WindowsForms/Configuration.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/Configuration.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.Platform.WindowsForms/Configuration.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -11,6 +11,7 @@
namespace AgateLib.Platform.WindowsForms
{
+ [Obsolete]
public static class Configuration
{
static FileProviderList mAssetProvider = new FileProviderList();
@@ -19,19 +20,19 @@
static FileProviderList mSoundProvider = new FileProviderList();
static FileProviderList mMusicProvider = new FileProviderList();
+ [Obsolete]
public static void Initialize()
{
- Core.Initialize(new FormsFactory());
- Resources.AddPath(".");
- Images.AddPath(".");
- Sounds.AddPath(".");
- MusicProvider.AddPath(".");
}
+ [Obsolete("Use AgateLib.IO.FileProvider instead.", true)]
public static FileProviderList Resources { get { return mResourceProvider; } }
+ [Obsolete("Use AgateLib.IO.FileProvider instead.", true)]
public static FileProviderList Images { get { return mSurfaceProvider; } }
+ [Obsolete("Use AgateLib.IO.FileProvider instead.", true)]
public static FileProviderList Sounds { get { return mSoundProvider; } }
+ [Obsolete("Use AgateLib.IO.FileProvider instead.", true)]
public static FileProviderList MusicProvider { get { return mMusicProvider; } }
}
}
Added: trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/ContextInfo.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/ContextInfo.cs (rev 0)
+++ trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/ContextInfo.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.Platform.WindowsForms.DisplayImplementation
+{
+ class ContextInfo : IDisposable
+ {
+ public OpenGL.ContextFB FrameBuffer { get; set; }
+
+ public OpenTK.Graphics.GraphicsContext Context { get; set; }
+
+ public void Dispose()
+ {
+ FrameBuffer.Dispose();
+ Context.Dispose();
+ }
+ }
+}
Modified: trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/DesktopGLDisplay.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/DesktopGLDisplay.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/DesktopGLDisplay.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -23,7 +23,7 @@
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
-using AgateLib.BitmapFont;
+using AgateLib.DisplayLib.BitmapFont;
using AgateLib.DisplayLib;
using AgateLib.DisplayLib.ImplementationBase;
using AgateLib.Drivers;
@@ -327,8 +327,6 @@
GL.ClearDepth(1); // Depth Buffer Setup
GL.Enable(EnableCap.DepthTest); // Enables Depth Testing
GL.DepthFunc(DepthFunction.Lequal); // The Type Of Depth Testing To Do
-
-
}
private void CreateWhiteSurface()
Modified: trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_DisplayControl.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_DisplayControl.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_DisplayControl.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -98,8 +98,7 @@
mDisplay = Display.Impl as DesktopGLDisplay;
- mContext = CreateContext();
- mFrameBuffer = CreateFrameBuffer();
+ CreateFrameBuffer();
AttachEvents();
}
@@ -147,7 +146,7 @@
mWindowInfo = CreateWindowInfo(CreateGraphicsMode());
AttachEvents();
- ReinitializeFramebuffer();
+ CreateFrameBuffer();
OpenTK.DisplayResolution resolution = OpenTK.DisplayDevice.Default.SelectResolution(
mChooseWidth, mChooseHeight, 32, 0);
@@ -194,8 +193,8 @@
if (mIcon != null)
frm.Icon = mIcon;
- frm.Show();
- ReinitializeFramebuffer();
+ frm.Show();
+ CreateFrameBuffer();
AttachEvents();
@@ -206,12 +205,6 @@
Core.IsActive = true;
}
- public void ReinitializeFramebuffer()
- {
- mContext = CreateContext();
- mFrameBuffer = CreateFrameBuffer();
- }
-
public OpenTK.Graphics.GraphicsContext CreateContext()
{
GraphicsMode newMode = CreateGraphicsMode();
@@ -237,9 +230,14 @@
return newMode;
}
- private ContextFB CreateFrameBuffer()
+ private void CreateFrameBuffer()
{
- return new ContextFB(mOwner, mContext, mWindowInfo, this.Size, true, false);
+ var old = mFrameBuffer;
+
+ mFrameBuffer = new ContextFB(mOwner, CreateGraphicsMode(), mWindowInfo, this.Size, true, false);
+
+ if (old != null)
+ old.Dispose();
}
private IWindowInfo CreateWindowInfo(GraphicsMode mode)
@@ -398,10 +396,11 @@
form.KeyDown += new System.Windows.Forms.KeyEventHandler(form_KeyDown);
form.KeyUp += new System.Windows.Forms.KeyEventHandler(form_KeyUp);
+
form.FormClosing += new FormClosingEventHandler(form_FormClosing);
form.FormClosed += new FormClosedEventHandler(form_FormClosed);
-
}
+
private void DetachEvents()
{
if (mRenderTarget == null)
@@ -504,7 +503,9 @@
}
void form_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
- Keyboard.Keys[FormUtil.TransformWinFormsKey(e.KeyCode)] = true;
+ var key = FormUtil.TransformWinFormsKey(e.KeyCode);
+
+ Keyboard.Keys[key] = true;
}
public override bool IsClosed
@@ -613,5 +614,11 @@
{
Application.Exit();
}
+
+
+ public void CreateContextForThread()
+ {
+ mFrameBuffer.CreateContextForThread();
+ }
}
}
Modified: trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_GameWindow.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_GameWindow.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_GameWindow.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -214,12 +214,10 @@
private void CreateFrameBuffer()
{
- GraphicsContext context = new GraphicsContext(mWindow.Context.GraphicsMode, mWindow.WindowInfo);
- Debug.WriteLine(string.Format("Created context {0}", context.ToString()));
+ mFrameBuffer = new ContextFB(mOwner,
+ mWindow.Context.GraphicsMode, mWindow.WindowInfo,
+ new Size(mWindow.ClientSize.Width, mWindow.ClientSize.Height), true, false);
- mFrameBuffer = new ContextFB(mOwner, context, mWindow.WindowInfo,
- new Size(mWindow.ClientSize.Width, mWindow.ClientSize.Height), true, false);
-
if (mOwner.Impl != null)
{
// force recreation of the parent FrameBuffer object which wraps mFrameBuffer.
@@ -309,7 +307,7 @@
mWindow.Keyboard.KeyRepeat = true;
mWindow.Keyboard.KeyDown += new EventHandler<OpenTK.Input.KeyboardKeyEventArgs>(Keyboard_KeyDown);
mWindow.Keyboard.KeyUp += new EventHandler<OpenTK.Input.KeyboardKeyEventArgs>(Keyboard_KeyUp);
-
+
mWindow.Mouse.ButtonDown += new EventHandler<OpenTK.Input.MouseButtonEventArgs>(Mouse_ButtonDown);
mWindow.Mouse.ButtonUp += new EventHandler<OpenTK.Input.MouseButtonEventArgs>(Mouse_ButtonUp);
mWindow.Mouse.Move += new EventHandler<OpenTK.Input.MouseMoveEventArgs>(Mouse_Move);
@@ -517,15 +515,15 @@
mWindow.Run();
}
- public void ReinitializeFramebuffer()
+ public void ExitMessageLoop()
{
- CreateFrameBuffer();
+ mWindow.Exit();
}
- public void ExitMessageLoop()
+ public void CreateContextForThread()
{
- mWindow.Exit();
+ mFrameBuffer.CreateContextForThread();
}
}
}
Modified: trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_Surface.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_Surface.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_Surface.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -71,7 +71,7 @@
mDisplay = Display.Impl as DesktopGLDisplay;
mDrawBuffer = mDisplay.DrawBuffer;
- mFilename = Configuration.Images.ResolveFile(filename);
+ mFilename = AgateLib.IO.FileProvider.SurfaceAssets.ResolveFile(filename);
Load();
}
Modified: trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/IPrimaryWindow.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/IPrimaryWindow.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/IPrimaryWindow.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -5,8 +5,8 @@
{
void RunApplication();
- void ReinitializeFramebuffer();
+ void ExitMessageLoop();
- void ExitMessageLoop();
+ void CreateContextForThread();
}
}
Modified: trunk/AgateLib.Platform.WindowsForms/Factories/FormsFactory.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/Factories/FormsFactory.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.Platform.WindowsForms/Factories/FormsFactory.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -1,4 +1,6 @@
-using AgateLib.Drivers;
+using AgateLib.DisplayLib;
+using AgateLib.Drivers;
+using AgateLib.Platform.WindowsForms.Resources;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -9,13 +11,15 @@
{
class FormsFactory : IAgateFactory
{
+ FontSurface mDefaultFont;
+
public FormsFactory()
{
DisplayFactory = new DisplayFactory();
PlatformFactory = new PlatformFactory();
-
+
var sdl = new SdlFactory();
-
+
AudioFactory = sdl;
InputFactory = sdl;
}
@@ -23,6 +27,22 @@
public IDisplayFactory DisplayFactory { get; private set; }
public IAudioFactory AudioFactory { get; private set; }
public IInputFactory InputFactory { get; private set; }
- public IPlatformFactory PlatformFactory { get; private set;}
+ public IPlatformFactory PlatformFactory { get; private set; }
+
+
+ public DisplayLib.FontSurface DefaultFont
+ {
+ get
+ {
+ if (mDefaultFont == null)
+ mDefaultFont = BuiltinResources.AgateSans10;
+
+ return mDefaultFont;
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
}
}
Modified: trunk/AgateLib.Platform.WindowsForms/WinForms/BitmapFontUtil.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/WinForms/BitmapFontUtil.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.Platform.WindowsForms/WinForms/BitmapFontUtil.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -23,7 +23,7 @@
using System.Windows.Forms;
using AgateLib.DisplayLib;
using AgateLib.Geometry;
-using AgateLib.BitmapFont;
+using AgateLib.DisplayLib.BitmapFont;
using AgateLib.Resources;
namespace AgateLib.Platform.WindowsForms.WinForms
Modified: trunk/AgateLib.Platform.WindowsForms/WinForms/BitmapFontUtilRenderers.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/WinForms/BitmapFontUtilRenderers.cs 2014-08-05 14:33:16 UTC (rev 1438)
+++ trunk/AgateLib.Platform.WindowsForms/WinForms/BitmapFontUtilRenderers.cs 2014-08-07 01:57:11 UTC (rev 1439)
@@ -24,7 +24,7 @@
using System.Windows.Forms;
using AgateLib.DisplayLib;
using AgateLib.Geometry;
-using AgateLib.BitmapFont;
+using AgateLib.DisplayLib.BitmapFont;
using AgateLib.Resources;
namespace AgateLib.Platform.WindowsForms.WinForms
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-05 14:33:21
|
Revision: 1438
http://sourceforge.net/p/agate/code/1438
Author: kanato
Date: 2014-08-05 14:33:16 +0000 (Tue, 05 Aug 2014)
Log Message:
-----------
Some fixes for SDL
Modified Paths:
--------------
trunk/AgateLib.AgateSDL/Audio/SDL_SoundBuffer.cs
trunk/AgateLib.AgateSDL/Audio/SDL_SoundBufferSession.cs
trunk/AgateLib.AgateSDL/Sdl2/ISDL.cs
trunk/AgateLib.AgateSDL/Sdl2/ISDLMixer.cs
trunk/AgateLib.AgateSDL/Sdl2/SDL32.cs
trunk/AgateLib.AgateSDL/Sdl2/SDL64.cs
trunk/AgateLib.AgateSDL/Sdl2/SdlFactory.cs
Modified: trunk/AgateLib.AgateSDL/Audio/SDL_SoundBuffer.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Audio/SDL_SoundBuffer.cs 2014-08-04 05:58:46 UTC (rev 1437)
+++ trunk/AgateLib.AgateSDL/Audio/SDL_SoundBuffer.cs 2014-08-05 14:33:16 UTC (rev 1438)
@@ -52,7 +52,7 @@
sdl = SdlFactory.CreateSDL();
this.filename = AgateLib.IO.FileProvider.SoundAssets.ResolveFile(filename);
- LoadFromFile(filename);
+ LoadFromFile(this.filename);
}
@@ -88,7 +88,11 @@
sound = sdl.Mixer.Mix_LoadWAV(file);
if (sound == IntPtr.Zero)
- throw new AgateException("Could not load audio file.");
+ {
+ var error = sdl.Mixer.GetError();
+
+ throw new AgateException("Could not load audio file:" + error);
+ }
}
public override double Volume
Modified: trunk/AgateLib.AgateSDL/Audio/SDL_SoundBufferSession.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Audio/SDL_SoundBufferSession.cs 2014-08-04 05:58:46 UTC (rev 1437)
+++ trunk/AgateLib.AgateSDL/Audio/SDL_SoundBufferSession.cs 2014-08-05 14:33:16 UTC (rev 1438)
@@ -55,6 +55,8 @@
audio = (SDL_Audio)AgateLib.AudioLib.Audio.Impl;
Debug.Print("Playing " + buffer.Filename);
+
+ Play();
}
public override void Dispose()
{
Modified: trunk/AgateLib.AgateSDL/Sdl2/ISDL.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Sdl2/ISDL.cs 2014-08-04 05:58:46 UTC (rev 1437)
+++ trunk/AgateLib.AgateSDL/Sdl2/ISDL.cs 2014-08-05 14:33:16 UTC (rev 1438)
@@ -34,5 +34,9 @@
void CallPollEvent();
void SDL_SetHint(string p1, string p2);
+
+ string GetError();
+
+ void SDL_Init(uint flags);
}
}
Modified: trunk/AgateLib.AgateSDL/Sdl2/ISDLMixer.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Sdl2/ISDLMixer.cs 2014-08-04 05:58:46 UTC (rev 1437)
+++ trunk/AgateLib.AgateSDL/Sdl2/ISDLMixer.cs 2014-08-05 14:33:16 UTC (rev 1438)
@@ -49,5 +49,7 @@
void Mix_Resume(int channel);
void Mix_Pause(int channel);
+
+ string GetError();
}
}
Modified: trunk/AgateLib.AgateSDL/Sdl2/SDL32.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Sdl2/SDL32.cs 2014-08-04 05:58:46 UTC (rev 1437)
+++ trunk/AgateLib.AgateSDL/Sdl2/SDL32.cs 2014-08-05 14:33:16 UTC (rev 1438)
@@ -15,6 +15,17 @@
get { return mixer; }
}
+ public void CheckReturnValue(int val)
+ {
+ if (val != 0)
+ throw new AgateException(SDL.SDL_GetError());
+ }
+
+ public void SDL_Init(uint flags)
+ {
+ CheckReturnValue(SDL.SDL_Init(flags));
+ }
+
public void SDL_QuitSubSystem(uint flags)
{
SDL.SDL_QuitSubSystem(flags);
@@ -85,6 +96,13 @@
{
SDL.SDL_SetHint(name, value);
}
+
+
+ public string GetError()
+ {
+ return SDL.SDL_GetError();
+ }
+
}
class SDLMixer32 : ISDLMixer
@@ -203,5 +221,11 @@
{
SDL_mixer.Mix_Pause(channel);
}
+
+
+ public string GetError()
+ {
+ return SDL.SDL_GetError();
+ }
}
}
Modified: trunk/AgateLib.AgateSDL/Sdl2/SDL64.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Sdl2/SDL64.cs 2014-08-04 05:58:46 UTC (rev 1437)
+++ trunk/AgateLib.AgateSDL/Sdl2/SDL64.cs 2014-08-05 14:33:16 UTC (rev 1438)
@@ -2,19 +2,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Runtime.InteropServices;
using System.Text;
namespace AgateLib.AgateSDL.Sdl2
{
class SDL64 : ISDL
{
+ [DllImport("kernel32.dll")]
+ public static extern IntPtr LoadLibrary(string dllToLoad);
+
SDLMixer64 mixer = new SDLMixer64();
+ public SDL64()
+ {
+ LoadLibrary("lib64/libogg-0.dll");
+ LoadLibrary("lib64/libvorbis-0.dll");
+ LoadLibrary("lib64/libvorbisfile-3.dll");
+ LoadLibrary("lib64/libFLAC-8.dll");
+ LoadLibrary("lib64/smepg2.dll");
+ LoadLibrary("lib64/libmikmod-2.dll");
+ LoadLibrary("lib64/libmodplug-1.dll");
+ }
+
ISDLMixer ISDL.Mixer
{
get { return mixer; }
}
+ public void CheckReturnValue(int val)
+ {
+ if (val != 0)
+ throw new AgateException(SDL.SDL_GetError());
+ }
+
+ public void SDL_Init(uint flags)
+ {
+ CheckReturnValue(SDL.SDL_Init(flags));
+ }
+
public void SDL_QuitSubSystem(uint p)
{
SDL.SDL_QuitSubSystem(p);
@@ -78,6 +104,10 @@
{
SDL.SDL_SetHint(name, value);
}
+ public string GetError()
+ {
+ return SDL.SDL_GetError();
+ }
}
class SDLMixer64 : ISDLMixer
@@ -196,5 +226,9 @@
{
SDL_mixer.Mix_Pause(channel);
}
+ public string GetError()
+ {
+ return SDL.SDL_GetError();
+ }
}
}
Modified: trunk/AgateLib.AgateSDL/Sdl2/SdlFactory.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Sdl2/SdlFactory.cs 2014-08-04 05:58:46 UTC (rev 1437)
+++ trunk/AgateLib.AgateSDL/Sdl2/SdlFactory.cs 2014-08-05 14:33:16 UTC (rev 1438)
@@ -18,6 +18,8 @@
sdl = new SDL64();
else
sdl = new SDL32();
+
+ sdl.SDL_Init(SDLConstants.SDL_INIT_AUDIO | SDLConstants.SDL_INIT_GAMECONTROLLER | SDLConstants.SDL_INIT_JOYSTICK);
}
return sdl;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|