Thread: [Agate-svn-commit] SF.net SVN: agate:[1437] trunk (Page 6)
Status: Alpha
Brought to you by:
kanato
|
From: <ka...@us...> - 2014-08-04 05:58:52
|
Revision: 1437
http://sourceforge.net/p/agate/code/1437
Author: kanato
Date: 2014-08-04 05:58:46 +0000 (Mon, 04 Aug 2014)
Log Message:
-----------
Some modifications to file provider.
Modified Paths:
--------------
trunk/AgateLib/IO/FileProvider.cs
trunk/AgateLib.AgateSDL/Audio/SDL_Music.cs
trunk/AgateLib.Platform.WindowsForms/Factories/PlatformFactory.cs
Modified: trunk/AgateLib/IO/FileProvider.cs
===================================================================
--- trunk/AgateLib/IO/FileProvider.cs 2014-08-04 05:33:00 UTC (rev 1436)
+++ trunk/AgateLib/IO/FileProvider.cs 2014-08-04 05:58:46 UTC (rev 1437)
@@ -22,22 +22,22 @@
public static IReadFileProvider SurfaceAssets
{
get { return mSurfaceAssets ?? Assets; }
- set { mSurfaceAssets = Assets; }
+ set { mSurfaceAssets = value; }
}
public static IReadFileProvider ResourceAssets
{
get { return mResourceAssets ?? Assets; }
- set { mResourceAssets = Assets; }
+ set { mResourceAssets = value; }
}
public static IReadFileProvider MusicAssets
{
get { return mMusicAssets ?? Assets; }
- set { mMusicAssets = Assets; }
+ set { mMusicAssets = value; }
}
public static IReadFileProvider SoundAssets
{
get { return mSoundAssets ?? Assets; }
- set { mSoundAssets = Assets; }
+ set { mSoundAssets = value; }
}
public static IReadWriteFileProvider UserFiles { get; private set; }
Modified: trunk/AgateLib.AgateSDL/Audio/SDL_Music.cs
===================================================================
--- trunk/AgateLib.AgateSDL/Audio/SDL_Music.cs 2014-08-04 05:33:00 UTC (rev 1436)
+++ trunk/AgateLib.AgateSDL/Audio/SDL_Music.cs 2014-08-04 05:58:46 UTC (rev 1437)
@@ -33,6 +33,7 @@
SDL_Audio audio;
IntPtr music;
string tempfile;
+ string filename;
double mVolume;
public SDL_Music(SDL_Audio audio, Stream stream)
@@ -52,8 +53,8 @@
sdl = SdlFactory.CreateSDL();
this.audio = audio;
-
- LoadFromFile(filename);
+ this.filename = AgateLib.IO.FileProvider.MusicAssets.ResolveFile(filename);
+ LoadFromFile(this.filename);
}
~SDL_Music()
Modified: trunk/AgateLib.Platform.WindowsForms/Factories/PlatformFactory.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/Factories/PlatformFactory.cs 2014-08-04 05:33:00 UTC (rev 1436)
+++ trunk/AgateLib.Platform.WindowsForms/Factories/PlatformFactory.cs 2014-08-04 05:58:46 UTC (rev 1437)
@@ -45,7 +45,8 @@
public IReadFileProvider CreateAssetFileProvider()
{
- return new FileSystemProvider(AssemblyLoadDirectory);
+ //return new FileSystemProvider(AssemblyLoadDirectory);
+ return new FileSystemProvider(".");
}
static public string AssemblyLoadDirectory
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
==================================================================...
[truncated message content] |
|
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 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 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 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-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
- ...
[truncated message content] |
|
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 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-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 Sys...
[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-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 ...
[truncated message content] |
|
From: <ka...@us...> - 2014-08-16 17:24:54
|
Revision: 1463
http://sourceforge.net/p/agate/code/1463
Author: kanato
Date: 2014-08-16 17:24:43 +0000 (Sat, 16 Aug 2014)
Log Message:
-----------
Add maximum value to NaturalCoordinates.
Some fixes to GUI.
Begin implementation of fixed/absolute CSS positioning.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/IO/SubDirectoryProvider.cs
trunk/AgateLib/UserInterface/Css/CssBackground.cs
trunk/AgateLib/UserInterface/Css/CssBorder.cs
trunk/AgateLib/UserInterface/Css/CssBorderImage.cs
trunk/AgateLib/UserInterface/Css/CssFont.cs
trunk/AgateLib/UserInterface/Css/CssLayout.cs
trunk/AgateLib/UserInterface/Css/CssStyle.cs
trunk/AgateLib/UserInterface/Css/CssStyleData.cs
trunk/AgateLib/UserInterface/Css/Layout/CssLayoutEngine.cs
trunk/AgateLib/UserInterface/Css/Rendering/CssDefaultImageProvider.cs
trunk/AgateLib/UserInterface/Css/Rendering/CssRenderer.cs
trunk/AgateLib/UserInterface/Css/Rendering/WidgetAnimator.cs
trunk/AgateLib/UserInterface/Widgets/Container.cs
trunk/AgateLib/UserInterface/Widgets/Gui.cs
trunk/AgateLib/UserInterface/Widgets/Linq/WidgetExtensions.cs
trunk/AgateLib/UserInterface/Widgets/Widget.cs
trunk/AgateLib/UserInterface/Widgets/Window.cs
trunk/AgateLib.Platform.WindowsForms/PlatformImplementation/FileSystemProvider.cs
trunk/Tests/UserInterfaceTests/GuiStuff.cs
trunk/UnitTests/UserInterface/Css/AdapterTest.cs
trunk/UnitTests/UserInterface/Css/LayoutTest.cs
Added Paths:
-----------
trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs
Removed Paths:
-------------
trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-16 17:24:43 UTC (rev 1463)
@@ -84,6 +84,7 @@
<Compile Include="Algorithms\PathFinding\AStarNode.cs" />
<Compile Include="Algorithms\PathFinding\AStarState.cs" />
<Compile Include="Algorithms\Inverting.cs" />
+ <Compile Include="ApplicationModels\CoordinateSystems\NaturalCoordinates.cs" />
<Compile Include="DisplayLib\FontSettings.cs" />
<Compile Include="DisplayLib\FontStyles.cs" />
<Compile Include="Drivers\NullDrivers\NullInputFactory.cs" />
@@ -96,7 +97,6 @@
</Compile>
<Compile Include="ApplicationModels\AgateAppModel.cs" />
<Compile Include="ApplicationModels\AssetLocations.cs" />
- <Compile Include="ApplicationModels\CoordinateSystems\NaturalCoordinates.cs" />
<Compile Include="ApplicationModels\CoordinateSystems\FixedAspectRatioCoordinates.cs" />
<Compile Include="ApplicationModels\ICoordinateSystemCreator.cs" />
<Compile Include="ApplicationModels\ModelParameters.cs" />
Deleted: trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -1,20 +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 provides a one-to-one mapping to the pixels
- /// in the display window.
- /// </summary>
- public class NaturalCoordinates : ICoordinateSystemCreator
- {
- public Rectangle DetermineCoordinateSystem(Size displayWindowSize)
- {
- return new Rectangle(0, 0, displayWindowSize.Width, displayWindowSize.Height);
- }
- }
-}
Added: trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs (rev 0)
+++ trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -0,0 +1,30 @@
+using AgateLib.Geometry;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.ApplicationModels.CoordinateSystems
+{
+ /// <summary>
+ /// Constructs a coordinate system which matches the pixels coordinates of the display window,
+ /// up to an optional maximum height and width.
+ /// </summary>
+ public class NaturalCoordinates : ICoordinateSystemCreator
+ {
+ public Rectangle DetermineCoordinateSystem(Size displayWindowSize)
+ {
+ Rectangle retval = new Rectangle(Point.Empty, displayWindowSize);
+
+ if (MaxSize != null)
+ {
+ retval.Width = Math.Min(retval.Width, MaxSize.Value.Width);
+ retval.Height = Math.Max(retval.Height, MaxSize.Value.Height);
+ }
+
+ return retval;
+ }
+
+ public Size? MaxSize { get; set; }
+ }
+}
Modified: trunk/AgateLib/IO/SubDirectoryProvider.cs
===================================================================
--- trunk/AgateLib/IO/SubDirectoryProvider.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/IO/SubDirectoryProvider.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -20,6 +20,10 @@
this.subdir += "/";
}
+ public override string ToString()
+ {
+ return parent.ToString() + subdir;
+ }
public System.IO.Stream OpenRead(string filename)
{
return parent.OpenRead(subdir + filename);
Modified: trunk/AgateLib/UserInterface/Css/CssBackground.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssBackground.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Css/CssBackground.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -8,12 +8,20 @@
namespace AgateLib.UserInterface.Css
{
- public class CssBackground
+ public class CssBackground : ICssPropertyFromText
{
public CssBackground()
{
+ Initialize();
+ }
+
+ private void Initialize()
+ {
Color = Color.FromArgb(0, 0, 0, 0);
+ Image = null;
+ Repeat = 0;
Position = new CssBackgroundPosition();
+ Clip = 0;
}
public Color Color { get; set; }
@@ -21,6 +29,16 @@
public CssBackgroundRepeat Repeat { get; set; }
public CssBackgroundClip Clip { get; set; }
public CssBackgroundPosition Position { get; set; }
+
+ public void SetValueFromText(string value)
+ {
+ if (value == "none")
+ {
+ Initialize();
+ }
+ else
+ throw new NotImplementedException();
+ }
}
public class CssBackgroundPosition : ICssPropertyFromText
Modified: trunk/AgateLib/UserInterface/Css/CssBorder.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssBorder.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Css/CssBorder.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -75,6 +75,18 @@
public class CssBorderData : ICssPropertyFromText
{
+ public CssBorderData()
+ {
+ Initialize();
+ }
+
+ private void Initialize()
+ {
+ Style = CssBorderStyle.None;
+ Width = new CssDistance();
+ Color = Color.FromArgb(0, 0, 0, 0);
+ }
+
public CssBorderStyle Style { get; set; }
public CssDistance Width { get; set; }
@@ -83,6 +95,12 @@
public void SetValueFromText(string value)
{
+ if (value == "none")
+ {
+ Initialize();
+ return;
+ }
+
string[] values = value.Split(Extensions.WhiteSpace);
foreach (var v in values)
@@ -104,6 +122,7 @@
}
}
}
+
}
public enum CssBorderStyle
Modified: trunk/AgateLib/UserInterface/Css/CssBorderImage.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssBorderImage.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Css/CssBorderImage.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -11,9 +11,16 @@
{
public CssBorderImage()
{
+ Initialize();
+ }
+
+ private void Initialize()
+ {
+ Source = string.Empty;
Slice = new CssBorderImageComponent();
Width = new CssBorderImageComponent();
Outset = new CssBorderImageComponent();
+ Repeat = CssBorderImageRepeat.Initial;
}
public string Source { get; set; }
@@ -24,7 +31,14 @@
public void SetValueFromText(string value)
{
- throw new NotImplementedException();
+ if (value == "none")
+ {
+ Initialize();
+ }
+ else
+ {
+ throw new NotImplementedException();
+ }
}
}
Modified: trunk/AgateLib/UserInterface/Css/CssFont.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssFont.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Css/CssFont.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -11,6 +11,11 @@
{
public class CssFont
{
+ public CssFont()
+ {
+ Color = Color.Black;
+ }
+
[CssAlias("font-family")]
public string Family { get; set; }
Modified: trunk/AgateLib/UserInterface/Css/CssLayout.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssLayout.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Css/CssLayout.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -44,6 +44,5 @@
Column,
Row,
Grid,
-
}
}
Modified: trunk/AgateLib/UserInterface/Css/CssStyle.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssStyle.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Css/CssStyle.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -12,8 +12,8 @@
{
public class CssStyle
{
- string mClassValue;
- List<string> mSplitClasses;
+ string mClassValue = string.Empty;
+ List<string> mSplitClasses = new List<string>();
public CssStyle(Widget widget)
{
@@ -39,6 +39,7 @@
get { return mClassValue; }
set
{
+ if (value == null) throw new ArgumentNullException();
if (mClassValue.Equals(value, StringComparison.OrdinalIgnoreCase))
return;
Modified: trunk/AgateLib/UserInterface/Css/CssStyleData.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssStyleData.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Css/CssStyleData.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -21,7 +21,7 @@
{
Selector = "";
- Position = new CssRectangle();
+ PositionData = new CssRectangle();
Font = new CssFont();
Background = new CssBackground();
Margin = new CssBoxComponent();
@@ -36,8 +36,10 @@
public CssSelectorGroup Selector { get; set; }
[CssPromoteProperties]
- public CssRectangle Position { get; set; }
+ public CssRectangle PositionData { get; set; }
+ public CssPosition Position { get; set; }
+
[CssPromoteProperties]
public CssFont Font { get; set; }
@@ -61,4 +63,13 @@
[CssPromoteProperties(prefix: "transition")]
public CssTransition Transition { get; set; }
}
+
+ public enum CssPosition
+ {
+ Initial,
+ Static = Initial,
+ Relative,
+ Absolute,
+ Fixed,
+ }
}
Modified: trunk/AgateLib/UserInterface/Css/Layout/CssLayoutEngine.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Layout/CssLayoutEngine.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Css/Layout/CssLayoutEngine.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -25,10 +25,39 @@
{
gui.Desktop.Width = renderTargetSize.Width;
gui.Desktop.Height = renderTargetSize.Height;
+ SetDesktopAnimatorProperties(gui.Desktop);
RedoLayout(gui.Desktop);
+
+ RedoFixedLayout(gui.Desktop);
}
+ private void SetDesktopAnimatorProperties(Desktop desktop)
+ {
+ var style = mAdapter.GetStyle(desktop);
+
+ style.Animator.ClientRect = new Rectangle(0, 0, desktop.Width, desktop.Height);
+ style.Animator.WidgetSize = new Size(desktop.Width, desktop.Height);
+ }
+
+ private void RedoFixedLayout(Desktop desktop)
+ {
+ foreach (var child in desktop.Descendants)
+ {
+ var style = mAdapter.GetStyle(child);
+ var sz = style.Animator.ClientRect.Size;
+ var box = style.BoxModel;
+
+ switch (style.Data.Position)
+ {
+ case CssPosition.Absolute:
+ case CssPosition.Fixed:
+ SetFixedCoordinates(style, box, sz);
+ break;
+ }
+ }
+ }
+
private void RedoLayout(Container container)
{
var containerStyle = mAdapter.GetStyle(container);
@@ -49,8 +78,8 @@
containerAnim.ClientRect.Width = maxWidth;
- int? fixedContainerWidth = ConvertDistance(container, containerStyle.Data.Position.Width, true);
- int? fixedContainerHeight = ConvertDistance(container, containerStyle.Data.Position.Height, true);
+ int? fixedContainerWidth = ConvertDistance(container, containerStyle.Data.PositionData.Width, true);
+ int? fixedContainerHeight = ConvertDistance(container, containerStyle.Data.PositionData.Height, true);
if (fixedContainerWidth != null)
maxWidth = (int)fixedContainerWidth;
@@ -61,8 +90,8 @@
var sz = ComputeSize(child, containerStyle);
var box = style.BoxModel;
- int? fixedWidth = ConvertDistance(child, style.Data.Position.Width, true);
- int? fixedHeight = ConvertDistance(child, style.Data.Position.Height, false);
+ int? fixedWidth = ConvertDistance(child, style.Data.PositionData.Width, true);
+ int? fixedHeight = ConvertDistance(child, style.Data.PositionData.Height, false);
if (fixedWidth != null) sz.Width = (int)fixedWidth;
if (fixedHeight != null) sz.Height = (int)fixedHeight;
@@ -79,6 +108,8 @@
break;
}
+ bool includeInLayout = true;
+
var anim = style.Animator;
anim.ClientRect.X = nextPos.X + box.Left;
@@ -86,6 +117,19 @@
anim.ClientRect.Width = sz.Width;
anim.ClientRect.Height = sz.Height;
+ switch (style.Data.Position)
+ {
+ case CssPosition.Absolute:
+ includeInLayout = false;
+ anim.ParentCoordinateSystem = TopLevelWidget(child, x => mAdapter.GetStyle(x).Data.Position == CssPosition.Relative);
+ break;
+
+ case CssPosition.Fixed:
+ includeInLayout = false;
+ anim.ParentCoordinateSystem = TopLevelWidget(child);
+ break;
+ }
+
anim.ClientWidgetOffset = new Point(
box.Padding.Left + box.Border.Left,
box.Padding.Top + box.Border.Top);
@@ -94,22 +138,25 @@
anim.ClientRect.Width + box.Padding.Left + box.Padding.Right + box.Border.Left + box.Border.Right,
anim.ClientRect.Height + box.Padding.Top + box.Padding.Bottom + box.Border.Bottom + box.Border.Top);
- switch (containerStyle.Data.Layout.Kind)
+ if (includeInLayout)
{
- case CssLayoutKind.Flow:
- nextPos.X += anim.ClientRect.Width + box.Left + box.Right;
- largestWidth = Math.Max(largestWidth, nextPos.X);
- break;
+ switch (containerStyle.Data.Layout.Kind)
+ {
+ case CssLayoutKind.Flow:
+ nextPos.X += anim.ClientRect.Width + box.Left + box.Right;
+ largestWidth = Math.Max(largestWidth, nextPos.X);
+ break;
- case CssLayoutKind.Column:
- nextPos.X = 0;
- nextPos.Y += anim.ClientRect.Height + box.Top + box.Bottom;
- largestWidth = Math.Max(largestWidth, anim.ClientRect.Width + box.Right + box.Left);
- break;
+ case CssLayoutKind.Column:
+ nextPos.X = 0;
+ nextPos.Y += anim.ClientRect.Height + box.Top + box.Bottom;
+ largestWidth = Math.Max(largestWidth, anim.ClientRect.Width + box.Right + box.Left);
+ break;
+ }
+
+ maxHeight = Math.Max(maxHeight, anim.ClientRect.Height + box.Top + box.Bottom);
+ bottom = Math.Max(bottom, anim.ClientRect.Y + anim.ClientRect.Height + box.Bottom); // only add box.Bottom here, because box.Top is taken into account in child.Y.
}
-
- maxHeight = Math.Max(maxHeight, anim.ClientRect.Height + box.Top + box.Bottom);
- bottom = Math.Max(bottom, anim.ClientRect.Y + anim.ClientRect.Height + box.Bottom); // only add box.Bottom here, because box.Top is taken into account in child.Y.
}
containerAnim.ClientRect.Width = Math.Min(largestWidth, maxWidth);
@@ -130,14 +177,14 @@
var box = style.BoxModel;
int width = containerAnim.ClientRect.Width - box.Left - box.Right;
- if (style.Data.Position.MinWidth.Automatic == false)
+ if (style.Data.PositionData.MinWidth.Automatic == false)
{
- int minwidth = mAdapter.CssDistanceToPixels(containerStyle, style.Data.Position.MinWidth, true);
+ int minwidth = mAdapter.CssDistanceToPixels(containerStyle, style.Data.PositionData.MinWidth, true);
width = Math.Max(width, minwidth);
}
- if (style.Data.Position.MaxWidth.Automatic == false)
+ if (style.Data.PositionData.MaxWidth.Automatic == false)
{
- int maxwidth = mAdapter.CssDistanceToPixels(containerStyle, style.Data.Position.MaxWidth, true);
+ int maxwidth = mAdapter.CssDistanceToPixels(containerStyle, style.Data.PositionData.MaxWidth, true);
width = Math.Min(width, maxwidth);
}
@@ -145,8 +192,57 @@
}
break;
}
+
+
}
+ private void SetFixedCoordinates(CssStyle style, CssBoxModel box, Size sz)
+ {
+ var anim = style.Animator;
+ var position = style.Data.PositionData;
+ var parentStyle = mAdapter.GetStyle(style.Widget.Parent);
+
+ if (position.Left.Automatic == false)
+ {
+ anim.ClientRect.X = ConvertDistance(style.Widget, position.Left, true, false).Value;
+ }
+ if (position.Right.Automatic == false)
+ {
+ int targetRight = ConvertDistance(style.Widget, position.Right, true, false).Value;
+ targetRight = parentStyle.Animator.WidgetSize.Width - targetRight;
+
+ anim.ClientRect.X = targetRight - anim.ClientRect.Width;
+ }
+ if (position.Top.Automatic == false)
+ {
+ anim.ClientRect.Y = ConvertDistance(style.Widget, position.Top, false, false).Value;
+ }
+ if (position.Bottom.Automatic == false)
+ {
+ int targetBottom = ConvertDistance(style.Widget, position.Bottom, false, false).Value;
+ targetBottom = parentStyle.Animator.WidgetSize.Height - targetBottom;
+
+ anim.ClientRect.Y = targetBottom - anim.ClientRect.Height;
+ }
+ }
+
+ private Widget TopLevelWidget(Widget child)
+ {
+ return TopLevelWidget(child, x => true);
+ }
+ private Widget TopLevelWidget(Widget child, Func<Widget, bool> continueToParent)
+ {
+ var retval = child.Parent;
+
+ if (retval == null)
+ return child;
+
+ if (continueToParent(retval) == false)
+ return retval;
+
+ return TopLevelWidget(retval, continueToParent);
+ }
+
private int ComputeMaxWidthForContainer(CssStyle style)
{
Container container = (Container)style.Widget;
@@ -159,11 +255,11 @@
int availableWidth = parentStyle.Animator.ClientRect.Width - container.X;
- if (styleData.Position.MaxWidth.Automatic)
+ if (styleData.PositionData.MaxWidth.Automatic)
return availableWidth;
else
{
- int maxWidth = mAdapter.CssDistanceToPixels(style, styleData.Position.MaxWidth, true);
+ int maxWidth = mAdapter.CssDistanceToPixels(style, styleData.PositionData.MaxWidth, true);
return Math.Min(availableWidth, maxWidth);
}
@@ -181,10 +277,10 @@
var style = mAdapter.GetStyle(control);
return control.ComputeSize(
- ConvertDistance(control, style.Data.Position.MinWidth, true),
- ConvertDistance(control, style.Data.Position.MinHeight, false),
- ConvertDistance(control, style.Data.Position.MaxWidth, true),
- ConvertDistance(control, style.Data.Position.MaxHeight, false));
+ ConvertDistance(control, style.Data.PositionData.MinWidth, true),
+ ConvertDistance(control, style.Data.PositionData.MinHeight, false),
+ ConvertDistance(control, style.Data.PositionData.MaxWidth, true),
+ ConvertDistance(control, style.Data.PositionData.MaxHeight, false));
}
private int? ConvertDistance(Widget control, CssDistance cssDistance, bool width, bool autoIsNull = true)
Modified: trunk/AgateLib/UserInterface/Css/Rendering/CssDefaultImageProvider.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Rendering/CssDefaultImageProvider.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Css/Rendering/CssDefaultImageProvider.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -18,7 +18,7 @@
file = file.Substring(4, file.Length - 5);
if (mSurfaces.ContainsKey(file) == false)
- mSurfaces.Add(file, new Surface(file));
+ mSurfaces.Add(file, new Surface(file, AgateLib.IO.FileProvider.UserInterfaceAssets));
return mSurfaces[file];
}
Modified: trunk/AgateLib/UserInterface/Css/Rendering/CssRenderer.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Rendering/CssRenderer.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Css/Rendering/CssRenderer.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -31,7 +31,7 @@
public void Update(Gui gui, double deltaTime)
{
- foreach (var widget in gui.Desktop.Descendants())
+ foreach (var widget in gui.Desktop.Descendants)
{
var style = mAdapter.GetStyle(widget);
Modified: trunk/AgateLib/UserInterface/Css/Rendering/WidgetAnimator.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Rendering/WidgetAnimator.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Css/Rendering/WidgetAnimator.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -45,5 +45,7 @@
Transition.Update(deltaTime);
}
}
+
+ public Widgets.Widget ParentCoordinateSystem { get; set; }
}
}
Modified: trunk/AgateLib/UserInterface/Widgets/Container.cs
===================================================================
--- trunk/AgateLib/UserInterface/Widgets/Container.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Widgets/Container.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -19,6 +19,26 @@
public WidgetList Children { get; protected set; }
+ /// <summary>
+ /// Enumerates all descendants of this container.
+ /// </summary>
+ public IEnumerable<Widget> Descendants
+ {
+ get
+ {
+ foreach (var w in Children)
+ {
+ yield return w;
+ }
+
+ foreach (var w in Children.OfType<Container>())
+ {
+ foreach (var ww in ((Container)w).Descendants)
+ yield return ww;
+ }
+ }
+ }
+
public bool ChildHasMouseIn
{
get
Modified: trunk/AgateLib/UserInterface/Widgets/Gui.cs
===================================================================
--- trunk/AgateLib/UserInterface/Widgets/Gui.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Widgets/Gui.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -10,7 +10,7 @@
namespace AgateLib.UserInterface.Widgets
{
- public class Gui
+ public class Gui : IInputHandler
{
Desktop mDesktop;
IAudioPlayer mAudioPlayer;
@@ -28,6 +28,8 @@
mDesktop = new Desktop(this);
InputMap = InputMap.CreateDefaultMapping();
+
+ ForwardUnhandledEvents = true;
}
public InputMap InputMap { get ; set; }
@@ -53,8 +55,43 @@
set { mFocusWidget = value; }
}
- public void OnKeyDown(InputEventArgs args)
+ private void FindFocusWidget()
{
+ foreach (var window in mDesktop.Windows.Reverse())
+ {
+ mFocusWidget = window.FindFocusWidget();
+
+ if (mFocusWidget != null)
+ return;
+ }
+ }
+
+ private Widget WidgetAt(Point point)
+ {
+ return WidgetAt(Desktop, point);
+ }
+ private Widget WidgetAt(Container container, Point point)
+ {
+ foreach (var child in container.Children)
+ {
+ if (child.WidgetRect.Contains(point))
+ {
+ if (child is Container)
+ {
+ return WidgetAt((Container)child, child.ParentToClient(point));
+ }
+ else
+ return child;
+ }
+ }
+
+ return container;
+ }
+
+ #region --- Event Handling ---
+
+ public void OnKeyDown(AgateInputEventArgs args)
+ {
bool handled = false;
GuiInput input = InputMap.MapKey(args.KeyCode);
@@ -74,7 +111,7 @@
DispatchEvent(window => { window.OnInputButtonDown(args.KeyCode, ref handled); return handled; });
}
}
- public void OnKeyUp(InputEventArgs args)
+ public void OnKeyUp(AgateInputEventArgs args)
{
bool handled = false;
@@ -91,39 +128,89 @@
}
}
- private void FindFocusWidget()
+ public void OnMouseMove(AgateInputEventArgs e)
{
- foreach (var window in mDesktop.Windows.Reverse())
+ Widget targetWidget = mMouseEventWidget;
+
+ if (targetWidget == null)
+ targetWidget = WidgetAt(e.MousePosition);
+
+ if (mHoverWidget != targetWidget)
{
- mFocusWidget = window.FindFocusWidget();
+ if (mHoverWidget != null)
+ {
+ mHoverWidget.MouseIn = false;
+ mHoverWidget.OnMouseLeave();
+ }
- if (mFocusWidget != null)
- return;
+ targetWidget.MouseIn = true;
+ targetWidget.OnMouseEnter();
+
+ mHoverWidget = targetWidget;
}
+
+ targetWidget.OnMouseMove(targetWidget.ScreenToClient(e.MousePosition));
}
+ public void OnMouseDown(AgateInputEventArgs e)
+ {
+ var targetWidget = WidgetAt(e.MousePosition);
- private Widget WidgetAt(Point point)
+ mMouseEventWidget = targetWidget;
+
+ targetWidget.OnMouseDown(e.MouseButton, targetWidget.ScreenToClient(e.MousePosition));
+ }
+ public void OnMouseUp(AgateInputEventArgs e)
{
- return WidgetAt(Desktop, point);
+ Widget targetWidget = mMouseEventWidget;
+
+ if (targetWidget == null)
+ targetWidget = WidgetAt(e.MousePosition);
+
+ mMouseEventWidget = null;
+ targetWidget.OnMouseUp(e.MouseButton, targetWidget.ScreenToClient(e.MousePosition));
}
- private Widget WidgetAt(Container container, Point point)
+
+ [Obsolete]
+ public void OnKeyDown(InputEventArgs args)
{
- foreach (var child in container.Children)
+ bool handled = false;
+ GuiInput input = InputMap.MapKey(args.KeyCode);
+
+ if (mFocusWidget == null)
+ FindFocusWidget();
+
+ if (mFocusWidget != null)
{
- if (child.WidgetRect.Contains(point))
+ mFocusWidget.OnKeyDown(args.KeyCode, args.KeyString);
+ if (input != GuiInput.None)
{
- if (child is Container)
- {
- return WidgetAt((Container)child, child.ParentToClient(point));
- }
- else
- return child;
+ mFocusWidget.OnGuiInput(input, ref handled);
}
}
+ else
+ {
+ DispatchEvent(window => { window.OnInputButtonDown(args.KeyCode, ref handled); return handled; });
+ }
+ }
+ [Obsolete]
+ public void OnKeyUp(InputEventArgs args)
+ {
+ bool handled = false;
- return container;
+ if (mFocusWidget == null)
+ FindFocusWidget();
+
+ if (mFocusWidget != null)
+ {
+ mFocusWidget.OnKeyUp(args.KeyCode, args.KeyString);
+ }
+ else
+ {
+ DispatchEvent(window => { window.OnInputButtonUp(args.KeyCode, ref handled); return handled; });
+ }
}
+ [Obsolete]
public void OnMouseMove(InputEventArgs e)
{
Widget targetWidget = mMouseEventWidget;
@@ -147,6 +234,7 @@
targetWidget.OnMouseMove(targetWidget.ScreenToClient(e.MousePosition));
}
+ [Obsolete]
public void OnMouseDown(InputEventArgs e)
{
var targetWidget = WidgetAt(e.MousePosition);
@@ -155,7 +243,7 @@
targetWidget.OnMouseDown(e.MouseButtons, targetWidget.ScreenToClient(e.MousePosition));
}
- public void OnMouseUp(InputEventArgs e)
+ [Obsolete] public void OnMouseUp(InputEventArgs e)
{
Widget targetWidget = mMouseEventWidget;
@@ -166,6 +254,8 @@
targetWidget.OnMouseUp(e.MouseButtons, targetWidget.ScreenToClient(e.MousePosition));
}
+ #endregion
+
public void OnUpdate(double delta_t, bool processInput)
{
mLayout.RedoLayout(this);
@@ -251,7 +341,19 @@
internal AgateLib.UserInterface.Css.CssDocument CssDocument { get; set; }
+ public void ProcessEvent(AgateInputEventArgs args)
+ {
+ switch(args.InputEventType)
+ {
+ case InputEventType.KeyDown: OnKeyDown(args); break;
+ case InputEventType.KeyUp: OnKeyUp(args); break;
+ case InputEventType.MouseDown: OnMouseDown(args); break;
+ case InputEventType.MouseUp: OnMouseUp(args); break;
+ case InputEventType.MouseMove: OnMouseMove(args); break;
+ }
+ }
+ public bool ForwardUnhandledEvents { get;set;}
}
class WindowList : IList<Window>
Modified: trunk/AgateLib/UserInterface/Widgets/Linq/WidgetExtensions.cs
===================================================================
--- trunk/AgateLib/UserInterface/Widgets/Linq/WidgetExtensions.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Widgets/Linq/WidgetExtensions.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -8,18 +8,5 @@
{
public static class WidgetExtensions
{
- public static IEnumerable<Widget> Descendants(this Container container)
- {
- foreach (var w in container.Children)
- {
- yield return w;
- }
-
- foreach (var w in container.Children.OfType<Container>())
- {
- foreach (var ww in ((Container)w).Descendants())
- yield return ww;
- }
- }
}
}
Modified: trunk/AgateLib/UserInterface/Widgets/Widget.cs
===================================================================
--- trunk/AgateLib/UserInterface/Widgets/Widget.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Widgets/Widget.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -18,6 +18,7 @@
private Font mFont;
private Color? mFontColor;
private bool mEnabled = true;
+ string mStyle = string.Empty;
public Widget()
{
@@ -243,8 +244,18 @@
public virtual bool Visible { get; set; }
- public string Style { get; set; }
+ public string Style
+ {
+ get { return mStyle; }
+ set
+ {
+ if (value == null)
+ throw new ArgumentNullException();
+ mStyle = value;
+ }
+ }
+
public virtual bool LayoutDirty { get; set; }
protected virtual Gui MyGui
Modified: trunk/AgateLib/UserInterface/Widgets/Window.cs
===================================================================
--- trunk/AgateLib/UserInterface/Widgets/Window.cs 2014-08-15 19:27:26 UTC (rev 1462)
+++ trunk/AgateLib/UserInterface/Widgets/Window.cs 2014-08-16 17:24:43 UTC (rev 1463)
@@ -17,6 +17,7 @@
}
public Window(strin...
[truncated message content] |
|
From: <ka...@us...> - 2014-08-17 22:08:29
|
Revision: 1466
http://sourceforge.net/p/agate/code/1466
Author: kanato
Date: 2014-08-17 22:08:19 +0000 (Sun, 17 Aug 2014)
Log Message:
-----------
Update mouse processing events for newer event system.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/DisplayLib/FrameBuffer.cs
trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs
trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs
trunk/AgateLib/InputLib/AgateInputEventArgs.cs
trunk/AgateLib/InputLib/Legacy/Mouse.cs
trunk/AgateLib/UserInterface/Widgets/MenuItem.cs
trunk/AgateLib/UserInterface/Widgets/WidgetList.cs
trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_DisplayControl.cs
trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_GameWindow.cs
trunk/UnitTests/Fakes/FakeDisplayWindow.cs
trunk/UnitTests/UnitTests.csproj
Added Paths:
-----------
trunk/AgateLib/UserInterface/Widgets/WidgetEventArgs.cs
trunk/UnitTests/Display/DisplayWindowTest.cs
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-17 05:36:22 UTC (rev 1465)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-17 22:08:19 UTC (rev 1466)
@@ -594,6 +594,7 @@
<Compile Include="UserInterface\Widgets\Panel.cs" />
<Compile Include="UserInterface\Widgets\ProgressBar.cs" />
<Compile Include="UserInterface\Widgets\Widget.cs" />
+ <Compile Include="UserInterface\Widgets\WidgetEventArgs.cs" />
<Compile Include="UserInterface\Widgets\WidgetList.cs" />
<Compile Include="UserInterface\Widgets\Window.cs" />
<Compile Include="UserInterface\WindowTransition.cs" />
Modified: trunk/AgateLib/DisplayLib/FrameBuffer.cs
===================================================================
--- trunk/AgateLib/DisplayLib/FrameBuffer.cs 2014-08-17 05:36:22 UTC (rev 1465)
+++ trunk/AgateLib/DisplayLib/FrameBuffer.cs 2014-08-17 22:08:19 UTC (rev 1466)
@@ -36,7 +36,6 @@
{
FrameBufferImpl impl;
Surface mRenderTarget;
- Rectangle mCoordinateSystem;
/// <summary>
/// Constructs a frame buffer to be used as a render target. FrameBuffers constructed
@@ -161,11 +160,8 @@
/// </summary>
public Rectangle CoordinateSystem
{
- get { return mCoordinateSystem; }
- set
- {
- mCoordinateSystem = value;
- }
+ get { return Impl.CoordinateSystem; }
+ set { Impl.CoordinateSystem = value; }
}
}
}
Modified: trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs 2014-08-17 05:36:22 UTC (rev 1465)
+++ trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs 2014-08-17 22:08:19 UTC (rev 1466)
@@ -161,5 +161,42 @@
/// </summary>
public event CancelEventHandler Closing;
+ /// <summary>
+ /// Converts a pixel location on screen to the logical coordinate system used by AgateLib.
+ /// This function is primarily for supporting input mouse and touch events.
+ /// </summary>
+ /// <param name="point"></param>
+ /// <returns></returns>
+ public Point PixelToLogicalCoords(Point point)
+ {
+ double x = point.X / (double)Width;
+ double y = point.Y / (double)Height;
+
+ Point retval = new Point(
+ (int)(x * FrameBuffer.CoordinateSystem.Width),
+ (int)(y * FrameBuffer.CoordinateSystem.Height));
+
+ retval.X += FrameBuffer.CoordinateSystem.X;
+ retval.Y += FrameBuffer.CoordinateSystem.Y;
+
+ return retval;
+ }
+ /// <summary>
+ /// Converts a logical coordinate to actual pixel coordinates.
+ /// </summary>
+ /// <param name="point"></param>
+ /// <returns></returns>
+ public Point LogicalToPixelCoords(Point point)
+ {
+ point.X -= FrameBuffer.CoordinateSystem.X;
+ point.Y -= FrameBuffer.CoordinateSystem.Y;
+
+ double x = point.X / (double)FrameBuffer.CoordinateSystem.Width;
+ double y = point.Y / (double)FrameBuffer.CoordinateSystem.Height;
+
+ return new Point(
+ (int)(x * Width),
+ (int)(y * Height));
+ }
}
}
\ No newline at end of file
Modified: trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs 2014-08-17 05:36:22 UTC (rev 1465)
+++ trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs 2014-08-17 22:08:19 UTC (rev 1466)
@@ -87,5 +87,10 @@
/// if this FrameBuffer is not attached to any window.
/// </summary>
public abstract DisplayWindow AttachedWindow { get; }
+
+ /// <summary>
+ /// Gets or sets the coordinate system that is used to map 2d coordinates to pixels in the render target.
+ /// </summary>
+ public virtual Rectangle CoordinateSystem { get; set; }
}
}
Modified: trunk/AgateLib/InputLib/AgateInputEventArgs.cs
===================================================================
--- trunk/AgateLib/InputLib/AgateInputEventArgs.cs 2014-08-17 05:36:22 UTC (rev 1465)
+++ trunk/AgateLib/InputLib/AgateInputEventArgs.cs 2014-08-17 22:08:19 UTC (rev 1466)
@@ -22,6 +22,32 @@
public MouseButton MouseButton { get; set; }
public int MouseWheelDelta { get; set; }
+ public static AgateInputEventArgs MouseDown(object sender, Point mousePosition, MouseButton button)
+ {
+ return new AgateInputEventArgs
+ {
+ InputEventType = InputEventType.MouseDown,
+ MousePosition = mousePosition,
+ MouseButton = button,
+ };
+ }
+ public static AgateInputEventArgs MouseUp(object sender, Point mousePosition, MouseButton button)
+ {
+ return new AgateInputEventArgs
+ {
+ InputEventType = InputEventType.MouseUp,
+ MousePosition = mousePosition,
+ MouseButton = button,
+ };
+ }
+ public static AgateInputEventArgs MouseMove(object sender, Point mousePosition)
+ {
+ return new AgateInputEventArgs
+ {
+ InputEventType = InputEventType.MouseMove,
+ MousePosition = mousePosition,
+ };
+ }
public static AgateInputEventArgs KeyDown(KeyCode code, KeyModifiers modifiers)
{
@@ -33,7 +59,6 @@
KeyModifiers = modifiers,
};
}
-
public static AgateInputEventArgs KeyUp(KeyCode code, KeyModifiers modifiers)
{
return new AgateInputEventArgs
Modified: trunk/AgateLib/InputLib/Legacy/Mouse.cs
===================================================================
--- trunk/AgateLib/InputLib/Legacy/Mouse.cs 2014-08-17 05:36:22 UTC (rev 1465)
+++ trunk/AgateLib/InputLib/Legacy/Mouse.cs 2014-08-17 22:08:19 UTC (rev 1466)
@@ -268,22 +268,23 @@
internal static void OnMouseDown(AgateInputEventArgs args)
{
- throw new NotImplementedException();
+ Buttons[args.MouseButton] = true;
}
internal static void OnMouseUp(AgateInputEventArgs args)
{
- throw new NotImplementedException();
+ Buttons[args.MouseButton] = false;
+
}
internal static void OnMouseWheel(AgateInputEventArgs args)
{
- throw new NotImplementedException();
+ OnMouseWheel(args.MouseWheelDelta);
}
internal static void OnMouseMove(AgateInputEventArgs args)
{
- throw new NotImplementedException();
+ Position = args.MousePosition;
}
}
Modified: trunk/AgateLib/UserInterface/Widgets/MenuItem.cs
===================================================================
--- trunk/AgateLib/UserInterface/Widgets/MenuItem.cs 2014-08-17 05:36:22 UTC (rev 1465)
+++ trunk/AgateLib/UserInterface/Widgets/MenuItem.cs 2014-08-17 22:08:19 UTC (rev 1466)
@@ -10,7 +10,10 @@
{
public MenuItem()
{
+ Children.WidgetAdded += Children_WidgetAdded;
+ Children.WidgetRemoved += Children_WidgetRemoved;
}
+
public MenuItem(params Widget[] children) : this()
{
Children.AddRange(children);
@@ -22,17 +25,17 @@
}
[Obsolete("Use static MenuItem.OfLabel method instead.")]
- public MenuItem(string name, string text)
+ public MenuItem(string name, string text) : this()
{
Name = name;
Children.Add(new Label(text));
}
- public MenuItem(Widget child)
+ public MenuItem(Widget child) : this()
{
Children.Add(child);
}
- public MenuItem(string name, Widget child)
+ public MenuItem(string name, Widget child) : this()
{
Name = name;
@@ -62,6 +65,72 @@
public event EventHandler PressMenu;
public event EventHandler Select;
+ void Children_WidgetAdded(object sender, WidgetEventArgs e)
+ {
+ var widget = e.Widget;
+ ListenToEventsIn(widget);
+ }
+ void Children_WidgetRemoved(object sender, WidgetEventArgs e)
+ {
+ var widget = e.Widget;
+ IgnoreEventsIn(widget);
+ }
+
+ private void ListenToEventsIn(Widget widget)
+ {
+ var container = widget as Container;
+
+ if (container != null)
+ {
+ container.Children.WidgetAdded += Children_WidgetAdded;
+ container.Children.WidgetRemoved += Children_WidgetRemoved;
+
+ foreach (var c in container.Children)
+ ListenToEventsIn(c);
+ }
+
+ widget.MouseDown += widget_MouseDown;
+ widget.MouseMove += widget_MouseMove;
+ widget.MouseUp += widget_MouseUp;
+ }
+
+ private void IgnoreEventsIn(Widget widget)
+ {
+ var container = widget as Container;
+
+ if (container != null)
+ {
+ container.Children.WidgetAdded -= Children_WidgetAdded;
+ container.Children.WidgetRemoved -= Children_WidgetRemoved;
+
+ foreach (var c in container.Children)
+ IgnoreEventsIn(c);
+ }
+
+ widget.MouseDown -= widget_MouseDown;
+ widget.MouseUp -= widget_MouseUp;
+ }
+
+ bool mouseDown;
+ void widget_MouseDown(object sender, MouseEventArgs e)
+ {
+ mouseDown = true;
+ }
+ void widget_MouseUp(object sender, MouseEventArgs e)
+ {
+ if (mouseDown)
+ {
+ OnPressAccept();
+ }
+
+ mouseDown = false;
+ }
+ void widget_MouseMove(object sender, MouseEventArgs e)
+ {
+ OnSelect();
+ }
+
+
internal void OnSelect()
{
if (Select != null)
Added: trunk/AgateLib/UserInterface/Widgets/WidgetEventArgs.cs
===================================================================
--- trunk/AgateLib/UserInterface/Widgets/WidgetEventArgs.cs (rev 0)
+++ trunk/AgateLib/UserInterface/Widgets/WidgetEventArgs.cs 2014-08-17 22:08:19 UTC (rev 1466)
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.UserInterface.Widgets
+{
+ public class WidgetEventArgs : EventArgs
+ {
+ public WidgetEventArgs(Widget widget)
+ {
+ this.Widget = widget;
+ }
+
+ public Widget Widget { get; private set; }
+ }
+}
Modified: trunk/AgateLib/UserInterface/Widgets/WidgetList.cs
===================================================================
--- trunk/AgateLib/UserInterface/Widgets/WidgetList.cs 2014-08-17 05:36:22 UTC (rev 1465)
+++ trunk/AgateLib/UserInterface/Widgets/WidgetList.cs 2014-08-17 22:08:19 UTC (rev 1466)
@@ -37,11 +37,13 @@
mItems.Insert(index, item);
item.Parent = mParent;
+ OnWidgetAdded(item);
}
public void RemoveAt(int index)
{
mItems[index].Parent = null;
+ OnWidgetRemoved(mItems[index]);
mItems.RemoveAt(index);
}
@@ -59,9 +61,11 @@
ValidateItem(value);
mItems[index].Parent = null;
+ OnWidgetRemoved(mItems[index]);
+
value.Parent = mParent;
-
mItems[index] = value;
+ OnWidgetAdded(value);
}
}
@@ -71,21 +75,26 @@
mItems.Add(item);
item.Parent = mParent;
+
+ OnWidgetAdded(item);
}
public void AddRange(IEnumerable<Widget> items)
{
if (items == null) throw new ArgumentNullException("item");
- mItems.AddRange(items);
-
foreach (var item in items)
- item.Parent = mParent;
+ {
+ Add(item);
+ }
}
public void Clear()
{
foreach (var item in mItems)
+ {
item.Parent = null;
+ OnWidgetRemoved(item);
+ }
mItems.Clear();
}
@@ -115,7 +124,10 @@
if (item == null) throw new ArgumentNullException("item");
if (mItems.Contains(item))
+ {
item.Parent = null;
+ OnWidgetRemoved(item);
+ }
return mItems.Remove(item);
}
@@ -152,6 +164,19 @@
return retval;
}
+
+ protected virtual void OnWidgetAdded(Widget widget)
+ {
+ if (WidgetAdded != null)
+ WidgetAdded(this, new WidgetEventArgs(widget));
+ }
+ protected virtual void OnWidgetRemoved(Widget widget)
+ {
+ if (WidgetRemoved != null)
+ WidgetRemoved(this, new WidgetEventArgs(widget));
+ }
+ public event EventHandler<WidgetEventArgs> WidgetAdded;
+ public event EventHandler<WidgetEventArgs> WidgetRemoved;
}
public class WidgetListOf<T> : WidgetList where T : Widget
Modified: trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_DisplayControl.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_DisplayControl.cs 2014-08-17 05:36:22 UTC (rev 1465)
+++ trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_DisplayControl.cs 2014-08-17 22:08:19 UTC (rev 1466)
@@ -421,7 +421,6 @@
form.KeyUp -= new System.Windows.Forms.KeyEventHandler(form_KeyUp);
form.FormClosing -= new FormClosingEventHandler(form_FormClosing);
form.FormClosed -= new FormClosedEventHandler(form_FormClosed);
-
}
void form_FormClosed(object sender, FormClosedEventArgs e)
@@ -480,17 +479,24 @@
{
var btn = GetButtons(e.Button);
- Mouse.Buttons[btn] = false;
+ //Mouse.Buttons[btn] = false;
+
+ Input.QueueInputEvent(AgateInputEventArgs.MouseUp(
+ this, PixelToLogicalCoords(new Point(e.X, e.Y)), btn));
}
void pct_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
var btn = GetButtons(e.Button);
- Mouse.Buttons[btn] = true;
+ //Mouse.Buttons[btn] = true;
+ Input.QueueInputEvent(AgateInputEventArgs.MouseDown(
+ this, PixelToLogicalCoords(new Point(e.X, e.Y)), btn));
}
void pct_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
SetInternalMousePosition(Interop.Convert(e.Location));
+ Input.QueueInputEvent(AgateInputEventArgs.MouseMove(
+ this, PixelToLogicalCoords(new Point(e.X, e.Y))));
}
void renderTarget_Disposed(object sender, EventArgs e)
{
Modified: trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_GameWindow.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_GameWindow.cs 2014-08-17 05:36:22 UTC (rev 1465)
+++ trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_GameWindow.cs 2014-08-17 22:08:19 UTC (rev 1466)
@@ -261,12 +261,19 @@
void Mouse_ButtonUp(object sender, OpenTK.Input.MouseButtonEventArgs e)
{
var agatebutton = TransformButton(e.Button);
- Mouse.Buttons[agatebutton] = false;
+ //Mouse.Buttons[agatebutton] = false;
+
+ Input.QueueInputEvent(AgateInputEventArgs.MouseUp(
+ this, PixelToLogicalCoords(new Point(e.X, e.Y)), agatebutton));
}
void Mouse_ButtonDown(object sender, OpenTK.Input.MouseButtonEventArgs e)
{
var agatebutton = TransformButton(e.Button);
- Mouse.Buttons[agatebutton] = true;
+
+ Input.QueueInputEvent(AgateInputEventArgs.MouseDown(
+ this, PixelToLogicalCoords(new Point(e.X, e.Y)), agatebutton));
+
+ //Mouse.Buttons[agatebutton] = true;
}
void Mouse_Move(object sender, OpenTK.Input.MouseMoveEventArgs e)
{
Added: trunk/UnitTests/Display/DisplayWindowTest.cs
===================================================================
--- trunk/UnitTests/Display/DisplayWindowTest.cs (rev 0)
+++ trunk/UnitTests/Display/DisplayWindowTest.cs 2014-08-17 22:08:19 UTC (rev 1466)
@@ -0,0 +1,46 @@
+using AgateLib.Geometry;
+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 DisplayWindowTest
+ {
+ FakeDisplayWindow wind;
+
+ [TestInitialize]
+ public void Initialize()
+ {
+ wind = new FakeDisplayWindow(new Size(500, 500));
+
+ wind.FrameBuffer.CoordinateSystem = new Geometry.Rectangle(50, 50, 1000, 1000);
+ }
+
+ [TestMethod]
+ public void XCoordinateSystemRoundTrip()
+ {
+ for (int j = -50; j < 1000; j += 250)
+ {
+ for (int i = -50; i < 1000; i += 250)
+ {
+ Point p = new Point(i, j);
+
+ Assert.AreEqual(p, wind.PixelToLogicalCoords(wind.LogicalToPixelCoords(p)));
+ }
+ }
+ }
+
+ [TestMethod]
+ public void XCoordinateSystem()
+ {
+ Assert.AreEqual(new Point(50, 50), wind.PixelToLogicalCoords(Point.Empty));
+ Assert.AreEqual(new Point(1050, 1050), wind.PixelToLogicalCoords(new Point(500, 500)));
+ }
+ }
+}
Modified: trunk/UnitTests/Fakes/FakeDisplayWindow.cs
===================================================================
--- trunk/UnitTests/Fakes/FakeDisplayWindow.cs 2014-08-17 05:36:22 UTC (rev 1465)
+++ trunk/UnitTests/Fakes/FakeDisplayWindow.cs 2014-08-17 22:08:19 UTC (rev 1466)
@@ -1,5 +1,6 @@
using AgateLib.DisplayLib;
using AgateLib.DisplayLib.ImplementationBase;
+using AgateLib.Geometry;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,10 +12,18 @@
class FakeDisplayWindow : DisplayWindowImpl
{
private DisplayWindow owner;
-
private CreateWindowParams windowParams;
+ private FrameBufferImpl frameBuffer;
+ private bool isDisposed;
+ public FakeDisplayWindow(Size size)
+ {
+ frameBuffer = new FakeFrameBuffer(this);
+
+ this.Size = size;
+ }
public FakeDisplayWindow(DisplayWindow owner, CreateWindowParams windowParams)
+ :this(windowParams.Size)
{
// TODO: Complete member initialization
this.owner = owner;
@@ -28,72 +37,41 @@
}
public override void Dispose()
{
+ isDisposed = true;
}
public override bool IsClosed
{
- get { throw new NotImplementedException(); }
+ get { return isDisposed; }
}
public override bool IsFullScreen
{
- get { throw new NotImplementedException(); }
+ get { return false; }
}
public override FrameBufferImpl FrameBuffer
{
- get { return new FakeFrameBuffer(this); }
+ get { return frameBuffer; }
}
public override void SetWindowed()
{
throw new NotImplementedException();
}
-
public override void SetFullScreen()
{
throw new NotImplementedException();
}
-
public override void SetFullScreen(int width, int height, int bpp)
{
throw new NotImplementedException();
}
- public override Geometry.Size Size
- {
- get
- {
- throw new NotImplementedException();
- }
- set
- {
- throw new NotImplementedException();
- }
- }
+ public override Size Size { get;set;}
- public override string Title
- {
- get
- {
- throw new NotImplementedException();
- }
- set
- {
- throw new NotImplementedException();
- }
- }
+ public override string Title { get;set;}
- public override Geometry.Point MousePosition
- {
- get
- {
- throw new NotImplementedException();
- }
- set
- {
- throw new NotImplementedException();
- }
- }
+ public override Point MousePosition { get;set;}
}
}
Modified: trunk/UnitTests/UnitTests.csproj
===================================================================
--- trunk/UnitTests/UnitTests.csproj 2014-08-17 05:36:22 UTC (rev 1465)
+++ trunk/UnitTests/UnitTests.csproj 2014-08-17 22:08:19 UTC (rev 1466)
@@ -93,6 +93,7 @@
<Compile Include="ApplicationModels\CoordinateSystemTest.cs" />
<Compile Include="Core\ConsoleTests.cs" />
<Compile Include="Display\DisplayTests.cs" />
+ <Compile Include="Display\DisplayWindowTest.cs" />
<Compile Include="Display\FontTests.cs" />
<Compile Include="Extensions\ListExtensions.cs" />
<Compile Include="Fakes\FakeAgateFactory.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-19 06:16:17
|
Revision: 1467
http://sourceforge.net/p/agate/code/1467
Author: kanato
Date: 2014-08-19 06:16:00 +0000 (Tue, 19 Aug 2014)
Log Message:
-----------
Organize css properties and add copyright information to several files.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/Sprites/CollisionRegion.cs
trunk/AgateLib/Sprites/ISpriteContainer.cs
trunk/AgateLib/Sprites/SpriteContainer.cs
trunk/AgateLib/UnitTesting/AssertThrows.cs
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/StyleCache.cs
trunk/AgateLib/UserInterface/Css/CssAdapter.cs
trunk/AgateLib/UserInterface/Css/CssDocument.cs
trunk/AgateLib/UserInterface/Css/CssMedia.cs
trunk/AgateLib/UserInterface/Css/CssPseudoClass.cs
trunk/AgateLib/UserInterface/Css/CssRuleBlock.cs
trunk/AgateLib/UserInterface/Css/CssStyle.cs
trunk/AgateLib/UserInterface/Css/CssStyleData.cs
trunk/AgateLib/UserInterface/Css/Extensions.cs
trunk/AgateLib/UserInterface/Css/ICssCanSelect.cs
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/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/CssParser.cs
trunk/AgateLib/UserInterface/Css/Parser/CssPromoteProperties.cs
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/CssDefaultImageProvider.cs
trunk/AgateLib/UserInterface/Css/Rendering/CssRenderer.cs
trunk/AgateLib/UserInterface/Css/Rendering/ICssImageProvider.cs
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/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/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/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/WidgetEventArgs.cs
trunk/AgateLib/UserInterface/Widgets/WidgetList.cs
trunk/AgateLib/UserInterface/Widgets/Window.cs
trunk/AgateLib/UserInterface/WindowTransition.cs
trunk/Tests/UserInterfaceTests/GuiStuff.cs
trunk/UnitTests/UserInterface/Css/AdapterTest.cs
trunk/UnitTests/UserInterface/Css/BindingTest.cs
trunk/UnitTests/UserInterface/Css/CssTestBase.cs
trunk/UnitTests/UserInterface/Css/ParseTest.cs
Added Paths:
-----------
trunk/AgateLib/UserInterface/Css/Properties/
trunk/AgateLib/UserInterface/Css/Properties/CssBackground.cs
trunk/AgateLib/UserInterface/Css/Properties/CssBackgroundPosition.cs
trunk/AgateLib/UserInterface/Css/Properties/CssBorder.cs
trunk/AgateLib/UserInterface/Css/Properties/CssBorderImage.cs
trunk/AgateLib/UserInterface/Css/Properties/CssBoxComponent.cs
trunk/AgateLib/UserInterface/Css/Properties/CssDistance.cs
trunk/AgateLib/UserInterface/Css/Properties/CssFont.cs
trunk/AgateLib/UserInterface/Css/Properties/CssLayout.cs
trunk/AgateLib/UserInterface/Css/Properties/CssRectangle.cs
trunk/AgateLib/UserInterface/Css/Properties/CssTransition.cs
trunk/AgateLib/UserInterface/Css/Properties/ICssBoxComponent.cs
trunk/AgateLib/UserInterface/Css/Properties/ICssPropertyFromText.cs
trunk/AgateLib/UserInterface/Css/Properties/PropertyEnums.cs
Removed Paths:
-------------
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/CssFont.cs
trunk/AgateLib/UserInterface/Css/CssLayout.cs
trunk/AgateLib/UserInterface/Css/CssRectangle.cs
trunk/AgateLib/UserInterface/Css/CssTransition.cs
trunk/AgateLib/UserInterface/Css/ICssBoxComponent.cs
trunk/AgateLib/UserInterface/Css/ICssPropertyFromText.cs
trunk/AgateLib/UserInterface/Widgets/Linq/
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-19 06:16:00 UTC (rev 1467)
@@ -526,26 +526,27 @@
<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\Properties\CssBackground.cs" />
+ <Compile Include="UserInterface\Css\Properties\CssBackgroundPosition.cs" />
+ <Compile Include="UserInterface\Css\Properties\CssBorder.cs" />
+ <Compile Include="UserInterface\Css\Properties\CssBorderImage.cs" />
+ <Compile Include="UserInterface\Css\Properties\CssBoxComponent.cs" />
+ <Compile Include="UserInterface\Css\Properties\PropertyEnums.cs" />
+ <Compile Include="UserInterface\Css\Properties\CssDistance.cs" />
<Compile Include="UserInterface\Css\CssDocument.cs" />
- <Compile Include="UserInterface\Css\CssFont.cs" />
- <Compile Include="UserInterface\Css\CssLayout.cs" />
+ <Compile Include="UserInterface\Css\Properties\CssFont.cs" />
+ <Compile Include="UserInterface\Css\Properties\CssLayout.cs" />
<Compile Include="UserInterface\Css\CssMedia.cs" />
<Compile Include="UserInterface\Css\CssPseudoClass.cs" />
- <Compile Include="UserInterface\Css\CssRectangle.cs" />
+ <Compile Include="UserInterface\Css\Properties\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\Properties\CssTransition.cs" />
<Compile Include="UserInterface\Css\Extensions.cs" />
- <Compile Include="UserInterface\Css\ICssBoxComponent.cs" />
+ <Compile Include="UserInterface\Css\Properties\ICssBoxComponent.cs" />
<Compile Include="UserInterface\Css\ICssCanSelect.cs" />
- <Compile Include="UserInterface\Css\ICssPropertyFromText.cs" />
+ <Compile Include="UserInterface\Css\Properties\ICssPropertyFromText.cs" />
<Compile Include="UserInterface\Css\Layout\CssBox.cs" />
<Compile Include="UserInterface\Css\Layout\CssBoxModel.cs" />
<Compile Include="UserInterface\Css\Layout\CssLayoutEngine.cs" />
@@ -587,7 +588,6 @@
<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" />
Modified: trunk/AgateLib/Sprites/CollisionRegion.cs
===================================================================
--- trunk/AgateLib/Sprites/CollisionRegion.cs 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/Sprites/CollisionRegion.cs 2014-08-19 06:16:00 UTC (rev 1467)
@@ -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/Sprites/ISpriteContainer.cs
===================================================================
--- trunk/AgateLib/Sprites/ISpriteContainer.cs 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/Sprites/ISpriteContainer.cs 2014-08-19 06:16:00 UTC (rev 1467)
@@ -1,4 +1,22 @@
-using AgateLib.Geometry;
+// 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;
using System;
using System.Collections.Generic;
Modified: trunk/AgateLib/Sprites/SpriteContainer.cs
===================================================================
--- trunk/AgateLib/Sprites/SpriteContainer.cs 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/Sprites/SpriteContainer.cs 2014-08-19 06:16:00 UTC (rev 1467)
@@ -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/UnitTesting/AssertThrows.cs
===================================================================
--- trunk/AgateLib/UnitTesting/AssertThrows.cs 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/UnitTesting/AssertThrows.cs 2014-08-19 06:16:00 UTC (rev 1467)
@@ -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/UserInterface/Css/Binders/Binding.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/Binding.cs 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/UserInterface/Css/Binders/Binding.cs 2014-08-19 06:16:00 UTC (rev 1467)
@@ -1,4 +1,23 @@
-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 AgateLib.UserInterface.Css.Properties;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
Modified: trunk/AgateLib/UserInterface/Css/Binders/CssAlias.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/CssAlias.cs 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/UserInterface/Css/Binders/CssAlias.cs 2014-08-19 06:16:00 UTC (rev 1467)
@@ -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/UserInterface/Css/Binders/CssBindingMapper.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/CssBindingMapper.cs 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/UserInterface/Css/Binders/CssBindingMapper.cs 2014-08-19 06:16:00 UTC (rev 1467)
@@ -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.Reflection;
Modified: trunk/AgateLib/UserInterface/Css/Binders/CssPropertyMap.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/CssPropertyMap.cs 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/UserInterface/Css/Binders/CssPropertyMap.cs 2014-08-19 06:16:00 UTC (rev 1467)
@@ -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/UserInterface/Css/Binders/CssTypeConverter.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/CssTypeConverter.cs 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/UserInterface/Css/Binders/CssTypeConverter.cs 2014-08-19 06:16:00 UTC (rev 1467)
@@ -1,4 +1,23 @@
-using AgateLib.Geometry;
+// 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;
+using AgateLib.UserInterface.Css.Properties;
using System;
using System.Collections.Generic;
using System.Linq;
Modified: trunk/AgateLib/UserInterface/Css/Binders/PropertyChain.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/PropertyChain.cs 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/UserInterface/Css/Binders/PropertyChain.cs 2014-08-19 06:16:00 UTC (rev 1467)
@@ -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.Reflection;
Modified: trunk/AgateLib/UserInterface/Css/Binders/ReflectionPropertyBinder.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/ReflectionPropertyBinder.cs 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/UserInterface/Css/Binders/ReflectionPropertyBinder.cs 2014-08-19 06:16:00 UTC (rev 1467)
@@ -1,4 +1,22 @@
-using AgateLib.Geometry;
+// 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;
using AgateLib.UserInterface.Css.Parser;
using System;
using System.Collections.Generic;
Modified: trunk/AgateLib/UserInterface/Css/Cache/StyleCache.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Cache/StyleCache.cs 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/UserInterface/Css/Cache/StyleCache.cs 2014-08-19 06:16:00 UTC (rev 1467)
@@ -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/UserInterface/Css/CssAdapter.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssAdapter.cs 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/UserInterface/Css/CssAdapter.cs 2014-08-19 06:16:00 UTC (rev 1467)
@@ -1,6 +1,25 @@
-using AgateLib.DisplayLib;
+// 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.DisplayLib;
using AgateLib.UserInterface.Css.Layout;
using AgateLib.UserInterface.Css.Layout.Defaults;
+using AgateLib.UserInterface.Css.Properties;
using AgateLib.UserInterface.Css.Selectors;
using AgateLib.UserInterface.Widgets;
using System;
Deleted: trunk/AgateLib/UserInterface/Css/CssBackground.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssBackground.cs 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/UserInterface/Css/CssBackground.cs 2014-08-19 06:16:00 UTC (rev 1467)
@@ -1,86 +0,0 @@
-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 : ICssPropertyFromText
- {
- public CssBackground()
- {
- Initialize();
- }
-
- private void Initialize()
- {
- Color = Color.FromArgb(0, 0, 0, 0);
- Image = null;
- Repeat = 0;
- Position = new CssBackgroundPosition();
- Clip = 0;
- }
-
- 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 void SetValueFromText(string value)
- {
- if (value == "none")
- {
- Initialize();
- }
- else
- throw new NotImplementedException();
- }
- }
-
- 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,
- }
-}
Deleted: trunk/AgateLib/UserInterface/Css/CssBorder.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssBorder.cs 2014-08-17 22:08:19 UTC (rev 1466)
+++ trunk/AgateLib/UserInterface/Css/CssBorder.cs 2014-08-19 06:16:00 UTC (rev 1467)
@@ -1,134 +0,0 @@
-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 CssBorderData()
- {
- Initialize();
- }
-
- private void Initialize()
- {
- Style = CssBorderStyle.None;
- Width = new CssDistance();
- Color = Color.FromArgb(0, 0, 0, 0);
- }
-
- public CssBorderStyle Style { get; set; }
-
- public CssDistance Width { get; set; }
-
- public Color Colo...
[truncated message content] |
|
From: <ka...@us...> - 2014-08-19 20:16:28
|
Revision: 1468
http://sourceforge.net/p/agate/code/1468
Author: kanato
Date: 2014-08-19 20:16:14 +0000 (Tue, 19 Aug 2014)
Log Message:
-----------
Initial implementation of css media selection.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/ApplicationModels/AgateAppModel.cs
trunk/AgateLib/ApplicationModels/ModelParameters.cs
trunk/AgateLib/Platform/PlatformInfo.cs
trunk/AgateLib/UserInterface/Css/Binders/Binding.cs
trunk/AgateLib/UserInterface/Css/Binders/CssTypeConverter.cs
trunk/AgateLib/UserInterface/Css/CssAdapter.cs
trunk/AgateLib/UserInterface/Css/CssStyleData.cs
trunk/AgateLib/UserInterface/Css/Documents/CssBackground.cs
trunk/AgateLib/UserInterface/Css/Documents/CssBackgroundPosition.cs
trunk/AgateLib/UserInterface/Css/Documents/CssBorder.cs
trunk/AgateLib/UserInterface/Css/Documents/CssBorderImage.cs
trunk/AgateLib/UserInterface/Css/Documents/CssBoxComponent.cs
trunk/AgateLib/UserInterface/Css/Documents/CssDistance.cs
trunk/AgateLib/UserInterface/Css/Documents/CssFont.cs
trunk/AgateLib/UserInterface/Css/Documents/CssLayout.cs
trunk/AgateLib/UserInterface/Css/Documents/CssRectangle.cs
trunk/AgateLib/UserInterface/Css/Documents/CssTransition.cs
trunk/AgateLib/UserInterface/Css/Documents/ICssBoxComponent.cs
trunk/AgateLib/UserInterface/Css/Documents/ICssPropertyFromText.cs
trunk/AgateLib/UserInterface/Css/Documents/PropertyEnums.cs
trunk/AgateLib/UserInterface/Css/Layout/CssLayoutEngine.cs
trunk/AgateLib/UserInterface/Css/Layout/Defaults/MenuDefaultStyle.cs
trunk/AgateLib/UserInterface/Css/Parser/CssParser.cs
trunk/AgateLib/UserInterface/Css/Rendering/CssRenderer.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/CssSelector.cs
trunk/AgateLib/UserInterface/Css/Selectors/CssSelectorChain.cs
trunk/AgateLib/UserInterface/Css/Selectors/ICssSelector.cs
trunk/AgateLib/UserInterface/Widgets/Gui.cs
trunk/AgateLib.Platform.WindowsForms/PlatformImplementation/FormsPlatformInfo.cs
Added Paths:
-----------
trunk/AgateLib/Platform/PlatformEnums.cs
trunk/AgateLib/UserInterface/Css/CssMediaInfo.cs
trunk/AgateLib/UserInterface/Css/Documents/
trunk/AgateLib/UserInterface/Css/Documents/CssDocument.cs
trunk/AgateLib/UserInterface/Css/Documents/CssMediaSelector.cs
Removed Paths:
-------------
trunk/AgateLib/Platform/PlatformType.cs
trunk/AgateLib/UserInterface/Css/CssDocument.cs
trunk/AgateLib/UserInterface/Css/CssMedia.cs
trunk/AgateLib/UserInterface/Css/Properties/
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-19 06:16:00 UTC (rev 1467)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-19 20:16:14 UTC (rev 1468)
@@ -183,7 +183,7 @@
<Compile Include="IO\SubDirectoryProvider.cs" />
<Compile Include="Platform\IStopWatch.cs" />
<Compile Include="Platform\PlatformInfo.cs" />
- <Compile Include="Platform\PlatformType.cs" />
+ <Compile Include="Platform\PlatformEnums.cs" />
<Compile Include="Resources\Legacy\ImageResource.cs" />
<Compile Include="Serialization\Xle\CompressionMode.cs" />
<Compile Include="Serialization\Xle\CompressionType.cs" />
@@ -526,27 +526,28 @@
<Compile Include="UserInterface\Css\Binders\ReflectionPropertyBinder.cs" />
<Compile Include="UserInterface\Css\Cache\StyleCache.cs" />
<Compile Include="UserInterface\Css\CssAdapter.cs" />
- <Compile Include="UserInterface\Css\Properties\CssBackground.cs" />
- <Compile Include="UserInterface\Css\Properties\CssBackgroundPosition.cs" />
- <Compile Include="UserInterface\Css\Properties\CssBorder.cs" />
- <Compile Include="UserInterface\Css\Properties\CssBorderImage.cs" />
- <Compile Include="UserInterface\Css\Properties\CssBoxComponent.cs" />
- <Compile Include="UserInterface\Css\Properties\PropertyEnums.cs" />
- <Compile Include="UserInterface\Css\Properties\CssDistance.cs" />
- <Compile Include="UserInterface\Css\CssDocument.cs" />
- <Compile Include="UserInterface\Css\Properties\CssFont.cs" />
- <Compile Include="UserInterface\Css\Properties\CssLayout.cs" />
- <Compile Include="UserInterface\Css\CssMedia.cs" />
+ <Compile Include="UserInterface\Css\CssMediaInfo.cs" />
+ <Compile Include="UserInterface\Css\Documents\CssBackground.cs" />
+ <Compile Include="UserInterface\Css\Documents\CssBackgroundPosition.cs" />
+ <Compile Include="UserInterface\Css\Documents\CssBorder.cs" />
+ <Compile Include="UserInterface\Css\Documents\CssBorderImage.cs" />
+ <Compile Include="UserInterface\Css\Documents\CssBoxComponent.cs" />
+ <Compile Include="UserInterface\Css\Documents\PropertyEnums.cs" />
+ <Compile Include="UserInterface\Css\Documents\CssDistance.cs" />
+ <Compile Include="UserInterface\Css\Documents\CssDocument.cs" />
+ <Compile Include="UserInterface\Css\Documents\CssFont.cs" />
+ <Compile Include="UserInterface\Css\Documents\CssLayout.cs" />
+ <Compile Include="UserInterface\Css\Documents\CssMediaSelector.cs" />
<Compile Include="UserInterface\Css\CssPseudoClass.cs" />
- <Compile Include="UserInterface\Css\Properties\CssRectangle.cs" />
+ <Compile Include="UserInterface\Css\Documents\CssRectangle.cs" />
<Compile Include="UserInterface\Css\CssRuleBlock.cs" />
<Compile Include="UserInterface\Css\CssStyle.cs" />
<Compile Include="UserInterface\Css\CssStyleData.cs" />
- <Compile Include="UserInterface\Css\Properties\CssTransition.cs" />
+ <Compile Include="UserInterface\Css\Documents\CssTransition.cs" />
<Compile Include="UserInterface\Css\Extensions.cs" />
- <Compile Include="UserInterface\Css\Properties\ICssBoxComponent.cs" />
+ <Compile Include="UserInterface\Css\Documents\ICssBoxComponent.cs" />
<Compile Include="UserInterface\Css\ICssCanSelect.cs" />
- <Compile Include="UserInterface\Css\Properties\ICssPropertyFromText.cs" />
+ <Compile Include="UserInterface\Css\Documents\ICssPropertyFromText.cs" />
<Compile Include="UserInterface\Css\Layout\CssBox.cs" />
<Compile Include="UserInterface\Css\Layout\CssBoxModel.cs" />
<Compile Include="UserInterface\Css\Layout\CssLayoutEngine.cs" />
Modified: trunk/AgateLib/ApplicationModels/AgateAppModel.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/AgateAppModel.cs 2014-08-19 06:16:00 UTC (rev 1467)
+++ trunk/AgateLib/ApplicationModels/AgateAppModel.cs 2014-08-19 20:16:14 UTC (rev 1468)
@@ -1,6 +1,7 @@
using AgateLib.DisplayLib;
using AgateLib.Geometry;
using AgateLib.InputLib;
+using AgateLib.Platform;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -14,8 +15,8 @@
public static AgateAppModel Instance { get; private set; }
- public static bool IsAlive
- {
+ public static bool IsAlive
+ {
get
{
if (Instance == null)
@@ -31,7 +32,7 @@
}
}
-
+
static Func<int> ActionToFunc(Action entry)
{
return () => { entry(); return 0; };
@@ -50,6 +51,11 @@
Instance = this;
}
+ /// <summary>
+ /// Initializes the applicatin model. This will process command line arguments and initialize AgateLib.
+ /// It is not required to call this function manually, it will be called by the Run method if it has not
+ /// been called.
+ /// </summary>
public void Initialize()
{
ProcessArguments();
@@ -57,6 +63,9 @@
InitializeImpl();
}
+ /// <summary>
+ /// Override this to provide proper platform initialization of AgateLib.
+ /// </summary>
protected virtual void InitializeImpl()
{ }
@@ -67,24 +76,49 @@
if (Instance == this)
Instance = null;
}
+ /// <summary>
+ /// Override this to clean up the platform initialization of AgateLib.
+ /// </summary>
+ /// <param name="disposing"></param>
protected virtual void Dispose(bool disposing)
{ }
-
+ /// <summary>
+ /// Runs the application model with the specified entry point for your application.
+ /// </summary>
+ /// <param name="entry">A delegate which will be called to run your application.</param>
+ /// <returns>Returns 0.</returns>
public int Run(Action entry)
{
return RunImpl(entry);
}
+ /// <summary>
+ /// Runs the application model with the specified entry point for your application.
+ /// </summary>
+ /// <param name="entry">A delegate which will be called to run your application.</param>
+ /// <returns>Returns the return value from the <c>entry</c> parameter.</returns>
public int Run(Func<int> entry)
{
return RunImpl(entry);
}
+ /// <summary>
+ /// Runs the application model with the specified entry point and command line arguments for your application.
+ /// </summary>
+ /// <param name="args">The command arguments to process.</param>
+ /// <param name="entry">A delegate which will be called to run your application.</param>
+ /// <returns>Returns 0.</returns>
public int Run(string[] args, Action entry)
{
Parameters.Arguments = args;
return RunImpl(entry);
}
+ /// <summary>
+ /// Runs the application model with the specified entry point and command line arguments for your application.
+ /// </summary>
+ /// <param name="args">The command arguments to process.</param>
+ /// <param name="entry">A delegate which will be called to run your application.</param>
+ /// <returns>Returns the return value from the <c>entry</c> parameter.</returns>
public int Run(string[] args, Func<int> entry)
{
Parameters.Arguments = args;
@@ -96,6 +130,12 @@
{
return RunImpl(ActionToFunc(entry));
}
+ /// <summary>
+ /// Runs the application model by calling RunModel. If you override this, make
+ /// sure to catch the ExitGameException and return 0 in the exception handler.
+ /// </summary>
+ /// <param name="entry"></param>
+ /// <returns></returns>
protected virtual int RunImpl(Func<int> entry)
{
try
@@ -108,42 +148,57 @@
}
}
+ /// <summary>
+ /// Processes command line arguments.
+ /// </summary>
protected virtual void ProcessArguments()
{
if (Parameters.Arguments == null) return;
- for(int i = 0; i < Parameters.Arguments.Length; i++)
+ List<string> p = new List<string>();
+
+ for (int i = 0; i < Parameters.Arguments.Length; i++)
{
var arg = Parameters.Arguments[i];
- int extraArguments = Parameters.Arguments.Length - i- 1;
- bool nextArgIsParam = extraArguments > 0 && Parameters.Arguments[i+1].StartsWith("--") == false;
+ int extraArguments = Parameters.Arguments.Length - i - 1;
- if (arg.StartsWith("--"))
+ p.Clear();
+ for (int j = i+1; j < Parameters.Arguments.Length; j++)
{
- if (nextArgIsParam)
- {
- ProcessArgument(arg, Parameters.Arguments[i + 1]);
- i++;
- }
+ if (Parameters.Arguments[j].StartsWith("-") == false)
+ p.Add(Parameters.Arguments[j]);
else
- ProcessArgument(arg, "");
+ break;
}
+
+ if (arg.StartsWith("--"))
+ {
+ ProcessArgument(arg, p);
+
+ i += p.Count;
+ }
}
}
- protected virtual void ProcessArgument(string arg, string parm)
+ protected virtual void ProcessArgument(string arg, IList<string> parm)
{
- switch(arg)
+ switch (arg)
{
case "--window":
Parameters.CreateFullScreenWindow = false;
- Parameters.DisplayWindowSize = Size.FromString(parm);
+ if (parm.Count > 0)
+ Parameters.DisplayWindowSize = Size.FromString(parm[0]);
break;
case "--novsync":
Parameters.VerticalSync = false;
break;
+ case "--emulate-device":
+ if (parm.Count > 0)
+ Parameters.EmulateDeviceType = (DeviceType)Enum.Parse(typeof(DeviceType), parm[0], true);
+ break;
+
default:
break;
}
@@ -155,6 +210,7 @@
{
Initialize();
AutoCreateDisplayWindow();
+ SetPlatformEmulation();
int retval = BeginModel(entryPoint);
@@ -169,15 +225,23 @@
}
}
+ private void SetPlatformEmulation()
+ {
+ if (Parameters.EmulateDeviceType != DeviceType.Unknown)
+ {
+ Core.Platform.DeviceType = Parameters.EmulateDeviceType;
+ }
+ }
+
protected abstract int BeginModel(Func<int> entryPoint);
-
+
private void AutoCreateDisplayWindow()
{
if (Parameters.AutoCreateDisplayWindow == false)
return;
if (Parameters.CreateFullScreenWindow)
- {
+ {
window = DisplayWindow.CreateFullScreen(
Parameters.ApplicationName,
GetFullScreenSize());
@@ -221,8 +285,8 @@
{
if (Parameters.DisplayWindowSize.IsEmpty)
return GetScreenSize();
-
- if (Parameters.DisplayWindowSize.Width == 0 ) throw new AgateException("Cannot create a display window with width 0.");
+
+ if (Parameters.DisplayWindowSize.Width == 0) throw new AgateException("Cannot create a display window with width 0.");
if (Parameters.DisplayWindowSize.Height == 0) throw new AgateException("Cannot create a display window with height 0.");
return Parameters.DisplayWindowSize;
Modified: trunk/AgateLib/ApplicationModels/ModelParameters.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/ModelParameters.cs 2014-08-19 06:16:00 UTC (rev 1467)
+++ trunk/AgateLib/ApplicationModels/ModelParameters.cs 2014-08-19 20:16:14 UTC (rev 1468)
@@ -1,5 +1,6 @@
using AgateLib.ApplicationModels.CoordinateSystems;
using AgateLib.Geometry;
+using AgateLib.Platform;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -43,5 +44,7 @@
/// AutoCreateDisplayWindow is false, this property is not used.
/// </summary>
public ICoordinateSystemCreator CoordinateSystem { get; set; }
+
+ public DeviceType EmulateDeviceType { get; set; }
}
}
Copied: trunk/AgateLib/Platform/PlatformEnums.cs (from rev 1466, trunk/AgateLib/Platform/PlatformType.cs)
===================================================================
--- trunk/AgateLib/Platform/PlatformEnums.cs (rev 0)
+++ trunk/AgateLib/Platform/PlatformEnums.cs 2014-08-19 20:16:14 UTC (rev 1468)
@@ -0,0 +1,145 @@
+// 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;
+
+namespace AgateLib.Platform
+{
+ /// <summary>
+ /// Enumeration listing the known platform types.
+ /// </summary>
+ public enum PlatformType
+ {
+ /// <summary>
+ /// Default value.
+ /// </summary>
+ Unknown = 0,
+
+ /// <summary>
+ /// The Microsoft Windows platform, including Windows 98, Windows NT, Windows XP, Windows Vista, etc.
+ /// </summary>
+ Windows,
+ /// <summary>
+ /// Some Linux / Unix platform, typically running with an X windowing system.
+ /// </summary>
+ Linux,
+ /// <summary>
+ /// Mac OS 10.3 or later.
+ /// </summary>
+ MacOS,
+
+ /// <summary>
+ /// Microsoft's XBox 360 console.
+ /// </summary>
+ XBox360,
+ /// <summary>
+ /// The portable GP2x handheld, or compatible.
+ /// </summary>
+ Gp2x,
+
+ /// <summary>
+ /// An device running the Android operating system.
+ /// </summary>
+ Android,
+ }
+
+ /// <summary>
+ /// Enum which indicates which type of device we are running on.
+ /// </summary>
+ public enum DeviceType
+ {
+ /// <summary>
+ /// Undetermined device type
+ /// </summary>
+ Unknown = 0,
+
+ /// <summary>
+ /// A desktop or laptop computer with a mouse and keyboard for input.
+ /// </summary>
+ Computer,
+ /// <summary>
+ /// A tablet with a large screen and the main input method is the touch screen.
+ /// </summary>
+ Tablet,
+ /// <summary>
+ /// A handheld device such as a smart phone with a small but possibly high resolution screen.
+ /// </summary>
+ Handheld,
+ }
+
+ /// <summary>
+ /// Enum indicating which version of Microsoft Windows is currently being run.
+ /// </summary>
+ public enum WindowsVersion
+ {
+ /// <summary>
+ /// An unknown version of Windows.
+ /// </summary>
+ Unknown = 0,
+
+ /// <summary>
+ /// Windows 98.
+ /// </summary>
+ Windows98,
+ /// <summary>
+ /// Windows XP or Server 2003.
+ /// </summary>
+ WindowsXP,
+ /// <summary>
+ /// Windows Vista or Server 2008.
+ /// </summary>
+ WindowsVista,
+ /// <summary>
+ /// Windows 7.
+ /// </summary>
+ Windows7,
+ /// <summary>
+ /// Windows 8.
+ /// </summary>
+ Windows8
+ }
+
+ /// <summary>
+ /// Enum indicating which .NET runtime is currently in use.
+ /// </summary>
+ public enum DotNetRuntime
+ {
+ /// <summary>
+ /// An unknown runtime.
+ /// </summary>
+ Unknown = 0,
+
+ /// <summary>
+ /// Microsoft's runtime.
+ /// </summary>
+ MicrosoftDotNet = 1,
+ /// <summary>
+ /// The runtime of the Mono project.
+ /// </summary>
+ Mono = 2,
+ /// <summary>
+ /// The DotGnu / Portable.NET runtime.
+ /// Note that presence of this enumeration value does not indicate
+ /// that using AgateLib on DotGnu is supported.
+ /// </summary>
+ DotGnu = 9999,
+ }
+}
Modified: trunk/AgateLib/Platform/PlatformInfo.cs
===================================================================
--- trunk/AgateLib/Platform/PlatformInfo.cs 2014-08-19 06:16:00 UTC (rev 1467)
+++ trunk/AgateLib/Platform/PlatformInfo.cs 2014-08-19 20:16:14 UTC (rev 1468)
@@ -13,8 +13,9 @@
protected internal abstract void SetFolderPaths(string mCompanyName, string mAppName);
protected internal abstract void EnsureAppDataDirectoryExists();
- public abstract PlatformType PlatformType { get; }
+ public PlatformType PlatformType { get; protected internal set; }
+ public DeviceType DeviceType { get; protected internal set; }
- public abstract DotNetRuntime Runtime { get; }
+ public DotNetRuntime Runtime { get; protected internal set; }
}
}
Deleted: trunk/AgateLib/Platform/PlatformType.cs
===================================================================
--- trunk/AgateLib/Platform/PlatformType.cs 2014-08-19 06:16:00 UTC (rev 1467)
+++ trunk/AgateLib/Platform/PlatformType.cs 2014-08-19 20:16:14 UTC (rev 1468)
@@ -1,116 +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;
-
-namespace AgateLib.Platform
-{
- /// <summary>
- /// Enumeration listing the known platform types.
- /// </summary>
- public enum PlatformType
- {
- /// <summary>
- /// Default value.
- /// </summary>
- Unknown = 0,
-
- /// <summary>
- /// The Microsoft Windows platform, including Windows 98, Windows NT, Windows XP, Windows Vista, etc.
- /// </summary>
- Windows,
- /// <summary>
- /// Some Linux / Unix platform, typically running with an X windowing system.
- /// </summary>
- Linux,
- /// <summary>
- /// Mac OS 10.3 or later.
- /// </summary>
- MacOS,
-
- /// <summary>
- /// Microsoft's XBox 360 console.
- /// </summary>
- XBox360,
- /// <summary>
- /// The portable GP2x handheld, or compatible.
- /// </summary>
- Gp2x,
- }
-
- /// <summary>
- /// Enum indicating which version of Microsoft Windows is currently being run.
- /// </summary>
- public enum WindowsVersion
- {
- /// <summary>
- /// An unknown version of Windows.
- /// </summary>
- Unknown = 0,
-
- /// <summary>
- /// Windows 98.
- /// </summary>
- Windows98,
- /// <summary>
- /// Windows XP or Server 2003.
- /// </summary>
- WindowsXP,
- /// <summary>
- /// Windows Vista or Server 2008.
- /// </summary>
- WindowsVista,
- /// <summary>
- /// Windows 7.
- /// </summary>
- Windows7,
- /// <summary>
- /// Windows 8.
- /// </summary>
- Windows8
- }
-
- /// <summary>
- /// Enum indicating which .NET runtime is currently in use.
- /// </summary>
- public enum DotNetRuntime
- {
- /// <summary>
- /// An unknown runtime.
- /// </summary>
- Unknown = 0,
-
- /// <summary>
- /// Microsoft's runtime.
- /// </summary>
- MicrosoftDotNet = 1,
- /// <summary>
- /// The runtime of the Mono project.
- /// </summary>
- Mono = 2,
- /// <summary>
- /// The DotGnu / Portable.NET runtime.
- /// Note that presence of this enumeration value does not indicate
- /// that using AgateLib on DotGnu is supported.
- /// </summary>
- DotGnu = 9999,
- }
-}
Modified: trunk/AgateLib/UserInterface/Css/Binders/Binding.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/Binding.cs 2014-08-19 06:16:00 UTC (rev 1467)
+++ trunk/AgateLib/UserInterface/Css/Binders/Binding.cs 2014-08-19 20:16:14 UTC (rev 1468)
@@ -16,7 +16,7 @@
//
// Contributor(s): Erik Ylvisaker
//
-using AgateLib.UserInterface.Css.Properties;
+using AgateLib.UserInterface.Css.Documents;
using System;
using System.Collections.Generic;
using System.Linq;
Modified: trunk/AgateLib/UserInterface/Css/Binders/CssTypeConverter.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Binders/CssTypeConverter.cs 2014-08-19 06:16:00 UTC (rev 1467)
+++ trunk/AgateLib/UserInterface/Css/Binders/CssTypeConverter.cs 2014-08-19 20:16:14 UTC (rev 1468)
@@ -17,7 +17,7 @@
// Contributor(s): Erik Ylvisaker
//
using AgateLib.Geometry;
-using AgateLib.UserInterface.Css.Properties;
+using AgateLib.UserInterface.Css.Documents;
using System;
using System.Collections.Generic;
using System.Linq;
Modified: trunk/AgateLib/UserInterface/Css/CssAdapter.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssAdapter.cs 2014-08-19 06:16:00 UTC (rev 1467)
+++ trunk/AgateLib/UserInterface/Css/CssAdapter.cs 2014-08-19 20:16:14 UTC (rev 1468)
@@ -19,7 +19,7 @@
using AgateLib.DisplayLib;
using AgateLib.UserInterface.Css.Layout;
using AgateLib.UserInterface.Css.Layout.Defaults;
-using AgateLib.UserInterface.Css.Properties;
+using AgateLib.UserInterface.Css.Documents;
using AgateLib.UserInterface.Css.Selectors;
using AgateLib.UserInterface.Widgets;
using System;
@@ -27,6 +27,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using AgateLib.Platform;
namespace AgateLib.UserInterface.Css
{
@@ -35,13 +36,31 @@
Dictionary<Widget, CssStyle> mObjectStyles = new Dictionary<Widget, CssStyle>();
DefaultStyleCollection mDefaultStyles = new DefaultStyleCollection();
private CssDocument mDocument;
-
+
internal CssAdapter(CssDocument doc)
{
Document = doc;
+
+ MediumInfo = new CssMediumInfo();
+
+ switch (Core.Platform.DeviceType)
+ {
+ case DeviceType.Computer:
+ MediumInfo.MediaType = MediaType.Screen;
+ break;
+
+ case DeviceType.Handheld:
+ MediumInfo.MediaType = MediaType.Handheld;
+ break;
+
+ case DeviceType.Tablet:
+ MediumInfo.MediaType = MediaType.Tablet;
+ break;
+ }
}
- public CssAdapter(CssDocument doc, Font defaultFont) : this(doc)
+ public CssAdapter(CssDocument doc, Font defaultFont)
+ : this(doc)
{
this.DefaultFont = defaultFont;
}
@@ -55,8 +74,6 @@
{
mDocument = value;
- CurrentMedium = mDocument.DefaultMedium;
-
foreach (var style in mObjectStyles.Values)
{
style.AppliedBlocks.Clear();
@@ -233,7 +250,7 @@
return;
mDefaultStyles[style.Widget.GetType()].InheritParentProperties(style, GetStyle(style.Widget.Parent));
-
+
}
private void ReportError(string p)
@@ -254,20 +271,23 @@
string id = control.Name;
IEnumerable<string> classes = GetCssClasses(style);
- foreach (var block in CurrentMedium.RuleBlocks)
+ foreach (var medium in ApplicableMedia)
{
- if (BlockAppliesTo(block, control, id, classes))
+ foreach (var block in medium.RuleBlocks)
{
- if (style.AppliedBlocks.Contains(block) == false)
+ if (BlockAppliesTo(block, control, id, classes))
{
- style.AppliedBlocks.Add(block);
+ if (style.AppliedBlocks.Contains(block) == false)
+ {
+ style.AppliedBlocks.Add(block);
+ }
}
- }
- else
- {
- if (style.AppliedBlocks.Contains(block))
+ else
{
- style.AppliedBlocks.Remove(block);
+ if (style.AppliedBlocks.Contains(block))
+ {
+ style.AppliedBlocks.Remove(block);
+ }
}
}
}
@@ -327,8 +347,31 @@
return style.SplitClasses;
}
+ public CssMediumInfo MediumInfo { get; set; }
+ public IEnumerable<CssMediaSelector> ApplicableMedia
+ {
+ get
+ {
+ yield return Document.DefaultMedium;
- CssMedia CurrentMedium { get; set; }
+ foreach (var medium in Document.Media)
+ {
+ if (MediaSelectorApplies(medium.Selector, MediumInfo))
+ yield return medium;
+ }
+ }
+ }
+
+ private bool MediaSelectorApplies(CssSelectorGroup selectorGroup, CssMediumInfo medium)
+ {
+ foreach (var sel in selectorGroup.IndividualSelectors)
+ {
+ if (sel.Matches(medium.MediaType.ToString(), null, CssPseudoClass.None, null))
+ return true;
+ }
+
+ return false;
+ }
}
}
Deleted: trunk/AgateLib/UserInterface/Css/CssDocument.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssDocument.cs 2014-08-19 06:16:00 UTC (rev 1467)
+++ trunk/AgateLib/UserInterface/Css/CssDocument.cs 2014-08-19 20:16:14 UTC (rev 1468)
@@ -1,61 +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 AgateLib.UserInterface.Css.Binders;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AgateLib.UserInterface.Css
-{
- public class CssDocument
- {
- List<CssMedia> mMedia = new List<CssMedia>();
-
- public CssDocument()
- {
- var defaultMedium = new CssMedia { Selector = "all" };
- Media.Add(defaultMedium);
- }
- public static CssDocument Load(string filename)
- {
- CssDocument doc = new CssDocument();
- CssParser parser = new CssParser();
-
- parser.Load(doc, filename);
-
- return doc;
- }
- public static CssDocument FromText(string text)
- {
- CssDocument doc = new CssDocument();
- CssParser parser = new CssParser();
-
- parser.ParseCss(doc, text);
-
- return doc;
- }
-
-
- public List<CssMedia> Media { get { return mMedia; } }
-
- public CssMedia DefaultMedium { get { return mMedia.First(x => x.Selector.Text == "all"); } }
- }
-}
Deleted: trunk/AgateLib/UserInterface/Css/CssMedia.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/CssMedia.cs 2014-08-19 06:16:00 UTC (rev 1467)
+++ trunk/AgateLib/UserInterface/Css/CssMedia.cs 2014-08-19 20:16:14 UTC (rev 1468)
@@ -1,38 +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 AgateLib.UserInterface.Css.Selectors;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AgateLib.UserInterface.Css
-{
- public class CssMedia : ICssCanSelect
- {
- public CssMedia()
- {
- RuleBlocks = new List<CssRuleBlock>();
- }
-
- public CssSelectorGroup Selector { get;set;}
- public List<CssRuleBlock> RuleBlocks { get; private set; }
- }
-}
Added: trunk/AgateLib/UserInterface/Css/CssMediaInfo.cs
===...
[truncated message content] |
|
From: <ka...@us...> - 2014-08-19 20:17:07
|
Revision: 1469
http://sourceforge.net/p/agate/code/1469
Author: kanato
Date: 2014-08-19 20:17:02 +0000 (Tue, 19 Aug 2014)
Log Message:
-----------
Add unit test updates for namespace changes.
Modified Paths:
--------------
trunk/Tests/UserInterfaceTests/GuiStuff.cs
trunk/UnitTests/ApplicationModels/ArgumentProcessing.cs
trunk/UnitTests/Fakes/FakePlatformInfo.cs
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
Modified: trunk/Tests/UserInterfaceTests/GuiStuff.cs
===================================================================
--- trunk/Tests/UserInterfaceTests/GuiStuff.cs 2014-08-19 20:16:14 UTC (rev 1468)
+++ trunk/Tests/UserInterfaceTests/GuiStuff.cs 2014-08-19 20:17:02 UTC (rev 1469)
@@ -4,6 +4,7 @@
using AgateLib.InputLib.Legacy;
using AgateLib.Resources.Legacy;
using AgateLib.UserInterface.Css;
+using AgateLib.UserInterface.Css.Documents;
using AgateLib.UserInterface.Css.Layout;
using AgateLib.UserInterface.Css.Rendering;
using AgateLib.UserInterface.Widgets;
Modified: trunk/UnitTests/ApplicationModels/ArgumentProcessing.cs
===================================================================
--- trunk/UnitTests/ApplicationModels/ArgumentProcessing.cs 2014-08-19 20:16:14 UTC (rev 1468)
+++ trunk/UnitTests/ApplicationModels/ArgumentProcessing.cs 2014-08-19 20:17:02 UTC (rev 1469)
@@ -1,5 +1,6 @@
using AgateLib.ApplicationModels;
using AgateLib.Geometry;
+using AgateLib.Platform;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
@@ -33,7 +34,7 @@
{
}
- protected override void ProcessArgument(string arg, string parm)
+ protected override void ProcessArgument(string arg, IList<string> parm)
{
if (Expected.Count > 0)
{
@@ -42,9 +43,9 @@
expected.RemoveAt(0);
- if (parm != "")
+ if (parm.Count > 0)
{
- Assert.AreEqual(expected[0], parm);
+ Assert.AreEqual(expected[0], parm[0]);
expected.RemoveAt(0);
}
}
@@ -92,5 +93,24 @@
Assert.IsFalse(p.Parameters.CreateFullScreenWindow);
Assert.AreEqual(new Size(640, 480), p.Parameters.DisplayWindowSize);
}
+
+
+ [TestMethod]
+ public void DeviceEmulation()
+ {
+ ArgumentProcessing p = EmulationArgument(DeviceType.Handheld);
+ Assert.AreEqual(DeviceType.Handheld, p.Parameters.EmulateDeviceType);
+ }
+
+ private static ArgumentProcessing EmulationArgument(DeviceType type)
+ {
+ ArgumentProcessing p = new ArgumentProcessing(new ModelParameters
+ {
+ Arguments = ("--emulate-device " + type.ToString()).Split(' '),
+ });
+
+ p.Initialize();
+ return p;
+ }
}
}
Modified: trunk/UnitTests/Fakes/FakePlatformInfo.cs
===================================================================
--- trunk/UnitTests/Fakes/FakePlatformInfo.cs 2014-08-19 20:16:14 UTC (rev 1468)
+++ trunk/UnitTests/Fakes/FakePlatformInfo.cs 2014-08-19 20:17:02 UTC (rev 1469)
@@ -22,15 +22,5 @@
{
throw new NotImplementedException();
}
-
- public override PlatformType PlatformType
- {
- get { throw new NotImplementedException(); }
- }
-
- public override DotNetRuntime Runtime
- {
- get { throw new NotImplementedException(); }
- }
}
}
Modified: trunk/UnitTests/UserInterface/Css/AdapterTest.cs
===================================================================
--- trunk/UnitTests/UserInterface/Css/AdapterTest.cs 2014-08-19 20:16:14 UTC (rev 1468)
+++ trunk/UnitTests/UserInterface/Css/AdapterTest.cs 2014-08-19 20:17:02 UTC (rev 1469)
@@ -1,5 +1,5 @@
using AgateLib.Geometry;
-using AgateLib.UserInterface.Css.Properties;
+using AgateLib.UserInterface.Css.Documents;
using AgateLib.UserInterface.Widgets;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
Modified: trunk/UnitTests/UserInterface/Css/BindingTest.cs
===================================================================
--- trunk/UnitTests/UserInterface/Css/BindingTest.cs 2014-08-19 20:16:14 UTC (rev 1468)
+++ trunk/UnitTests/UserInterface/Css/BindingTest.cs 2014-08-19 20:17:02 UTC (rev 1469)
@@ -1,5 +1,5 @@
using AgateLib.UserInterface.Css.Binders;
-using AgateLib.UserInterface.Css.Properties;
+using AgateLib.UserInterface.Css.Documents;
using AgateLib.UserInterface.Css.Selectors;
using AgateLib.UserInterface.Widgets;
using Microsoft.VisualStudio.TestTools.UnitTesting;
Modified: trunk/UnitTests/UserInterface/Css/CssTestBase.cs
===================================================================
--- trunk/UnitTests/UserInterface/Css/CssTestBase.cs 2014-08-19 20:16:14 UTC (rev 1468)
+++ trunk/UnitTests/UserInterface/Css/CssTestBase.cs 2014-08-19 20:17:02 UTC (rev 1469)
@@ -1,6 +1,6 @@
using AgateLib.Geometry;
using AgateLib.UserInterface.Css.Binders;
-using AgateLib.UserInterface.Css.Properties;
+using AgateLib.UserInterface.Css.Documents;
using AgateLib.UserInterface.Css.Selectors;
using AgateLib.UserInterface.Widgets;
using Microsoft.VisualStudio.TestTools.UnitTesting;
Modified: trunk/UnitTests/UserInterface/Css/LayoutTest.cs
===================================================================
--- trunk/UnitTests/UserInterface/Css/LayoutTest.cs 2014-08-19 20:16:14 UTC (rev 1468)
+++ trunk/UnitTests/UserInterface/Css/LayoutTest.cs 2014-08-19 20:17:02 UTC (rev 1469)
@@ -3,6 +3,7 @@
using AgateLib.Geometry;
using AgateLib.Platform.WindowsForms.ApplicationModels;
using AgateLib.UnitTests.Fakes;
+using AgateLib.UserInterface.Css.Documents;
using AgateLib.UserInterface.Css.Layout;
using AgateLib.UserInterface.Widgets;
using AgateLib.UserInterface.Widgets.Tests;
Modified: trunk/UnitTests/UserInterface/Css/ParseTest.cs
===================================================================
--- trunk/UnitTests/UserInterface/Css/ParseTest.cs 2014-08-19 20:16:14 UTC (rev 1468)
+++ trunk/UnitTests/UserInterface/Css/ParseTest.cs 2014-08-19 20:17:02 UTC (rev 1469)
@@ -1,7 +1,7 @@
using AgateLib.Geometry;
using AgateLib.UnitTesting;
using AgateLib.UserInterface.Css.Binders;
-using AgateLib.UserInterface.Css.Properties;
+using AgateLib.UserInterface.Css.Documents;
using AgateLib.UserInterface.Css.Selectors;
using AgateLib.UserInterface.Widgets;
using Microsoft.VisualStudio.TestTools.UnitTesting;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-20 01:37:46
|
Revision: 1471
http://sourceforge.net/p/agate/code/1471
Author: kanato
Date: 2014-08-20 01:37:39 +0000 (Wed, 20 Aug 2014)
Log Message:
-----------
Add some caching to user interface.
Modified Paths:
--------------
trunk/AgateLib/UserInterface/Css/Layout/CssLayoutEngine.cs
trunk/AgateLib/UserInterface/Widgets/Gui.cs
trunk/AgateLib/UserInterface/Widgets/IGuiLayoutEngine.cs
trunk/UnitTests/UserInterface/Css/LayoutTest.cs
trunk/UnitTests/UserInterface/Widgets/ConversionTests.cs
Modified: trunk/AgateLib/UserInterface/Css/Layout/CssLayoutEngine.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Layout/CssLayoutEngine.cs 2014-08-19 21:50:07 UTC (rev 1470)
+++ trunk/AgateLib/UserInterface/Css/Layout/CssLayoutEngine.cs 2014-08-20 01:37:39 UTC (rev 1471)
@@ -36,17 +36,23 @@
{
this.mAdapter = adapter;
}
- public void RedoLayout(Gui gui)
+ public void UpdateLayout(Gui gui)
{
- RedoLayout(gui, Display.RenderTarget.CoordinateSystem.Size);
+ UpdateLayout(gui, Display.RenderTarget.CoordinateSystem.Size);
}
- public void RedoLayout(Gui gui, Size renderTargetSize)
+ public void UpdateLayout(Gui gui, Size renderTargetSize)
{
+ bool totalRefresh = false;
+
+ totalRefresh |= gui.Desktop.Width != renderTargetSize.Width;
+ totalRefresh |= gui.Desktop.Height != renderTargetSize.Height;
+
gui.Desktop.Width = renderTargetSize.Width;
gui.Desktop.Height = renderTargetSize.Height;
+
SetDesktopAnimatorProperties(gui.Desktop);
- RedoLayout(gui.Desktop);
+ RedoLayout(gui.Desktop, totalRefresh);
RedoFixedLayout(gui.Desktop);
}
@@ -111,7 +117,7 @@
}
- private void RedoLayout(Container container)
+ private void RedoLayout(Container container, bool forceRefresh = false)
{
var containerStyle = mAdapter.GetStyle(container);
var containerAnim = containerStyle.Animator;
@@ -120,6 +126,12 @@
containerAnim.ClientRect.X = 0;
containerAnim.ClientRect.Y = 0;
+ if (forceRefresh == false)
+ {
+ if (container.Descendants.Any(x => x.LayoutDirty) == false)
+ return;
+ }
+
int maxWidth = ComputeMaxWidthForContainer(containerStyle);
Point nextPos = Point.Empty;
int maxHeight = 0;
@@ -210,6 +222,8 @@
maxHeight = Math.Max(maxHeight, anim.ClientRect.Height + box.Top + box.Bottom);
bottom = Math.Max(bottom, anim.ClientRect.Y + anim.ClientRect.Height + box.Bottom); // only add box.Bottom here, because box.Top is taken into account in child.Y.
}
+
+ child.LayoutDirty = false;
}
containerAnim.ClientRect.Width = Math.Min(largestWidth, maxWidth);
@@ -246,7 +260,7 @@
break;
}
-
+ container.LayoutDirty = false;
}
private Widget TopLevelWidget(Widget child)
Modified: trunk/AgateLib/UserInterface/Widgets/Gui.cs
===================================================================
--- trunk/AgateLib/UserInterface/Widgets/Gui.cs 2014-08-19 21:50:07 UTC (rev 1470)
+++ trunk/AgateLib/UserInterface/Widgets/Gui.cs 2014-08-20 01:37:39 UTC (rev 1471)
@@ -290,7 +290,7 @@
public void OnUpdate(double delta_t, bool processInput)
{
- mLayout.RedoLayout(this);
+ mLayout.UpdateLayout(this);
mRenderer.Update(this, delta_t);
DispatchEvent(window => { window.Update(delta_t, ref processInput); return false; });
Modified: trunk/AgateLib/UserInterface/Widgets/IGuiLayoutEngine.cs
===================================================================
--- trunk/AgateLib/UserInterface/Widgets/IGuiLayoutEngine.cs 2014-08-19 21:50:07 UTC (rev 1470)
+++ trunk/AgateLib/UserInterface/Widgets/IGuiLayoutEngine.cs 2014-08-20 01:37:39 UTC (rev 1471)
@@ -25,6 +25,6 @@
{
public interface IGuiLayoutEngine
{
- void RedoLayout(Gui gui);
+ void UpdateLayout(Gui gui);
}
}
Modified: trunk/UnitTests/UserInterface/Css/LayoutTest.cs
===================================================================
--- trunk/UnitTests/UserInterface/Css/LayoutTest.cs 2014-08-19 21:50:07 UTC (rev 1470)
+++ trunk/UnitTests/UserInterface/Css/LayoutTest.cs 2014-08-20 01:37:39 UTC (rev 1471)
@@ -53,7 +53,7 @@
}
private void RedoLayout()
{
- engine.RedoLayout(gui, new Size(1000, 1000));
+ engine.UpdateLayout(gui, new Size(1000, 1000));
foreach (var d in gui.Desktop.Descendants)
{
Modified: trunk/UnitTests/UserInterface/Widgets/ConversionTests.cs
===================================================================
--- trunk/UnitTests/UserInterface/Widgets/ConversionTests.cs 2014-08-19 21:50:07 UTC (rev 1470)
+++ trunk/UnitTests/UserInterface/Widgets/ConversionTests.cs 2014-08-20 01:37:39 UTC (rev 1471)
@@ -19,7 +19,7 @@
}
class FakeLayout : IGuiLayoutEngine
{
- public void RedoLayout(Gui gui)
+ public void UpdateLayout(Gui gui)
{
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-20 14:18:55
|
Revision: 1472
http://sourceforge.net/p/agate/code/1472
Author: kanato
Date: 2014-08-20 14:18:48 +0000 (Wed, 20 Aug 2014)
Log Message:
-----------
Fix debugger slowness caused by Enum.TryParse method.
Modified Paths:
--------------
trunk/AgateLib/UserInterface/Css/Documents/CssBorder.cs
trunk/AgateLib/UserInterface/Css/Rendering/CssRenderer.cs
trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_DisplayControl.cs
trunk/AgateLib.Platform.WindowsForms/WinForms/FormUtil.cs
Modified: trunk/AgateLib/UserInterface/Css/Documents/CssBorder.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Documents/CssBorder.cs 2014-08-20 01:37:39 UTC (rev 1471)
+++ trunk/AgateLib/UserInterface/Css/Documents/CssBorder.cs 2014-08-20 14:18:48 UTC (rev 1472)
@@ -130,11 +130,11 @@
{
Width = CssDistance.FromString(v);
}
- if (Enum.TryParse(v, out stl))
+ else if (Enum.TryParse(v, out stl))
{
Style = stl;
}
- if (CssTypeConverter.TryParseColor(v, out clr))
+ else if (CssTypeConverter.TryParseColor(v, out clr))
{
Color = clr;
}
Modified: trunk/AgateLib/UserInterface/Css/Rendering/CssRenderer.cs
===================================================================
--- trunk/AgateLib/UserInterface/Css/Rendering/CssRenderer.cs 2014-08-20 01:37:39 UTC (rev 1471)
+++ trunk/AgateLib/UserInterface/Css/Rendering/CssRenderer.cs 2014-08-20 14:18:48 UTC (rev 1472)
@@ -337,6 +337,14 @@
{
var border = style.Data.Border;
+ if (border.Top.Color.A == 0 &&
+ border.Left.Color.A == 0 &&
+ border.Right.Color.A == 0 &&
+ border.Bottom.Color.A == 0)
+ {
+ return;
+ }
+
// draw top
Rectangle rect = new Rectangle(borderRect.X, borderRect.Y, borderRect.Width, (int)border.Top.Width.Amount);
Modified: trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_DisplayControl.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_DisplayControl.cs 2014-08-20 01:37:39 UTC (rev 1471)
+++ trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_DisplayControl.cs 2014-08-20 14:18:48 UTC (rev 1472)
@@ -494,7 +494,7 @@
}
void pct_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
- SetInternalMousePosition(Interop.Convert(e.Location));
+ //SetInternalMousePosition(Interop.Convert(e.Location));
Input.QueueInputEvent(AgateInputEventArgs.MouseMove(
this, PixelToLogicalCoords(new Point(e.X, e.Y))));
}
Modified: trunk/AgateLib.Platform.WindowsForms/WinForms/FormUtil.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/WinForms/FormUtil.cs 2014-08-20 01:37:39 UTC (rev 1471)
+++ trunk/AgateLib.Platform.WindowsForms/WinForms/FormUtil.cs 2014-08-20 14:18:48 UTC (rev 1472)
@@ -124,8 +124,7 @@
/// <summary>
/// Gets a System.Windows.Forms.Cursor object which is completely transparent.
/// </summary>
- [Obsolete("This will be made private in the next release. Don't use it.")]
- public static Cursor BlankCursor
+ internal static Cursor BlankCursor
{
get
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-23 16:21:00
|
Revision: 1474
http://sourceforge.net/p/agate/code/1474
Author: kanato
Date: 2014-08-23 16:20:55 +0000 (Sat, 23 Aug 2014)
Log Message:
-----------
Refactor displayimpl so that factory methods are in DisplayFactory.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/Core.cs
trunk/AgateLib/DisplayLib/DisplayWindow.cs
trunk/AgateLib/DisplayLib/FontSurface.cs
trunk/AgateLib/DisplayLib/FrameBuffer.cs
trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs
trunk/AgateLib/DisplayLib/Surface.cs
trunk/AgateLib/Drivers/IAgateFactory.cs
trunk/AgateLib/Drivers/IDisplayFactory.cs
trunk/AgateLib/Resources/Legacy/AgateResourceCollection.cs
trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/DesktopGLDisplay.cs
trunk/AgateLib.Platform.WindowsForms/Factories/DisplayFactory.cs
trunk/UnitTests/Fakes/FakeDisplayDriver.cs
Removed Paths:
-------------
trunk/AgateLib/Drivers/TypeRegistry.cs
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-21 06:06:57 UTC (rev 1473)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-23 16:20:55 UTC (rev 1474)
@@ -155,7 +155,6 @@
<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" />
<Compile Include="Extensions\Collections\Generic\ListSorting.cs" />
<Compile Include="Extensions\Collections\NonGeneric\NonGenericListSorting.cs" />
Modified: trunk/AgateLib/Core.cs
===================================================================
--- trunk/AgateLib/Core.cs 2014-08-21 06:06:57 UTC (rev 1473)
+++ trunk/AgateLib/Core.cs 2014-08-23 16:20:55 UTC (rev 1474)
@@ -331,7 +331,7 @@
FileSystem.Path = factory.PlatformFactory.CreatePath();
FileProvider.Initialize(factory.PlatformFactory);
- Display.Initialize(factory.DisplayFactory.CreateDisplayImpl());
+ Display.Initialize(factory.DisplayFactory.DisplayImpl);
Audio.Initialize(factory.AudioFactory.CreateAudioImpl());
JoystickInput.Initialize(factory.InputFactory.CreateJoystickInputImpl());
Modified: trunk/AgateLib/DisplayLib/DisplayWindow.cs
===================================================================
--- trunk/AgateLib/DisplayLib/DisplayWindow.cs 2014-08-21 06:06:57 UTC (rev 1473)
+++ trunk/AgateLib/DisplayLib/DisplayWindow.cs 2014-08-23 16:20:55 UTC (rev 1474)
@@ -58,14 +58,14 @@
CreateWindowParams par = CreateWindowParams.FullScreen(
disp.Title, disp.Size.Width, disp.Size.Height, disp.Bpp);
- mImpl = Display.Impl.CreateDisplayWindow(this, par);
+ mImpl = Core.Factory.DisplayFactory.CreateDisplayWindow(this, par);
}
else
{
CreateWindowParams par = CreateWindowParams.Windowed(
disp.Title, disp.Size.Width, disp.Size.Height, disp.AllowResize, null);
- mImpl = Display.Impl.CreateDisplayWindow(this, par);
+ mImpl = Core.Factory.DisplayFactory.CreateDisplayWindow(this, par);
}
Display.RenderTarget = FrameBuffer;
@@ -83,7 +83,7 @@
"Display has not been initialized." + Environment.NewLine +
"Did you forget to call AgateSetup.Initialize or Display.Initialize?");
- mImpl = Display.Impl.CreateDisplayWindow(this, windowParams);
+ mImpl = Core.Factory.DisplayFactory.CreateDisplayWindow(this, windowParams);
Display.RenderTarget = FrameBuffer;
Display.DisposeDisplay += new Display.DisposeDisplayHandler(Dispose);
Modified: trunk/AgateLib/DisplayLib/FontSurface.cs
===================================================================
--- trunk/AgateLib/DisplayLib/FontSurface.cs 2014-08-21 06:06:57 UTC (rev 1473)
+++ trunk/AgateLib/DisplayLib/FontSurface.cs 2014-08-23 16:20:55 UTC (rev 1474)
@@ -74,7 +74,7 @@
throw new ArgumentOutOfRangeException("Font size must be positive and non-zero, but was " +
sizeInPoints.ToString() + ".");
- mImpl = Display.Impl.CreateFont(fontFamily, sizeInPoints, style);
+ mImpl = Core.Factory.DisplayFactory.CreateFont(fontFamily, sizeInPoints, style);
Display.DisposeDisplay += new Display.DisposeDisplayHandler(Dispose);
@@ -110,7 +110,7 @@
/// <param name="bitmapOptions"></param>
public FontSurface(BitmapFontOptions bitmapOptions)
{
- mImpl = Display.Impl.CreateFont(bitmapOptions);
+ mImpl = Core.Factory.DisplayFactory.CreateFont(bitmapOptions);
Display.DisposeDisplay += new Display.DisposeDisplayHandler(Dispose);
Modified: trunk/AgateLib/DisplayLib/FrameBuffer.cs
===================================================================
--- trunk/AgateLib/DisplayLib/FrameBuffer.cs 2014-08-21 06:06:57 UTC (rev 1473)
+++ trunk/AgateLib/DisplayLib/FrameBuffer.cs 2014-08-23 16:20:55 UTC (rev 1474)
@@ -44,7 +44,7 @@
/// <param name="size"></param>
public FrameBuffer(Size size)
{
- impl = Display.Impl.CreateFrameBuffer(size);
+ impl = Core.Factory.DisplayFactory.CreateFrameBuffer(size);
CoordinateSystem = new Rectangle(Point.Empty, size);
}
/// <summary>
Modified: trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs 2014-08-21 06:06:57 UTC (rev 1473)
+++ trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs 2014-08-23 16:20:55 UTC (rev 1474)
@@ -110,82 +110,7 @@
/// </summary>
protected abstract void OnRenderTargetResize();
- ///// <summary>
- ///// Creates a DisplayWindowImpl derived object.
- ///// </summary>
- ///// <param name="title"></param>
- ///// <param name="clientWidth"></param>
- ///// <param name="clientHeight"></param>
- ///// <param name="allowResize"></param>
- ///// <param name="iconFile"></param>
- ///// <param name="startFullscreen"></param>
- ///// <returns></returns>
- //public abstract DisplayWindowImpl CreateDisplayWindow(string title, int clientWidth, int clientHeight, string iconFile, bool startFullscreen, bool allowResize);
- ///// <summary>
- ///// Creates a DisplayWindowImpl derived object.
- ///// </summary>
- //public abstract DisplayWindowImpl CreateDisplayWindow(System.Windows.Forms.Control renderTarget);
-
/// <summary>
- /// Creates a DisplayWindowImpl derived object.
- /// </summary>
- /// <param name="windowParams"></param>
- /// <returns></returns>
- public abstract DisplayWindowImpl CreateDisplayWindow(DisplayWindow owner, CreateWindowParams windowParams);
-
- /// <summary>
- /// Creates a SurfaceImpl derived object.
- /// </summary>
- /// <param name="provider"></param>
- /// <param name="filename"></param>
- /// <returns></returns>
- public virtual SurfaceImpl CreateSurface(IReadFileProvider provider, string filename)
- {
- return CreateSurface(provider.OpenRead(filename));
- }
- /// <summary>
- /// Creates a SurfaceImpl derived object.
- /// </summary>
- public abstract SurfaceImpl CreateSurface(string fileName);
- /// <summary>
- /// Creates a SurfaceImpl derived object from a stream containing
- /// the file contents.
- /// </summary>
- /// <param name="fileStream"></param>
- /// <returns></returns>
- public abstract SurfaceImpl CreateSurface(Stream fileStream);
-
- /// <summary>
- /// Creates a SurfaceImpl derived object.
- /// </summary>
- public abstract SurfaceImpl CreateSurface(Size surfaceSize);
-
- /// <summary>
- /// Creates a SurfaceImpl derived object.
- /// Forwards the call to CreateSurface(Size).
- /// </summary>
- public SurfaceImpl CreateSurface(int width, int height)
- {
- return CreateSurface(new Size(width, height));
- }
- /// <summary>
- /// Creates a FontSurfaceImpl derived object.
- /// </summary>
- /// <param name="fontFamily"></param>
- /// <param name="sizeInPoints"></param>
- /// <param name="style"></param>
- /// <returns></returns>
- public abstract FontSurfaceImpl CreateFont(string fontFamily,
- float sizeInPoints, FontStyles style);
-
- /// <summary>
- /// Creates a BitmapFontImpl object from the specified options.
- /// </summary>
- /// <param name="bitmapOptions"></param>
- /// <returns></returns>
- public abstract FontSurfaceImpl CreateFont(BitmapFontOptions bitmapOptions);
-
- /// <summary>
/// Gets or sets the threshold value for alpha transparency below which
/// pixels are considered completely transparent, and may not be drawn.
/// </summary>
@@ -651,50 +576,6 @@
protected internal abstract void HideCursor();
- protected internal virtual VertexBufferImpl CreateVertexBuffer(
- Geometry.VertexTypes.VertexLayout layout, int vertexCount)
- {
- throw new AgateException("Cannot create a vertex buffer with a driver that does not support 3D.");
- }
-
- protected internal virtual IndexBufferImpl CreateIndexBuffer(IndexBufferType type, int size)
- {
- throw new AgateException("Cannot create an index buffer with a driver that does not support 3D.");
- }
-
-
- /// <summary>
- /// Creates one of the build in shaders in AgateLib. Implementers should
- /// return null for any built in shader that is not supported.
- /// Basic2DShader must have an implementation, but any other shader can be unsupported.
- /// </summary>
- /// <param name="builtInShaderType"></param>
- /// <returns></returns>
- protected internal abstract AgateShaderImpl CreateBuiltInShader(AgateLib.DisplayLib.Shaders.Implementation.BuiltInShader builtInShaderType);
-
- /// <summary>
- /// Creates a
- /// </summary>
- /// <param name="size"></param>
- protected internal abstract FrameBufferImpl CreateFrameBuffer(Size size);
-
- /// <summary>
- /// Override this method if shaders are supported.
- /// Only call the base class method if shaders aren't supported, as it throws a NotSupportedException.
- /// </summary>
- /// <returns></returns>
- [Obsolete]
- protected internal virtual ShaderCompilerImpl CreateShaderCompiler()
- {
- throw new NotSupportedException("The current driver does not support shaders.");
- }
-
- [Obsolete]
- public virtual Effect Effect
- {
- get { return null; }
- set { throw new NotSupportedException("The current driver does not support shaders."); }
- }
public virtual AgateShader Shader
{
get { return mShader; }
@@ -723,5 +604,26 @@
protected internal abstract bool GetRenderState(RenderStateBool renderStateBool);
protected internal abstract void SetRenderState(RenderStateBool renderStateBool, bool value);
+ protected internal virtual VertexBufferImpl CreateVertexBuffer(
+ Geometry.VertexTypes.VertexLayout layout, int vertexCount)
+ {
+ throw new AgateException("Cannot create a vertex buffer with a driver that does not support 3D.");
+ }
+
+ protected internal virtual IndexBufferImpl CreateIndexBuffer(IndexBufferType type, int size)
+ {
+ throw new AgateException("Cannot create an index buffer with a driver that does not support 3D.");
+ }
+
+
+ /// <summary>
+ /// Creates one of the build in shaders in AgateLib. Implementers should
+ /// return null for any built in shader that is not supported.
+ /// Basic2DShader must have an implementation, but any other shader can be unsupported.
+ /// </summary>
+ /// <param name="builtInShaderType"></param>
+ /// <returns></returns>
+ protected internal abstract AgateShaderImpl CreateBuiltInShader(AgateLib.DisplayLib.Shaders.Implementation.BuiltInShader builtInShaderType);
+
}
}
Modified: trunk/AgateLib/DisplayLib/Surface.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Surface.cs 2014-08-21 06:06:57 UTC (rev 1473)
+++ trunk/AgateLib/DisplayLib/Surface.cs 2014-08-23 16:20:55 UTC (rev 1474)
@@ -93,7 +93,7 @@
if (fileprovider == null)
fileprovider = AgateLib.IO.FileProvider.SurfaceAssets;
- mImpl = Display.Impl.CreateSurface(fileprovider.ResolveFile(filename));
+ mImpl = Core.Factory.DisplayFactory.CreateSurface(fileprovider, filename);
Display.DisposeDisplay += new Display.DisposeDisplayHandler(Dispose);
Display.PackAllSurfacesEvent += new EventHandler(Display_PackAllSurfacesEvent);
@@ -107,7 +107,7 @@
if (Display.Impl == null)
throw new AgateException("AgateLib's display system has not been initialized.");
- mImpl = Display.Impl.CreateSurface(st);
+ mImpl = Core.Factory.DisplayFactory.CreateSurface(st);
Display.DisposeDisplay += new Display.DisposeDisplayHandler(Dispose);
Display.PackAllSurfacesEvent += new EventHandler(Display_PackAllSurfacesEvent);
@@ -133,7 +133,7 @@
if (Display.Impl == null)
throw new AgateException("AgateLib's display system has not been initialized.");
- mImpl = Display.Impl.CreateSurface(size);
+ mImpl = Core.Factory.DisplayFactory.CreateSurface(size);
Display.DisposeDisplay += new Display.DisposeDisplayHandler(Dispose);
Display.PackAllSurfacesEvent += new EventHandler(Display_PackAllSurfacesEvent);
Modified: trunk/AgateLib/Drivers/IAgateFactory.cs
===================================================================
--- trunk/AgateLib/Drivers/IAgateFactory.cs 2014-08-21 06:06:57 UTC (rev 1473)
+++ trunk/AgateLib/Drivers/IAgateFactory.cs 2014-08-23 16:20:55 UTC (rev 1474)
@@ -21,6 +21,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using AgateLib.DisplayLib;
namespace AgateLib.Drivers
{
@@ -31,6 +32,6 @@
IInputFactory InputFactory { get; }
IPlatformFactory PlatformFactory { get; }
- DisplayLib.FontSurface DefaultFont { get; set; }
+ FontSurface DefaultFont { get; set; }
}
}
Modified: trunk/AgateLib/Drivers/IDisplayFactory.cs
===================================================================
--- trunk/AgateLib/Drivers/IDisplayFactory.cs 2014-08-21 06:06:57 UTC (rev 1473)
+++ trunk/AgateLib/Drivers/IDisplayFactory.cs 2014-08-23 16:20:55 UTC (rev 1474)
@@ -16,17 +16,76 @@
//
// Contributor(s): Erik Ylvisaker
//
+using AgateLib.DisplayLib;
+using AgateLib.DisplayLib.BitmapFont;
using AgateLib.DisplayLib.ImplementationBase;
+using AgateLib.Geometry;
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AgateLib.Drivers
{
+ /// <summary>
+ /// Interface that the display factory must implement.
+ /// </summary>
public interface IDisplayFactory
{
- DisplayImpl CreateDisplayImpl();
+ DisplayImpl DisplayImpl { get; }
+
+ /// <summary>
+ /// Creates a DisplayWindowImpl derived object.
+ /// </summary>
+ /// <param name="windowParams"></param>
+ /// <returns></returns>
+ DisplayWindowImpl CreateDisplayWindow(DisplayWindow owner, CreateWindowParams windowParams);
+
+ /// <summary>
+ /// Creates a SurfaceImpl derived object.
+ /// </summary>
+ /// <param name="provider"></param>
+ /// <param name="filename"></param>
+ /// <returns></returns>
+ SurfaceImpl CreateSurface(IReadFileProvider provider, string filename);
+
+ /// <summary>
+ /// Creates a SurfaceImpl derived object from a stream containing
+ /// the file contents.
+ /// </summary>
+ /// <param name="fileStream"></param>
+ /// <returns></returns>
+ SurfaceImpl CreateSurface(Stream fileStream);
+
+ /// <summary>
+ /// Creates a SurfaceImpl derived object that is blank of the specified size.
+ /// </summary>
+ SurfaceImpl CreateSurface(Size surfaceSize);
+
+ /// <summary>
+ /// Creates a FontSurfaceImpl derived object based on an operating system font.
+ /// </summary>
+ /// <param name="fontFamily"></param>
+ /// <param name="sizeInPoints"></param>
+ /// <param name="style"></param>
+ /// <returns></returns>
+ FontSurfaceImpl CreateFont(string fontFamily, float sizeInPoints, FontStyles style);
+
+ /// <summary>
+ /// Creates a BitmapFontImpl object from the specified options.
+ /// </summary>
+ /// <param name="bitmapOptions"></param>
+ /// <returns></returns>
+ FontSurfaceImpl CreateFont(BitmapFontOptions bitmapOptions);
+
+
+ /// <summary>
+ /// Creates a FrameBufferImpl object of the specified size.
+ /// </summary>
+ /// <param name="size"></param>
+ FrameBufferImpl CreateFrameBuffer(Size size);
+
}
}
Deleted: trunk/AgateLib/Drivers/TypeRegistry.cs
===================================================================
--- trunk/AgateLib/Drivers/TypeRegistry.cs 2014-08-21 06:06:57 UTC (rev 1473)
+++ trunk/AgateLib/Drivers/TypeRegistry.cs 2014-08-23 16:20:55 UTC (rev 1474)
@@ -1,33 +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.Threading.Tasks;
-
-namespace AgateLib.Drivers
-{
- public static class TypeRegistry
- {
- public static Type DisplayDriver { get; set; }
- public static Type AudioDriver { get; set; }
- public static Type InputDriver { get; set; }
- }
-}
Modified: trunk/AgateLib/Resources/Legacy/AgateResourceCollection.cs
===================================================================
--- trunk/AgateLib/Resources/Legacy/AgateResourceCollection.cs 2014-08-21 06:06:57 UTC (rev 1473)
+++ trunk/AgateLib/Resources/Legacy/AgateResourceCollection.cs 2014-08-23 16:20:55 UTC (rev 1474)
@@ -456,7 +456,7 @@
{
string path = string.IsNullOrEmpty(RootDirectory) ? filename :
RootDirectory + "/" + filename;
- SurfaceImpl impl = Display.Impl.CreateSurface(FileProvider, path);
+ SurfaceImpl impl = Core.Factory.DisplayFactory.CreateSurface(FileProvider, path);
mOwnedSurfaces.Add(filename, impl);
Modified: trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/DesktopGLDisplay.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/DesktopGLDisplay.cs 2014-08-21 06:06:57 UTC (rev 1473)
+++ trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/DesktopGLDisplay.cs 2014-08-23 16:20:55 UTC (rev 1474)
@@ -45,8 +45,6 @@
Stack<Rectangle> mClipRects = new Stack<Rectangle>();
Rectangle mCurrentClip = Rectangle.Empty;
private bool mVSync = true;
- private bool mSupportsFramebufferArb;
- private bool mSupportsFramebufferExt;
private bool mNonPowerOf2Textures;
private bool mSupportsShaders;
private decimal mGLVersion;
@@ -56,8 +54,6 @@
PrimitiveRenderer mPrimitives;
- bool mGL3;
-
public Surface WhiteSurface
{
get;
@@ -69,6 +65,10 @@
private set { mNonPowerOf2Textures = value; }
}
+ public bool GL3 { get; private set; }
+ public bool SupportsFramebufferExt { get; internal set; }
+ public bool SupportsFramebufferArb { get; private set;}
+
protected override void OnRenderTargetChange(FrameBuffer oldRenderTarget)
{
mRenderTarget = RenderTarget.Impl as GL_FrameBuffer;
@@ -92,29 +92,10 @@
{
return ShaderFactory.CreateBuiltInShader(builtInShaderType);
}
- public override DisplayWindowImpl CreateDisplayWindow(DisplayWindow owner, CreateWindowParams windowParams)
- {
- if (windowParams.IsFullScreen && windowParams.RenderToControl == false)
- return new GL_GameWindow(owner, windowParams);
- else
- return new GL_DisplayControl(owner, windowParams);
- //if (windowParams.RenderToControl)
- //{
- // return new GL_DisplayControl(windowParams);
- //}
- //else
- //{
- // return new GL_GameWindow(windowParams);
- //}
- }
- public override SurfaceImpl CreateSurface(string fileName)
- {
- return new GL_Surface(fileName);
- }
protected override VertexBufferImpl CreateVertexBuffer(VertexLayout layout, int vertexCount)
{
- if (mGL3)
+ if (GL3)
return new AgateLib.OpenGL.GL3.GLVertexBuffer(layout, vertexCount);
else
return new AgateLib.OpenGL.Legacy.LegacyVertexBuffer(layout, vertexCount);
@@ -124,55 +105,8 @@
return new GL_IndexBuffer(type, size);
}
- public override SurfaceImpl CreateSurface(Size surfaceSize)
+ public bool ReadSettingsBool(string name)
{
- return new GL_Surface(surfaceSize);
- }
- public override SurfaceImpl CreateSurface(System.IO.Stream fileStream)
- {
- return new GL_Surface(fileStream);
- }
- public override FontSurfaceImpl CreateFont(string fontFamily, float sizeInPoints, FontStyles style)
- {
- BitmapFontOptions options = new BitmapFontOptions(fontFamily, sizeInPoints, style);
-
- return AgateLib.Platform.WindowsForms.WinForms.BitmapFontUtil.ConstructFromOSFont(options);
- }
- public override FontSurfaceImpl CreateFont(BitmapFontOptions bitmapOptions)
- {
- return AgateLib.Platform.WindowsForms.WinForms.BitmapFontUtil.ConstructFromOSFont(bitmapOptions);
- }
-
- protected override FrameBufferImpl CreateFrameBuffer(Size size)
- {
- if (mGL3 || (mSupportsFramebufferArb && ReadSettingsBool("DisableFramebufferArb") == false))
- return new AgateLib.OpenGL.GL3.FrameBuffer((IGL_Surface)new Surface(size).Impl);
- else if (mSupportsFramebufferExt && ReadSettingsBool("DisableFramebufferExt") == false)
- {
- try
- {
- return new AgateLib.OpenGL.Legacy.FrameBufferExt((IGL_Surface)new Surface(size).Impl);
- }
- catch (Exception e)
- {
- Trace.WriteLine(string.Format("Caught exception {0} when trying to create GL_FrameBuffer_Ext wrapper.", e.GetType()));
- Trace.Indent();
- Trace.WriteLine(e.Message);
- Trace.Unindent();
- Trace.WriteLine("");
- Trace.WriteLine("Disabling frame buffer extension, and falling back onto glCopyTexSubImage2D.");
- Trace.WriteLine("Extensive use of offscreen rendering targets will result in poor performance.");
- Trace.WriteLine("");
-
- mSupportsFramebufferExt = false;
- }
- }
-
- return new AgateLib.OpenGL.Legacy.FrameBufferReadPixels((IGL_Surface)new Surface(size).Impl);
- }
-
- bool ReadSettingsBool(string name)
- {
string value;
if (AgateLib.Core.Settings["AgateLib.OpenGL"].TryGetValue(name, out value) == false)
@@ -186,7 +120,7 @@
public GLDrawBuffer CreateDrawBuffer()
{
- if (mGL3)
+ if (GL3)
return new AgateLib.OpenGL.GL3.DrawBuffer();
else
return new AgateLib.OpenGL.Legacy.LegacyDrawBuffer();
@@ -364,19 +298,19 @@
{
if (ReadSettingsBool("EnableGL3"))
{
- mGL3 = true;
+ GL3 = true;
}
else
{
- mGL3 = false;
+ GL3 = false;
mGLVersion = 2.1m;
}
}
LoadExtensions();
- mSupportsFramebufferArb = SupportsExtension("GL_ARB_FRAMEBUFFER_OBJECT");
- mSupportsFramebufferExt = SupportsExtension("GL_EXT_FRAMEBUFFER_OBJECT");
+ SupportsFramebufferArb = SupportsExtension("GL_ARB_FRAMEBUFFER_OBJECT");
+ SupportsFramebufferExt = SupportsExtension("GL_EXT_FRAMEBUFFER_OBJECT");
mNonPowerOf2Textures = SupportsExtension("GL_ARB_NON_POWER_OF_TWO");
if (mGLVersion >= 3m)
@@ -398,7 +332,7 @@
throw new AgateLib.AgateException("OpenGL 1.2 or higher is required, but this system only supports OpenGL " + mGLVersion.ToString() + ".");
}
- if (mGL3)
+ if (GL3)
mPrimitives = new AgateLib.OpenGL.GL3.GLPrimitiveRenderer();
else
mPrimitives = new AgateLib.OpenGL.Legacy.LegacyPrimitiveRenderer();
@@ -408,7 +342,7 @@
mSupportsShaders = true;
}
- ShaderFactory.Initialize(mGL3);
+ ShaderFactory.Initialize(GL3);
Trace.WriteLine(string.Format("OpenGL version {0} from vendor {1} detected.", mGLVersion, vendor));
Trace.WriteLine("NPOT: " + mNonPowerOf2Textures.ToString());
@@ -420,7 +354,7 @@
string[] extensions;
private void LoadExtensions()
{
- if (mGL3)
+ if (GL3)
{
// Forward compatible context (GL 3.0+)
int num_extensions;
Modified: trunk/AgateLib.Platform.WindowsForms/Factories/DisplayFactory.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/Factories/DisplayFactory.cs 2014-08-21 06:06:57 UTC (rev 1473)
+++ trunk/AgateLib.Platform.WindowsForms/Factories/DisplayFactory.cs 2014-08-23 16:20:55 UTC (rev 1474)
@@ -1,7 +1,14 @@
-using AgateLib.Drivers;
+using AgateLib.Diagnostics;
+using AgateLib.DisplayLib;
+using AgateLib.DisplayLib.BitmapFont;
+using AgateLib.DisplayLib.ImplementationBase;
+using AgateLib.Drivers;
+using AgateLib.Geometry;
+using AgateLib.OpenGL;
using AgateLib.Platform.WindowsForms.DisplayImplementation;
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -10,9 +17,90 @@
{
class DisplayFactory : IDisplayFactory
{
- public DisplayLib.ImplementationBase.DisplayImpl CreateDisplayImpl()
+ public DisplayFactory()
{
- return new DesktopGLDisplay();
+ FullDisplayImpl = new DesktopGLDisplay();
}
+
+ public DisplayImpl DisplayImpl { get { return FullDisplayImpl; } }
+ public DesktopGLDisplay FullDisplayImpl { get; private set; }
+
+ public DisplayWindowImpl CreateDisplayWindow(DisplayWindow owner, DisplayLib.CreateWindowParams windowParams)
+ {
+ if (windowParams.IsFullScreen && windowParams.RenderToControl == false)
+ return new GL_GameWindow(owner, windowParams);
+ else
+ return new GL_DisplayControl(owner, windowParams);
+ }
+
+ public SurfaceImpl CreateSurface(IReadFileProvider provider, string filename)
+ {
+ return new GL_Surface(provider.ResolveFile(filename));
+ }
+
+ public SurfaceImpl CreateSurface(Stream fileStream)
+ {
+ return new GL_Surface(fileStream);
+ }
+
+ public SurfaceImpl CreateSurface(Size surfaceSize)
+ {
+ return new GL_Surface(surfaceSize);
+ }
+
+ public FontSurfaceImpl CreateFont(string fontFamily, float sizeInPoints, FontStyles style)
+ {
+ BitmapFontOptions options = new BitmapFontOptions(fontFamily, sizeInPoints, style);
+
+ return AgateLib.Platform.WindowsForms.WinForms.BitmapFontUtil.ConstructFromOSFont(options);
+ }
+
+ public FontSurfaceImpl CreateFont(BitmapFontOptions bitmapOptions)
+ {
+ return AgateLib.Platform.WindowsForms.WinForms.BitmapFontUtil.ConstructFromOSFont(bitmapOptions);
+ }
+
+
+ public FrameBufferImpl CreateFrameBuffer(Size size)
+ {
+ if (FullDisplayImpl.GL3)
+ return new AgateLib.OpenGL.GL3.FrameBuffer((IGL_Surface)new Surface(size).Impl);
+
+ if (SupportsFramebufferArb && ReadSettingsBool("DisableFramebufferArb") == false)
+ return new AgateLib.OpenGL.GL3.FrameBuffer((IGL_Surface)new Surface(size).Impl);
+
+ if (SupportsFramebufferExt && ReadSettingsBool("DisableFramebufferExt") == false)
+ {
+ try
+ {
+ return new AgateLib.OpenGL.Legacy.FrameBufferExt((IGL_Surface)new Surface(size).Impl);
+ }
+ catch (Exception e)
+ {
+ Log.WriteLine(string.Format("Caught exception {0} when trying to create GL_FrameBuffer_Ext wrapper.", e.GetType()));
+ Log.WriteLine(e.Message);
+ Log.WriteLine("");
+ Log.WriteLine("Disabling frame buffer extension, and falling back onto glCopyTexSubImage2D.");
+ Log.WriteLine("Extensive use of offscreen rendering targets will result in poor performance.");
+ Log.WriteLine("");
+
+ SupportsFramebufferExt = false;
+ }
+ }
+
+ return new AgateLib.OpenGL.Legacy.FrameBufferReadPixels((IGL_Surface)new Surface(size).Impl);
+ }
+
+ private bool ReadSettingsBool(string name)
+ {
+ return FullDisplayImpl.ReadSettingsBool(name);
+ }
+
+ public bool SupportsFramebufferArb { get { return FullDisplayImpl.SupportsFramebufferArb; } }
+ public bool SupportsFramebufferExt
+ {
+ get { return FullDisplayImpl.SupportsFramebufferExt; }
+ set { FullDisplayImpl.SupportsFramebufferExt = value; }
+ }
}
}
Modified: trunk/UnitTests/Fakes/FakeDisplayDriver.cs
===================================================================
--- trunk/UnitTests/Fakes/FakeDisplayDriver.cs 2014-08-21 06:06:57 UTC (rev 1473)
+++ trunk/UnitTests/Fakes/FakeDisplayDriver.cs 2014-08-23 16:20:55 UTC (rev 1474)
@@ -44,36 +44,7 @@
throw new NotImplementedException();
}
- public override DisplayWindowImpl CreateDisplayWindow(AgateLib.DisplayLib.DisplayWindow owner, AgateLib.DisplayLib.CreateWindowParams windowParams)
- {
- return new FakeDisplayWindow(owner, windowParams);
- }
- public override SurfaceImpl CreateSurface(string fileName)
- {
- throw new NotImplementedException();
- }
-
- public override SurfaceImpl CreateSurface(System.IO.Stream fileStream)
- {
- throw new NotImplementedException();
- }
-
- public override SurfaceImpl CreateSurface(AgateLib.Geometry.Size surfaceSize)
- {
- throw new NotImplementedException();
- }
-
- public override FontSurfaceImpl CreateFont(string fontFamily, float sizeInPoints, AgateLib.DisplayLib.FontStyles style)
- {
- throw new NotImplementedException();
- }
-
- public override FontSurfaceImpl CreateFont(BitmapFontOptions bitmapOptions)
- {
- throw new NotImplementedException();
- }
-
protected override void OnBeginFrame()
{
throw new NotImplementedException();
@@ -159,10 +130,6 @@
return null;
}
- protected internal override FrameBufferImpl CreateFrameBuffer(AgateLib.Geometry.Size size)
- {
- throw new NotImplementedException();
- }
protected internal override bool GetRenderState(AgateLib.DisplayLib.RenderStateBool renderStateBool)
{
@@ -185,10 +152,47 @@
class FakeDisplayFactory : IDisplayFactory
{
- public DisplayImpl CreateDisplayImpl()
+ public FakeDisplayFactory()
{
- return new FakeDisplayDriver();
+ DisplayImpl = new FakeDisplayDriver();
}
+
+ public DisplayImpl DisplayImpl { get; private set;}
+
+ public DisplayWindowImpl CreateDisplayWindow(...
[truncated message content] |
|
From: <ka...@us...> - 2014-08-23 20:11:44
|
Revision: 1475
http://sourceforge.net/p/agate/code/1475
Author: kanato
Date: 2014-08-23 20:11:39 +0000 (Sat, 23 Aug 2014)
Log Message:
-----------
Refactor models to allow for scene model to be developed.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/ApplicationModels/AgateAppModel.cs
trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj
trunk/AgateLib.Platform.WindowsForms/ApplicationModels/PassiveModel.cs
trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SceneModel.cs
trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SerialModel.cs
trunk/UnitTests/ApplicationModels/ArgumentProcessing.cs
Added Paths:
-----------
trunk/AgateLib/ApplicationModels/EntryPointAppModelBase.cs
trunk/AgateLib/ApplicationModels/Scene.cs
trunk/AgateLib/ApplicationModels/SceneAppModelBase.cs
trunk/AgateLib/ApplicationModels/SceneStack.cs
trunk/AgateLib.Platform.WindowsForms/Initializer.cs
Removed Paths:
-------------
trunk/AgateLib.Platform.WindowsForms/ApplicationModels/FormsModelBase.cs
trunk/AgateLib.Platform.WindowsForms/Configuration.cs
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-23 16:20:55 UTC (rev 1474)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-23 20:11:39 UTC (rev 1475)
@@ -85,6 +85,10 @@
<Compile Include="Algorithms\PathFinding\AStarState.cs" />
<Compile Include="Algorithms\Inverting.cs" />
<Compile Include="ApplicationModels\CoordinateSystems\NaturalCoordinates.cs" />
+ <Compile Include="ApplicationModels\EntryPointAppModelBase.cs" />
+ <Compile Include="ApplicationModels\Scene.cs" />
+ <Compile Include="ApplicationModels\SceneAppModelBase.cs" />
+ <Compile Include="ApplicationModels\SceneStack.cs" />
<Compile Include="DisplayLib\FontSettings.cs" />
<Compile Include="DisplayLib\FontStyles.cs" />
<Compile Include="Drivers\NullDrivers\NullInputFactory.cs" />
Modified: trunk/AgateLib/ApplicationModels/AgateAppModel.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/AgateAppModel.cs 2014-08-23 16:20:55 UTC (rev 1474)
+++ trunk/AgateLib/ApplicationModels/AgateAppModel.cs 2014-08-23 20:11:39 UTC (rev 1475)
@@ -52,11 +52,6 @@
}
- static Func<int> ActionToFunc(Action entry)
- {
- return () => { entry(); return 0; };
- }
-
#endregion
DisplayWindow window;
@@ -91,81 +86,28 @@
public void Dispose()
{
Dispose(true);
+ DisposeAutoCreatedWindow();
if (Instance == this)
Instance = null;
}
- /// <summary>
- /// Override this to clean up the platform initialization of AgateLib.
- /// </summary>
- /// <param name="disposing"></param>
- protected virtual void Dispose(bool disposing)
- { }
- /// <summary>
- /// Runs the application model with the specified entry point for your application.
- /// </summary>
- /// <param name="entry">A delegate which will be called to run your application.</param>
- /// <returns>Returns 0.</returns>
- public int Run(Action entry)
- {
- return RunImpl(entry);
- }
- /// <summary>
- /// Runs the application model with the specified entry point for your application.
- /// </summary>
- /// <param name="entry">A delegate which will be called to run your application.</param>
- /// <returns>Returns the return value from the <c>entry</c> parameter.</returns>
- public int Run(Func<int> entry)
- {
- return RunImpl(entry);
- }
- /// <summary>
- /// Runs the application model with the specified entry point and command line arguments for your application.
- /// </summary>
- /// <param name="args">The command arguments to process.</param>
- /// <param name="entry">A delegate which will be called to run your application.</param>
- /// <returns>Returns 0.</returns>
- public int Run(string[] args, Action entry)
- {
- Parameters.Arguments = args;
- return RunImpl(entry);
- }
- /// <summary>
- /// Runs the application model with the specified entry point and command line arguments for your application.
- /// </summary>
- /// <param name="args">The command arguments to process.</param>
- /// <param name="entry">A delegate which will be called to run your application.</param>
- /// <returns>Returns the return value from the <c>entry</c> parameter.</returns>
- public int Run(string[] args, Func<int> entry)
+ protected void DisposeAutoCreatedWindow()
{
- Parameters.Arguments = args;
-
- return RunImpl(entry);
+ if (window != null)
+ {
+ window.Dispose();
+ window = null;
+ }
}
- private int RunImpl(Action entry)
- {
- return RunImpl(ActionToFunc(entry));
- }
/// <summary>
- /// Runs the application model by calling RunModel. If you override this, make
- /// sure to catch the ExitGameException and return 0 in the exception handler.
+ /// Override this to clean up the platform initialization of AgateLib.
/// </summary>
- /// <param name="entry"></param>
- /// <returns></returns>
- protected virtual int RunImpl(Func<int> entry)
- {
- try
- {
- return RunModel(entry);
- }
- catch (ExitGameException)
- {
- return 0;
- }
- }
+ /// <param name="disposing"></param>
+ protected virtual void Dispose(bool disposing)
+ { }
/// <summary>
/// Processes command line arguments. Override this to completely replace the
@@ -257,30 +199,9 @@
Log.WriteLine(" {0} {1}", arg, string.Join(" ", parm));
}
- /// <summary>
- /// Runs the application model.
- /// </summary>
- /// <param name="entryPoint"></param>
- /// <returns></returns>
- protected int RunModel(Func<int> entryPoint)
+ protected void PrerunInitialization()
{
- try
- {
- Initialize();
- AutoCreateDisplayWindow();
- SetPlatformEmulation();
-
- int retval = BeginModel(entryPoint);
-
- return retval;
- }
- finally
- {
- if (window != null)
- window.Dispose();
-
- Dispose();
- }
+ SetPlatformEmulation();
}
private void SetPlatformEmulation()
@@ -291,17 +212,11 @@
}
}
- /// <summary>
- /// Override this to implement the application model. This function
- /// should call the entry point and return its return value.
- /// It should not catch ExitGameException.
- /// </summary>
- /// <param name="entryPoint">The application entry point to call.</param>
- /// <returns></returns>
- protected abstract int BeginModel(Func<int> entryPoint);
+ protected void AutoCreateDisplayWindow()
+ {
+ if (window != null)
+ throw new InvalidOperationException("Cannot do autocreation of window if one already exists.");
- private void AutoCreateDisplayWindow()
- {
if (Parameters.AutoCreateDisplayWindow == false)
return;
Added: trunk/AgateLib/ApplicationModels/EntryPointAppModelBase.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/EntryPointAppModelBase.cs (rev 0)
+++ trunk/AgateLib/ApplicationModels/EntryPointAppModelBase.cs 2014-08-23 20:11:39 UTC (rev 1475)
@@ -0,0 +1,124 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.ApplicationModels
+{
+ /// <summary>
+ /// Provides a base class for application models that use a function
+ /// as an entry point.
+ /// </summary>
+ public abstract class EntryPointAppModelBase : AgateAppModel
+ {
+
+ public EntryPointAppModelBase(ModelParameters parameters)
+ : base(parameters)
+ { }
+
+ /// <summary>
+ /// Runs the application model with the specified entry point for your application.
+ /// </summary>
+ /// <param name="entry">A delegate which will be called to run your application.</param>
+ /// <returns>Returns 0.</returns>
+ public int Run(Action entry)
+ {
+ return RunImpl(entry);
+ }
+ /// <summary>
+ /// Runs the application model with the specified entry point for your application.
+ /// </summary>
+ /// <param name="entry">A delegate which will be called to run your application.</param>
+ /// <returns>Returns the return value from the <c>entry</c> parameter.</returns>
+ public int Run(Func<int> entry)
+ {
+ return RunImpl(entry);
+ }
+ /// <summary>
+ /// Runs the application model with the specified entry point and command line arguments for your application.
+ /// </summary>
+ /// <param name="args">The command arguments to process.</param>
+ /// <param name="entry">A delegate which will be called to run your application.</param>
+ /// <returns>Returns 0.</returns>
+ public int Run(string[] args, Action entry)
+ {
+ Parameters.Arguments = args;
+
+ return RunImpl(entry);
+ }
+ /// <summary>
+ /// Runs the application model with the specified entry point and command line arguments for your application.
+ /// </summary>
+ /// <param name="args">The command arguments to process.</param>
+ /// <param name="entry">A delegate which will be called to run your application.</param>
+ /// <returns>Returns the return value from the <c>entry</c> parameter.</returns>
+ public int Run(string[] args, Func<int> entry)
+ {
+ Parameters.Arguments = args;
+
+ return RunImpl(entry);
+ }
+
+ private int RunImpl(Action entry)
+ {
+ return RunImpl(ActionToFunc(entry));
+ }
+ /// <summary>
+ /// Runs the application model by calling RunModel. If you override this, make
+ /// sure to catch the ExitGameException and return 0 in the exception handler.
+ /// </summary>
+ /// <param name="entry"></param>
+ /// <returns></returns>
+ protected virtual int RunImpl(Func<int> entry)
+ {
+ try
+ {
+ return RunModel(entry);
+ }
+ catch (ExitGameException)
+ {
+ return 0;
+ }
+ }
+
+ /// <summary>
+ /// Runs the application model.
+ /// </summary>
+ /// <param name="entryPoint"></param>
+ /// <returns></returns>
+ protected int RunModel(Func<int> entryPoint)
+ {
+ try
+ {
+ Initialize();
+ AutoCreateDisplayWindow();
+ PrerunInitialization();
+
+ int retval = BeginModel(entryPoint);
+
+ return retval;
+ }
+ finally
+ {
+ DisposeAutoCreatedWindow();
+
+ Dispose();
+ }
+ }
+
+ /// <summary>
+ /// Override this to implement the application model. This function
+ /// should call the entry point and return its return value.
+ /// It should not catch ExitGameException.
+ /// </summary>
+ /// <param name="entryPoint">The application entry point to call.</param>
+ /// <returns></returns>
+ protected abstract int BeginModel(Func<int> entryPoint);
+
+ static Func<int> ActionToFunc(Action entry)
+ {
+ return () => { entry(); return 0; };
+ }
+
+ }
+}
Added: trunk/AgateLib/ApplicationModels/Scene.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/Scene.cs (rev 0)
+++ trunk/AgateLib/ApplicationModels/Scene.cs 2014-08-23 20:11:39 UTC (rev 1475)
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.ApplicationModels
+{
+ public abstract class Scene
+ {
+ public bool UpdateBelow { get; set; }
+ public bool DrawBelow { get; set; }
+
+ public abstract void Update(double delta_t);
+ public abstract void Draw();
+ }
+}
Added: trunk/AgateLib/ApplicationModels/SceneAppModelBase.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/SceneAppModelBase.cs (rev 0)
+++ trunk/AgateLib/ApplicationModels/SceneAppModelBase.cs 2014-08-23 20:11:39 UTC (rev 1475)
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.ApplicationModels
+{
+ public abstract class SceneAppModelBase : AgateAppModel
+ {
+ public SceneAppModelBase(ModelParameters parameters)
+ : base(parameters)
+ { }
+ }
+}
Added: trunk/AgateLib/ApplicationModels/SceneStack.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/SceneStack.cs (rev 0)
+++ trunk/AgateLib/ApplicationModels/SceneStack.cs 2014-08-23 20:11:39 UTC (rev 1475)
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.ApplicationModels
+{
+ public static class SceneStack
+ {
+ static List<Scene> mScenes = new List<Scene>();
+
+ public static void Add(Scene scene)
+ {
+ mScenes.Add(scene);
+ }
+ public static void Remove(Scene scene)
+ {
+ mScenes.Remove(scene);
+ }
+
+ static IEnumerable<Scene> ScenesAbove(Func<Scene, bool> pred)
+ {
+ if (mScenes.Count == 0)
+ yield break;
+
+ int bottomIndex = 0;
+
+ for (int i = mScenes.Count - 1; i >= 0; i--)
+ {
+ if (mScenes[i].UpdateBelow == false)
+ bottomIndex = i;
+ }
+
+ for (int i = bottomIndex; i < mScenes.Count; i++)
+ yield return mScenes[i];
+ }
+
+ public static IEnumerable<Scene> UpdateScenes
+ {
+ get { return ScenesAbove(x => x.UpdateBelow == false); }
+ }
+ public static IEnumerable<Scene> DrawScenes
+ {
+ get { return ScenesAbove(x => x.DrawBelow == false); }
+ }
+
+ public static int Count { get { return mScenes.Count; } }
+
+ public static bool Contains(Scene scene)
+ {
+ return mScenes.Contains(scene);
+ }
+ }
+}
Modified: trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj 2014-08-23 16:20:55 UTC (rev 1474)
+++ trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj 2014-08-23 20:11:39 UTC (rev 1475)
@@ -89,7 +89,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
- <Compile Include="ApplicationModels\FormsModelBase.cs" />
<Compile Include="ApplicationModels\FormsModelParameters.cs" />
<Compile Include="ApplicationModels\PassiveModel.cs" />
<Compile Include="ApplicationModels\PassiveModelParameters.cs" />
@@ -135,7 +134,7 @@
<Compile Include="PlatformImplementation\TgzFileProvider.cs" />
<Compile Include="PlatformImplementation\ZipFileProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Configuration.cs" />
+ <Compile Include="Initializer.cs" />
<Compile Include="Resources\BuiltinResources.cs" />
<Compile Include="SurfaceExtensions.cs" />
<Compile Include="WinForms\AgateRenderTarget.cs">
Deleted: trunk/AgateLib.Platform.WindowsForms/ApplicationModels/FormsModelBase.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/ApplicationModels/FormsModelBase.cs 2014-08-23 16:20:55 UTC (rev 1474)
+++ trunk/AgateLib.Platform.WindowsForms/ApplicationModels/FormsModelBase.cs 2014-08-23 20:11:39 UTC (rev 1475)
@@ -1,40 +0,0 @@
-using AgateLib.ApplicationModels;
-using AgateLib.Platform.WindowsForms.Factories;
-using AgateLib.Utility;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace AgateLib.Platform.WindowsForms.ApplicationModels
-{
- public abstract class FormsModelBase : AgateAppModel
- {
- public FormsModelBase(ModelParameters parameters)
- : base(parameters)
- {
-
- }
-
- public new FormsModelParameters Parameters
- {
- get { return (FormsModelParameters)base.Parameters; }
- }
-
- protected override void InitializeImpl()
- {
- 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)
- {
- }
- }
-}
Modified: trunk/AgateLib.Platform.WindowsForms/ApplicationModels/PassiveModel.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/ApplicationModels/PassiveModel.cs 2014-08-23 16:20:55 UTC (rev 1474)
+++ trunk/AgateLib.Platform.WindowsForms/ApplicationModels/PassiveModel.cs 2014-08-23 20:11:39 UTC (rev 1475)
@@ -12,7 +12,7 @@
/// program exits. The passive model is suitable for applications which provide their own message
/// pump and render loop logic.
/// </summary>
- public class PassiveModel : FormsModelBase
+ public class PassiveModel : EntryPointAppModelBase
{
#region --- Static Members ---
Modified: trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SceneModel.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SceneModel.cs 2014-08-23 16:20:55 UTC (rev 1474)
+++ trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SceneModel.cs 2014-08-23 20:11:39 UTC (rev 1475)
@@ -1,4 +1,5 @@
using AgateLib.ApplicationModels;
+using AgateLib.DisplayLib;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,21 +8,33 @@
namespace AgateLib.Platform.WindowsForms.ApplicationModels
{
- public class SceneModel : FormsModelBase
+ public class SceneModel : SceneAppModelBase
{
private SceneModel(ModelParameters parameters) : base(parameters)
{ }
public static ModelParameters DefaultParameters { get; set; }
- protected override int BeginModel(Func<int> entryPoint)
+ public int Run(Scene scene)
{
- throw new NotImplementedException();
+ if (SceneStack.Contains(scene) == false)
+ SceneStack.Add(scene);
+
+ while(SceneStack.Count > 0)
+ {
+ foreach (var sc in SceneStack.UpdateScenes)
+ sc.Update(Display.DeltaTime);
+
+ foreach (var sc in SceneStack.DrawScenes)
+ sc.Draw();
+ }
+
+ return 0;
}
public override void KeepAlive()
{
- throw new NotImplementedException();
+ base.KeepAlive();
}
}
}
Modified: trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SerialModel.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SerialModel.cs 2014-08-23 16:20:55 UTC (rev 1474)
+++ trunk/AgateLib.Platform.WindowsForms/ApplicationModels/SerialModel.cs 2014-08-23 20:11:39 UTC (rev 1475)
@@ -9,7 +9,7 @@
namespace AgateLib.Platform.WindowsForms.ApplicationModels
{
- public class SerialModel : FormsModelBase
+ public class SerialModel : EntryPointAppModelBase
{
#region --- Static Members ---
Deleted: trunk/AgateLib.Platform.WindowsForms/Configuration.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/Configuration.cs 2014-08-23 16:20:55 UTC (rev 1474)
+++ trunk/AgateLib.Platform.WindowsForms/Configuration.cs 2014-08-23 20:11:39 UTC (rev 1475)
@@ -1,38 +0,0 @@
-using AgateLib.Drivers;
-using AgateLib.Platform.WindowsForms.DisplayImplementation;
-using AgateLib.OpenGL;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using AgateLib.Platform.WindowsForms.Factories;
-using AgateLib.Utility;
-
-namespace AgateLib.Platform.WindowsForms
-{
- [Obsolete]
- public static class Configuration
- {
- static FileProviderList mAssetProvider = new FileProviderList();
- static FileProviderList mResourceProvider = new FileProviderList();
- static FileProviderList mSurfaceProvider = new FileProviderList();
- static FileProviderList mSoundProvider = new FileProviderList();
- static FileProviderList mMusicProvider = new FileProviderList();
-
- [Obsolete]
- public static void Initialize()
- {
-
- }
-
- [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; } }
- }
-}
Copied: trunk/AgateLib.Platform.WindowsForms/Initializer.cs (from rev 1473, trunk/AgateLib.Platform.WindowsForms/Configuration.cs)
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/Initializer.cs (rev 0)
+++ trunk/AgateLib.Platform.WindowsForms/Initializer.cs 2014-08-23 20:11:39 UTC (rev 1475)
@@ -0,0 +1,19 @@
+using AgateLib.Platform.WindowsForms.ApplicationModels;
+using AgateLib.Platform.WindowsForms.Factories;
+using AgateLib.Utility;
+
+namespace AgateLib.Platform.WindowsForms
+{
+ static class Initializer
+ {
+ public static void Initialize(FormsModelParameters Parameters)
+ {
+ 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);
+ }
+ }
+}
Modified: trunk/UnitTests/ApplicationModels/ArgumentProcessing.cs
===================================================================
--- trunk/UnitTests/ApplicationModels/ArgumentProcessing.cs 2014-08-23 16:20:55 UTC (rev 1474)
+++ trunk/UnitTests/ApplicationModels/ArgumentProcessing.cs 2014-08-23 20:11:39 UTC (rev 1475)
@@ -19,10 +19,10 @@
{
}
- protected override int BeginModel(Func<int> entryPoint)
- {
- return 0;
- }
+ //protected override int BeginModel(Func<int> entryPoint)
+ //{
+ // return 0;
+ //}
public List<string> Expected { get { return expected; } }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-23 21:28:43
|
Revision: 1476
http://sourceforge.net/p/agate/code/1476
Author: kanato
Date: 2014-08-23 21:28:36 +0000 (Sat, 23 Aug 2014)
Log Message:
-----------
Convert OpenTK reference to nuget reference.
Modified Paths:
--------------
trunk/AgateLib-Everything.sln
trunk/AgateLib.GL/AgateLib.GL.csproj
trunk/AgateLib.GL/GL3/Shaders/ShaderSources.Designer.cs
trunk/AgateLib.GL/packages.config
trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj
trunk/AgateLib.Platform.WindowsForms/WinForms/Icons.Designer.cs
trunk/AgateLib.Platform.WindowsForms/packages.config
trunk/AgateLib.sln
Removed Paths:
-------------
trunk/AgateLib.GL/OpenTK.dll
trunk/AgateLib.GL/OpenTK.dll.config
trunk/AgateLib.GL/OpenTK.xml
Modified: trunk/AgateLib-Everything.sln
===================================================================
--- trunk/AgateLib-Everything.sln 2014-08-23 20:11:39 UTC (rev 1475)
+++ trunk/AgateLib-Everything.sln 2014-08-23 21:28:36 UTC (rev 1476)
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
-VisualStudioVersion = 12.0.30501.0
+VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Files", "{6AFA2E43-361A-4AA6-83D9-6DE946C1F0B6}"
ProjectSection(SolutionItems) = preProject
@@ -40,92 +40,221 @@
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|ARM = Debug|ARM
+ Debug|x86 = Debug|x86
Public|Any CPU = Public|Any CPU
+ Public|ARM = Public|ARM
+ Public|x86 = Public|x86
Release|Any CPU = Release|Any CPU
+ Release|ARM = Release|ARM
+ 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|ARM.ActiveCfg = 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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.ActiveCfg = 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|ARM.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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.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|ARM.ActiveCfg = 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|ARM.ActiveCfg = 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|ARM.ActiveCfg = Release|Any CPU
+ {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|x86.ActiveCfg = Release|x86
+ {F22ADCCC-7991-4F52-B2D0-697D60121BB3}.Release|x86.Build.0 = Release|x86
{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|ARM.ActiveCfg = Debug|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.ActiveCfg = Debug|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.ActiveCfg = Debug|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.ActiveCfg = Debug|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.ActiveCfg = Debug|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.ActiveCfg = Debug|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.ActiveCfg = Debug|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.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|ARM.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|ARM.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|ARM.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|ARM.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|ARM.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|ARM.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|ARM.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|ARM.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|ARM.ActiveCfg = Debug|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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|ARM.ActiveCfg = Release|Any CPU
+ {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
Modified: trunk/AgateLib.GL/AgateLib.GL.csproj
===================================================================
--- trunk/AgateLib.GL/AgateLib.GL.csproj 2014-08-23 20:11:39 UTC (rev 1475)
+++ trunk/AgateLib.GL/AgateLib.GL.csproj 2014-08-23 21:28:36 UTC (rev 1476)
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AgateLib.GL</RootNamespace>
<AssemblyName>AgateLib.GL</AssemblyName>
- <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
@@ -75,8 +75,7 @@
<ItemGroup>
<Reference Include="OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\Drivers\AgateOTK\OpenTK.dll</HintPath>
- <Private>True</Private>
+ <HintPath>..\packages\OpenTK.1.1.1589.5942\lib\NET40\OpenTK.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -137,9 +136,6 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
- <None Include="OpenTK.dll.config">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
<None Include="packages.config" />
<None Include="Resources\Basic2D_pixel.txt" />
</ItemGroup>
@@ -147,14 +143,6 @@
<None Include="Resources\Basic2D_vert.txt" />
</ItemGroup>
<ItemGroup>
- <Content Include="OpenTK.dll">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- <Content Include="OpenTK.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- </ItemGroup>
- <ItemGroup>
<ProjectReference Include="..\AgateLib\AgateLib.csproj">
<Project>{9490b719-829e-43a7-a5fe-8001f8a81759}</Project>
<Name>AgateLib</Name>
Modified: trunk/AgateLib.GL/GL3/Shaders/ShaderSources.Designer.cs
===================================================================
--- trunk/AgateLib.GL/GL3/Shaders/ShaderSources.Designer.cs 2014-08-23 20:11:39 UTC (rev 1475)
+++ trunk/AgateLib.GL/GL3/Shaders/ShaderSources.Designer.cs 2014-08-23 21:28:36 UTC (rev 1476)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:4.0.30319.18408
+// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -39,7 +39,7 @@
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AgateLib.OpenGL.GL3.Shaders.ShaderSources", typeof(ShaderSources).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AgateLib.GL.GL3.Shaders.ShaderSources", typeof(ShaderSources).Assembly);
resourceMan = temp;
}
return resourceMan;
Deleted: trunk/AgateLib.GL/OpenTK.dll
===================================================================
(Binary files differ)
Deleted: trunk/AgateLib.GL/OpenTK.dll.config
===================================================================
--- trunk/AgateLib.GL/OpenTK.dll.config 2014-08-23 20:11:39 UTC (rev 1475)
+++ trunk/AgateLib.GL/OpenTK.dll.config 2014-08-23 21:28:36 UTC (rev 1476)
@@ -1,25 +0,0 @@
-<configuration>
- <dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
- <dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>
- <dllmap os="linux" dll="openal32.dll" target="libopenal.so.1"/>
- <dllmap os="linux" dll="alut.dll" target="libalut.so.0"/>
- <dllmap os="linux" dll="opencl.dll" target="libOpenCL.so"/>
- <dllmap os="linux" dll="libX11" target="libX11.so.6"/>
- <dllmap os="linux" dll="libXi" target="libXi.so.6"/>
- <dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0"/>
- <dllmap os="osx" dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL"/>
- <dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
- <dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
- <dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
- <dllmap os="osx" dll="libGLESv1_CM.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
- <dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
- <dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL"/>
- <dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib"/>
- <!-- XQuartz compatibility (X11 on Mac) -->
- <dllmap os="osx" dll="libGL.so.1" target="/usr/X11/lib/libGL.dylib"/>
- <dllmap os="osx" dll="libX11" target="/usr/X11/lib/libX11.dylib"/>
- <dllmap os="osx" dll="libXcursor.so.1" target="/usr/X11/lib/libXcursor.dylib"/>
- <dllmap os="osx" dll="libXi" target="/usr/X11/lib/libXi.dylib"/>
- <dllmap os="osx" dll="libXinerama" target="/usr/X11/lib/libXinerama.dylib"/>
- <dllmap os="osx" dll="libXrandr.so.2" target="/usr/X11/lib/libXrandr.dylib"/>
-</configuration>
Deleted: trunk/AgateLib.GL/OpenTK.xml
===================================================================
--- trunk/AgateLib.GL/OpenTK.xml 2014-08-23 20:11:39 UTC (rev 1475)
+++ trunk/AgateLib.GL/OpenTK.xml 2014-08-23 21:28:36 UTC (rev 1476)
@@ -1,421025 +0,0 @@
-<?xml version="1.0"?>
-<doc>
- <assembly>
- <name>OpenTK</name>
- </assembly>
- <members>
- <member name="T:OpenTK.DisplayDevice">
- <summary>
- Defines a display device on the underlying system, and provides
- methods to query and change its display parameters.
- </summary>
- </member>
- <member name="M:OpenTK.DisplayDevice.SelectResolution(System.Int32,System.Int32,System.Int32,System.Single)">
- <summary>
- Selects an available resolution that matches the specified parameters.
- </summary>
- <param name="width">The width of the requested resolution in pixels.</param>
- <param name="height">The height of the requested resolution in pixels.</param>
- <param name="bitsPerPixel">The bits per pixel of the requested resolution.</param>
- <param name="refreshRate">The refresh rate of the requested resolution in hertz.</param>
- <returns>The requested DisplayResolution or null if the parameters cannot be met.</returns>
- <remarks>
- <para>If a matching resolution is not found, this function will retry ignoring the specified refresh rate,
- bits per pixel and resolution, in this order. If a matching resolution still doesn't exist, this function will
- return the current resolution.</para>
- <para>A parameter set to 0 or negative numbers will not be used in the search (e.g. if refreshRate is 0,
- any refresh rate will be considered valid).</para>
- <para>This function allocates memory.</para>
- </remarks>
- </member>
- <member name="M:OpenTK.DisplayDevice.ChangeResolution(OpenTK.DisplayResolution)">
- <summary>Changes the resolution of the DisplayDevice.</summary>
- <param name="resolution">The resolution to set. <see cref="M:OpenTK.DisplayDevice.SelectResolution(System.Int32,System.Int32,System.Int32,System.Single)"/></param>
- <exception cref="T:OpenTK.Graphics.GraphicsModeException">Thrown if the requested resolution could not be set.</exception>
- <remarks>If the specified resolution is null, this function will restore the original DisplayResolution.</remarks>
- </member>
- <member name="M:OpenTK.DisplayDevice.ChangeResolution(System.Int32,System.Int32,System.Int32,System.Single)">
- <summary>Changes the resolution of the DisplayDevice.</summary>
- <param name="width">The new width of the DisplayDevice.</param>
- <param name="height">The new height of the DisplayDevice.</param>
- <param name="bitsPerPixel">The new bits per pixel of the DisplayDevice.</param>
- <param name="refreshRate">The new refresh rate of the DisplayDevice.</param>
- <exception cref="T:OpenTK.Graphics.GraphicsModeException">Thrown if the requested resolution could not be set.</exception>
- </member>
- <member name="M:OpenTK.DisplayDevice.RestoreResolution">
- <summary>Restores the original resolution of the DisplayDevice.</summary>
- <exception cref="T:OpenTK.Graphics.GraphicsModeException">Thrown if the original resolution could not be restored.</exception>
- </member>
- <member name="M:OpenTK.DisplayDevice.GetDisplay(OpenTK.DisplayIndex)">
- <summary>
- Gets the <see cref="T:OpenTK.DisplayDevice"/> for the specified <see cref="T:OpenTK.DisplayIndex"/>.
- </summary>
- <param name="index">The <see cref="T:OpenTK.DisplayIndex"/> that defines the desired display.</param>
- <returns>A <see cref="T:OpenTK.DisplayDevice"/> or null, if no device corresponds to the specified index.</returns>
- </member>
- <member name="M:OpenTK.DisplayDevice.ToString">
- <summary>
- Returns a System.String representing this DisplayDevice.
- </summary>
- <returns>A System.String representing this DisplayDevice.</returns>
- </member>
- <member name="P:OpenTK.DisplayDevice.Bounds">
- <summary>
- Gets the bounds of this instance in pixel coordinates..
- </summary>
- </member>
- <member name="P:OpenTK.DisplayDevice.Width">
- <summary>Gets a System.Int32 that contains the width of this display in pixels.</summary>
- </member>
- <member name="P:OpenTK.DisplayDevice.Height">
- <summary>Gets a System.Int32 that contains the height of this display in pixels.</summary>
- </member>
- <member name="P:OpenTK.DisplayDevice.BitsPerPixel">
- <summary>Gets a System.Int32 that contains number of bits per pixel of this display. Typical values include 8, 16, 24 and 32.</summary>
- </member>
- <member name="P:OpenTK.DisplayDevice.RefreshRate">
- <summary>
- Gets a System.Single representing the vertical refresh rate of this display.
- </summary>
- </member>
- <member name="P:OpenTK.DisplayDevice.IsPrimary">
- <summary>Gets a System.Boolean that indicates whether this Display is the primary Display in systems with multiple Displays.</summary>
- </member>
- <member name="P:OpenTK.DisplayDevice.AvailableResolutions">
- <summary>
- Gets the list of <see cref="T:OpenTK.DisplayResolution"/> objects available on this device.
- </summary>
- </member>
- <member name="P:OpenTK.DisplayDevice.AvailableDisplays">
- <summary>
- Gets the list of available <see cref="T:OpenTK.DisplayDevice"/> objects.
- This function allocates memory.
- </summary>
- </member>
- <member name="P:OpenTK.DisplayDevice.Default">
- <summary>Gets the default (primary) display of this system.</summary>
- </member>
- <member name="P:OpenTK.DisplayDevice.OriginalResolution">
- <summary>
- Gets the original resolution of this instance.
- </summary>
- </member>
- <member name="T:OpenTK.DisplayIndex">
- <summary>
- Defines <see cref="T:OpenTK.DisplayDevice"/> indice...
[truncated message content] |
|
From: <ka...@us...> - 2014-08-24 19:04:45
|
Revision: 1479
http://sourceforge.net/p/agate/code/1479
Author: kanato
Date: 2014-08-24 19:04:33 +0000 (Sun, 24 Aug 2014)
Log Message:
-----------
Loading of basic 2d shader works properly.
Modified Paths:
--------------
trunk/AgateLib/AgateGame.cs
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/ApplicationModels/AgateAppModel.cs
trunk/AgateLib/ApplicationModels/ModelParameters.cs
trunk/AgateLib/Diagnostics/AgateConsole.cs
trunk/AgateLib/DisplayLib/CreateWindowParams.cs
trunk/AgateLib/DisplayLib/Display.cs
trunk/AgateLib/DisplayLib/DisplayWindow.cs
trunk/AgateLib/DisplayLib/FrameBuffer.cs
trunk/AgateLib/DisplayLib/IFrameBuffer.cs
trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs
trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs
trunk/AgateLib/Geometry/CoordinateSystems/FixedAspectRatioCoordinates.cs
trunk/AgateLib/UserInterface/Css/Layout/CssLayoutEngine.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/DisplayImplementation/GL_DisplayControl.cs
trunk/AgateLib.Platform.WindowsForms/DisplayImplementation/GL_GameWindow.cs
trunk/AgateLib.Platform.WindowsPhone/AgateLib.Platform.WindowsPhone.csproj
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/FrameBufferSurface.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/FrameBufferWindow.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_Display.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_DisplayWindow.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_FrameBuffer.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_Surface.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/Shaders/SDX_Basic2DShader.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/Shaders/ShaderFactory.cs
trunk/AgateLib.Platform.WindowsPhone/Factories/DisplayFactory.cs
trunk/AgateLib.Platform.WindowsPhone/Factories/WindowsPhoneFactory.cs
trunk/AgateLib.Platform.WindowsPhone/WindowsPhoneInitializer.cs
trunk/Tests/AudioTests/SoundbufferStopTester.cs
trunk/Tests/DisplayTests/PixelBufferTest/PixelBufferTest.cs
trunk/Tests/DisplayTests/SpriteTester/frmSpriteTester.cs
trunk/Tests/DisplayTests/SurfaceTester/frmSurfaceTester.cs
trunk/Tests/InputTests/Input/frmInputTester.cs
trunk/UnitTests/ApplicationModels/CoordinateSystemTest.cs
trunk/UnitTests/Display/DisplayWindowTest.cs
trunk/UnitTests/Fakes/FakeFrameBuffer.cs
Added Paths:
-----------
trunk/AgateLib/Geometry/CoordinateSystems/
trunk/AgateLib/Geometry/CoordinateSystems/NativeCoordinates.cs
trunk/AgateLib/Geometry/ICoordinateSystemCreator.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/Shaders/SDX_Lighting3DShader.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/Shaders/ShaderResources.Designer.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/Shaders/ShaderResources.resx
trunk/AgateLib.Platform.WindowsPhone/Resources/
trunk/AgateLib.Platform.WindowsPhone/Resources/Basic2Dpixel.fxo
trunk/AgateLib.Platform.WindowsPhone/Resources/Basic2Dvert.fxo
trunk/AgateLib.Platform.WindowsPhone/Resources/ShaderSource/
trunk/AgateLib.Platform.WindowsPhone/Resources/ShaderSource/Basic2Dpixel.hlsl
trunk/AgateLib.Platform.WindowsPhone/Resources/ShaderSource/Basic2Dvert.hlsl
trunk/AgateLib.Platform.WindowsPhone/Resources/buildshaders.bat
trunk/AgateLib.Platform.WindowsPhone/Resources/fxc.bat
Removed Paths:
-------------
trunk/AgateLib/ApplicationModels/CoordinateSystems/
trunk/AgateLib/ApplicationModels/ICoordinateSystemCreator.cs
trunk/AgateLib/Geometry/CoordinateSystems/NaturalCoordinates.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/Shaders/SDL_Lighting3DShader.cs
Modified: trunk/AgateLib/AgateGame.cs
===================================================================
--- trunk/AgateLib/AgateGame.cs 2014-08-24 07:13:05 UTC (rev 1478)
+++ trunk/AgateLib/AgateGame.cs 2014-08-24 19:04:33 UTC (rev 1479)
@@ -153,7 +153,7 @@
if (FullScreen)
{
windp = CreateWindowParams.FullScreen(ApplicationTitle,
- WindowSize.Width, WindowSize.Height, 32);
+ WindowSize.Width, WindowSize.Height, 32, null);
windp.IconFile = InitParams.IconFile;
}
@@ -161,7 +161,7 @@
{
windp = CreateWindowParams.Windowed(ApplicationTitle,
WindowSize.Width, WindowSize.Height,
- InitParams.AllowResize, InitParams.IconFile);
+ InitParams.AllowResize, InitParams.IconFile, null);
}
mWindow = new DisplayWindow(windp);
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-24 07:13:05 UTC (rev 1478)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-24 19:04:33 UTC (rev 1479)
@@ -48,7 +48,7 @@
<Compile Include="Algorithms\PathFinding\AStarNode.cs" />
<Compile Include="Algorithms\PathFinding\AStarState.cs" />
<Compile Include="Algorithms\Inverting.cs" />
- <Compile Include="ApplicationModels\CoordinateSystems\NaturalCoordinates.cs" />
+ <Compile Include="Geometry\CoordinateSystems\NativeCoordinates.cs" />
<Compile Include="ApplicationModels\EntryPointAppModelBase.cs" />
<Compile Include="ApplicationModels\Scene.cs" />
<Compile Include="ApplicationModels\SceneAppModelBase.cs" />
@@ -65,8 +65,8 @@
</Compile>
<Compile Include="ApplicationModels\AgateAppModel.cs" />
<Compile Include="ApplicationModels\AssetLocations.cs" />
- <Compile Include="ApplicationModels\CoordinateSystems\FixedAspectRatioCoordinates.cs" />
- <Compile Include="ApplicationModels\ICoordinateSystemCreator.cs" />
+ <Compile Include="Geometry\CoordinateSystems\FixedAspectRatioCoordinates.cs" />
+ <Compile Include="Geometry\ICoordinateSystemCreator.cs" />
<Compile Include="ApplicationModels\ModelParameters.cs" />
<Compile Include="Resources\DC\AgateResource.cs" />
<Compile Include="Resources\DC\FontResource.cs" />
Modified: trunk/AgateLib/ApplicationModels/AgateAppModel.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/AgateAppModel.cs 2014-08-24 07:13:05 UTC (rev 1478)
+++ trunk/AgateLib/ApplicationModels/AgateAppModel.cs 2014-08-24 19:04:33 UTC (rev 1479)
@@ -224,18 +224,17 @@
{
window = DisplayWindow.CreateFullScreen(
Parameters.ApplicationName,
- GetFullScreenSize());
+ GetFullScreenSize(),
+ Parameters.CoordinateSystem);
}
else
{
window = DisplayWindow.CreateWindowed(
Parameters.ApplicationName,
- GetWindowedScreenSize());
+ GetWindowedScreenSize(),
+ Parameters.CoordinateSystem);
}
- window.FrameBuffer.CoordinateSystem =
- Parameters.CoordinateSystem.DetermineCoordinateSystem(window.Size);
-
Display.RenderState.WaitForVerticalBlank = Parameters.VerticalSync;
window.Closing += window_Closing;
Deleted: trunk/AgateLib/ApplicationModels/ICoordinateSystemCreator.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/ICoordinateSystemCreator.cs 2014-08-24 07:13:05 UTC (rev 1478)
+++ trunk/AgateLib/ApplicationModels/ICoordinateSystemCreator.cs 2014-08-24 19:04:33 UTC (rev 1479)
@@ -1,39 +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 AgateLib.Geometry;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace AgateLib.ApplicationModels
-{
- /// <summary>
- /// Interface for classes which create a coordinate system for a given DisplayWindow size.
- /// </summary>
- public interface ICoordinateSystemCreator
- {
- /// <summary>
- /// Returns the coordinate system given the size of the display window.
- /// </summary>
- /// <param name="displayWindowSize"></param>
- /// <returns></returns>
- Rectangle DetermineCoordinateSystem(Size displayWindowSize);
- }
-}
Modified: trunk/AgateLib/ApplicationModels/ModelParameters.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/ModelParameters.cs 2014-08-24 07:13:05 UTC (rev 1478)
+++ trunk/AgateLib/ApplicationModels/ModelParameters.cs 2014-08-24 19:04:33 UTC (rev 1479)
@@ -16,8 +16,8 @@
//
// Contributor(s): Erik Ylvisaker
//
-using AgateLib.ApplicationModels.CoordinateSystems;
using AgateLib.Geometry;
+using AgateLib.Geometry.CoordinateSystems;
using AgateLib.Platform;
using System;
using System.Collections.Generic;
@@ -39,7 +39,7 @@
public ModelParameters()
{
AssetLocations = new AssetLocations();
- CoordinateSystem = new NaturalCoordinates();
+ CoordinateSystem = new NativeCoordinates();
AutoCreateDisplayWindow = true;
CreateFullScreenWindow = true;
Modified: trunk/AgateLib/Diagnostics/AgateConsole.cs
===================================================================
--- trunk/AgateLib/Diagnostics/AgateConsole.cs 2014-08-24 07:13:05 UTC (rev 1478)
+++ trunk/AgateLib/Diagnostics/AgateConsole.cs 2014-08-24 19:04:33 UTC (rev 1479)
@@ -261,7 +261,7 @@
IsVisible = !IsVisible;
args.Handled = true;
- sInstance.mHeight = Display.RenderTarget.CoordinateSystem.Height * 5 / 12;
+ sInstance.mHeight = Display.CoordinateSystem.Height * 5 / 12;
}
else if (IsVisible)
{
Modified: trunk/AgateLib/DisplayLib/CreateWindowParams.cs
===================================================================
--- trunk/AgateLib/DisplayLib/CreateWindowParams.cs 2014-08-24 07:13:05 UTC (rev 1478)
+++ trunk/AgateLib/DisplayLib/CreateWindowParams.cs 2014-08-24 19:04:33 UTC (rev 1479)
@@ -22,6 +22,8 @@
using AgateLib.Geometry;
using AgateLib.Utility;
+using AgateLib.ApplicationModels;
+using AgateLib.Geometry.CoordinateSystems;
namespace AgateLib.DisplayLib
{
@@ -213,6 +215,12 @@
set { mRenderTarget = value; }
}
+ /// <summary>
+ /// The object which will be used to set the coordinate system for the window
+ /// at the beginning of each frame.
+ /// </summary>
+ public ICoordinateSystemCreator Coordinates { get; set; }
+
#endregion
#region --- Static creation methods ---
@@ -221,13 +229,15 @@
/// Creates a CreateWindowParams object which describes rendering into a WinForms control.
/// </summary>
/// <param name="control"></param>
+ /// <param name="coordinates">Coordinate system creator object. May be null</param>
/// <returns></returns>
- public static CreateWindowParams FromControl(object control)
+ public static CreateWindowParams FromControl(object control, ICoordinateSystemCreator coordinates)
{
CreateWindowParams retval = new CreateWindowParams();
retval.RenderToControl = true;
retval.RenderTarget = control;
+ retval.Coordinates = coordinates ?? new NativeCoordinates();
return retval;
}
@@ -239,8 +249,9 @@
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="bpp"></param>
+ /// <param name="coordinates">Coordinate system creator object. May be null</param>
/// <returns></returns>
- public static CreateWindowParams FullScreen(string title, int width, int height, int bpp)
+ public static CreateWindowParams FullScreen(string title, int width, int height, int bpp, ICoordinateSystemCreator coordinates)
{
CreateWindowParams retval = new CreateWindowParams();
@@ -249,6 +260,7 @@
retval.Width = width;
retval.Height = height;
retval.mBpp = bpp;
+ retval.Coordinates = coordinates ?? new NativeCoordinates();
return retval;
}
@@ -260,8 +272,9 @@
/// <param name="height"></param>
/// <param name="iconFile"></param>
/// <param name="allowResize"></param>
+ /// <param name="coordinates">Coordinate system creator object. May be null</param>
/// <returns></returns>
- public static CreateWindowParams Windowed(string title, int width, int height, bool allowResize, string iconFile)
+ public static CreateWindowParams Windowed(string title, int width, int height, bool allowResize, string iconFile, ICoordinateSystemCreator coordinates)
{
CreateWindowParams retval = new CreateWindowParams();
@@ -271,6 +284,7 @@
retval.IconFile = iconFile;
retval.IsResizable = allowResize;
retval.HasMaximize = allowResize;
+ retval.Coordinates = coordinates ?? new NativeCoordinates();
return retval;
}
@@ -282,8 +296,9 @@
/// <param name="title"></param>
/// <param name="width"></param>
/// <param name="height"></param>
+ /// <param name="coordinates">Coordinate system creator object. May be null</param>
/// <returns></returns>
- public static CreateWindowParams NoFrame(string title, int width, int height)
+ public static CreateWindowParams NoFrame(string title, int width, int height, ICoordinateSystemCreator coordinates)
{
CreateWindowParams retval = new CreateWindowParams();
@@ -292,10 +307,12 @@
retval.Height = height;
retval.IsResizable = false;
retval.HasFrame = false;
+ retval.Coordinates = coordinates ?? new NativeCoordinates();
return retval;
}
#endregion
+
}
}
Modified: trunk/AgateLib/DisplayLib/Display.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Display.cs 2014-08-24 07:13:05 UTC (rev 1478)
+++ trunk/AgateLib/DisplayLib/Display.cs 2014-08-24 19:04:33 UTC (rev 1479)
@@ -189,11 +189,11 @@
}
/// <summary>
- /// Gets the coordinate system for the current render target. Equivalent to Display.RenderTarget.CoordinateSystem.
+ /// Gets the coordinate system for the current render target.
/// </summary>
public static Rectangle CoordinateSystem
{
- get { return RenderTarget.CoordinateSystem; }
+ get { return RenderTarget.CoordinateSystem.DetermineCoordinateSystem(RenderTarget.Size); }
}
/// <summary>
@@ -288,7 +288,7 @@
sImpl.BeginFrame();
AgateBuiltInShaders.Basic2DShader.CoordinateSystem =
- RenderTarget.CoordinateSystem;
+ RenderTarget.CoordinateSystem.DetermineCoordinateSystem(RenderTarget.Size);
AgateBuiltInShaders.Basic2DShader.Activate();
sCurrentClipRect = new Rectangle(Point.Empty, RenderTarget.Size);
Modified: trunk/AgateLib/DisplayLib/DisplayWindow.cs
===================================================================
--- trunk/AgateLib/DisplayLib/DisplayWindow.cs 2014-08-24 07:13:05 UTC (rev 1478)
+++ trunk/AgateLib/DisplayLib/DisplayWindow.cs 2014-08-24 19:04:33 UTC (rev 1479)
@@ -21,6 +21,7 @@
using System.Text;
using AgateLib.Geometry;
using AgateLib.DisplayLib.ImplementationBase;
+using AgateLib.ApplicationModels;
namespace AgateLib.DisplayLib
{
@@ -38,6 +39,7 @@
{
DisplayWindowImpl mImpl;
FrameBuffer mFrameBuffer;
+ ICoordinateSystemCreator mCoordinates;
/// <summary>
/// Constructs a DisplayWindow from a resource.
@@ -56,14 +58,14 @@
if (disp.FullScreen)
{
CreateWindowParams par = CreateWindowParams.FullScreen(
- disp.Title, disp.Size.Width, disp.Size.Height, disp.Bpp);
+ disp.Title, disp.Size.Width, disp.Size.Height, disp.Bpp, null);
mImpl = Core.Factory.DisplayFactory.CreateDisplayWindow(this, par);
}
else
{
CreateWindowParams par = CreateWindowParams.Windowed(
- disp.Title, disp.Size.Width, disp.Size.Height, disp.AllowResize, null);
+ disp.Title, disp.Size.Width, disp.Size.Height, disp.AllowResize, null, null);
mImpl = Core.Factory.DisplayFactory.CreateDisplayWindow(this, par);
}
@@ -103,9 +105,9 @@
/// new DisplayWindow(CreateWindowParams.FromControl(control)).</remarks>
/// <param name="control">Windows.Forms control which should be used as the
/// render target.</param>
- public static DisplayWindow CreateFromControl(object control)
+ public static DisplayWindow CreateFromControl(object control, ICoordinateSystemCreator coordinates = null)
{
- return new DisplayWindow(CreateWindowParams.FromControl(control));
+ return new DisplayWindow(CreateWindowParams.FromControl(control, coordinates));
}
/// <summary>
/// Creates a DisplayWindow object which renders to the entire screen, setting
@@ -115,9 +117,9 @@
/// <param name="width"></param>
/// <param name="height"></param>
/// <returns></returns>
- public static DisplayWindow CreateFullScreen(string title, Size size)
+ public static DisplayWindow CreateFullScreen(string title, Size size, ICoordinateSystemCreator coordinates = null)
{
- return new DisplayWindow(CreateWindowParams.FullScreen(title, size.Width, size.Height, 32));
+ return new DisplayWindow(CreateWindowParams.FullScreen(title, size.Width, size.Height, 32, coordinates));
}
/// <summary>
/// Creates a DisplayWindow object which renders to the entire screen, setting
@@ -127,9 +129,9 @@
/// <param name="width"></param>
/// <param name="height"></param>
/// <returns></returns>
- public static DisplayWindow CreateFullScreen(string title, int width, int height)
+ public static DisplayWindow CreateFullScreen(string title, int width, int height, ICoordinateSystemCreator coordinates = null)
{
- return new DisplayWindow(CreateWindowParams.FullScreen(title, width, height, 32));
+ return new DisplayWindow(CreateWindowParams.FullScreen(title, width, height, 32, null));
}
/// <summary>
/// Creates a DisplayWindow object which generates a desktop window to render into.
@@ -138,47 +140,22 @@
/// <param name="title"></param>
/// <param name="size"></param>
/// <returns></returns>
- public static DisplayWindow CreateWindowed(string title, Size size)
+ public static DisplayWindow CreateWindowed(string title, Size size, ICoordinateSystemCreator coordinates = null)
{
- return DisplayWindow.CreateWindowed(title, size.Width, size.Height);
+ return DisplayWindow.CreateWindowed(title, size.Width, size.Height, false, null, coordinates);
}
/// <summary>
/// Creates a DisplayWindow object which generates a desktop window to render into.
- /// This overload creates a window which has the default icon and is not resizeable.
/// </summary>
/// <param name="title"></param>
/// <param name="width"></param>
/// <param name="height"></param>
- /// <returns></returns>
- public static DisplayWindow CreateWindowed(string title, int width, int height)
- {
- return DisplayWindow.CreateWindowed(title, width, height, false, null);
- }
- /// <summary>
- /// Creates a DisplayWindow object which generates a desktop window to render into.
- /// This overload creates a window which has the default icon and is not resizeable.
- /// </summary>
- /// <param name="title"></param>
- /// <param name="width"></param>
- /// <param name="height"></param>
- /// <param name="allowResize"></param>
- /// <returns></returns>
- public static DisplayWindow CreateWindowed(string title, int width, int height, bool allowResize)
- {
- return DisplayWindow.CreateWindowed(title, width, height, allowResize, null);
- }
- /// <summary>
- /// Creates a DisplayWindow object which generates a desktop window to render into.
- /// </summary>
- /// <param name="title"></param>
- /// <param name="width"></param>
- /// <param name="height"></param>
/// <param name="iconFile"></param>
/// <param name="allowResize"></param>
/// <returns></returns>
- public static DisplayWindow CreateWindowed(string title, int width, int height, bool allowResize, string iconFile)
+ public static DisplayWindow CreateWindowed(string title, int width, int height, bool allowResize = false, string iconFile = null, ICoordinateSystemCreator coordinates = null)
{
- return new DisplayWindow(CreateWindowParams.Windowed(title, width, height, allowResize, iconFile));
+ return new DisplayWindow(CreateWindowParams.Windowed(title, width, height, allowResize, iconFile, null));
}
/// <summary>
/// Creates a DisplayWindow object which is a desktop window with no frame or
@@ -188,9 +165,9 @@
/// <param name="width"></param>
/// <param name="height"></param>
/// <returns></returns>
- public static DisplayWindow CreateNoFrame(string title, int width, int height)
+ public static DisplayWindow CreateNoFrame(string title, int width, int height, ICoordinateSystemCreator coordinates = null)
{
- return new DisplayWindow(CreateWindowParams.NoFrame(title, width, height));
+ return new DisplayWindow(CreateWindowParams.NoFrame(title, width, height, null));
}
#endregion
@@ -352,7 +329,6 @@
add { mImpl.Closing += value; }
remove { mImpl.Closing -= value; }
}
-
}
public delegate void CancelEventHandler(object sender, ref bool cancel);
Modified: trunk/AgateLib/DisplayLib/FrameBuffer.cs
===================================================================
--- trunk/AgateLib/DisplayLib/FrameBuffer.cs 2014-08-24 07:13:05 UTC (rev 1478)
+++ trunk/AgateLib/DisplayLib/FrameBuffer.cs 2014-08-24 19:04:33 UTC (rev 1479)
@@ -21,7 +21,9 @@
using System.Linq;
using System.Text;
using AgateLib.Geometry;
+using AgateLib.Geometry.CoordinateSystems;
using AgateLib.DisplayLib.ImplementationBase;
+using AgateLib.ApplicationModels;
namespace AgateLib.DisplayLib
{
@@ -45,7 +47,7 @@
public FrameBuffer(Size size)
{
impl = Core.Factory.DisplayFactory.CreateFrameBuffer(size);
- CoordinateSystem = new Rectangle(Point.Empty, size);
+ CoordinateSystem = new NativeCoordinates();
}
/// <summary>
/// Constructs a frame buffer to be used as a render target. FrameBuffers constructed
@@ -64,7 +66,6 @@
internal FrameBuffer(FrameBufferImpl impl)
{
this.impl = impl;
- CoordinateSystem = new Rectangle(Point.Empty, impl.Size);
}
/// <summary>
/// Disposes of unmanaged resources.
@@ -158,7 +159,7 @@
/// framebuffer as a render target, this coordinate system is automatically
/// loaded.
/// </summary>
- public Rectangle CoordinateSystem
+ public ICoordinateSystemCreator CoordinateSystem
{
get { return Impl.CoordinateSystem; }
set { Impl.CoordinateSystem = value; }
Modified: trunk/AgateLib/DisplayLib/IFrameBuffer.cs
===================================================================
--- trunk/AgateLib/DisplayLib/IFrameBuffer.cs 2014-08-24 07:13:05 UTC (rev 1478)
+++ trunk/AgateLib/DisplayLib/IFrameBuffer.cs 2014-08-24 19:04:33 UTC (rev 1479)
@@ -1,4 +1,5 @@
-using AgateLib.Geometry;
+using AgateLib.ApplicationModels;
+using AgateLib.Geometry;
using System;
namespace AgateLib.DisplayLib
{
@@ -25,6 +26,6 @@
/// <summary>
/// Gets or sets the coordinate system for the render target.
/// </summary>
- Rectangle CoordinateSystem { get; set; }
+ ICoordinateSystemCreator CoordinateSystem { get; set; }
}
}
Modified: trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs 2014-08-24 07:13:05 UTC (rev 1478)
+++ trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs 2014-08-24 19:04:33 UTC (rev 1479)
@@ -85,8 +85,10 @@
/// <summary>
/// Gets or sets the mouse position within the render area.
/// </summary>
+ [Obsolete("This is probably obsolete.")]
public abstract Point MousePosition { get; set; }
+ [Obsolete("This is probably obsolete.")]
protected void SetInternalMousePosition(AgateLib.Geometry.Point pt)
{
AgateLib.InputLib.Legacy.Mouse.SetStoredPosition(pt);
@@ -147,15 +149,17 @@
/// <returns></returns>
public Point PixelToLogicalCoords(Point point)
{
+ var coords = FrameBuffer.CoordinateSystem.DetermineCoordinateSystem(FrameBuffer.Size);
+
double x = point.X / (double)Width;
double y = point.Y / (double)Height;
-
+
Point retval = new Point(
- (int)(x * FrameBuffer.CoordinateSystem.Width),
- (int)(y * FrameBuffer.CoordinateSystem.Height));
+ (int)(x * coords.Width),
+ (int)(y * coords.Height));
- retval.X += FrameBuffer.CoordinateSystem.X;
- retval.Y += FrameBuffer.CoordinateSystem.Y;
+ retval.X += coords.X;
+ retval.Y += coords.Y;
return retval;
}
@@ -166,11 +170,13 @@
/// <returns></returns>
public Point LogicalToPixelCoords(Point point)
{
- point.X -= FrameBuffer.CoordinateSystem.X;
- point.Y -= FrameBuffer.CoordinateSystem.Y;
+ var coords = FrameBuffer.CoordinateSystem.DetermineCoordinateSystem(FrameBuffer.Size);
- double x = point.X / (double)FrameBuffer.CoordinateSystem.Width;
- double y = point.Y / (double)FrameBuffer.CoordinateSystem.Height;
+ point.X -= coords.X;
+ point.Y -= coords.Y;
+
+ double x = point.X / (double)coords.Width;
+ double y = point.Y / (double)coords.Height;
return new Point(
(int)(x * Width),
Modified: trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs 2014-08-24 07:13:05 UTC (rev 1478)
+++ trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs 2014-08-24 19:04:33 UTC (rev 1479)
@@ -21,6 +21,7 @@
using System.Linq;
using System.Text;
using AgateLib.Geometry;
+using AgateLib.ApplicationModels;
namespace AgateLib.DisplayLib.ImplementationBase
{
@@ -29,6 +30,11 @@
/// </summary>
public abstract class FrameBufferImpl : IDisposable
{
+ public FrameBufferImpl(ICoordinateSystemCreator coords)
+ {
+ this.CoordinateSystem = coords;
+ }
+
/// <summary>
/// Disposes of the unmanaged resources.
/// </summary>
@@ -91,6 +97,6 @@
/// <summary>
/// Gets or sets the coordinate system that is used to map 2d coordinates to pixels in the render target.
/// </summary>
- public virtual Rectangle CoordinateSystem { get; set; }
+ public virtual ICoordinateSystemCreator CoordinateSystem { get; set; }
}
}
Modified: trunk/AgateLib/Geometry/CoordinateSystems/FixedAspectRatioCoordinates.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/CoordinateSystems/FixedAspectRatioCoordinates.cs 2014-08-23 20:11:39 UTC (rev 1475)
+++ trunk/AgateLib/Geometry/CoordinateSystems/FixedAspectRatioCoordinates.cs 2014-08-24 19:04:33 UTC (rev 1479)
@@ -22,7 +22,7 @@
using System.Linq;
using System.Text;
-namespace AgateLib.ApplicationModels.CoordinateSystems
+namespace AgateLib.Geometry.CoordinateSystems
{
/// <summary>
/// Constructs a coordinate system that gives a render area constrained to a
Copied: trunk/AgateLib/Geometry/CoordinateSystems/NativeCoordinates.cs (from rev 1475, trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs)
===================================================================
--- trunk/AgateLib/Geometry/CoordinateSystems/NativeCoordinates.cs (rev 0)
+++ trunk/AgateLib/Geometry/CoordinateSystems/NativeCoordinates.cs 2014-08-24 19:04:33 UTC (rev 1479)
@@ -0,0 +1,48 @@
+// 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;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.Geometry.CoordinateSystems
+{
+ /// <summary>
+ /// Constructs a coordinate system which matches the pixels coordinates of the display window,
+ /// up to an optional maximum height and width.
+ /// </summary>
+ public class NativeCoordinates : ICoordinateSystemCreator
+ {
+ public Rectangle DetermineCoordinateSystem(Size displayWindowSize)
+ {
+ Rectangle retval = new Rectangle(Point.Empty, displayWindowSize);
+
+ if (MaxSize != null)
+ {
+ retval.Width = Math.Min(retval.Width, MaxSize.Value.Width);
+ retval.Height = Math.Min(retval.Height, MaxSize.Value.Height);
+ }
+
+ return retval;
+ }
+
+ public Size? MaxSize { get; set; }
+ }
+}
Deleted: trunk/AgateLib/Geometry/CoordinateSystems/NaturalCoordinates.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/CoordinateSystems/NaturalCoordinates.cs 2014-08-23 20:11:39 UTC (rev 1475)
+++ trunk/AgateLib/Geometry/CoordinateSystems/NaturalCoordinates.cs 2014-08-24 19:04:33 UTC (rev 1479)
@@ -1,48 +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 implie...
[truncated message content] |
|
From: <ka...@us...> - 2014-08-27 01:20:07
|
Revision: 1480
http://sourceforge.net/p/agate/code/1480
Author: kanato
Date: 2014-08-27 01:19:58 +0000 (Wed, 27 Aug 2014)
Log Message:
-----------
Initial attempt at implementing surface drawing on WP.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/DisplayLib/ImplementationBase/IndexBufferImpl.cs
trunk/AgateLib/DisplayLib/ImplementationBase/VertexBufferImpl.cs
trunk/AgateLib/DisplayLib/IndexBuffer.cs
trunk/AgateLib/DisplayLib/VertexBuffer.cs
trunk/AgateLib.AgateSDL/AgateLib.AgateSDL.csproj
trunk/AgateLib.GL/AgateLib.GL.csproj
trunk/AgateLib.GL/GL3/GLVertexBuffer.cs
trunk/AgateLib.GL/GL_IndexBuffer.cs
trunk/AgateLib.GL/Legacy/LegacyVertexBuffer.cs
trunk/AgateLib.Platform.Common/AgateLib.Platform.Common.csproj
trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj
trunk/AgateLib.Platform.WindowsPhone/AgateLib.Platform.WindowsPhone.csproj
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/D3DDevice.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/DrawBuffer.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/FrameBufferWindow.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_Display.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_IndexBuffer.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_Surface.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_VertexBuffer.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/Shaders/SDX_Basic2DShader.cs
trunk/AgateLib.Platform.WindowsPhone/Resources/Basic2Dpixel.fxo
trunk/AgateLib.Platform.WindowsPhone/Resources/Basic2Dvert.fxo
trunk/AgateLib.Platform.WindowsPhone/Resources/ShaderSource/Basic2Dpixel.hlsl
trunk/AgateLib.Platform.WindowsPhone/Resources/ShaderSource/Basic2Dvert.hlsl
trunk/Tests.WindowsPhone/TestScene.cs
trunk/Tests.WindowsPhone/Tests.WindowsPhone.csproj
trunk/UnitTests/UnitTests.csproj
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib/AgateLib.csproj 2014-08-27 01:19:58 UTC (rev 1480)
@@ -25,6 +25,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RunCodeAnalysis>false</RunCodeAnalysis>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Modified: trunk/AgateLib/DisplayLib/ImplementationBase/IndexBufferImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/ImplementationBase/IndexBufferImpl.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib/DisplayLib/ImplementationBase/IndexBufferImpl.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -27,9 +27,14 @@
/// <summary>
/// Base class for implementing a hardware stored index buffer.
/// </summary>
- public abstract class IndexBufferImpl
+ public abstract class IndexBufferImpl : IDisposable
{
/// <summary>
+ /// Disposes of the buffer.
+ /// </summary>
+ public abstract void Dispose();
+
+ /// <summary>
/// Writes indices to the index buffer.
/// </summary>
/// <param name="indices"></param>
Modified: trunk/AgateLib/DisplayLib/ImplementationBase/VertexBufferImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/ImplementationBase/VertexBufferImpl.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib/DisplayLib/ImplementationBase/VertexBufferImpl.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -28,7 +28,7 @@
/// <summary>
/// Class for implementing a vertex buffer stored in hardware memory.
/// </summary>
- public abstract class VertexBufferImpl
+ public abstract class VertexBufferImpl : IDisposable
{
/// <summary>
/// Constructs a vertex buffer implementation.
@@ -39,6 +39,11 @@
}
/// <summary>
+ /// Disposes of the buffer.
+ /// </summary>
+ public abstract void Dispose();
+
+ /// <summary>
/// Writes vertices to the vertex buffer.
/// </summary>
/// <typeparam name="T">The type of vertices in the buffer. This type must be a struct, and may not
@@ -80,5 +85,6 @@
/// Gets the vertex layout which is used to interpret the data in the vertex buffer.
/// </summary>
public abstract VertexLayout VertexLayout { get; }
+
}
}
Modified: trunk/AgateLib/DisplayLib/IndexBuffer.cs
===================================================================
--- trunk/AgateLib/DisplayLib/IndexBuffer.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib/DisplayLib/IndexBuffer.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -29,7 +29,7 @@
/// used to reduce the amount of vertex data that needs to be stored/sent to the
/// graphics adapter.
/// </summary>
- public class IndexBuffer
+ public class IndexBuffer : IDisposable
{
IndexBufferImpl impl;
@@ -44,6 +44,14 @@
}
/// <summary>
+ /// Disposes of the buffer.
+ /// </summary>
+ public void Dispose()
+ {
+ impl.Dispose();
+ }
+
+ /// <summary>
/// Writes indices to the index buffer.
/// </summary>
/// <param name="indices">The indices to write.</param>
Modified: trunk/AgateLib/DisplayLib/VertexBuffer.cs
===================================================================
--- trunk/AgateLib/DisplayLib/VertexBuffer.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib/DisplayLib/VertexBuffer.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -29,7 +29,7 @@
/// <summary>
/// Class which represents a vertex buffer in memory.
/// </summary>
- public sealed class VertexBuffer
+ public sealed class VertexBuffer : IDisposable
{
VertexBufferImpl impl;
@@ -54,6 +54,14 @@
}
/// <summary>
+ /// Disposes of the buffer.
+ /// </summary>
+ public void Dispose()
+ {
+ impl.Dispose();
+ }
+
+ /// <summary>
/// Writes data to the vertex buffer.
/// </summary>
/// <typeparam name="T">Type of the vertex data. This must be a struct type, and it
Modified: trunk/AgateLib.AgateSDL/AgateLib.AgateSDL.csproj
===================================================================
--- trunk/AgateLib.AgateSDL/AgateLib.AgateSDL.csproj 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.AgateSDL/AgateLib.AgateSDL.csproj 2014-08-27 01:19:58 UTC (rev 1480)
@@ -60,6 +60,7 @@
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
Modified: trunk/AgateLib.GL/AgateLib.GL.csproj
===================================================================
--- trunk/AgateLib.GL/AgateLib.GL.csproj 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.GL/AgateLib.GL.csproj 2014-08-27 01:19:58 UTC (rev 1480)
@@ -41,6 +41,7 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
Modified: trunk/AgateLib.GL/GL3/GLVertexBuffer.cs
===================================================================
--- trunk/AgateLib.GL/GL3/GLVertexBuffer.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.GL/GL3/GLVertexBuffer.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -66,8 +66,13 @@
}
- public override void Write<T>(T[] vertices)
+ public override void Dispose()
{
+ GL.DeleteBuffer(mVertexBufferID);
+ }
+
+ public override void Write<T>(T[] vertices)
+ {
GL.BindBuffer(BufferTarget.ArrayBuffer, mVertexBufferID);
int size = vertices.Length * Marshal.SizeOf(typeof(T));
@@ -106,7 +111,7 @@
}
public override void DrawIndexed(IndexBuffer indexbuffer, int start, int count)
{
- GL_IndexBuffer gl_indexbuffer = (GL_IndexBuffer) indexbuffer.Impl;
+ GL_IndexBuffer gl_indexbuffer = (GL_IndexBuffer)indexbuffer.Impl;
GL.BindBuffer(BufferTarget.ElementArrayBuffer, gl_indexbuffer.BufferID);
GL.IndexPointer(IndexPointerType.Short, 0, start);
@@ -161,8 +166,8 @@
if (HasNormals)
{
GL.EnableClientState(EnableCap.NormalArray);
- GL.NormalPointer(NormalPointerType.Float, mLayout.VertexSize,
- (IntPtr) mLayout.ElementByteIndex(VertexElement.Normal));
+ GL.NormalPointer(NormalPointerType.Float, mLayout.VertexSize,
+ (IntPtr)mLayout.ElementByteIndex(VertexElement.Normal));
}
else
{
@@ -195,7 +200,7 @@
(IntPtr)mLayout.ElementByteIndex(VertexElement.Texture));
}
-
+
//GlslShader shader = Display.Shader as GlslShader;
if (Textures.ActiveTextures > 1)
Modified: trunk/AgateLib.GL/GL_IndexBuffer.cs
===================================================================
--- trunk/AgateLib.GL/GL_IndexBuffer.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.GL/GL_IndexBuffer.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -46,6 +46,11 @@
System.Diagnostics.Debug.Print("Created {0} index buffer.", type);
}
+ public override void Dispose()
+ {
+ GL.DeleteBuffer(mBufferID);
+ }
+
private void CreateBuffer()
{
GL.GenBuffers(1, out mBufferID);
Modified: trunk/AgateLib.GL/Legacy/LegacyVertexBuffer.cs
===================================================================
--- trunk/AgateLib.GL/Legacy/LegacyVertexBuffer.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.GL/Legacy/LegacyVertexBuffer.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -62,6 +62,11 @@
}
+ public override void Dispose()
+ {
+ GL.DeleteBuffer(mVertexBufferID);
+ }
+
public override void Write<T>(T[] vertices)
{
GL.BindBuffer(BufferTarget.ArrayBuffer, mVertexBufferID);
Modified: trunk/AgateLib.Platform.Common/AgateLib.Platform.Common.csproj
===================================================================
--- trunk/AgateLib.Platform.Common/AgateLib.Platform.Common.csproj 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.Platform.Common/AgateLib.Platform.Common.csproj 2014-08-27 01:19:58 UTC (rev 1480)
@@ -24,6 +24,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Modified: trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj
===================================================================
--- trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.Platform.WindowsForms/AgateLib.Platform.WindowsForms.csproj 2014-08-27 01:19:58 UTC (rev 1480)
@@ -41,6 +41,7 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
Modified: trunk/AgateLib.Platform.WindowsPhone/AgateLib.Platform.WindowsPhone.csproj
===================================================================
--- trunk/AgateLib.Platform.WindowsPhone/AgateLib.Platform.WindowsPhone.csproj 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.Platform.WindowsPhone/AgateLib.Platform.WindowsPhone.csproj 2014-08-27 01:19:58 UTC (rev 1480)
@@ -51,6 +51,7 @@
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
Modified: trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/D3DDevice.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/D3DDevice.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/D3DDevice.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -60,7 +60,7 @@
mWorld2D = Matrix.Identity;
- mDrawBuffer = new DrawBuffer(this);
+ mDrawBuffer = new DrawBuffer(this, context);
}
Modified: trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/DrawBuffer.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/DrawBuffer.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/DrawBuffer.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -23,7 +23,8 @@
using AgateLib.DisplayLib;
using AgateLib.Geometry.VertexTypes;
using Texture2D = SharpDX.Direct3D11.Texture2D;
-using SharpDX.Toolkit.Graphics;
+using SharpDX.Direct3D11;
+using SharpDX.SimpleInitializer;
namespace AgateLib.Platform.WindowsPhone.DisplayImplementation
{
@@ -36,8 +37,8 @@
const int vertPageSize = 1000;
int pages = 1;
+ SharpDXContext mContext;
D3DDevice mDevice;
- BasicEffect mEffect;
PositionTextureColor[] mVerts;
short[] mIndices;
@@ -46,29 +47,92 @@
int mIndexPointer = 0;
Texture2D mTexture;
+ ShaderResourceView mTextureView;
bool mAlphaBlend;
- public DrawBuffer(D3DDevice device)
+ SharpDX.Direct3D11.Buffer mVertexBuffer;
+ SharpDX.Direct3D11.Buffer mIndexBuffer;
+ SharpDX.Direct3D11.InputLayout mVertexLayout;
+ VertexBufferBinding mVertexBinding;
+
+ public DrawBuffer(D3DDevice device, SharpDXContext context)
{
+ mContext = context;
mDevice = device;
- mEffect = mDevice.Effect;
+ mContext.DeviceReset += Context_DeviceReset;
+
AllocateVerts();
+
+
}
+ void Context_DeviceReset(object sender, SharpDX.SimpleInitializer.DeviceResetEventArgs e)
+ {
+ AllocateHardwareResources();
+ }
+
+ public void AllocateHardwareResources()
+ {
+ if (mDevice.Device == null)
+ return;
+
+ if (mVertexLayout != null)
+ {
+ mVertexLayout.Dispose();
+ mVertexBuffer.Dispose();
+ mIndexBuffer.Dispose();
+ }
+
+ mVertexLayout = new SharpDX.Direct3D11.InputLayout(
+ mDevice.Device, (byte[])Shaders.ShaderResources.ResourceManager.GetObject("Basic2Dvert"),
+ new[] {
+ new SharpDX.Direct3D11.InputElement("POSITION", 0, SharpDX.DXGI.Format.R32G32B32A32_Float, 0, 0),
+ new SharpDX.Direct3D11.InputElement("TEXCOORD", 0, SharpDX.DXGI.Format.R32G32_Float, 16, 0),
+ new SharpDX.Direct3D11.InputElement("COLOR", 0, SharpDX.DXGI.Format.R8G8B8A8_UInt, 0)
+ });
+
+ var layout = PositionTextureColor.VertexLayout;
+
+ mVertexBuffer = new SharpDX.Direct3D11.Buffer(
+ mDevice.Device,
+ new BufferDescription(mVerts.Length * layout.VertexSize,
+ ResourceUsage.Dynamic,
+ BindFlags.VertexBuffer,
+ CpuAccessFlags.Write,
+ ResourceOptionFlags.None,
+ layout.VertexSize));
+
+ mIndexBuffer = new SharpDX.Direct3D11.Buffer(
+ mDevice.Device,
+ new BufferDescription(mIndices.Length * 2,
+ ResourceUsage.Dynamic,
+ BindFlags.IndexBuffer,
+ CpuAccessFlags.Write,
+ ResourceOptionFlags.None,
+ 2));
+
+ mVertexBinding = new VertexBufferBinding(mVertexBuffer, layout.VertexSize, 0);
+ }
+
private void AllocateVerts()
{
mVerts = new PositionTextureColor[vertPageSize * pages];
mIndices = new short[vertPageSize / 2 * 3 * pages];
+
+ AllocateHardwareResources();
}
- public void CacheDrawIndexedTriangles(PositionTextureColor[] verts, short[] indices,
- Texture2D texture, bool alphaBlend)
+
+ public void CacheDrawIndexedTriangles(
+ PositionTextureColor[] verts, short[] indices,
+ Texture2D texture, ShaderResourceView textureView, bool alphaBlend)
{
if (mTexture != texture || mAlphaBlend != alphaBlend)
{
Flush();
mTexture = texture;
+ mTextureView = textureView;
mAlphaBlend = alphaBlend;
}
@@ -117,8 +181,18 @@
private void DoDraw(object ignored)
{
- throw new NotImplementedException();
+ //mDevice.DeviceContext.OutputMerger.SetTargets(this.parentContext.DepthStencilView, this.parentContext.BackBufferView);
+ mDevice.DeviceContext.UpdateSubresource(mVerts, mVertexBuffer);
+ mDevice.DeviceContext.UpdateSubresource(mIndices, mIndexBuffer);
+
+ mDevice.DeviceContext.InputAssembler.SetVertexBuffers(0, mVertexBinding);
+ mDevice.DeviceContext.InputAssembler.SetIndexBuffer(mIndexBuffer, SharpDX.DXGI.Format.R16_UInt, 0);
+ mDevice.DeviceContext.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.TriangleList;
+
+ mDevice.DeviceContext.PixelShader.SetShaderResource(0, mTextureView);
+ mDevice.DeviceContext.DrawIndexed(mIndexPointer, 0, 0);
+
try
{
//mDevice.Device.DrawIndexedUserPrimitives
Modified: trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/FrameBufferWindow.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/FrameBufferWindow.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/FrameBufferWindow.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -94,6 +94,11 @@
//mDisplay.D3D_Device.Device.SetRenderTarget(0, mBackBuffer);
//mDisplay.D3D_Device.Device.DepthStencilSurface = mBackDepthStencil;
//mDisplay.D3D_Device.Device.BeginScene();
+
+ mContext.D3DContext.OutputMerger.SetTargets(
+ mContext.DepthStencilView,
+ mContext.BackBufferView);
+
}
public override void EndRender()
Modified: trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_Display.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_Display.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_Display.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -89,7 +89,6 @@
this.sdxContext = context;
this.mRenderControl = renderTarget;
- mDevice = new D3DDevice(context);
context.DeviceReset += context_DeviceReset;
}
@@ -100,6 +99,8 @@
public override void Initialize()
{
+ mDevice = new D3DDevice(sdxContext);
+
Report("SharpDX driver instantiated for display.");
}
Modified: trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_IndexBuffer.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_IndexBuffer.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_IndexBuffer.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -43,6 +43,11 @@
CreateIndexBuffer();
}
+ public override void Dispose()
+ {
+ mBuffer.Dispose();
+ }
+
public SharpDX.Direct3D11.Buffer DeviceIndexBuffer
{
get { return mBuffer; }
Modified: trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_Surface.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_Surface.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_Surface.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -47,6 +47,7 @@
SharpDX.Toolkit.Graphics.GraphicsDevice mGraphicsDevice { get { return mDevice.GraphicsDevice; } }
Ref<Texture2D> mTexture;
+ SharpDX.Direct3D11.ShaderResourceView mTextureView;
string mFileName;
@@ -59,7 +60,6 @@
PositionTextureColor[] mExtraVerts = new PositionTextureColor[4];
short[] mExtraIndices = new short[] { 0, 2, 1, 1, 2, 3 };
- private SharpDX.Direct3D11.ShaderResourceView mTextureView;
#endregion
@@ -67,6 +67,10 @@
{
get { return mTexture.Value; }
}
+ public SharpDX.Direct3D11.ShaderResourceView TextureView
+ {
+ get { return mTextureView; }
+ }
#region --- TextureCoordinates structure ---
@@ -272,6 +276,11 @@
}
private void Draw(SurfaceState state, SurfaceDrawInstance inst)
{
+ if (SurfaceSize.IsEmpty)
+ {
+ InitializeValues();
+ }
+
float destX = inst.DestLocation.X;
float destY = inst.DestLocation.Y;
Rectangle srcRect = inst.GetSourceRect(SurfaceSize);
@@ -307,9 +316,16 @@
rotationCenter.X, rotationCenter.Y,
state.DisplayAlignment, mRotationCos, mRotationSin);
- mDevice.DrawBuffer.CacheDrawIndexedTriangles(mVerts, mIndices, mTexture.Value, alphaBlend);
+ mDevice.DrawBuffer.CacheDrawIndexedTriangles(mVerts, mIndices,
+ mTexture.Value, mTextureView, alphaBlend);
}
+ private void InitializeValues()
+ {
+ mTextureSize = new Size( mTexture.Value.Description.Width, mTexture.Value.Description.Height);
+ mSrcRect = new Rectangle(Point.Empty, mTextureSize);
+ }
+
private void SetVertsTextureCoordinates(PositionTextureColor[] verts, int startIndex,
Rectangle srcRect)
{
Modified: trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_VertexBuffer.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_VertexBuffer.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/SDX_VertexBuffer.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -35,7 +35,6 @@
SharpDX.Direct3D11.Buffer mBuffer;
int mCount;
VertexLayout mLayout;
- DataStream mStream;
public SDX_VertexBuffer(SDX_Display display, VertexLayout layout, int vertexCount)
{
@@ -58,6 +57,11 @@
//mStream = display.D3D_Device.DeviceContext. mBuffer.Map
}
+ public override void Dispose()
+ {
+ mBuffer.Dispose();
+ }
+
public override VertexLayout VertexLayout
{
get { return mLayout; }
Modified: trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/Shaders/SDX_Basic2DShader.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/Shaders/SDX_Basic2DShader.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/Shaders/SDX_Basic2DShader.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -38,6 +38,8 @@
PixelShader mPixelShader;
SharpDX.Direct3D11.Buffer mConstantBuffer;
+ SamplerState mSampler;
+
public SDX_Basic2DShader()
{
mDisplay = (SDX_Display)DisplayLib.Display.Impl;
@@ -63,6 +65,29 @@
mVertexShader = new VertexShader(mDevice.Device, vs);
mPixelShader = new PixelShader(mDevice.Device, ps);
+
+ mConstantBuffer = new SharpDX.Direct3D11.Buffer(
+ mDevice.Device,
+ SharpDX.Utilities.SizeOf<SharpDX.Matrix>(),
+ ResourceUsage.Default,
+ BindFlags.ConstantBuffer,
+ CpuAccessFlags.None,
+ ResourceOptionFlags.None,
+ 0);
+
+ mSampler = new SamplerState(mDevice.Device, new SamplerStateDescription()
+ {
+ Filter = Filter.MinMagMipLinear,
+ AddressU = TextureAddressMode.Wrap,
+ AddressV = TextureAddressMode.Wrap,
+ AddressW = TextureAddressMode.Wrap,
+ BorderColor = SharpDX.Color.Black,
+ ComparisonFunction = Comparison.Never,
+ MaximumAnisotropy = 16,
+ MipLodBias = 0,
+ MinimumLod = -float.MaxValue,
+ MaximumLod = float.MaxValue
+ });
}
public override AgateLib.Geometry.Rectangle CoordinateSystem
@@ -102,6 +127,7 @@
SharpDX.Matrix orthoProj = SharpDX.Matrix.OrthoOffCenterRH(
mCoords.Left, mCoords.Right, mCoords.Bottom, mCoords.Top, -1, 1);
+ mDevice.DeviceContext.UpdateSubresource(ref orthoProj, mConstantBuffer, 0);
//// TODO: figure out why this method sometimes gets called when mDevice is null?
//if (mDevice != null)
//{
@@ -118,6 +144,12 @@
public override void Begin()
{
+ mDevice.DeviceContext.VertexShader.SetConstantBuffer(0, mConstantBuffer);
+ mDevice.DeviceContext.VertexShader.Set(mVertexShader);
+
+ mDevice.DeviceContext.PixelShader.Set(mPixelShader);
+ mDevice.DeviceContext.PixelShader.SetSampler(0, mSampler);
+
//SDX_Display mDisplay = (SDX_Display)AgateLib.DisplayLib.Display.Impl;
//Set2DDrawState();
Modified: trunk/AgateLib.Platform.WindowsPhone/Resources/Basic2Dpixel.fxo
===================================================================
(Binary files differ)
Modified: trunk/AgateLib.Platform.WindowsPhone/Resources/Basic2Dvert.fxo
===================================================================
(Binary files differ)
Modified: trunk/AgateLib.Platform.WindowsPhone/Resources/ShaderSource/Basic2Dpixel.hlsl
===================================================================
--- trunk/AgateLib.Platform.WindowsPhone/Resources/ShaderSource/Basic2Dpixel.hlsl 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.Platform.WindowsPhone/Resources/ShaderSource/Basic2Dpixel.hlsl 2014-08-27 01:19:58 UTC (rev 1480)
@@ -20,7 +20,6 @@
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
- float3 normal : NORMAL;
float4 color : COLOR;
};
@@ -30,6 +29,8 @@
////////////////////////////////////////////////////////////////////////////////
float4 PixelShaderMain(PixelInputType input) : SV_TARGET
{
+ return float4(0, 0, 0, 1);
+
float4 textureColor;
float3 lightDir;
float lightIntensity;
@@ -42,7 +43,7 @@
lightDir = -lightDirection;
// Calculate the amount of light on this pixel.
- lightIntensity = saturate(dot(input.normal, lightDir));
+ lightIntensity = saturate(lightDir.z);
// Determine the final amount of diffuse color based on the diffuse color combined with the light intensity.
color = saturate(diffuseColor * lightIntensity);
Modified: trunk/AgateLib.Platform.WindowsPhone/Resources/ShaderSource/Basic2Dvert.hlsl
===================================================================
--- trunk/AgateLib.Platform.WindowsPhone/Resources/ShaderSource/Basic2Dvert.hlsl 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/AgateLib.Platform.WindowsPhone/Resources/ShaderSource/Basic2Dvert.hlsl 2014-08-27 01:19:58 UTC (rev 1480)
@@ -12,7 +12,6 @@
{
float4 position : POSITION;
float2 tex : TEXCOORD0;
- float3 normal : NORMAL;
float4 color : COLOR0;
};
@@ -20,7 +19,6 @@
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
- float3 normal : NORMAL;
float4 color : COLOR;
};
@@ -41,12 +39,6 @@
// Store the texture coordinates for the pixel shader.
output.tex = input.tex;
- // No separate world transformation for 2D
- output.normal = input.normal;
-
- // Normalize the normal vector.
- output.normal = normalize(output.normal);
-
output.color = input.color;
return output;
Modified: trunk/Tests.WindowsPhone/TestScene.cs
===================================================================
--- trunk/Tests.WindowsPhone/TestScene.cs 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/Tests.WindowsPhone/TestScene.cs 2014-08-27 01:19:58 UTC (rev 1480)
@@ -30,6 +30,10 @@
public override void Draw()
{
Display.Clear(clr);
+
+ int pos = (int)(time * 100);
+
+ image.Draw(pos % 100, pos % 200);
}
}
}
Modified: trunk/Tests.WindowsPhone/Tests.WindowsPhone.csproj
===================================================================
--- trunk/Tests.WindowsPhone/Tests.WindowsPhone.csproj 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/Tests.WindowsPhone/Tests.WindowsPhone.csproj 2014-08-27 01:19:58 UTC (rev 1480)
@@ -57,6 +57,7 @@
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
Modified: trunk/UnitTests/UnitTests.csproj
===================================================================
--- trunk/UnitTests/UnitTests.csproj 2014-08-24 19:04:33 UTC (rev 1479)
+++ trunk/UnitTests/UnitTests.csproj 2014-08-27 01:19:58 UTC (rev 1480)
@@ -61,6 +61,7 @@
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2014-08-27 07:23:01
|
Revision: 1481
http://sourceforge.net/p/agate/code/1481
Author: kanato
Date: 2014-08-27 07:22:57 +0000 (Wed, 27 Aug 2014)
Log Message:
-----------
Drawing images works in windows phone and windows rt.
Modified Paths:
--------------
trunk/AgateLib/ApplicationModels/SceneAppModelBase.cs
trunk/AgateLib/Utility/Ref.cs
trunk/AgateLib.Platform.Common/AgateLib.Platform.Common.csproj
trunk/AgateLib.Platform.Windows/ApplicationModels/SceneModelParameters.cs
trunk/AgateLib.Platform.WindowsPhone/AgateLib.Platform.WindowsPhone.csproj
trunk/AgateLib.Platform.WindowsPhone/packages.config
trunk/AgateLib.Platform.WindowsPhone8/ApplicationModels/SceneModelParameters.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/Shaders/SDX_Lighting2DShader.cs
trunk/AgateLib.Platform.WindowsStoreCommon/Factories/FakeFile.cs
trunk/AgateLib.Platform.WindowsStoreCommon/Factories/FakePath.cs
trunk/AgateLib.Platform.WindowsStoreCommon/PlatformImplementation/DiagnosticsStopwatch.cs
trunk/AgateLib.Platform.WindowsStoreCommon/PlatformImplementation/WPPlatformInfo.cs
trunk/AgateLib.Platform.WindowsStoreCommon/Resources/buildshaders.bat
trunk/AgateLib.Platform.WindowsStoreCommon/Resources/fxc.bat
trunk/AgateLib.sln
trunk/Tests.WindowsPhone/Properties/WMAppManifest.xml
trunk/Tests.WindowsPhone/Resources/AppResources.Designer.cs
trunk/Tests.WindowsPhone/Tests.WindowsPhone.csproj
Added Paths:
-----------
trunk/AgateLib.Platform.Windows/
trunk/AgateLib.Platform.Windows/AgateLib.Platform.Windows.csproj
trunk/AgateLib.Platform.Windows/ApplicationModels/
trunk/AgateLib.Platform.Windows/ApplicationModels/SceneModel.cs
trunk/AgateLib.Platform.Windows/Factories/
trunk/AgateLib.Platform.Windows/Factories/WinPlatformFactory.cs
trunk/AgateLib.Platform.Windows/Factories/WindowsFactory.cs
trunk/AgateLib.Platform.Windows/Properties/
trunk/AgateLib.Platform.Windows/Properties/AssemblyInfo.cs
trunk/AgateLib.Platform.Windows/WindowsInitializer.cs
trunk/AgateLib.Platform.Windows/packages.config
trunk/AgateLib.Platform.WindowsPhone/Factories/
trunk/AgateLib.Platform.WindowsPhone/Factories/WPPlatformFactory.cs
trunk/AgateLib.Platform.WindowsPhone/Factories/WindowsPhoneFactory.cs
trunk/AgateLib.Platform.WindowsPhone/Interop.cs
trunk/AgateLib.Platform.WindowsPhone/SwapChainBackgroundPanelAdapter.cs
trunk/AgateLib.Platform.WindowsPhone8/
trunk/AgateLib.Platform.WindowsPhone8/AgateLib.Platform.WindowsPhone8.csproj
trunk/AgateLib.Platform.WindowsPhone8/ApplicationModels/
trunk/AgateLib.Platform.WindowsPhone8/ApplicationModels/SceneModel.cs
trunk/AgateLib.Platform.WindowsPhone8/Factories/
trunk/AgateLib.Platform.WindowsPhone8/Factories/WPPlatformFactory.cs
trunk/AgateLib.Platform.WindowsPhone8/Factories/WindowsPhoneFactory.cs
trunk/AgateLib.Platform.WindowsPhone8/Properties/
trunk/AgateLib.Platform.WindowsPhone8/Properties/AssemblyInfo.cs
trunk/AgateLib.Platform.WindowsPhone8/WindowsPhoneInitializer.cs
trunk/AgateLib.Platform.WindowsPhone8/packages.config
trunk/AgateLib.Platform.WindowsStoreCommon/
trunk/AgateLib.Platform.WindowsStoreCommon/AgateLib.Platform.WindowsStoreCommon.csproj
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/D3DDevice.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/DrawBuffer.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/FrameBufferSurface.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/FrameBufferWindow.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/SDX_Display.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/SDX_DisplayWindow.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/SDX_FrameBuffer.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/SDX_IndexBuffer.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/SDX_Surface.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/SDX_VertexBuffer.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/Shaders/SDX_Basic2DShader.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/Shaders/SDX_Lighting3DShader.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/Shaders/ShaderFactory.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/Shaders/ShaderSourceProvider.cs
trunk/AgateLib.Platform.WindowsStoreCommon/Factories/
trunk/AgateLib.Platform.WindowsStoreCommon/Factories/DisplayFactory.cs
trunk/AgateLib.Platform.WindowsStoreCommon/IRenderTargetAdapter.cs
trunk/AgateLib.Platform.WindowsStoreCommon/Interop.cs
trunk/AgateLib.Platform.WindowsStoreCommon/PlatformImplementation/
trunk/AgateLib.Platform.WindowsStoreCommon/PlatformImplementation/WPAssetFileProvider.cs
trunk/AgateLib.Platform.WindowsStoreCommon/PlatformImplementation/WindowsStorePlatformFactory.cs
trunk/AgateLib.Platform.WindowsStoreCommon/Properties/
trunk/AgateLib.Platform.WindowsStoreCommon/Properties/AssemblyInfo.cs
trunk/AgateLib.Platform.WindowsStoreCommon/Resources/
trunk/AgateLib.Platform.WindowsStoreCommon/Resources/Basic2Dpixel.fxo
trunk/AgateLib.Platform.WindowsStoreCommon/Resources/Basic2Dvert.fxo
trunk/AgateLib.Platform.WindowsStoreCommon/Resources/ShaderSource/Basic2Dpixel.hlsl
trunk/AgateLib.Platform.WindowsStoreCommon/Resources/ShaderSource/Basic2Dvert.hlsl
trunk/AgateLib.Platform.WindowsStoreCommon/SwapChainBackgroundPanelAdapter.cs
trunk/AgateLib.Platform.WindowsStoreCommon/packages.config
trunk/Tests.WindowsPhone/Assets/BadgeLogo.png
trunk/Tests.WindowsPhone/Assets/Logo.png
trunk/Tests.WindowsPhone/Assets/SplashScreen.png
trunk/Tests.WindowsPhone/Assets/SquareTile150x150.png
trunk/Tests.WindowsPhone/Assets/SquareTile71x71.png
trunk/Tests.WindowsPhone/Assets/StoreLogo.png
trunk/Tests.WindowsPhone/Assets/WideLogo.png
trunk/Tests.WindowsPhone/Package.appxmanifest
trunk/Tests.WindowsStore/
trunk/Tests.WindowsStore/Tests.WindowsStore.Shared/
trunk/Tests.WindowsStore/Tests.WindowsStore.Shared/App.xaml
trunk/Tests.WindowsStore/Tests.WindowsStore.Shared/App.xaml.cs
trunk/Tests.WindowsStore/Tests.WindowsStore.Shared/TestScene.cs
trunk/Tests.WindowsStore/Tests.WindowsStore.Windows/
trunk/Tests.WindowsStore/Tests.WindowsStore.Windows/Assets/
trunk/Tests.WindowsStore/Tests.WindowsStore.Windows/Assets/Logo.scale-100.png
trunk/Tests.WindowsStore/Tests.WindowsStore.Windows/Assets/SmallLogo.scale-100.png
trunk/Tests.WindowsStore/Tests.WindowsStore.Windows/Assets/SplashScreen.scale-100.png
trunk/Tests.WindowsStore/Tests.WindowsStore.Windows/Assets/StoreLogo.scale-100.png
trunk/Tests.WindowsStore/Tests.WindowsStore.Windows/Assets/agatelogo.png
trunk/Tests.WindowsStore/Tests.WindowsStore.Windows/MainPage.xaml
trunk/Tests.WindowsStore/Tests.WindowsStore.Windows/MainPage.xaml.cs
trunk/Tests.WindowsStore/Tests.WindowsStore.Windows/Package.appxmanifest
trunk/Tests.WindowsStore/Tests.WindowsStore.Windows/Properties/
trunk/Tests.WindowsStore/Tests.WindowsStore.Windows/Properties/AssemblyInfo.cs
trunk/Tests.WindowsStore/Tests.WindowsStore.Windows/Tests.WindowsStore.Windows.csproj
trunk/Tests.WindowsStore/Tests.WindowsStore.Windows/Tests.WindowsStore.Windows_TemporaryKey.pfx
trunk/Tests.WindowsStore/Tests.WindowsStore.WindowsPhone/
trunk/Tests.WindowsStore/Tests.WindowsStore.WindowsPhone/Assets/
trunk/Tests.WindowsStore/Tests.WindowsStore.WindowsPhone/Assets/Logo.scale-240.png
trunk/Tests.WindowsStore/Tests.WindowsStore.WindowsPhone/Assets/SmallLogo.scale-240.png
trunk/Tests.WindowsStore/Tests.WindowsStore.WindowsPhone/Assets/SplashScreen.scale-240.png
trunk/Tests.WindowsStore/Tests.WindowsStore.WindowsPhone/Assets/Square71x71Logo.scale-240.png
trunk/Tests.WindowsStore/Tests.WindowsStore.WindowsPhone/Assets/StoreLogo.scale-240.png
trunk/Tests.WindowsStore/Tests.WindowsStore.WindowsPhone/Assets/WideLogo.scale-240.png
trunk/Tests.WindowsStore/Tests.WindowsStore.WindowsPhone/Assets/agatelogo.png
trunk/Tests.WindowsStore/Tests.WindowsStore.WindowsPhone/MainPage.xaml
trunk/Tests.WindowsStore/Tests.WindowsStore.WindowsPhone/MainPage.xaml.cs
trunk/Tests.WindowsStore/Tests.WindowsStore.WindowsPhone/Package.appxmanifest
trunk/Tests.WindowsStore/Tests.WindowsStore.WindowsPhone/Properties/
trunk/Tests.WindowsStore/Tests.WindowsStore.WindowsPhone/Properties/AssemblyInfo.cs
trunk/Tests.WindowsStore/Tests.WindowsStore.WindowsPhone/Tests.WindowsStore.WindowsPhone.csproj
Removed Paths:
-------------
trunk/AgateLib.Platform.Windows/ApplicationModels/SceneModel.cs
trunk/AgateLib.Platform.WindowsPhone/DisplayImplementation/
trunk/AgateLib.Platform.WindowsPhone/Factories/
trunk/AgateLib.Platform.WindowsPhone/Interop.cs
trunk/AgateLib.Platform.WindowsPhone/PlatformImplementation/
trunk/AgateLib.Platform.WindowsPhone/Resources/
trunk/AgateLib.Platform.WindowsPhone8/ApplicationModels/SceneModel.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/D3DDevice.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/DrawBuffer.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/FrameBufferSurface.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/FrameBufferWindow.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/SDX_Display.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/SDX_DisplayWindow.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/SDX_FrameBuffer.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/SDX_IndexBuffer.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/SDX_Surface.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/SDX_VertexBuffer.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/Shaders/SDL_Lighting3DShader.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/Shaders/SDX_Basic2DShader.cs
trunk/AgateLib.Platform.WindowsStoreCommon/DisplayImplementation/Shaders/ShaderFactory.cs
trunk/AgateLib.Platform.WindowsStoreCommon/Factories/DisplayFactory.cs
trunk/AgateLib.Platform.WindowsStoreCommon/Factories/WPPlatformFactory.cs
trunk/AgateLib.Platform.WindowsStoreCommon/Factories/WindowsPhoneFactory.cs
trunk/AgateLib.Platform.WindowsStoreCommon/PlatformImplementation/AssetFileProvider.cs
trunk/AgateLib.Platform.WindowsStoreCommon/Resources/Basic2Dpixel.fxo
trunk/AgateLib.Platform.WindowsStoreCommon/Resources/Basic2Dvert.fxo
trunk/AgateLib.Platform.WindowsStoreCommon/Resources/ShaderSource/Basic2Dpixel.hlsl
trunk/AgateLib.Platform.WindowsStoreCommon/Resources/ShaderSource/Basic2Dvert.hlsl
Modified: trunk/AgateLib/ApplicationModels/SceneAppModelBase.cs
===================================================================
--- trunk/AgateLib/ApplicationModels/SceneAppModelBase.cs 2014-08-27 01:19:58 UTC (rev 1480)
+++ trunk/AgateLib/ApplicationModels/SceneAppModelBase.cs 2014-08-27 07:22:57 UTC (rev 1481)
@@ -17,11 +17,12 @@
{
try
{
+ sceneToStartWith = scene;
+
Initialize();
AutoCreateDisplayWindow();
PrerunInitialization();
- sceneToStartWith = scene;
BeginModel();
}
finally
Modified: trunk/AgateLib/Utility/Ref.cs
===================================================================
--- trunk/AgateLib/Utility/Ref.cs 2014-08-27 01:19:58 UTC (rev 1480)
+++ trunk/AgateLib/Utility/Ref.cs 2014-08-27 07:22:57 UTC (rev 1481)
@@ -168,5 +168,18 @@
v.Dispose();
v = null;
}
+
+ public static bool operator==(Ref<T> r, object obj)
+ {
+ if (obj == null && r.v == null)
+ return true;
+
+ else
+ return false;
+ }
+ public static bool operator !=(Ref<T> r, object obj)
+ {
+ return !(r == obj);
+ }
}
}
Modified: trunk/AgateLib.Platform.Common/AgateLib.Platform.Common.csproj
===================================================================
--- trunk/AgateLib.Platform.Common/AgateLib.Platform.Common.csproj 2014-08-27 01:19:58 UTC (rev 1480)
+++ trunk/AgateLib.Platform.Common/AgateLib.Platform.Common.csproj 2014-08-27 07:22:57 UTC (rev 1481)
@@ -13,7 +13,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <TargetFrameworkProfile>Profile49</TargetFrameworkProfile>
+ <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Index: trunk/AgateLib.Platform.Windows
===================================================================
--- trunk/AgateLib.Platform.Windows 2014-08-27 01:19:58 UTC (rev 1480)
+++ trunk/AgateLib.Platform.Windows 2014-08-27 07:22:57 UTC (rev 1481)
Property changes on: trunk/AgateLib.Platform.Windows
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,10 ##
+[Bb]in
+obj
+[Dd]ebug
+[Rr]elease
+*.user
+*.aps
+*.eto
+ClientBin
+GeneratedArtifacts
+_Pvt_Extensions
Added: trunk/AgateLib.Platform.Windows/AgateLib.Platform.Windows.csproj
===================================================================
--- trunk/AgateLib.Platform.Windows/AgateLib.Platform.Windows.csproj (rev 0)
+++ trunk/AgateLib.Platform.Windows/AgateLib.Platform.Windows.csproj 2014-08-27 07:22:57 UTC (rev 1481)
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{C9B8F763-187D-4F2E-BAEE-827B7247C278}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>AgateLib.Platform.Windows</RootNamespace>
+ <AssemblyName>AgateLib.Platform.Windows</AssemblyName>
+ <DefaultLanguage>en-US</DefaultLanguage>
+ <TargetPlatformVersion>8.1</TargetPlatformVersion>
+ <MinimumVisualStudioVersion>12</MinimumVisualStudioVersion>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>5fb9b2f3</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\ARM\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants>
+ <NoWarn>;2008</NoWarn>
+ <DebugType>full</DebugType>
+ <PlatformTarget>ARM</PlatformTarget>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ <ErrorReport>prompt</ErrorReport>
+ <Prefer32Bit>true</Prefer32Bit>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
+ <OutputPath>bin\ARM\Release\</OutputPath>
+ <DefineConstants>TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants>
+ <Optimize>true</Optimize>
+ <NoWarn>;2008</NoWarn>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>ARM</PlatformTarget>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ <ErrorReport>prompt</ErrorReport>
+ <Prefer32Bit>true</Prefer32Bit>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\x64\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants>
+ <NoWarn>;2008</NoWarn>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ <ErrorReport>prompt</ErrorReport>
+ <Prefer32Bit>true</Prefer32Bit>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+ <OutputPath>bin\x64\Release\</OutputPath>
+ <DefineConstants>TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants>
+ <Optimize>true</Optimize>
+ <NoWarn>;2008</NoWarn>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ <ErrorReport>prompt</ErrorReport>
+ <Prefer32Bit>true</Prefer32Bit>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\x86\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants>
+ <NoWarn>;2008</NoWarn>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ <ErrorReport>prompt</ErrorReport>
+ <Prefer32Bit>true</Prefer32Bit>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+ <OutputPath>bin\x86\Release\</OutputPath>
+ <DefineConstants>TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants>
+ <Optimize>true</Optimize>
+ <NoWarn>;2008</NoWarn>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ <ErrorReport>prompt</ErrorReport>
+ <Prefer32Bit>true</Prefer32Bit>
+ </PropertyGroup>
+ <ItemGroup>
+ <!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
+ <ProjectReference Include="..\AgateLib.Platform.Common\AgateLib.Platform.Common.csproj">
+ <Project>{fc9e7036-aa75-4a6b-82db-0f5e98b5fbcb}</Project>
+ <Name>AgateLib.Platform.Common</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\AgateLib.Platform.WindowsStoreCommon\AgateLib.Platform.WindowsStoreCommon.csproj">
+ <Project>{c7f9ae34-b781-4490-a9b2-5728f44f3523}</Project>
+ <Name>AgateLib.Platform.WindowsStoreCommon</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\AgateLib\AgateLib.csproj">
+ <Project>{9490b719-829e-43a7-a5fe-8001f8a81759}</Project>
+ <Name>AgateLib</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ApplicationModels\SceneModel.cs" />
+ <Compile Include="ApplicationModels\SceneModelParameters.cs" />
+ <Compile Include="Factories\WindowsFactory.cs" />
+ <Compile Include="Factories\WinPlatformFactory.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="WindowsInitializer.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Reference Include="SharpDX">
+ <HintPath>$(SharpDXPackageBinDir)\SharpDX.dll</HintPath>
+ </Reference>
+ <Reference Include="SharpDX.Direct3D11">
+ <HintPath>$(SharpDXPackageBinDir)\SharpDX.Direct3D11.dll</HintPath>
+ </Reference>
+ <Reference Include="SharpDX.DXGI">
+ <HintPath>$(SharpDXPackageBinDir)\SharpDX.DXGI.dll</HintPath>
+ </Reference>
+ <Reference Include="SharpDX.SimpleInitializer">
+ <HintPath>..\packages\SharpDX.SimpleInitializer.1.0.0\lib\portable-netcore451+wpa81\SharpDX.SimpleInitializer.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '12.0' ">
+ <VisualStudioVersion>12.0</VisualStudioVersion>
+ </PropertyGroup>
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
+ <Import Project="..\packages\SharpDX.2.6.2\build\SharpDX.targets" Condition="Exists('..\packages\SharpDX.2.6.2\build\SharpDX.targets')" />
+ <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+ <PropertyGroup>
+ <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+ </PropertyGroup>
+ <Error Condition="!Exists('..\packages\SharpDX.2.6.2\build\SharpDX.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SharpDX.2.6.2\build\SharpDX.targets'))" />
+ </Target>
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Deleted: trunk/AgateLib.Platform.Windows/ApplicationModels/SceneModel.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsPhone/ApplicationModels/SceneModel.cs 2014-08-24 02:45:10 UTC (rev 1477)
+++ trunk/AgateLib.Platform.Windows/ApplicationModels/SceneModel.cs 2014-08-27 07:22:57 UTC (rev 1481)
@@ -1,55 +0,0 @@
-using AgateLib.ApplicationModels;
-using AgateLib.DisplayLib;
-using SharpDX.SimpleInitializer;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AgateLib.Platform.WindowsPhone.ApplicationModels
-{
- public class SceneModel : SceneAppModelBase
- {
- SharpDXContext context;
-
- public SceneModel(SceneModelParameters parameters)
- : base(parameters)
- { }
-
- public new SceneModelParameters Parameters { get { return (SceneModelParameters)base.Parameters; } }
-
- protected override void BeginModel()
- {
- }
-
- protected override void InitializeImpl()
- {
- context = new SharpDXContext();
- context.Render += context_Render;
- context.BindToControl(Parameters.RenderTarget);
-
- WindowsPhoneInitializer.Initialize(context, Parameters.RenderTarget);
- }
-
- void context_Render(object sender, EventArgs e)
- {
- foreach (var sc in SceneStack.UpdateScenes)
- sc.Update(Display.DeltaTime);
-
- Display.BeginFrame();
-
- foreach (var sc in SceneStack.DrawScenes)
- sc.Draw();
-
- Display.EndFrame();
-
- Core.KeepAlive();
- }
-
- public override void KeepAlive()
- {
- base.KeepAlive();
- }
- }
-}
Copied: trunk/AgateLib.Platform.Windows/ApplicationModels/SceneModel.cs (from rev 1478, trunk/AgateLib.Platform.WindowsPhone/ApplicationModels/SceneModel.cs)
===================================================================
--- trunk/AgateLib.Platform.Windows/ApplicationModels/SceneModel.cs (rev 0)
+++ trunk/AgateLib.Platform.Windows/ApplicationModels/SceneModel.cs 2014-08-27 07:22:57 UTC (rev 1481)
@@ -0,0 +1,68 @@
+using AgateLib.ApplicationModels;
+using AgateLib.DisplayLib;
+using AgateLib.Platform.WindowsStoreCommon;
+using SharpDX.SimpleInitializer;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AgateLib.Platform.Windows.ApplicationModels
+{
+ public class SceneModel : SceneAppModelBase
+ {
+ SharpDXContext context;
+
+ public SceneModel(SceneModelParameters parameters)
+ : base(parameters)
+ { }
+
+ public new SceneModelParameters Parameters { get { return (SceneModelParameters)base.Parameters; } }
+
+ protected override void BeginModel()
+ {
+ }
+
+ protected override void InitializeImpl()
+ {
+ context = new SharpDXContext();
+ context.Render += context_Render;
+ context.DeviceReset += context_DeviceReset;
+
+ var adapter = (SwapChainBackgroundPanelAdapter)Parameters.RenderTarget;
+
+ WindowsInitializer.Initialize(context, Parameters.RenderTarget, Parameters.AssetLocations);
+
+ context.BindToControl(adapter.RenderTarget);
+ }
+
+ void context_DeviceReset(object sender, DeviceResetEventArgs e)
+ {
+ if (sceneToStartWith != null)
+ {
+ SceneStack.Add(sceneToStartWith);
+ sceneToStartWith = null;
+ }
+ }
+
+ void context_Render(object sender, EventArgs e)
+ {
+ foreach (var sc in SceneStack.UpdateScenes)
+ sc.Update(Display.DeltaTime);
+
+ Display.BeginFrame();
+
+ foreach (var sc in SceneStack.DrawScenes)
+ sc.Draw();
+
+ Display.EndFrame();
+ Core.KeepAlive();
+ }
+
+ public override void KeepAlive()
+ {
+ base.KeepAlive();
+ }
+ }
+}
Modified: trunk/AgateLib.Platform.Windows/ApplicationModels/SceneModelParameters.cs
===================================================================
--- trunk/AgateLib.Platform.WindowsPhone/ApplicationModels/SceneModelParameters.cs 2014-08-24 02:45:10 UTC (rev 1477)
+++ trunk/AgateLib.Platform.Windows/ApplicationModels/SceneModelParameters.cs 2014-08-27 07:22:57 UTC (rev 1481)
@@ -1,20 +1,20 @@
using AgateLib.ApplicationModels;
+using AgateLib.Platform.WindowsStoreCommon;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using System.Windows.Controls;
-namespace AgateLib.Platform.WindowsPhone.ApplicationModels
+namespace AgateLib.Platform.Windows.ApplicationModels
{
public class SceneModelParameters : ModelParameters
{
- public SceneModelParameters(DrawingSurfaceBackgroundGrid renderTarget)
+ public SceneModelParameters(IRenderTargetAdapter renderTarget)
{
this.RenderTarget = renderTarget;
}
- public DrawingSurfaceBackgroundGrid RenderTarget { get; set; }
+ public IRenderTargetAdapter RenderTarget { get; set; }
}
}
Copied: trunk/AgateLib.Platform.Windows/Factories/WinPlatformFactory.cs (from rev 1478, trunk/AgateLib.Platform.WindowsPhone/Factories/WPPlatformFactory.cs)
===================================================================
--- trunk/AgateLib.Platform.Windows/Factories/WinPlatformFactory.cs (rev 0)
+++ trunk/AgateLib.Platform.Windows/Factories/WinPlatformFactory.cs 2014-08-27 07:22:57 UTC (rev 1481)
@@ -0,0 +1,17 @@
+using AgateLib.Drivers;
+using AgateLib.Platform.WindowsStoreCommon.PlatformImplementation;
+using AgateLib.Platform.WindowsStoreCommon.Factories;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.Platform.Windows.Factories
+{
+ class WinPlatformFactory : WindowsStorePlatformFactory
+ {
+ public WinPlatformFactory()
+ : base(false)
+ { }
+ }
+}
Copied: trunk/AgateLib.Platform.Windows/Factories/WindowsFactory.cs (from rev 1479, trunk/AgateLib.Platform.WindowsPhone/Factories/WindowsPhoneFactory.cs)
===================================================================
--- trunk/AgateLib.Platform.Windows/Factories/WindowsFactory.cs (rev 0)
+++ trunk/AgateLib.Platform.Windows/Factories/WindowsFactory.cs 2014-08-27 07:22:57 UTC (rev 1481)
@@ -0,0 +1,36 @@
+using AgateLib.DisplayLib;
+using AgateLib.Drivers;
+using AgateLib.Drivers.NullDrivers;
+using AgateLib.Platform.WindowsStoreCommon;
+using AgateLib.Platform.WindowsStoreCommon.Factories;
+using SharpDX.SimpleInitializer;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.Platform.Windows.Factories
+{
+ class WindowsFactory : IAgateFactory
+ {
+ DisplayFactory mDisplayFactory;
+
+ public WindowsFactory(SharpDXContext context, IRenderTargetAdapter renderTarget)
+ {
+ mDisplayFactory = new DisplayFactory(context, renderTarget);
+ PlatformFactory = new WinPlatformFactory();
+
+ AudioFactory = new NullSoundFactory();
+ InputFactory = new NullInputFactory();
+ }
+
+ public IDisplayFactory DisplayFactory
+ {
+ get { return mDisplayFactory; }
+ }
+ public IAudioFactory AudioFactory { get; private set; }
+ public IInputFactory InputFactory { get; private set; }
+ public IPlatformFactory PlatformFactory { get; private set; }
+ public FontSurface DefaultFont { get; set; }
+ }
+}
Added: trunk/AgateLib.Platform.Windows/Properties/AssemblyInfo.cs
===================================================================
--- trunk/AgateLib.Platform.Windows/Properties/AssemblyInfo.cs (rev 0)
+++ trunk/AgateLib.Platform.Windows/Properties/AssemblyInfo.cs 2014-08-27 07:22:57 UTC (rev 1481)
@@ -0,0 +1,29 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("AgateLib.Platform.Windows")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("AgateLib.Platform.Windows")]
+[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Version information for an assembly consists of the following fo...
[truncated message content] |