Thread: [Agate-svn-commit] SF.net SVN: agate:[1266] trunk (Page 3)
Status: Alpha
Brought to you by:
kanato
|
From: <ka...@us...> - 2011-01-07 20:11:48
|
Revision: 1266
http://agate.svn.sourceforge.net/agate/?rev=1266&view=rev
Author: kanato
Date: 2011-01-07 20:11:41 +0000 (Fri, 07 Jan 2011)
Log Message:
-----------
Removed Gui files which will not be in the next release.
Modified Paths:
--------------
trunk/AgateLib/AgateGame.cs
trunk/AgateTools.sln
trunk/ChangeLog.txt
trunk/Drivers/AgateDrawing/AgateDrawing.csproj
trunk/Drivers/AgateLib.WinForms/AgateLib.WinForms.csproj
trunk/TODO.txt
trunk/Tools/AgateDataLib/AgateDataLib.csproj
trunk/Tools/DatabaseEditor/DatabaseEditor.csproj
trunk/Tools/FontCreator/FontCreator.csproj
trunk/Tools/PackedSpriteCreator/PackedSpriteCreator.csproj
trunk/Tools/ResourceEditor/ResourceEditor.csproj
Removed Paths:
-------------
trunk/AgateLib/Gui/
trunk/Tests/GuiTests/
Modified: trunk/AgateLib/AgateGame.cs
===================================================================
--- trunk/AgateLib/AgateGame.cs 2011-01-07 20:05:01 UTC (rev 1265)
+++ trunk/AgateLib/AgateGame.cs 2011-01-07 20:11:41 UTC (rev 1266)
@@ -45,7 +45,7 @@
DisplayWindow mWindow;
AppInitParameters mInitParams;
FontSurface font;
- Gui.GuiRoot mGui;
+ //Gui.GuiRoot mGui;
double totalSplashTime = 0;
bool splashFadeDone = false;
@@ -99,8 +99,8 @@
if (MainWindow.IsClosed)
break;
- if (GuiRoot != null)
- GuiRoot.DoUpdate();
+// if (GuiRoot != null)
+// GuiRoot.DoUpdate();
Display.RenderTarget = MainWindow.FrameBuffer;
@@ -108,8 +108,8 @@
Render();
- if (GuiRoot != null)
- GuiRoot.Draw();
+// if (GuiRoot != null)
+// GuiRoot.Draw();
Display.EndFrame();
Core.KeepAlive();
@@ -325,27 +325,27 @@
get { return mWindow; }
}
- /// <summary>
- /// Gets or sets the GuiRoot object.
- /// </summary>
- public Gui.GuiRoot GuiRoot
- {
- get { return mGui; }
- set
- {
- if (value == null && mGui == null)
- return;
+// / <summary>
+// / Gets or sets the GuiRoot object.
+// / </summary>
+// public Gui.GuiRoot GuiRoot
+// {
+// get { return mGui; }
+// set
+// {
+// if (value == null && mGui == null)
+// return;
+//
+// if (mGui != null)
+// mGui.EnableInteraction = false;
+//
+// mGui = value;
+//
+// if (mGui != null)
+// mGui.EnableInteraction = true;
+// }
+// }
- if (mGui != null)
- mGui.EnableInteraction = false;
-
- mGui = value;
-
- if (mGui != null)
- mGui.EnableInteraction = true;
- }
- }
-
#endregion
/// <summary>
Modified: trunk/AgateTools.sln
===================================================================
--- trunk/AgateTools.sln 2011-01-07 20:05:01 UTC (rev 1265)
+++ trunk/AgateTools.sln 2011-01-07 20:11:41 UTC (rev 1266)
@@ -1,3 +1,4 @@
+
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Files", "{4B147B99-8BC3-4B78-938A-1035B16A8D1B}"
@@ -35,42 +36,6 @@
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {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|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}.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|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
- {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x64.ActiveCfg = Debug|x64
- {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x64.Build.0 = Debug|x64
- {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x86.ActiveCfg = Debug|x86
- {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x86.Build.0 = Debug|x86
- {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Any CPU.Build.0 = Release|Any CPU
- {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|x64.ActiveCfg = Release|x64
- {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|x64.Build.0 = Release|x64
- {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|x86.ActiveCfg = Release|x86
- {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.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|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}.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|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
{164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|x64.ActiveCfg = Debug|x64
@@ -83,42 +48,6 @@
{164A785D-924E-40FB-A517-D7E677F3B53A}.Release|x64.Build.0 = Release|x64
{164A785D-924E-40FB-A517-D7E677F3B53A}.Release|x86.ActiveCfg = Release|x86
{164A785D-924E-40FB-A517-D7E677F3B53A}.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|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}.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|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
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x64.ActiveCfg = Debug|x64
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x64.Build.0 = Debug|x64
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x86.ActiveCfg = Debug|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x86.Build.0 = Debug|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.Build.0 = Release|Any CPU
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x64.ActiveCfg = Release|x64
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x64.Build.0 = Release|x64
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x86.ActiveCfg = Release|x86
- {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x86.Build.0 = Release|x86
- {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|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}.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|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
{2F7A686B-2272-4803-9EF9-0B34BA7802DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F7A686B-2272-4803-9EF9-0B34BA7802DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F7A686B-2272-4803-9EF9-0B34BA7802DC}.Debug|x64.ActiveCfg = Debug|x64
@@ -143,7 +72,84 @@
{685E7B82-4609-4ABB-B25B-0DC7C58BD45F}.Release|x64.Build.0 = Release|x64
{685E7B82-4609-4ABB-B25B-0DC7C58BD45F}.Release|x86.ActiveCfg = Release|x86
{685E7B82-4609-4ABB-B25B-0DC7C58BD45F}.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|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}.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|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
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x64.ActiveCfg = Debug|x64
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x64.Build.0 = Debug|x64
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x86.ActiveCfg = Debug|x86
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x86.Build.0 = Debug|x86
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x64.ActiveCfg = Release|x64
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x64.Build.0 = Release|x64
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x86.ActiveCfg = Release|x86
+ {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x86.Build.0 = Release|x86
+ {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|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}.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|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
+ {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x64.ActiveCfg = Debug|x64
+ {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x64.Build.0 = Debug|x64
+ {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x86.ActiveCfg = Debug|x86
+ {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x86.Build.0 = Debug|x86
+ {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|x64.ActiveCfg = Release|x64
+ {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|x64.Build.0 = Release|x64
+ {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|x86.ActiveCfg = Release|x86
+ {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.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|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}.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|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
+ {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|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}.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|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
EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+ GlobalSection(MonoDevelopProperties) = preSolution
+ StartupItem = Tools\DatabaseEditor\DatabaseEditor.csproj
+ EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
Modified: trunk/ChangeLog.txt
===================================================================
--- trunk/ChangeLog.txt 2011-01-07 20:05:01 UTC (rev 1265)
+++ trunk/ChangeLog.txt 2011-01-07 20:11:41 UTC (rev 1266)
@@ -1,8 +1,51 @@
Version 0.3.2
===================
+Even though the version number has only been incremented slightly, there are a lot of changes in
+this release. Many of the changes are backend changes that will ease the future development
+of AgateLib, but may not be noticable to a developer using AgateLib.
+
+Removed the prebuild-based build system. Now that Mono's xbuild can build AgateLib, and
+MonoDevelop supports Visual Studio project files, there is no need for it and the headaches
+associated with it.
+
+The source code for Tao.Sdl is absorbed into AgateSDL, so there is no need to distribute
+Tao.Sdl.dll files.
+
+AgateMDX has been dropped and replced with AgateSDX. Now DirectX support is obtained through
+SlimDX instead of the old, buggy, deprecated Managed DirectX.
+
+A simple framework is in place for saving user preferences. The .NET/WinForms properties
+don't seem to be well supported under Mono so this is a simple replacement for that.
+
+The AgateLib.Data namespace has been added with classes that implement a flat-file
+relational database. A database editor application exists in the Tools folder as well. This
+provides cross-platform light-weight support for basic database features to provide a
+structured data store for games without bringing in any external dependencies. The database
+editor includes a code generator to create stongly typed objects that can easily access the
+data in the tables of the database.
+
+A system for use of vertex and pixel shaders has been developed. Mainly, the framework is
+in place for future expansion, there is little that can be done with shaders at this point
+aside from using the built in shaders for lighting or standard rendering.
+
+Vertex buffers can be created and used. Also, arbitrary transformation matrices can be
+specified, so that AgateLib can now be used for basic 3D applications. It is likely
+not very practical at the moment but the basic framework is in place for future expansion.
+
+Font rendering and surface rendering backends have been changed to utilize stateless drawing.
+All drawing options can be specified in objects passed to draw methods. The stateful drawing
+methods can still be used, but this allows for a great deal of cleanup in the backend
+rendering methods as well as the option to circumvent the stateful drawing. This also allows
+for AgateLib to put less pressure on the GC, especially in rendering text.
+
+Better platform detection is implemented.
+
+Various minor bugs have been fixed.
+
Moved ISprite and ISpriteFrame to Sprites namespace.
+
Version 0.3.1
===================
All obsolete API's have been removed.
Modified: trunk/Drivers/AgateDrawing/AgateDrawing.csproj
===================================================================
--- trunk/Drivers/AgateDrawing/AgateDrawing.csproj 2011-01-07 20:05:01 UTC (rev 1265)
+++ trunk/Drivers/AgateDrawing/AgateDrawing.csproj 2011-01-07 20:11:41 UTC (rev 1266)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
@@ -7,8 +7,6 @@
<ProjectGuid>{164A785D-924E-40FB-A517-D7E677F3B53A}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ApplicationIcon>
- </ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>AgateDrawing</AssemblyName>
@@ -21,52 +19,41 @@
<AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>AgateDrawing</RootNamespace>
- <StartupObject>
- </StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE;</DefineConstants>
<DocumentationFile>
</DocumentationFile>
- <DebugSymbols>True</DebugSymbols>
+ <DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
- <Optimize>False</Optimize>
+ <Optimize>false</Optimize>
<OutputPath>..\..\Binaries\Debug\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
- <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
- <NoWarn>
- </NoWarn>
+ <DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;</DefineConstants>
<DocumentationFile>
</DocumentationFile>
- <DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment>
- <Optimize>True</Optimize>
+ <Optimize>true</Optimize>
<OutputPath>..\..\Binaries\Release\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
- <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
- <NoWarn>
- </NoWarn>
+ <DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
@@ -75,6 +62,9 @@
<BaseAddress>285212672</BaseAddress>
<FileAlignment>4096</FileAlignment>
<PlatformTarget>x64</PlatformTarget>
+ <DebugType>full</DebugType>
+ <WarningLevel>4</WarningLevel>
+ <Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<OutputPath>bin\x64\Release\</OutputPath>
@@ -83,6 +73,8 @@
<Optimize>true</Optimize>
<FileAlignment>4096</FileAlignment>
<PlatformTarget>x64</PlatformTarget>
+ <DebugType>none</DebugType>
+ <WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
@@ -91,6 +83,9 @@
<BaseAddress>285212672</BaseAddress>
<FileAlignment>4096</FileAlignment>
<PlatformTarget>x86</PlatformTarget>
+ <DebugType>full</DebugType>
+ <WarningLevel>4</WarningLevel>
+ <Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\x86\Release\</OutputPath>
@@ -99,6 +94,8 @@
<Optimize>true</Optimize>
<FileAlignment>4096</FileAlignment>
<PlatformTarget>x86</PlatformTarget>
+ <DebugType>none</DebugType>
+ <WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
@@ -153,6 +150,7 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
Modified: trunk/Drivers/AgateLib.WinForms/AgateLib.WinForms.csproj
===================================================================
--- trunk/Drivers/AgateLib.WinForms/AgateLib.WinForms.csproj 2011-01-07 20:05:01 UTC (rev 1265)
+++ trunk/Drivers/AgateLib.WinForms/AgateLib.WinForms.csproj 2011-01-07 20:11:41 UTC (rev 1266)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
@@ -7,8 +7,6 @@
<ProjectGuid>{BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ApplicationIcon>
- </ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>AgateLib.WinForms</AssemblyName>
@@ -21,51 +19,40 @@
<AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>AgateLib.WinForms</RootNamespace>
- <StartupObject>
- </StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE;</DefineConstants>
<DocumentationFile>
</DocumentationFile>
- <DebugSymbols>True</DebugSymbols>
+ <DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
- <Optimize>False</Optimize>
+ <Optimize>false</Optimize>
<OutputPath>..\..\Binaries\Debug\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
- <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
- <NoWarn>
- </NoWarn>
+ <DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;</DefineConstants>
<DocumentationFile>AgateLib.WinForms.xml</DocumentationFile>
- <DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment>
- <Optimize>True</Optimize>
+ <Optimize>true</Optimize>
<OutputPath>..\..\Binaries\Release\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
- <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
- <NoWarn>
- </NoWarn>
+ <DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
@@ -74,6 +61,9 @@
<BaseAddress>285212672</BaseAddress>
<FileAlignment>4096</FileAlignment>
<PlatformTarget>x64</PlatformTarget>
+ <DebugType>full</DebugType>
+ <WarningLevel>4</WarningLevel>
+ <Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<OutputPath>bin\x64\Release\</OutputPath>
@@ -83,6 +73,8 @@
<Optimize>true</Optimize>
<FileAlignment>4096</FileAlignment>
<PlatformTarget>x64</PlatformTarget>
+ <DebugType>none</DebugType>
+ <WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
@@ -91,6 +83,9 @@
<BaseAddress>285212672</BaseAddress>
<FileAlignment>4096</FileAlignment>
<PlatformTarget>x86</PlatformTarget>
+ <DebugType>full</DebugType>
+ <WarningLevel>4</WarningLevel>
+ <Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\x86\Release\</OutputPath>
@@ -100,6 +95,8 @@
<Optimize>true</Optimize>
<FileAlignment>4096</FileAlignment>
<PlatformTarget>x86</PlatformTarget>
+ <DebugType>none</DebugType>
+ <WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
@@ -125,7 +122,6 @@
<ProjectReference Include="..\..\AgateLib\AgateLib.csproj">
<Name>AgateLib</Name>
<Project>{9490B719-829E-43A7-A5FE-8001F8A81759}</Project>
- <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
</ProjectReference>
</ItemGroup>
<ItemGroup>
@@ -190,6 +186,7 @@
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
Modified: trunk/TODO.txt
===================================================================
--- trunk/TODO.txt 2011-01-07 20:05:01 UTC (rev 1265)
+++ trunk/TODO.txt 2011-01-07 20:11:41 UTC (rev 1266)
@@ -6,13 +6,12 @@
General:
Remove all OpenGL immediate mode code from AgateOTK.
Check GetPixelFormat method in AgateSDX
- Test / Debug writing pixel buffer to SDX surface.
Deal with TODO's in font tests.
Implement better Platform.HasWriteAccessToAppDirectory method.
- Test ClipRects with AgateOTK
Test if GL_GameWindow is viable.
Remove old resource code so that surface and sprites are loaded only as subelements
of the Image tag.
+ Skinnable GUI
Goals for 0.3.2
--------------------------------
@@ -26,6 +25,8 @@
D Fix bug with rotation where ScaleWidth or ScaleHeight are less than zero.
Drivers
D Update AgateOTK to not call GL functions in finalizers.
+ * Test ClipRects with AgateOTK
+ * Test / Debug writing pixel buffer to SDX surface.
Input
* Add support for POV hats on joysticks.
@@ -46,6 +47,7 @@
D Convert AgateMDX to use SlimDX instead and deprecate the use of AgateMDX.
D Interface to allow audio to be generated at runtime.
D Convert AgateOTK to use vertex buffers instead of vertex arrays.
+ * Use OpenGL 3.0 forward compatible context in AgateOTK if available.
Gui
* Document GUI classes
* Develop data-driven skinning system for the GUI
@@ -78,7 +80,7 @@
Compact Sprites Builder:
Utility to construct packed sprite files with an associated xml
resource file describing frame locations.
- Fonts:
+ Fonts: - Done
Utility to construct fonts from System.Drawing from options specified.
Distributions:
Builds distributions for Linux, Windows, and MacOS based on the assemblies and resource
Modified...
[truncated message content] |
|
From: <ka...@us...> - 2011-01-07 20:24:16
|
Revision: 1269
http://agate.svn.sourceforge.net/agate/?rev=1269&view=rev
Author: kanato
Date: 2011-01-07 20:24:09 +0000 (Fri, 07 Jan 2011)
Log Message:
-----------
Remove extraneous references to GUI stuff.
Set versions in databases and resources to 0.3.2 instead of 0.4.0
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/Data/AgateDatabase.cs
trunk/AgateLib/Data/AgateTable.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/Tests/ResourceTests/Res032.cs
Removed Paths:
-------------
trunk/AgateLib/Resources/GuiThemeResource.cs
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2011-01-07 20:14:25 UTC (rev 1268)
+++ trunk/AgateLib/AgateLib.csproj 2011-01-07 20:24:09 UTC (rev 1269)
@@ -167,56 +167,12 @@
<Compile Include="DisplayLib\Shaders\Lighting2D.cs" />
<Compile Include="DisplayLib\Shaders\Lighting3D.cs" />
<Compile Include="Geometry\VertexTypes\PositionTextureColorNormal.cs" />
- <Compile Include="Gui\AgateGuiException.cs" />
- <Compile Include="Gui\Button.cs" />
- <Compile Include="Gui\ThemeEngines\Venus\CssRenderer.cs" />
- <Compile Include="Gui\WidgetRenderer.cs" />
- <Compile Include="Gui\CheckBox.cs" />
- <Compile Include="Gui\ComboBox.cs" />
- <Compile Include="Gui\Container.cs" />
- <Compile Include="Gui\GuiRoot.cs" />
- <Compile Include="Gui\IGuiThemeEngine.cs" />
- <Compile Include="Gui\ILayoutPerformer.cs" />
- <Compile Include="Gui\Label.cs" />
- <Compile Include="Gui\LayoutExpand.cs" />
- <Compile Include="Gui\Layout\BoxLayoutBase.cs" />
- <Compile Include="Gui\Layout\Grid.cs" />
- <Compile Include="Gui\Layout\HorizontalBox.cs" />
- <Compile Include="Gui\Layout\VerticalBox.cs" />
- <Compile Include="Gui\ListBox.cs" />
- <Compile Include="Gui\Panel.cs" />
- <Compile Include="Gui\RadioButton.cs" />
- <Compile Include="Gui\TextBox.cs" />
- <Compile Include="Gui\ThemeEngines\Mercury\Cache\ScrollBarCache.cs" />
- <Compile Include="Gui\ThemeEngines\Mercury\Mercury.cs" />
- <Compile Include="Gui\ThemeEngines\Mercury\MercuryButton.cs" />
- <Compile Include="Gui\ThemeEngines\Mercury\MercuryCheckBox.cs" />
- <Compile Include="Gui\ThemeEngines\Mercury\MercuryGuiRoot.cs" />
- <Compile Include="Gui\ThemeEngines\Mercury\MercuryLabel.cs" />
- <Compile Include="Gui\ThemeEngines\Mercury\MercuryListBox.cs" />
- <Compile Include="Gui\ThemeEngines\Mercury\MercuryPanel.cs" />
- <Compile Include="Gui\ThemeEngines\Mercury\MercuryScheme.cs" />
- <Compile Include="Gui\ScrollBar.cs" />
- <Compile Include="Gui\ThemeEngines\Mercury\MercuryWidget.cs" />
- <Compile Include="Gui\ThemeEngines\Mercury\MercuryScrollBar.cs" />
- <Compile Include="Gui\ThemeEngines\Mercury\MercuryTextBox.cs" />
- <Compile Include="Gui\ThemeEngines\Mercury\MercuryWindow.cs" />
- <Compile Include="Gui\ThemeEngines\Venus\CssData.cs" />
- <Compile Include="Gui\ThemeEngines\Venus\Venus.cs" />
- <Compile Include="Gui\ThemeEngines\Venus\VenusScheme.cs" />
- <Compile Include="Gui\ThemeEngines\Venus\VenusTheme.cs" />
- <Compile Include="Gui\ThemeEngines\Venus\VenusThemeDictionary.cs" />
- <Compile Include="Gui\ThemeEngines\Venus\WidgetStyle.cs" />
- <Compile Include="Gui\Widget.cs" />
- <Compile Include="Gui\WidgetList.cs" />
- <Compile Include="Gui\Window.cs" />
<Compile Include="IFileProvider.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="DisplayLib\ImplementationBase\FrameBufferImpl.cs" />
<Compile Include="Platform.cs" />
<Compile Include="PlatformType.cs" />
- <Compile Include="Resources\GuiThemeResource.cs" />
<Compile Include="Resources\ImageResource.cs" />
<Compile Include="Serialization\Xle\CompressionType.cs" />
<Compile Include="Settings\SettingsGroup.cs" />
@@ -634,9 +590,6 @@
<None Include="InternalResources\Fonts.zip" />
<None Include="InternalResources\images.tar.gz" />
</ItemGroup>
- <ItemGroup>
- <Folder Include="Gui\Cache\" />
- </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
Modified: trunk/AgateLib/Data/AgateDatabase.cs
===================================================================
--- trunk/AgateLib/Data/AgateDatabase.cs 2011-01-07 20:14:25 UTC (rev 1268)
+++ trunk/AgateLib/Data/AgateDatabase.cs 2011-01-07 20:24:09 UTC (rev 1269)
@@ -79,7 +79,7 @@
void IXleSerializable.WriteData(XleSerializationInfo info)
{
- info.Write("Version", "0.4.0");
+ info.Write("Version", "0.3.2");
info.Write("CodeNamespace", CodeNamespace);
info.Write("Tables", TableList.ToList());
@@ -88,7 +88,7 @@
{
string version = info.ReadString("Version");
- if (version == "0.4.0")
+ if (version == "0.3.2")
{
List<string> tables = info.ReadList<string>("Tables");
mTables.AddUnloadedTable(tables);
@@ -144,7 +144,7 @@
{
StringBuilder b = new StringBuilder();
- b.AppendLine("Version:0.4.0");
+ b.AppendLine("Version:0.3.2");
foreach (var table in mTables)
{
Modified: trunk/AgateLib/Data/AgateTable.cs
===================================================================
--- trunk/AgateLib/Data/AgateTable.cs 2011-01-07 20:14:25 UTC (rev 1268)
+++ trunk/AgateLib/Data/AgateTable.cs 2011-01-07 20:24:09 UTC (rev 1269)
@@ -56,7 +56,7 @@
mColumns.SortByDisplayIndex();
info.Write("Name", mName);
- info.Write("Version", "0.4.0");
+ info.Write("Version", "0.3.2");
info.Write("Columns", mColumns.ColumnList);
info.Write("Rows", RowString());
}
@@ -66,7 +66,7 @@
string version = info.ReadString("Version");
- if (version == "0.4.0")
+ if (version == "0.3.2")
{
mColumns = new AgateColumnDictionary(this, info.ReadList<AgateColumn>("Columns"));
mRows = new AgateRowList(this, ReadRows(info.ReadString("Rows")));
Modified: trunk/AgateLib/Resources/AgateResourceCollection.cs
===================================================================
--- trunk/AgateLib/Resources/AgateResourceCollection.cs 2011-01-07 20:14:25 UTC (rev 1268)
+++ trunk/AgateLib/Resources/AgateResourceCollection.cs 2011-01-07 20:24:09 UTC (rev 1269)
@@ -38,14 +38,14 @@
Dictionary<string, AgateResource> mStore = new Dictionary<string, AgateResource>();
List<ImageResource> mImages = new List<ImageResource>();
- List<GuiThemeResource> mGuiThemes = new List<GuiThemeResource>();
+ //List<GuiThemeResource> mGuiThemes = new List<GuiThemeResource>();
const string mStringTableKey = "Strings";
bool mOwnFileProvider;
IFileProvider mFileProvider;
SurfaceResourceList mSurfaceAccessor;
- GuiThemeResourceList mGuiThemeAccessor;
+ //GuiThemeResourceList mGuiThemeAccessor;
public class SurfaceResourceList
{
@@ -77,44 +77,44 @@
get { return mResources.mImages.Count; }
}
}
- public class GuiThemeResourceList
- {
- AgateResourceCollection mResources;
+// public class GuiThemeResourceList
+// {
+// AgateResourceCollection mResources;
+//
+// internal GuiThemeResourceList(AgateResourceCollection resources)
+// {
+// mResources = resources;
+// }
+//
+// public GuiThemeResource this[string key]
+// {
+// get
+// {
+// var retval = mResources.mGuiThemes.FirstOrDefault(x => x.Name == key);
+//
+// if (retval == null)
+// throw new AgateResourceException("Could not find the gui theme resource {0}.", key);
+//
+// return retval;
+// }
+// }
+// public GuiThemeResource this[int index]
+// {
+// get { return mResources.mGuiThemes[index]; }
+// }
+// public int Count
+// {
+// get { return mResources.mGuiThemes.Count; }
+// }
+// }
- internal GuiThemeResourceList(AgateResourceCollection resources)
- {
- mResources = resources;
- }
-
- public GuiThemeResource this[string key]
- {
- get
- {
- var retval = mResources.mGuiThemes.FirstOrDefault(x => x.Name == key);
-
- if (retval == null)
- throw new AgateResourceException("Could not find the gui theme resource {0}.", key);
-
- return retval;
- }
- }
- public GuiThemeResource this[int index]
- {
- get { return mResources.mGuiThemes[index]; }
- }
- public int Count
- {
- get { return mResources.mGuiThemes.Count; }
- }
- }
-
/// <summary>
/// Constructs a new AgateResourceCollection object.
/// </summary>
public AgateResourceCollection()
{
mSurfaceAccessor = new SurfaceResourceList(this);
- mGuiThemeAccessor = new GuiThemeResourceList(this);
+ //mGuiThemeAccessor = new GuiThemeResourceList(this);
this.mStore.Add(mStringTableKey, new StringTable());
}
@@ -140,7 +140,7 @@
public AgateResourceCollection(IFileProvider fileProvider, string filename)
{
mSurfaceAccessor = new SurfaceResourceList(this);
- mGuiThemeAccessor = new GuiThemeResourceList(this);
+ //mGuiThemeAccessor = new GuiThemeResourceList(this);
FileProvider = fileProvider;
RootDirectory = Path.GetDirectoryName(filename);
@@ -219,10 +219,10 @@
/// <summary>
/// Gets the list of GuiThemeResource objects.
/// </summary>
- public GuiThemeResourceList GuiThemes
- {
- get { return mGuiThemeAccessor; }
- }
+// public GuiThemeResourceList GuiThemes
+// {
+// get { return mGuiThemeAccessor; }
+// }
/// <summary>
/// Enumerates through the DisplayWindowResources contained in this group of resources.
/// </summary>
@@ -267,10 +267,10 @@
mImages.Add(img);
}
- else if (item is GuiThemeResource)
- {
- mGuiThemes.Add((GuiThemeResource)item);
- }
+// else if (item is GuiThemeResource)
+// {
+// mGuiThemes.Add((GuiThemeResource)item);
+// }
else
mStore.Add(item.Name, item);
}
Modified: trunk/AgateLib/Resources/AgateResourceLoader.cs
===================================================================
--- trunk/AgateLib/Resources/AgateResourceLoader.cs 2011-01-07 20:14:25 UTC (rev 1268)
+++ trunk/AgateLib/Resources/AgateResourceLoader.cs 2011-01-07 20:24:09 UTC (rev 1269)
@@ -38,7 +38,7 @@
{
XmlDocument doc = new XmlDocument();
XmlElement root = doc.CreateElement("AgateResources");
- XmlHelper.AppendAttribute(root, doc, "Version", "0.4.0");
+ XmlHelper.AppendAttribute(root, doc, "Version", "0.3.2");
doc.AppendChild(root);
@@ -99,10 +99,10 @@
switch (version)
{
- case "0.4.0":
+ case "0.3.2":
case "0.3.1":
case "0.3.0":
- ReadVersion040(resources, root, version);
+ ReadVersion032(resources, root, version);
break;
default:
@@ -111,7 +111,7 @@
}
- private static void ReadVersion040(AgateResourceCollection resources, XmlNode root, string version)
+ private static void ReadVersion032(AgateResourceCollection resources, XmlNode root, string version)
{
for (int i = 0; i < root.ChildNodes.Count; i++)
{
@@ -144,9 +144,6 @@
case "Image":
return new ImageResource(node, version);
- case "GuiTheme":
- return new GuiThemeResource(node, version);
-
case "Surface":
return new SurfaceResource(node, version);
Modified: trunk/AgateLib/Resources/BitmapFontResource.cs
===================================================================
--- trunk/AgateLib/Resources/BitmapFontResource.cs 2011-01-07 20:14:25 UTC (rev 1268)
+++ trunk/AgateLib/Resources/BitmapFontResource.cs 2011-01-07 20:24:09 UTC (rev 1269)
@@ -27,11 +27,11 @@
{
switch (version)
{
- case "0.4.0":
+ case "0.3.2":
Name = node.Attributes["name"].Value;
mImage = XmlHelper.ReadAttributeString(node, "image", string.Empty);
- ReadMetrics040(node);
+ ReadMetrics032(node);
break;
@@ -50,7 +50,7 @@
}
}
- private void ReadMetrics040(XmlNode parent)
+ private void ReadMetrics032(XmlNode parent)
{
XmlNode root = null;
Modified: trunk/AgateLib/Resources/DisplayWindowResource.cs
===================================================================
--- trunk/AgateLib/Resources/DisplayWindowResource.cs 2011-01-07 20:14:25 UTC (rev 1268)
+++ trunk/AgateLib/Resources/DisplayWindowResource.cs 2011-01-07 20:24:09 UTC (rev 1269)
@@ -110,6 +110,7 @@
{
switch (version)
{
+ case "0.3.2":
case "0.3.1":
case "0.3.0":
Name = node.Attributes["name"].Value;
Deleted: trunk/AgateLib/Resources/GuiThemeResource.cs
===================================================================
--- trunk/AgateLib/Resources/GuiThemeResource.cs 2011-01-07 20:14:25 UTC (rev 1268)
+++ trunk/AgateLib/Resources/GuiThemeResource.cs 2011-01-07 20:24:09 UTC (rev 1269)
@@ -1,35 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Xml;
-
-namespace AgateLib.Resources
-{
- public class GuiThemeResource : AgateResource
- {
- public string CssFile { get; set; }
-
- public GuiThemeResource()
- { }
- public GuiThemeResource(string name)
- : base(name)
- { }
-
- internal GuiThemeResource(XmlNode node, string version)
- {
- Name = XmlHelper.ReadAttributeString(node, "name");
- CssFile = XmlHelper.ReadAttributeString(node, "css");
- }
-
- internal override void BuildNodes(XmlElement parent, System.Xml.XmlDocument doc)
- {
- throw new NotImplementedException();
- }
-
- protected override AgateResource Clone()
- {
- throw new NotImplementedException();
- }
- }
-}
Modified: trunk/AgateLib/Resources/ImageResource.cs
===================================================================
--- trunk/AgateLib/Resources/ImageResource.cs 2011-01-07 20:14:25 UTC (rev 1268)
+++ trunk/AgateLib/Resources/ImageResource.cs 2011-01-07 20:24:09 UTC (rev 1269)
@@ -22,9 +22,9 @@
switch (version)
{
- case "0.4.0":
+ case "0.3.2":
Filename = node.Attributes["filename"].Value;
- ReadSubNodes040(node);
+ ReadSubNodes032(node);
break;
default:
@@ -32,7 +32,7 @@
}
}
- private void ReadSubNodes040(XmlNode node)
+ private void ReadSubNodes032(XmlNode node)
{
foreach (XmlNode n in node.ChildNodes)
{
Modified: trunk/AgateLib/Resources/SpriteResource.cs
===================================================================
--- trunk/AgateLib/Resources/SpriteResource.cs 2011-01-07 20:14:25 UTC (rev 1268)
+++ trunk/AgateLib/Resources/SpriteResource.cs 2011-01-07 20:24:09 UTC (rev 1269)
@@ -132,6 +132,7 @@
{
switch (version)
{
+ case "0.3.2":
case "0.3.1":
Name = node.Attributes["name"].Value;
mFilename = XmlHelper.ReadAttributeString(node, "image", string.Empty);
Modified: trunk/AgateLib/Resources/StringTable.cs
===================================================================
--- trunk/AgateLib/Resources/StringTable.cs 2011-01-07 20:14:25 UTC (rev 1268)
+++ trunk/AgateLib/Resources/StringTable.cs 2011-01-07 20:24:09 UTC (rev 1269)
@@ -40,6 +40,8 @@
{
switch (version)
{
+ case "0.3.2":
+ case "0.3.1":
case "0.3.0":
for (int i = 0; i < node.ChildNodes.Count; i++)
{
Modified: trunk/AgateLib/Resources/SurfaceResource.cs
===================================================================
--- trunk/AgateLib/Resources/SurfaceResource.cs 2011-01-07 20:14:25 UTC (rev 1268)
+++ trunk/AgateLib/Resources/SurfaceResource.cs 2011-01-07 20:24:09 UTC (rev 1269)
@@ -70,6 +70,7 @@
{
switch (version)
{
+ case "0.3.2":
case "0.3.1":
case "0.3.0":
Name = node.Attributes["name"].Value;
Modified: trunk/Tests/ResourceTests/Res032.cs
===================================================================
--- trunk/Tests/ResourceTests/Res032.cs 2011-01-07 20:14:25 UTC (rev 1268)
+++ trunk/Tests/ResourceTests/Res032.cs 2011-01-07 20:24:09 UTC (rev 1269)
@@ -8,7 +8,7 @@
namespace Tests.ResourceTests
{
- class Resources040: AgateGame, IAgateTest
+ class Resources032: AgateGame, IAgateTest
{
public void Main(string[] args)
{
@@ -20,7 +20,7 @@
initParams.AllowResize = true;
}
- public string Name { get { return "Resources 0.4.0"; } }
+ public string Name { get { return "Resources 0.3.2"; } }
public string Category { get { return "Resources"; } }
AgateResourceCollection resources;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-01-10 21:18:38
|
Revision: 1273
http://agate.svn.sourceforge.net/agate/?rev=1273&view=rev
Author: kanato
Date: 2011-01-10 21:18:31 +0000 (Mon, 10 Jan 2011)
Log Message:
-----------
Fix clip rect projection matrix for AgateOTK
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/DisplayLib/Shaders/AgateShader.cs
trunk/AgateLib/DisplayLib/Shaders/Basic2DShader.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/AgateShaderImpl.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/Basic2DImpl.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/Lighting2DImpl.cs
trunk/AgateLib/DisplayLib/Shaders/Lighting2D.cs
trunk/Drivers/AgateOTK/GL_Display.cs
trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Basic2DShader.cs
trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Lighting2D.cs
Added Paths:
-----------
trunk/AgateLib/DisplayLib/Shaders/IShader2D.cs
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2011-01-09 18:53:59 UTC (rev 1272)
+++ trunk/AgateLib/AgateLib.csproj 2011-01-10 21:18:31 UTC (rev 1273)
@@ -584,6 +584,7 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>DataResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
+ <Compile Include="DisplayLib\Shaders\IShader2D.cs" />
</ItemGroup>
<ItemGroup>
<None Include="InternalResources\agate-black-gui.zip" />
Modified: trunk/AgateLib/DisplayLib/Shaders/AgateShader.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Shaders/AgateShader.cs 2011-01-09 18:53:59 UTC (rev 1272)
+++ trunk/AgateLib/DisplayLib/Shaders/AgateShader.cs 2011-01-10 21:18:31 UTC (rev 1273)
@@ -83,5 +83,6 @@
{
Display.Shader = this;
}
+
}
}
Modified: trunk/AgateLib/DisplayLib/Shaders/Basic2DShader.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Shaders/Basic2DShader.cs 2011-01-09 18:53:59 UTC (rev 1272)
+++ trunk/AgateLib/DisplayLib/Shaders/Basic2DShader.cs 2011-01-10 21:18:31 UTC (rev 1273)
@@ -29,7 +29,7 @@
/// The default 2D shader. This shader supports no effects, and must be implemented
/// by every AgateLib display driver.
/// </summary>
- public class Basic2DShader : AgateInternalShader
+ public class Basic2DShader : AgateInternalShader, IShader2D
{
/// <summary>
/// Constructs a 2D shader.
Added: trunk/AgateLib/DisplayLib/Shaders/IShader2D.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Shaders/IShader2D.cs (rev 0)
+++ trunk/AgateLib/DisplayLib/Shaders/IShader2D.cs 2011-01-10 21:18:31 UTC (rev 1273)
@@ -0,0 +1,38 @@
+// 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-2009.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using AgateLib.DisplayLib.Shaders.Implementation;
+using AgateLib.Geometry;
+
+namespace AgateLib.DisplayLib.Shaders
+{
+ public interface IShader2D
+ {
+ /// <summary>
+ /// Gets or sets the coordinate system used for drawing.
+ /// The default for any render target is to use a one-to-one
+ /// mapping for pixels.
+ /// </summary>
+ Rectangle CoordinateSystem { get; set; }
+ }
+}
+
Modified: trunk/AgateLib/DisplayLib/Shaders/Implementation/AgateShaderImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Shaders/Implementation/AgateShaderImpl.cs 2011-01-09 18:53:59 UTC (rev 1272)
+++ trunk/AgateLib/DisplayLib/Shaders/Implementation/AgateShaderImpl.cs 2011-01-10 21:18:31 UTC (rev 1273)
@@ -41,5 +41,6 @@
public abstract void BeginPass(int passIndex);
public abstract void EndPass();
public abstract void End();
+
}
}
Modified: trunk/AgateLib/DisplayLib/Shaders/Implementation/Basic2DImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Shaders/Implementation/Basic2DImpl.cs 2011-01-09 18:53:59 UTC (rev 1272)
+++ trunk/AgateLib/DisplayLib/Shaders/Implementation/Basic2DImpl.cs 2011-01-10 21:18:31 UTC (rev 1273)
@@ -33,5 +33,6 @@
/// Gets or sets the coordinate system used (orthogonal projection).
/// </summary>
public abstract Rectangle CoordinateSystem { get; set; }
+
}
}
Modified: trunk/AgateLib/DisplayLib/Shaders/Implementation/Lighting2DImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Shaders/Implementation/Lighting2DImpl.cs 2011-01-09 18:53:59 UTC (rev 1272)
+++ trunk/AgateLib/DisplayLib/Shaders/Implementation/Lighting2DImpl.cs 2011-01-10 21:18:31 UTC (rev 1273)
@@ -49,6 +49,10 @@
/// Sets the ambient light color.
/// </summary>
public abstract Color AmbientLight { get; set; }
-
+
+ /// <summary>
+ /// Gets or sets the coordinate system used (orthogonal projection).
+ /// </summary>
+ public abstract Rectangle CoordinateSystem { get; set; }
}
}
Modified: trunk/AgateLib/DisplayLib/Shaders/Lighting2D.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Shaders/Lighting2D.cs 2011-01-09 18:53:59 UTC (rev 1272)
+++ trunk/AgateLib/DisplayLib/Shaders/Lighting2D.cs 2011-01-10 21:18:31 UTC (rev 1273)
@@ -28,7 +28,7 @@
/// <summary>
/// Lighting2D is the Basic2DShader with lighting effects added.
/// </summary>
- public class Lighting2D : AgateInternalShader
+ public class Lighting2D : AgateInternalShader, IShader2D
{
protected override BuiltInShader BuiltInShaderType
{
@@ -86,6 +86,19 @@
}
}
}
+
+
+ #region IShader2D implementation
+
+ public Rectangle CoordinateSystem
+ {
+ get { return Impl.CoordinateSystem; }
+ set
+ {
+ Impl.CoordinateSystem = value;
+ }
+ }
+ #endregion
}
public class Light
Modified: trunk/Drivers/AgateOTK/GL_Display.cs
===================================================================
--- trunk/Drivers/AgateOTK/GL_Display.cs 2011-01-09 18:53:59 UTC (rev 1272)
+++ trunk/Drivers/AgateOTK/GL_Display.cs 2011-01-10 21:18:31 UTC (rev 1273)
@@ -207,7 +207,14 @@
{
GL.Viewport(newClipRect.X, mRenderTarget.Height - newClipRect.Bottom,
newClipRect.Width, newClipRect.Height);
-
+
+ if (Display.Shader is AgateLib.DisplayLib.Shaders.IShader2D)
+ {
+ AgateLib.DisplayLib.Shaders.IShader2D s = (AgateLib.DisplayLib.Shaders.IShader2D)Display.Shader ;
+
+ s.CoordinateSystem = newClipRect;
+ }
+
mCurrentClip = newClipRect;
}
Modified: trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Basic2DShader.cs
===================================================================
--- trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Basic2DShader.cs 2011-01-09 18:53:59 UTC (rev 1272)
+++ trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Basic2DShader.cs 2011-01-10 21:18:31 UTC (rev 1273)
@@ -14,6 +14,13 @@
{
Rectangle coords;
+ void SetProjection ()
+ {
+ GL.MatrixMode(MatrixMode.Projection);
+ GL.LoadIdentity();
+ GL.Ortho(coords.Left, coords.Right, coords.Bottom, coords.Top, -1, 1);
+ }
+
public override Rectangle CoordinateSystem
{
get
@@ -23,17 +30,16 @@
set
{
coords = value;
+ SetProjection();
}
}
public override void Begin()
{
+ SetProjection();
+
GL.Disable(EnableCap.Lighting);
- GL.MatrixMode(MatrixMode.Projection);
- GL.LoadIdentity();
- GL.Ortho(coords.Left, coords.Right, coords.Bottom, coords.Top, -1, 1);
-
GL.Enable(EnableCap.Texture2D);
GL.Enable(EnableCap.Blend);
Modified: trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Lighting2D.cs
===================================================================
--- trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Lighting2D.cs 2011-01-09 18:53:59 UTC (rev 1272)
+++ trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Lighting2D.cs 2011-01-10 21:18:31 UTC (rev 1273)
@@ -11,11 +11,28 @@
{
class OTK_FF_Lighting2D : Lighting2DImpl
{
+ Rectangle coords;
+
Color mAmbientLight;
public OTK_FF_Lighting2D()
{
}
+
+
+ public override Rectangle CoordinateSystem
+ {
+ get
+ {
+ return coords;
+ }
+ set
+ {
+ coords = value;
+ }
+ }
+
+
public override int MaxActiveLights
{
get
@@ -48,6 +65,10 @@
public override void Begin()
{
+ GL.MatrixMode(MatrixMode.Projection);
+ GL.LoadIdentity();
+ GL.Ortho(coords.Left, coords.Right, coords.Bottom, coords.Top, -1, 1);
+
GL.Enable(EnableCap.Lighting);
float[] array = new float[4];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-01-13 19:29:28
|
Revision: 1277
http://agate.svn.sourceforge.net/agate/?rev=1277&view=rev
Author: kanato
Date: 2011-01-13 19:29:17 +0000 (Thu, 13 Jan 2011)
Log Message:
-----------
Fix Surface.WritePixels overload when there is a specified startPoint with Direct3D.
Modified Paths:
--------------
trunk/AgateLib/DisplayLib/PixelBuffer.cs
trunk/AgateLib/DisplayLib/Surface.cs
trunk/Drivers/AgateSDX/SDX_Surface.cs
trunk/Tests/DisplayTests/PixelBufferMask.cs
Modified: trunk/AgateLib/DisplayLib/PixelBuffer.cs
===================================================================
--- trunk/AgateLib/DisplayLib/PixelBuffer.cs 2011-01-13 16:15:47 UTC (rev 1276)
+++ trunk/AgateLib/DisplayLib/PixelBuffer.cs 2011-01-13 19:29:17 UTC (rev 1277)
@@ -496,6 +496,9 @@
if (srcRect.X < 0 || srcRect.Y < 0 || srcRect.Right > buffer.Width || srcRect.Bottom > buffer.Height)
throw new ArgumentOutOfRangeException("srcRect", "Source rectangle outside size of buffer!");
+ if (destPt.X < 0 || destPt.Y < 0)
+ throw new ArgumentOutOfRangeException("destPt", "Destination cannot be less than zero.");
+
if (buffer.RowStride == RowStride && buffer.PixelFormat == PixelFormat && destPt.X == 0)
{
int destIndex = GetPixelIndex(destPt.X, destPt.Y);
Modified: trunk/AgateLib/DisplayLib/Surface.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Surface.cs 2011-01-13 16:15:47 UTC (rev 1276)
+++ trunk/AgateLib/DisplayLib/Surface.cs 2011-01-13 19:29:17 UTC (rev 1277)
@@ -796,6 +796,7 @@
/// writing pixel data.</param>
public void WritePixels(PixelBuffer buffer, Rectangle sourceRect, Point destPt)
{
+ // TODO: add validation on the rectangle, and only do the copy if the rectangle doesn't match the buffer dimensions.
PixelBuffer smallBuffer = new PixelBuffer(buffer, sourceRect);
WritePixels(smallBuffer, destPt);
Modified: trunk/Drivers/AgateSDX/SDX_Surface.cs
===================================================================
--- trunk/Drivers/AgateSDX/SDX_Surface.cs 2011-01-13 16:15:47 UTC (rev 1276)
+++ trunk/Drivers/AgateSDX/SDX_Surface.cs 2011-01-13 19:29:17 UTC (rev 1277)
@@ -649,20 +649,24 @@
surf.Dispose();
+ // This should probably only lock the region of the surface we intend to update.
+ // However, as is usually the case with DirectX, doing so gives weird errors
+ // with no real explanation as to what is wrong.
DataRectangle stm = mTexture.Value.LockRectangle
- (0, Interop.Convert(updateRect), LockFlags.Discard);
+ (0, LockFlags.None);
if (buffer.PixelFormat != pixelFormat)
buffer = buffer.ConvertTo(pixelFormat);
unsafe
{
- for (int i = updateRect.Top; i < updateRect.Bottom; i++)
+ for (int i = 0; i < buffer.Height; i++)
{
int startIndex = buffer.GetPixelIndex(0, i);
int rowStride = buffer.RowStride;
IntPtr dest = (IntPtr)
- ((byte*)stm.Data.DataPointer + i * stm.Pitch + updateRect.Left * pixelPitch);
+ ((byte*)stm.Data.DataPointer + (i + updateRect.Top) * stm.Pitch
+ + updateRect.Left * pixelPitch);
Marshal.Copy(buffer.Data, startIndex, dest, rowStride);
}
Modified: trunk/Tests/DisplayTests/PixelBufferMask.cs
===================================================================
--- trunk/Tests/DisplayTests/PixelBufferMask.cs 2011-01-13 16:15:47 UTC (rev 1276)
+++ trunk/Tests/DisplayTests/PixelBufferMask.cs 2011-01-13 19:29:17 UTC (rev 1277)
@@ -11,8 +11,6 @@
{
class PixelBufferMask : IAgateTest
{
- #region IAgateTest Members
-
public string Name
{
get { return "Pixel Buffer Masking"; }
@@ -27,8 +25,7 @@
{
using (AgateSetup setup = new AgateSetup())
{
- bool isRunning = false;
-
+ setup.AskUser = true;
setup.InitializeAll();
if (setup.WasCanceled)
@@ -54,17 +51,14 @@
surfRealBg.WritePixels(pbBg);
- isRunning = true;
-
- while (isRunning)
+ while (Display.CurrentWindow.IsClosed == false)
{
Display.CurrentWindow.Title = Display.FramesPerSecond.ToString();
Display.BeginFrame();
if (Keyboard.Keys[KeyCode.Escape])
- isRunning = false;
+ return;
-
if (Mouse.Buttons[Mouse.MouseButtons.Primary])
{
int mX = Mouse.X;
@@ -93,7 +87,5 @@
}
}
}
-
- #endregion
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-10-03 16:47:18
|
Revision: 1286
http://agate.svn.sourceforge.net/agate/?rev=1286&view=rev
Author: kanato
Date: 2011-10-03 16:47:12 +0000 (Mon, 03 Oct 2011)
Log Message:
-----------
Add conversions from YUV and HSV for colors.
Fix some comments.
Added function to convert PixelBuffer to System.Drawing.Bitmap.
Removed some obsolete code.
Modified Paths:
--------------
trunk/AgateLib/DisplayLib/Display.cs
trunk/AgateLib/Geometry/Color.cs
trunk/AgateLib/Geometry/Rectangle.cs
trunk/AgateLib/Geometry/Size.cs
trunk/Drivers/AgateLib.WinForms/FormUtil.cs
trunk/Drivers/AgateLib.WinForms/FormsInterop.cs
trunk/Drivers/AgateSDL/Reporter.cs
trunk/Tests/Tests.csproj
Added Paths:
-----------
trunk/Tests/DisplayTests/ColorTest.cs
Modified: trunk/AgateLib/DisplayLib/Display.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Display.cs 2011-06-18 01:08:48 UTC (rev 1285)
+++ trunk/AgateLib/DisplayLib/Display.cs 2011-10-03 16:47:12 UTC (rev 1286)
@@ -108,11 +108,6 @@
get { return mRenderState; }
}
- [Obsolete]
- private static ShaderCompilerImpl CreateShaderCompiler()
- {
- return impl.CreateShaderCompiler();
- }
/// <summary>
/// Disposes of the Display.
/// </summary>
Modified: trunk/AgateLib/Geometry/Color.cs
===================================================================
--- trunk/AgateLib/Geometry/Color.cs 2011-06-18 01:08:48 UTC (rev 1285)
+++ trunk/AgateLib/Geometry/Color.cs 2011-10-03 16:47:12 UTC (rev 1286)
@@ -884,5 +884,62 @@
* */
}
+ // See algorithm at http://en.wikipedia.org/wiki/YUV#Conversion_to.2Ffrom_RGB
+ const double W_R = 0.299;
+ const double W_B = 0.114;
+ const double W_G = 0.587;
+ const double Umax = 0.436;
+ const double Vmax = 0.615;
+
+ public void ToYuv(out double y, out double u, out double v)
+ {
+ y = (W_R * r + W_G * g + W_B * b) / 255.0;
+ u = Umax * (b/255.0 - y) / (1 - W_B);
+ v = Vmax * (r / 255.0 - y) / (1 - W_R);
+ }
+
+ public static Color FromYuv(double y, double u, double v)
+ {
+ return Color.FromArgb(
+ (int)(255 * (y + v * (1 - W_R) / Vmax)),
+ (int)(255 * (y - u * W_B * (1 - W_B) / (Umax * W_G) - v * W_R * (1 - W_R) / (Vmax * W_G))),
+ (int)(255 * (y + u * (1 - W_B) / Umax)));
+ }
+
+ /// <summary>
+ /// Returns a Color object calculated from hue, saturation and value.
+ /// See algorithm at http://en.wikipedia.org/wiki/HSL_and_HSV#From_HSV
+ /// </summary>
+ /// <param name="h">The hue angle in degrees.</param>
+ /// <param name="s">A value from 0 to 1 representing saturation.</param>
+ /// <param name="v">A value from 0 to 1 representing the value.</param>
+ /// <returns></returns>
+ public static Color FromHsv(double h, double s, double v)
+ {
+ while (h < 0)
+ h += 360;
+ if (h > 360)
+ h = h % 360;
+
+ double hp = h / 60;
+ double chroma = v * s;
+ double X = chroma * (1 - Math.Abs(hp % 2 - 1));
+
+ double r1 = 0, b1 = 0, g1 = 0;
+
+ switch ((int)hp)
+ {
+ case 0: r1 = chroma; g1 = X; break;
+ case 1: r1 = X; g1 = chroma; break;
+ case 2: g1 = chroma; b1 = X; break;
+ case 3: g1 = X; b1 = chroma; break;
+ case 4: r1 = X; b1 = chroma; break;
+ case 5: r1 = chroma; b1 = X; break;
+ }
+
+ double m = v - chroma;
+
+ return Color.FromArgb((int)(255 * (r1 + m)), (int)(255 * (g1 + m)), (int)(255 * b1 + m));
+ }
}
}
\ No newline at end of file
Modified: trunk/AgateLib/Geometry/Rectangle.cs
===================================================================
--- trunk/AgateLib/Geometry/Rectangle.cs 2011-06-18 01:08:48 UTC (rev 1285)
+++ trunk/AgateLib/Geometry/Rectangle.cs 2011-10-03 16:47:12 UTC (rev 1286)
@@ -25,7 +25,7 @@
namespace AgateLib.Geometry
{
/// <summary>
- /// Replacement for System.Drawing.Rectangle structure.
+ /// Implements a Rectangle structure, containing position and size.
/// </summary>
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]
Modified: trunk/AgateLib/Geometry/Size.cs
===================================================================
--- trunk/AgateLib/Geometry/Size.cs 2011-06-18 01:08:48 UTC (rev 1285)
+++ trunk/AgateLib/Geometry/Size.cs 2011-10-03 16:47:12 UTC (rev 1286)
@@ -25,7 +25,7 @@
namespace AgateLib.Geometry
{
/// <summary>
- /// Replacement for System.Drawing.Size object.
+ /// A structure with two properties, a width and height.
/// </summary>
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]
Modified: trunk/Drivers/AgateLib.WinForms/FormUtil.cs
===================================================================
--- trunk/Drivers/AgateLib.WinForms/FormUtil.cs 2011-06-18 01:08:48 UTC (rev 1285)
+++ trunk/Drivers/AgateLib.WinForms/FormUtil.cs 2011-10-03 16:47:12 UTC (rev 1286)
@@ -179,24 +179,8 @@
/// <param name="format"></param>
public static void SavePixelBuffer(PixelBuffer buffer, string filename, ImageFileFormat format)
{
+ Bitmap bmp = Interop.BitmapFromPixelBuffer(buffer);
- Bitmap bmp = new Bitmap(buffer.Width, buffer.Height);
-
- System.Drawing.Imaging.BitmapData data = bmp.LockBits(
- new Rectangle(Point.Empty, Interop.Convert(buffer.Size)),
- System.Drawing.Imaging.ImageLockMode.WriteOnly,
- System.Drawing.Imaging.PixelFormat.Format32bppArgb);
-
- if (buffer.PixelFormat != PixelFormat.BGRA8888)
- {
- buffer = buffer.ConvertTo(PixelFormat.BGRA8888);
- }
-
- System.Runtime.InteropServices.Marshal.Copy(
- buffer.Data, 0, data.Scan0, buffer.Data.Length);
-
- bmp.UnlockBits(data);
-
switch (format)
{
case ImageFileFormat.Bmp:
Modified: trunk/Drivers/AgateLib.WinForms/FormsInterop.cs
===================================================================
--- trunk/Drivers/AgateLib.WinForms/FormsInterop.cs 2011-06-18 01:08:48 UTC (rev 1285)
+++ trunk/Drivers/AgateLib.WinForms/FormsInterop.cs 2011-10-03 16:47:12 UTC (rev 1286)
@@ -191,5 +191,31 @@
return new Draw.SizeF(sz.Width, sz.Height);
}
+ /// <summary>
+ /// Converts an AgateLib.DisplayLib.PixelBuffer object into a System.Drawing.Bitmap object.
+ /// </summary>
+ /// <param name="buffer">The PixelBuffer object containing the pixel data.</param>
+ /// <returns></returns>
+ public static System.Drawing.Bitmap BitmapFromPixelBuffer(PixelBuffer buffer)
+ {
+ System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(buffer.Width, buffer.Height);
+
+ System.Drawing.Imaging.BitmapData data = bmp.LockBits(
+ new Draw.Rectangle(Draw.Point.Empty, Interop.Convert(buffer.Size)),
+ System.Drawing.Imaging.ImageLockMode.WriteOnly,
+ System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+
+ if (buffer.PixelFormat != PixelFormat.BGRA8888)
+ {
+ buffer = buffer.ConvertTo(PixelFormat.BGRA8888);
+ }
+
+ System.Runtime.InteropServices.Marshal.Copy(
+ buffer.Data, 0, data.Scan0, buffer.Data.Length);
+
+ bmp.UnlockBits(data);
+
+ return bmp;
+ }
}
}
Modified: trunk/Drivers/AgateSDL/Reporter.cs
===================================================================
--- trunk/Drivers/AgateSDL/Reporter.cs 2011-06-18 01:08:48 UTC (rev 1285)
+++ trunk/Drivers/AgateSDL/Reporter.cs 2011-10-03 16:47:12 UTC (rev 1286)
@@ -38,8 +38,12 @@
return true;
}
- catch (DllNotFoundException)
+ catch (DllNotFoundException e)
{
+ AgateLib.Core.ErrorReporting.Report(AgateLib.ErrorLevel.Warning,
+ "A DllNotFoundException was thrown when attempting to load SDL binaries." + Environment.NewLine +
+ "This indicates that SDL.dll or SDL_mixer.dll was not found.", e);
+
return false;
}
catch (BadImageFormatException e)
Added: trunk/Tests/DisplayTests/ColorTest.cs
===================================================================
--- trunk/Tests/DisplayTests/ColorTest.cs (rev 0)
+++ trunk/Tests/DisplayTests/ColorTest.cs 2011-10-03 16:47:12 UTC (rev 1286)
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using AgateLib;
+using AgateLib.Geometry;
+using AgateLib.DisplayLib;
+
+namespace Tests.DisplayTests
+{
+ class ColorTest : IAgateTest
+ {
+ #region IAgateTest Members
+
+ public string Name
+ {
+ get { return "Color Test"; }
+ }
+
+ public string Category
+ {
+ get { return "Display"; }
+ }
+
+ public void Main(string[] args)
+ {
+ using (AgateSetup setup = new AgateSetup())
+ {
+ setup.AskUser = true;
+ setup.Initialize(true, false, false);
+ if (setup.WasCanceled)
+ return;
+
+ DisplayWindow wind = DisplayWindow.CreateWindowed(
+ "Color Test", 640, 480);
+
+ while (wind.IsClosed == false)
+ {
+ Display.BeginFrame();
+ Display.Clear();
+
+ for (int i = 0; i < 360; i++)
+ {
+ Display.FillRect(new Rectangle(i, 0, 1, 75), Color.FromHsv(i, 1, 1));
+ }
+
+ Display.EndFrame();
+ Core.KeepAlive();
+ }
+ }
+ }
+
+ #endregion
+ }
+}
Modified: trunk/Tests/Tests.csproj
===================================================================
--- trunk/Tests/Tests.csproj 2011-06-18 01:08:48 UTC (rev 1285)
+++ trunk/Tests/Tests.csproj 2011-10-03 16:47:12 UTC (rev 1286)
@@ -138,6 +138,7 @@
<Compile Include="DisplayTests\Capabilities\frmCapabilities.Designer.cs">
<DependentUpon>frmCapabilities.cs</DependentUpon>
</Compile>
+ <Compile Include="DisplayTests\ColorTest.cs" />
<Compile Include="DisplayTests\PixelBufferMask.cs" />
<Compile Include="DisplayTests\ClipRect.cs" />
<Compile Include="DisplayTests\Prerendered.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-10-11 17:45:49
|
Revision: 1289
http://agate.svn.sourceforge.net/agate/?rev=1289&view=rev
Author: kanato
Date: 2011-10-11 17:45:40 +0000 (Tue, 11 Oct 2011)
Log Message:
-----------
Some refactoring done. Mostly name changes of variable names.
Modified Paths:
--------------
trunk/AgateLib/AgateGame.cs
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/AgateSetup.cs
trunk/AgateLib/AudioLib/Audio.cs
trunk/AgateLib/AudioLib/SoundBuffer.cs
trunk/AgateLib/BitmapFont/BitmapFontImpl.cs
trunk/AgateLib/Core.cs
trunk/AgateLib/Data/AgateTable.cs
trunk/AgateLib/Data/FieldType.cs
trunk/AgateLib/DisplayLib/CreateWindowParams.cs
trunk/AgateLib/DisplayLib/Display.cs
trunk/AgateLib/DisplayLib/DisplayWindow.cs
trunk/AgateLib/DisplayLib/FontSurface.cs
trunk/AgateLib/DisplayLib/ISurface.cs
trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs
trunk/AgateLib/DisplayLib/ImplementationBase/SurfaceImpl.cs
trunk/AgateLib/DisplayLib/ImplementationBase/VertexBufferImpl.cs
trunk/AgateLib/DisplayLib/PixelBuffer.cs
trunk/AgateLib/DisplayLib/Shaders/AgateShader.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/Effect.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/Lighting2DImpl.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/Lighting3DImpl.cs
trunk/AgateLib/DisplayLib/Surface.cs
trunk/AgateLib/Drivers/Registrar.cs
trunk/AgateLib/Meshes/Loaders/Obj/Parser.cs
trunk/AgateLib/Particles/Emitters/PixelEmitter.cs
trunk/AgateLib/Platform.cs
trunk/AgateLib/Resources/AgateResource.cs
trunk/AgateLib/Serialization/Formatters/Xml/XmlFormatter.cs
trunk/AgateLib/Sprites/Sprite.cs
trunk/AgateLib/Utility/TgzFileProvider.cs
trunk/AgateLib/Utility/ZipFileProvider.cs
trunk/Drivers/AgateDrawing/Drawing_Display.cs
trunk/Drivers/AgateDrawing/Drawing_Surface.cs
trunk/Drivers/AgateLib.WinForms/BitmapFontUtil.cs
trunk/Drivers/AgateLib.WinForms/BitmapFontUtilRenderers.cs
trunk/Drivers/AgateLib.WinForms/WinFormsDriver.cs
trunk/Drivers/AgateOTK/GL3/Shaders/GlslShader.cs
trunk/Drivers/AgateOTK/GL_Display.cs
trunk/Drivers/AgateOTK/GL_FrameBuffer.cs
trunk/Drivers/AgateOTK/GL_Surface.cs
trunk/Drivers/AgateSDX/SDX_Display.cs
trunk/Drivers/AgateSDX/SDX_Surface.cs
Added Paths:
-----------
trunk/AgateLib/DisplayLib/Shaders/AgateShaderCompileException.cs
Removed Paths:
-------------
trunk/AgateLib/DisplayLib/Shaders/AgateShaderCompileError.cs
Modified: trunk/AgateLib/AgateGame.cs
===================================================================
--- trunk/AgateLib/AgateGame.cs 2011-10-06 03:08:42 UTC (rev 1288)
+++ trunk/AgateLib/AgateGame.cs 2011-10-11 17:45:40 UTC (rev 1289)
@@ -44,11 +44,11 @@
{
DisplayWindow mWindow;
AppInitParameters mInitParams;
- FontSurface font;
+ FontSurface mFont;
//Gui.GuiRoot mGui;
- double totalSplashTime = 0;
- bool splashFadeDone = false;
+ double mTotalSplashTime = 0;
+ bool mSplashFadeDone = false;
#region --- Run Method ---
@@ -83,7 +83,7 @@
CreateDisplayWindow();
- font = FontSurface.AgateSans14;
+ mFont = FontSurface.AgateSans14;
if (InitParams.ShowSplashScreen)
{
@@ -187,20 +187,20 @@
{
RenderSplashScreen();
- if (splashFadeDone)
+ if (mSplashFadeDone)
{
Surface powered = InternalResources.Data.PoweredBy;
Size size = powered.SurfaceSize;
int bottom = MainWindow.Height - size.Height;
- int h = font.FontHeight;
+ int h = mFont.FontHeight;
- font.DisplayAlignment = OriginAlignment.BottomLeft;
- font.Color = Color.Black;
+ mFont.DisplayAlignment = OriginAlignment.BottomLeft;
+ mFont.Color = Color.Black;
- font.DrawText(0, bottom - 2 * h, "Welcome to AgateLib.");
- font.DrawText(0, bottom - h, "Your application framework is ready.");
- font.DrawText(0, bottom, "Override the Render method in order to do your own drawing.");
+ mFont.DrawText(0, bottom - 2 * h, "Welcome to AgateLib.");
+ mFont.DrawText(0, bottom - h, "Your application framework is ready.");
+ mFont.DrawText(0, bottom, "Override the Render method in order to do your own drawing.");
}
}
@@ -233,9 +233,9 @@
/// <param name="time_ms"></param>
protected virtual bool UpdateSplashScreen(double time_ms)
{
- totalSplashTime += time_ms / 1000.0;
+ mTotalSplashTime += time_ms / 1000.0;
- if (totalSplashTime > 3.0)
+ if (mTotalSplashTime > 3.0)
return false;
else
return true;
@@ -251,14 +251,14 @@
Surface powered = InternalResources.Data.PoweredBy;
Size size = powered.SurfaceSize;
- int left = (int)(totalSplashTime * size.Width - size.Width) + 1;
+ int left = (int)(mTotalSplashTime * size.Width - size.Width) + 1;
Rectangle gradientRect = new Rectangle(left, MainWindow.Height - size.Height,
size.Width, size.Height);
if (left < 0)
Display.PushClipRect(gradientRect);
else if (left > size.Width)
- splashFadeDone = true;
+ mSplashFadeDone = true;
powered.DisplayAlignment = OriginAlignment.BottomLeft;
powered.Draw(0, MainWindow.Height);
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2011-10-06 03:08:42 UTC (rev 1288)
+++ trunk/AgateLib/AgateLib.csproj 2011-10-11 17:45:40 UTC (rev 1289)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
@@ -156,6 +156,7 @@
<Compile Include="Data\AgateTableDictionary.cs" />
<Compile Include="DisplayLib\FrameBuffer.cs" />
<Compile Include="DisplayLib\Shaders\AgateBuiltInShaders.cs" />
+ <Compile Include="DisplayLib\Shaders\AgateShaderCompileException.cs" />
<Compile Include="DisplayLib\Shaders\Basic2DShader.cs" />
<Compile Include="DisplayLib\Shaders\AgateShader.cs" />
<Compile Include="DisplayLib\Shaders\Implementation\AgateInternalShader.cs" />
@@ -269,9 +270,6 @@
<Compile Include="DisplayLib\Cache\SurfaceStateCache.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="DisplayLib\Shaders\Implementation\AgateShaderCompileError.cs">
- <SubType>Code</SubType>
- </Compile>
<Compile Include="DisplayLib\Shaders\Implementation\Effect.cs">
<SubType>Code</SubType>
</Compile>
Modified: trunk/AgateLib/AgateSetup.cs
===================================================================
--- trunk/AgateLib/AgateSetup.cs 2011-10-06 03:08:42 UTC (rev 1288)
+++ trunk/AgateLib/AgateSetup.cs 2011-10-11 17:45:40 UTC (rev 1289)
@@ -124,7 +124,7 @@
/// Constructs a Setup object.
/// </summary>
/// <param name="args">Command line arguments to the program.</param>
- public AgateSetup(string[] args)
+ public AgateSetup(IEnumerable<string> args)
: this("AgateLib", args)
{
}
@@ -133,7 +133,7 @@
/// </summary>
/// <param name="title"></param>
/// <param name="args">Command line arguments to the program.</param>
- public AgateSetup(string title, string[] args)
+ public AgateSetup(string title, IEnumerable<string> args)
{
if (sCreatedSetup != null)
{
Modified: trunk/AgateLib/AudioLib/Audio.cs
===================================================================
--- trunk/AgateLib/AudioLib/Audio.cs 2011-10-06 03:08:42 UTC (rev 1288)
+++ trunk/AgateLib/AudioLib/Audio.cs 2011-10-11 17:45:40 UTC (rev 1289)
@@ -32,8 +32,8 @@
/// </summary>
public static class Audio
{
- private static AudioImpl impl;
- private static AudioCapsInfo caps = new AudioCapsInfo();
+ private static AudioImpl sImpl;
+ private static readonly AudioCapsInfo caps = new AudioCapsInfo();
/// <summary>
/// Gets the capabilities querying object for the audio subsystem.
@@ -47,7 +47,7 @@
/// </summary>
public static AudioImpl Impl
{
- get { return impl; }
+ get { return sImpl; }
}
/// <summary>
/// Initializes the audio system by instantiating the driver with the given
@@ -59,8 +59,8 @@
{
Core.Initialize();
- impl = Registrar.CreateAudioDriver(audioType);
- impl.Initialize();
+ sImpl = Registrar.CreateAudioDriver(audioType);
+ sImpl.Initialize();
}
/// <summary>
@@ -70,10 +70,10 @@
{
OnDispose();
- if (impl != null)
+ if (sImpl != null)
{
- impl.Dispose();
- impl = null;
+ sImpl.Dispose();
+ sImpl = null;
}
}
private static void OnDispose()
@@ -156,9 +156,9 @@
/// </summary>
public static void Update()
{
- if (impl == null) return;
+ if (sImpl == null) return;
- impl.Update();
+ sImpl.Update();
}
}
Modified: trunk/AgateLib/AudioLib/SoundBuffer.cs
===================================================================
--- trunk/AgateLib/AudioLib/SoundBuffer.cs 2011-10-06 03:08:42 UTC (rev 1288)
+++ trunk/AgateLib/AudioLib/SoundBuffer.cs 2011-10-11 17:45:40 UTC (rev 1289)
@@ -44,7 +44,7 @@
public sealed class SoundBuffer
{
private string mFilename;
- private SoundBufferImpl impl;
+ private SoundBufferImpl mImpl;
private double mVolume = 1.0;
private double mPan = 0;
private bool mIsDisposed = false;
@@ -76,7 +76,7 @@
{
using (System.IO.Stream s = fileProvider.OpenRead(filename))
{
- impl = Audio.Impl.CreateSoundBuffer(s);
+ mImpl = Audio.Impl.CreateSoundBuffer(s);
}
mFilename = filename;
@@ -88,7 +88,7 @@
/// <param name="source"></param>
public SoundBuffer(Stream source)
{
- impl = Audio.Impl.CreateSoundBuffer(source);
+ mImpl = Audio.Impl.CreateSoundBuffer(source);
}
/// <summary>
@@ -104,10 +104,10 @@
foreach (SoundBufferSession s in sessions)
s.Dispose();
- if (impl != null)
+ if (mImpl != null)
{
- impl.Dispose();
- impl = null;
+ mImpl.Dispose();
+ mImpl = null;
}
mIsDisposed = true;
@@ -118,7 +118,7 @@
/// </summary>
public SoundBufferImpl Impl
{
- get { return impl; }
+ get { return mImpl; }
}
/// <summary>
/// Creates a SoundBufferSession object, for playing of this
@@ -149,8 +149,8 @@
/// </summary>
public bool Loop
{
- get { return impl.Loop; }
- set { impl.Loop = value; }
+ get { return mImpl.Loop; }
+ set { mImpl.Loop = value; }
}
/// <summary>
Modified: trunk/AgateLib/BitmapFont/BitmapFontImpl.cs
===================================================================
--- trunk/AgateLib/BitmapFont/BitmapFontImpl.cs 2011-10-06 03:08:42 UTC (rev 1288)
+++ trunk/AgateLib/BitmapFont/BitmapFontImpl.cs 2011-10-11 17:45:40 UTC (rev 1289)
@@ -194,7 +194,7 @@
if (string.IsNullOrEmpty(text))
return Size.Empty;
- int CRcount = 0;
+ int carriageReturnCount = 0;
int i = 0;
double highestLineWidth = 0;
@@ -226,15 +226,15 @@
if (i == -1)
break;
- CRcount++;
+ carriageReturnCount++;
} while (i != -1);
if (text[text.Length - 1] == '\n')
- CRcount--;
+ carriageReturnCount--;
return new Size((int)Math.Ceiling(highestLineWidth * state.ScaleWidth),
- (int)(mCharHeight * (CRcount + 1) * state.ScaleHeight));
+ (int)(mCharHeight * (carriageReturnCount + 1) * state.ScaleHeight));
}
/// <summary>
Modified: trunk/AgateLib/Core.cs
===================================================================
--- trunk/AgateLib/Core.cs 2011-10-06 03:08:42 UTC (rev 1288)
+++ trunk/AgateLib/Core.cs 2011-10-11 17:45:40 UTC (rev 1289)
@@ -87,11 +87,11 @@
/// </summary>
public static class Core
{
- private static bool mAutoPause = false;
- private static bool mIsActive = true;
- private static bool mInititalized = false;
- private static Platform mPlatform;
- private static PersistantSettings mSettings;
+ private static bool sAutoPause = false;
+ private static bool sIsActive = true;
+ private static bool sInititalized = false;
+ private static readonly Platform mPlatform = new Platform();
+ private static PersistantSettings sSettings;
#region --- Error Reporting ---
@@ -104,9 +104,9 @@
/// </summary>
public static class ErrorReporting
{
- private static string mErrorFile = "errorlog.txt";
- private static bool mAutoStackTrace = false;
- private static bool mWroteHeader = false;
+ private static string sErrorFile = "errorlog.txt";
+ private static bool sAutoStackTrace = false;
+ private static bool sWroteHeader = false;
/// <summary>
/// Gets or sets the file name to which errors are recorded. Defaults
@@ -114,8 +114,8 @@
/// </summary>
public static string ErrorFile
{
- get { return mErrorFile; }
- set { mErrorFile = value; }
+ get { return sErrorFile; }
+ set { sErrorFile = value; }
}
/// <summary>
@@ -133,8 +133,8 @@
/// </example>
public static bool AutoStackTrace
{
- get { return mAutoStackTrace; }
- set { mAutoStackTrace = value; }
+ get { return sAutoStackTrace; }
+ set { sAutoStackTrace = value; }
}
/// <summary>
@@ -244,7 +244,7 @@
{
try
{
- if (mWroteHeader == true)
+ if (sWroteHeader == true)
{
FileStream stream = File.Open(ErrorFile, FileMode.Append, FileAccess.Write);
@@ -257,7 +257,7 @@
WriteHeader(writer);
- mWroteHeader = true;
+ sWroteHeader = true;
return writer;
}
@@ -300,7 +300,6 @@
static Core()
{
- mPlatform = new Platform();
}
/// <summary>
/// Initializes Core class.
@@ -308,13 +307,13 @@
/// </summary>
public static void Initialize()
{
- if (mInititalized)
+ if (sInititalized)
return;
Drivers.Registrar.Initialize();
- mInititalized = true;
+ sInititalized = true;
}
/// <summary>
@@ -332,12 +331,12 @@
{
get
{
- if (mSettings == null)
+ if (sSettings == null)
{
- mSettings = new PersistantSettings();
+ sSettings = new PersistantSettings();
}
- return mSettings;
+ return sSettings;
}
}
/// <summary>
@@ -348,8 +347,8 @@
/// </summary>
public static bool IsActive
{
- get { return mIsActive; }
- set { mIsActive = value; }
+ get { return sIsActive; }
+ set { sIsActive = value; }
}
/// <summary>
/// Gets or sets a bool value indicating whether or not Agate
@@ -364,8 +363,8 @@
/// </summary>
public static bool AutoPause
{
- get { return mAutoPause; }
- set { mAutoPause = value; }
+ get { return sAutoPause; }
+ set { sAutoPause = value; }
}
/// <summary>
/// Delegate for types which attach to the KeepAliveEvent.
Modified: trunk/AgateLib/Data/AgateTable.cs
===================================================================
--- trunk/AgateLib/Data/AgateTable.cs 2011-10-06 03:08:42 UTC (rev 1288)
+++ trunk/AgateLib/Data/AgateTable.cs 2011-10-11 17:45:40 UTC (rev 1289)
@@ -87,13 +87,13 @@
return b.ToString();
}
- static readonly char[] lineSplitChars = new char[] { '\n', '\r' };
+ static readonly char[] LineSplitChars = new char[] { '\n', '\r' };
private List<AgateRow> ReadRows(string rows)
{
List<AgateRow> retval = new List<AgateRow>();
- string[] lines = rows.Split(lineSplitChars, StringSplitOptions.RemoveEmptyEntries);
+ string[] lines = rows.Split(LineSplitChars, StringSplitOptions.RemoveEmptyEntries);
foreach (string line in lines)
{
Modified: trunk/AgateLib/Data/FieldType.cs
===================================================================
--- trunk/AgateLib/Data/FieldType.cs 2011-10-06 03:08:42 UTC (rev 1288)
+++ trunk/AgateLib/Data/FieldType.cs 2011-10-11 17:45:40 UTC (rev 1289)
@@ -98,13 +98,13 @@
[global::System.AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = true)]
sealed class DataTypeAttribute : Attribute
{
- readonly Type dataType;
+ readonly Type mDataType;
public DataTypeAttribute(Type dataType)
{
- this.dataType = dataType;
+ this.mDataType = dataType;
}
- public Type DataType { get { return dataType; } }
+ public Type DataType { get { return mDataType; } }
}
}
Modified: trunk/AgateLib/DisplayLib/CreateWindowParams.cs
===================================================================
--- trunk/AgateLib/DisplayLib/CreateWindowParams.cs 2011-10-06 03:08:42 UTC (rev 1288)
+++ trunk/AgateLib/DisplayLib/CreateWindowParams.cs 2011-10-11 17:45:40 UTC (rev 1289)
@@ -63,22 +63,22 @@
{
#region --- Private Fields ---
- private bool isFullScreen = false;
- private Size size = new Size(1024, 768);
- private WindowPosition position;
- private int bpp = 32;
- private bool isResizable = false;
+ private bool mIsFullScreen = false;
+ private Size mSize = new Size(1024, 768);
+ private WindowPosition mPosition;
+ private int mBpp = 32;
+ private bool mIsResizable = false;
- private bool hasFrame = true;
- private bool hasMaximize = false;
- private bool hasMinimize = true;
+ private bool mHasFrame = true;
+ private bool mHasMaximize = false;
+ private bool mHasMinimize = true;
- private string iconFile = "";
+ private string mIconFile = "";
- private bool renderToControl = false;
- private object renderTarget = null;
+ private bool mRenderToControl = false;
+ private object mRenderTarget = null;
- private string title = "AgateLib Application";
+ private string mTitle = "AgateLib Application";
#endregion
#region --- Properties ---
@@ -88,48 +88,48 @@
/// </summary>
public string Title
{
- get { return title; }
- set { title = value; }
+ get { return mTitle; }
+ set { mTitle = value; }
}
/// <summary>
/// Whether or not the window should be created as a full screen window. Defaults to false.
/// </summary>
public bool IsFullScreen
{
- get { return isFullScreen; }
- set { isFullScreen = value; }
+ get { return mIsFullScreen; }
+ set { mIsFullScreen = value; }
}
/// <summary>
/// Size of the window. Defaults to 1024x768.
/// </summary>
public Size Size
{
- get { return size; }
- set { size = value; }
+ get { return mSize; }
+ set { mSize = value; }
}
/// <summary>
/// Width of the window
/// </summary>
public int Width
{
- get { return size.Width; }
- set { size.Width = value; }
+ get { return mSize.Width; }
+ set { mSize.Width = value; }
}
/// <summary>
/// Height of the window
/// </summary>
public int Height
{
- get { return size.Height; }
- set { size.Height = value; }
+ get { return mSize.Height; }
+ set { mSize.Height = value; }
}
/// <summary>
/// Sets the initial position of the window.
/// </summary>
public WindowPosition WindowPosition
{
- get { return position; }
- set { position = value; }
+ get { return mPosition; }
+ set { mPosition = value; }
}
@@ -139,8 +139,8 @@
/// </summary>
public int Bpp
{
- get { return bpp; }
- set { bpp = value; }
+ get { return mBpp; }
+ set { mBpp = value; }
}
/// <summary>
@@ -149,8 +149,8 @@
/// </summary>
public bool IsResizable
{
- get { return isResizable; }
- set { isResizable = value; }
+ get { return mIsResizable; }
+ set { mIsResizable = value; }
}
/// <summary>
@@ -159,8 +159,8 @@
/// </summary>
public bool HasFrame
{
- get { return hasFrame; }
- set { hasFrame = value; }
+ get { return mHasFrame; }
+ set { mHasFrame = value; }
}
/// <summary>
@@ -169,8 +169,8 @@
/// </summary>
public bool HasMaximize
{
- get { return hasMaximize; }
- set { hasMaximize = value; }
+ get { return mHasMaximize; }
+ set { mHasMaximize = value; }
}
/// <summary>
@@ -178,8 +178,8 @@
/// </summary>
public bool HasMinimize
{
- get { return hasMinimize; }
- set { hasMinimize = value; }
+ get { return mHasMinimize; }
+ set { mHasMinimize = value; }
}
/// <summary>
@@ -187,10 +187,10 @@
/// </summary>
public string IconFile
{
- get { return iconFile; }
+ get { return mIconFile; }
set
{
- iconFile = value;
+ mIconFile = value;
}
}
@@ -200,8 +200,8 @@
/// </summary>
public bool RenderToControl
{
- get { return renderToControl; }
- set { renderToControl = value; }
+ get { return mRenderToControl; }
+ set { mRenderToControl = value; }
}
/// <summary>
@@ -209,8 +209,8 @@
/// </summary>
public object RenderTarget
{
- get { return renderTarget; }
- set { renderTarget = value; }
+ get { return mRenderTarget; }
+ set { mRenderTarget = value; }
}
#endregion
@@ -248,7 +248,7 @@
retval.Title = title;
retval.Width = width;
retval.Height = height;
- retval.bpp = bpp;
+ retval.mBpp = bpp;
return retval;
}
Modified: trunk/AgateLib/DisplayLib/Display.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Display.cs 2011-10-06 03:08:42 UTC (rev 1288)
+++ trunk/AgateLib/DisplayLib/Display.cs 2011-10-11 17:45:40 UTC (rev 1289)
@@ -58,13 +58,13 @@
/// </example>
public static class Display
{
- private static DisplayImpl impl;
- private static DisplayWindow mCurrentWindow;
- private static SurfacePacker mSurfacePacker;
- private static Rectangle mCurrentClipRect;
- private static Stack<Rectangle> mClipRects = new Stack<Rectangle>();
- private static RenderStateAdapter mRenderState = new RenderStateAdapter();
- private static DisplayCapsInfo mCapsInfo = new DisplayCapsInfo();
+ private static DisplayImpl sImpl;
+ private static DisplayWindow sCurrentWindow;
+ private static SurfacePacker sSurfacePacker;
+ private static Rectangle sCurrentClipRect;
+ private static Stack<Rectangle> sClipRects = new Stack<Rectangle>();
+ private static RenderStateAdapter sRenderState = new RenderStateAdapter();
+ private static DisplayCapsInfo sCapsInfo = new DisplayCapsInfo();
/// <summary>
/// Gets the object which handles all of the actual calls to Display functions.
@@ -76,7 +76,7 @@
/// </summary>
public static DisplayImpl Impl
{
- get { return impl; }
+ get { return sImpl; }
}
/// <summary>
/// Initializes the display by instantiating the driver with the given
@@ -91,10 +91,10 @@
{
Core.Initialize();
- impl = Registrar.CreateDisplayDriver(displayType);
- impl.Initialize();
+ sImpl = Registrar.CreateDisplayDriver(displayType);
+ sImpl.Initialize();
- mSurfacePacker = new SurfacePacker();
+ sSurfacePacker = new SurfacePacker();
Shaders.AgateBuiltInShaders.InitializeShaders();
}
@@ -105,7 +105,7 @@
/// </summary>
public static RenderStateAdapter RenderState
{
- get { return mRenderState; }
+ get { return sRenderState; }
}
/// <summary>
@@ -115,10 +115,10 @@
{
OnDispose();
- if (impl != null)
+ if (sImpl != null)
{
- impl.Dispose();
- impl = null;
+ sImpl.Dispose();
+ sImpl = null;
}
Shaders.AgateBuiltInShaders.DisposeShaders();
@@ -126,19 +126,19 @@
internal static void ProcessEvents()
{
- if (impl == null)
+ if (sImpl == null)
return;
- impl.ProcessEvents();
+ sImpl.ProcessEvents();
}
internal static bool IsAppIdle
{
get
{
- if (impl == null)
+ if (sImpl == null)
return false;
- return impl.IsAppIdle;
+ return sImpl.IsAppIdle;
}
}
@@ -147,8 +147,8 @@
/// </summary>
public static Shaders.AgateShader Shader
{
- get { return impl.Shader; }
- internal set { impl.Shader = value; }
+ get { return sImpl.Shader; }
+ internal set { sImpl.Shader = value; }
}
/// <summary>
@@ -175,7 +175,7 @@
/// </summary>
public static PixelFormat DefaultSurfaceFormat
{
- get { return impl.DefaultSurfaceFormat; }
+ get { return sImpl.DefaultSurfaceFormat; }
}
/// <summary>
@@ -187,14 +187,14 @@
{
get
{
- return impl.RenderTarget;
+ return sImpl.RenderTarget;
}
set
{
if (value == null)
throw new ArgumentNullException("RenderTarget cannot be null.");
- impl.RenderTarget = value;
+ sImpl.RenderTarget = value;
// TODO: replace this with an ActiveWindow property.
//if (value is DisplayWindow)
@@ -207,8 +207,8 @@
/// </summary>
public static DisplayWindow CurrentWindow
{
- get { return mCurrentWindow; }
- internal set { mCurrentWindow = value; }
+ get { return sCurrentWindow; }
+ internal set { sCurrentWindow = value; }
}
/// <summary>
@@ -218,8 +218,8 @@
/// </summary>
public static double AlphaThreshold
{
- get { return impl.AlphaThreshold; }
- set { impl.AlphaThreshold = value; }
+ get { return sImpl.AlphaThreshold; }
+ set { sImpl.AlphaThreshold = value; }
}
/// <summary>
@@ -246,7 +246,7 @@
/// <param name="color"></param>
public static void Clear(Color color)
{
- impl.Clear(color);
+ sImpl.Clear(color);
}
/// <summary>
/// Clears the buffer to the specified color.
@@ -254,7 +254,7 @@
/// <param name="color">32-bit integer indicating the color. The color will be constructed from Color.FromArgb.</param>
public static void Clear(int color)
{
- impl.Clear(Color.FromArgb(color));
+ sImpl.Clear(Color.FromArgb(color));
}
/// <summary>
/// Clears a region of the buffer to the specified color.
@@ -265,7 +265,7 @@
/// <param name="dest">Destination rectangle to clear.</param>
public static void Clear(Color color, Rectangle dest)
{
- impl.Clear(color, dest);
+ sImpl.Clear(color, dest);
}
/// <summary>
/// Clears a region of the buffer to the specified color.
@@ -276,7 +276,7 @@
/// <param name="dest"></param>
public static void Clear(int color, Rectangle dest)
{
- impl.Clear(Color.FromArgb(color), dest);
+ sImpl.Clear(Color.FromArgb(color), dest);
}
// BeginFrame and EndFrame must be called at the start and end of each frame.
/// <summary>
@@ -291,12 +291,12 @@
if (CurrentWindow.IsClosed)
throw new AgateException("The current window has been closed, and a new render target has not been set. A render target must be set to continue rendering.");
- impl.BeginFrame();
+ sImpl.BeginFrame();
AgateBuiltInShaders.Basic2DShader.CoordinateSystem = new Rectangle(Point.Empty, RenderTarget.Size);
AgateBuiltInShaders.Basic2DShader.Activate();
- mCurrentClipRect = new Rectangle(Point.Empty, RenderTarget.Size);
+ sCurrentClipRect = new Rectangle(Point.Empty, RenderTarget.Size);
RenderState.AlphaBlend = true;
}
@@ -307,27 +307,27 @@
/// </summary>
public static void EndFrame()
{
- impl.EndFrame();
+ sImpl.EndFrame();
}
/// <summary>
/// Gets the amount of time in milliseconds that has passed between this frame
/// and the last one.
/// </summary>
- public static double DeltaTime { get { return impl.DeltaTime; } }
+ public static double DeltaTime { get { return sImpl.DeltaTime; } }
/// <summary>
/// Provides a means to set the value returned by DeltaTime.
/// </summary>
/// <param name="deltaTime"></param>
public static void SetDeltaTime(double deltaTime)
{
- impl.SetDeltaTime(deltaTime);
+ sImpl.SetDeltaTime(deltaTime);
}
/// <summary>
/// Gets the framerate
/// </summary>
- public static double FramesPerSecond { get { return impl.FramesPerSecond; } }
+ public static double FramesPerSecond { get { return sImpl.FramesPerSecond; } }
/// <summary>
/// Set the current clipping rect.
@@ -336,7 +336,7 @@
public static void SetClipRect(Rectangle newClipRect)
{
FlushDrawBuffer();
- impl.SetClipRect(newClipRect);
+ sImpl.SetClipRect(newClipRect);
}
/// <summary>
/// Pushes a clip rect onto the clip rect stack.
@@ -344,7 +344,7 @@
/// <param name="newClipRect"></param>
public static void PushClipRect(Rectangle newClipRect)
{
- mClipRects.Push(mCurrentClipRect);
+ sClipRects.Push(sCurrentClipRect);
SetClipRect(newClipRect);
}
/// <summary>
@@ -352,13 +352,13 @@
/// </summary>
public static void PopClipRect()
{
- if (mClipRects.Count == 0)
+ if (sClipRects.Count == 0)
{
throw new AgateException("You have popped the cliprect too many times.");
}
else
{
- SetClipRect(mClipRects.Pop());
+ SetClipRect(sClipRects.Pop());
}
}
@@ -374,7 +374,7 @@
/// </summary>
public static SurfacePacker SurfacePacker
{
- get { return mSurfacePacker; }
+ get { return sSurfacePacker; }
}
/// <summary>
@@ -388,12 +388,12 @@
/// </summary>
public static void PackAllSurfaces()
{
- mSurfacePacker.ClearQueue();
+ sSurfacePacker.ClearQueue();
if (PackAllSurfacesEvent != null)
PackAllSurfacesEvent(null, EventArgs.Empty);
- mSurfacePacker.PackQueue();
+ sSurfacePacker.PackQueue();
GC.Collect();
}
@@ -406,7 +406,7 @@
/// <returns>An array of available full-screen modes.</returns>
public static ScreenMode[] EnumScreenModes()
{
- return impl.EnumScreenModes();
+ return sImpl.EnumScreenModes();
}
/// <summary>
@@ -416,7 +416,7 @@
internal static Surface BuildPackedSurface(Size size, SurfacePacker.RectPacker<Surface> packedRects)
{
- Surface retval = impl.BuildPackedSurface(size, packedRects);
+ Surface retval = sImpl.BuildPackedSurface(size, packedRects);
retval.ShouldBePacked = false;
return retval;
@@ -445,7 +445,7 @@
/// </summary>
public static void FlushDrawBuffer()
{
- impl.FlushDrawBuffer();
+ sImpl.FlushDrawBuffer();
}
/// <summary>
@@ -502,7 +502,7 @@
/// <param name="color"></param>
public static void DrawEllipse(Rectangle rect, Color color)
{
- impl.DrawEllipse(rect, color);
+ sImpl.DrawEllipse(rect, color);
}
/// <summary>
/// Draws a line between the two points specified.
@@ -514,7 +514,7 @@
/// <param name="color"></param>
public static void DrawLine(int x1, int y1, int x2, int y2, Color color)
{
- impl.DrawLine(new Point(x1, y1), new Point(x2, y2), color);
+ sImpl.DrawLine(new Point(x1, y1), new Point(x2, y2), color);
}
/// <summary>
/// Draws a line between the two points specified.
@@ -524,7 +524,7 @@
/// <param name="color"></param>
public static void DrawLin...
[truncated message content] |
|
From: <ka...@us...> - 2011-10-26 04:03:18
|
Revision: 1295
http://agate.svn.sourceforge.net/agate/?rev=1295&view=rev
Author: kanato
Date: 2011-10-26 04:03:11 +0000 (Wed, 26 Oct 2011)
Log Message:
-----------
Implement POV hats for joysticks with support from AgateSDL.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/AgateSetup.cs
trunk/AgateLib/InputLib/ImplementationBase/JoystickImpl.cs
trunk/AgateLib/InputLib/Joystick.cs
trunk/ChangeLog.txt
trunk/Drivers/AgateSDL/Input/SDL_Input.cs
trunk/Drivers/AgateSDL/SDL.dll
trunk/Drivers/AgateSDL/Tao.Sdl/Sdl.cs
trunk/Drivers/AgateSDX/SDX_Input.cs
trunk/TODO.txt
trunk/Tests/InputTests/Input/InputTester.cs
trunk/Tests/InputTests/Input/frmInputTester.Designer.cs
trunk/Tests/InputTests/Input/frmInputTester.cs
trunk/Tests/InputTests/Input/frmInputTester.resx
Added Paths:
-----------
trunk/AgateLib/InputLib/HatState.cs
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2011-10-26 02:52:06 UTC (rev 1294)
+++ trunk/AgateLib/AgateLib.csproj 2011-10-26 04:03:11 UTC (rev 1295)
@@ -172,6 +172,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="DisplayLib\ImplementationBase\FrameBufferImpl.cs" />
+ <Compile Include="InputLib\HatState.cs" />
<Compile Include="Platform.cs" />
<Compile Include="PlatformType.cs" />
<Compile Include="Resources\ImageResource.cs" />
Modified: trunk/AgateLib/AgateSetup.cs
===================================================================
--- trunk/AgateLib/AgateSetup.cs 2011-10-26 02:52:06 UTC (rev 1294)
+++ trunk/AgateLib/AgateSetup.cs 2011-10-26 04:03:11 UTC (rev 1295)
@@ -330,6 +330,8 @@
/// </summary>
private void DoAskUser()
{
+ Core.Initialize();
+
if (mAlreadyAsked)
return;
if (mAskUser == false)
Added: trunk/AgateLib/InputLib/HatState.cs
===================================================================
--- trunk/AgateLib/InputLib/HatState.cs (rev 0)
+++ trunk/AgateLib/InputLib/HatState.cs 2011-10-26 04:03:11 UTC (rev 1295)
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.InputLib
+{
+ /// <summary>
+ /// An enum containing the possible states of a POV hat on a joystick.
+ /// </summary>
+ public enum HatState
+ {
+ /// <summary>
+ /// A value indicating the POV hat is not depressed.
+ /// </summary>
+ None,
+ /// <summary>
+ /// A value indicating the POV hat is pressed to the right.
+ /// </summary>
+ Right,
+ /// <summary>
+ /// A value indicating the POV hat is pressed to the upper right.
+ /// </summary>
+ UpRight,
+ /// <summary>
+ /// A value indicating the POV hat is pressed upwards.
+ /// </summary>
+ Up,
+ /// <summary>
+ /// A value indicating the POV hat is pressed up left.
+ /// </summary>
+ UpLeft,
+ /// <summary>
+ /// A value indicating the POV hat is pressed to the left.
+ /// </summary>
+ Left,
+ /// <summary>
+ /// A value indicating the POV hat is pressed down left.
+ /// </summary>
+ DownLeft,
+ /// <summary>
+ /// A value indicating the POV hat is pressed downwards.
+ /// </summary>
+ Down,
+ /// <summary>
+ /// A value indicating the POV hat is pressed down-right.
+ /// </summary>
+ DownRight,
+ }
+}
Modified: trunk/AgateLib/InputLib/ImplementationBase/JoystickImpl.cs
===================================================================
--- trunk/AgateLib/InputLib/ImplementationBase/JoystickImpl.cs 2011-10-26 02:52:06 UTC (rev 1294)
+++ trunk/AgateLib/InputLib/ImplementationBase/JoystickImpl.cs 2011-10-26 04:03:11 UTC (rev 1295)
@@ -35,6 +35,10 @@
/// Gets how many buttons are on this joystick.
/// </summary>
public abstract int ButtonCount { get; }
+ /// <summary>
+ /// Gets how many POV hats are on this joystick.
+ /// </summary>
+ public abstract int HatCount { get; }
/// <summary>
/// Gets the reported name of the joystick.
@@ -57,6 +61,13 @@
/// <param name="axisIndex"></param>
/// <returns></returns>
public abstract double GetAxisValue(int axisIndex);
+
+ /// <summary>
+ /// Gets the state of the specified POV hat.
+ /// </summary>
+ /// <param name="hatIndex"></param>
+ /// <returns></returns>
+ public abstract HatState GetHatState(int hatIndex);
/// <summary>
/// Recalibrates the joystick.
@@ -73,9 +84,11 @@
/// </summary>
public abstract bool PluggedIn { get; }
+
/// <summary>
/// Polls the joystick for input.
/// </summary>
public abstract void Poll();
+
}
}
\ No newline at end of file
Modified: trunk/AgateLib/InputLib/Joystick.cs
===================================================================
--- trunk/AgateLib/InputLib/Joystick.cs 2011-10-26 02:52:06 UTC (rev 1294)
+++ trunk/AgateLib/InputLib/Joystick.cs 2011-10-26 04:03:11 UTC (rev 1295)
@@ -19,6 +19,7 @@
using System;
using System.Collections.Generic;
using System.Text;
+using AgateLib.Geometry;
using AgateLib.InputLib.ImplementationBase;
namespace AgateLib.InputLib
@@ -50,8 +51,21 @@
/// Returns the number of buttons this joystick has.
/// </summary>
public int ButtonCount { get { return impl.ButtonCount; } }
+ /// <summary>
+ /// Returns the number of POV hats this joystick has.
+ /// </summary>
+ public int HatCount { get { return impl.HatCount; } }
/// <summary>
+ /// Gets the state of the specified POV hat.
+ /// </summary>
+ /// <param name="hatIndex"></param>
+ /// <returns></returns>
+ public HatState GetHatState(int hatIndex)
+ {
+ return impl.GetHatState(hatIndex);
+ }
+ /// <summary>
/// Gets the current value for the given axis.
/// Axis 0 is always the x-axis, axis 1 is always the y-axis on
/// controlers which have this capability.
Modified: trunk/ChangeLog.txt
===================================================================
--- trunk/ChangeLog.txt 2011-10-26 02:52:06 UTC (rev 1294)
+++ trunk/ChangeLog.txt 2011-10-26 04:03:11 UTC (rev 1295)
@@ -1,4 +1,9 @@
+Current
+===================
+
+POV hat support for joysticks has been added.
+
Version 0.3.2
===================
Even though the version number has only been incremented slightly, there are a lot of changes in
Modified: trunk/Drivers/AgateSDL/Input/SDL_Input.cs
===================================================================
--- trunk/Drivers/AgateSDL/Input/SDL_Input.cs 2011-10-26 02:52:06 UTC (rev 1294)
+++ trunk/Drivers/AgateSDL/Input/SDL_Input.cs 2011-10-26 04:03:11 UTC (rev 1295)
@@ -49,16 +49,16 @@
public override void Initialize()
{
- if (Tao.Sdl.Sdl.SDL_InitSubSystem(Tao.Sdl.Sdl.SDL_INIT_JOYSTICK) != 0)
+ // apparently initializing the video has some side-effect
+ // that is required for joysticks to work on windows (at least).
+ if (Tao.Sdl.Sdl.SDL_InitSubSystem(Tao.Sdl.Sdl.SDL_INIT_JOYSTICK | Tao.Sdl.Sdl.SDL_INIT_VIDEO) != 0)
{
throw new AgateLib.AgateException("Failed to initialize SDL joysticks.");
}
- // apparently initializing the video has some side-effect
- // that is required for joysticks to work on windows (at least).
- Tao.Sdl.Sdl.SDL_InitSubSystem(Tao.Sdl.Sdl.SDL_INIT_VIDEO);
+ Tao.Sdl.Sdl.SDL_version version = Tao.Sdl.Sdl.SDL_VERSION();
- Report("SDL driver instantiated for joystick input.");
+ Report("SDL driver version " + version.ToString() + " instantiated for joystick input.");
}
}
@@ -79,13 +79,22 @@
public override string Name
{
- get { return Tao.Sdl.Sdl.SDL_JoystickName(joystickIndex); }
+ get
+ {
+ string retval = Tao.Sdl.Sdl.SDL_JoystickName(joystickIndex);
+
+ return retval;
+ }
}
public override int AxisCount
{
get { return Tao.Sdl.Sdl.SDL_JoystickNumAxes(joystick); }
}
+ public override int HatCount
+ {
+ get { return Tao.Sdl.Sdl.SDL_JoystickNumHats(joystick); }
+ }
public override double AxisThreshold
{
@@ -108,7 +117,24 @@
{
return buttons[buttonIndex];
}
+ public override AgateLib.InputLib.HatState GetHatState(int hatIndex)
+ {
+ switch(Tao.Sdl.Sdl.SDL_JoystickGetHat(joystick, hatIndex))
+ {
+ case Tao.Sdl.Sdl.SDL_HAT_RIGHTUP: return AgateLib.InputLib.HatState.UpRight;
+ case Tao.Sdl.Sdl.SDL_HAT_RIGHT: return AgateLib.InputLib.HatState.Right;
+ case Tao.Sdl.Sdl.SDL_HAT_RIGHTDOWN: return AgateLib.InputLib.HatState.DownRight;
+ case Tao.Sdl.Sdl.SDL_HAT_LEFTUP: return AgateLib.InputLib.HatState.UpLeft;
+ case Tao.Sdl.Sdl.SDL_HAT_LEFT: return AgateLib.InputLib.HatState.Left;
+ case Tao.Sdl.Sdl.SDL_HAT_LEFTDOWN: return AgateLib.InputLib.HatState.DownLeft;
+ case Tao.Sdl.Sdl.SDL_HAT_DOWN: return AgateLib.InputLib.HatState.Down;
+ case Tao.Sdl.Sdl.SDL_HAT_UP: return AgateLib.InputLib.HatState.Up;
+ case Tao.Sdl.Sdl.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.
Modified: trunk/Drivers/AgateSDL/SDL.dll
===================================================================
(Binary files differ)
Modified: trunk/Drivers/AgateSDL/Tao.Sdl/Sdl.cs
===================================================================
--- trunk/Drivers/AgateSDL/Tao.Sdl/Sdl.cs 2011-10-26 02:52:06 UTC (rev 1294)
+++ trunk/Drivers/AgateSDL/Tao.Sdl/Sdl.cs 2011-10-26 04:03:11 UTC (rev 1295)
@@ -7893,7 +7893,7 @@
/// <seealso cref="SDL_JoystickOpen"/>
public static string SDL_JoystickName(int device_index)
{
- return Marshal.PtrToStringAuto(__SDL_JoystickName(device_index));
+ return Marshal.PtrToStringAnsi(__SDL_JoystickName(device_index));
}
[DllImport(SDL_NATIVE_LIBRARY, CallingConvention = CALLING_CONVENTION, EntryPoint = "SDL_JoystickName"),
Modified: trunk/Drivers/AgateSDX/SDX_Input.cs
===================================================================
--- trunk/Drivers/AgateSDX/SDX_Input.cs 2011-10-26 02:52:06 UTC (rev 1294)
+++ trunk/Drivers/AgateSDX/SDX_Input.cs 2011-10-26 04:03:11 UTC (rev 1295)
@@ -126,6 +126,10 @@
{
get { return mDevice.Capabilities.ButtonCount; }
}
+ public override int HatCount
+ {
+ get { return mDevice.Capabilities.PovCount; }
+ }
public override bool GetButtonState(int buttonIndex)
{
@@ -160,6 +164,12 @@
// return mDevice.GetCurrentState().GetSliders()[axisIndex - 4] / maxX;
}
+ public override AgateLib.InputLib.HatState GetHatState(int hatIndex)
+ {
+ int value = mDevice.GetCurrentState().GetPointOfViewControllers()[hatIndex];
+
+ return (AgateLib.InputLib.HatState)value;
+ }
private double CorrectAxisValue(int axisValue, int shiftValue, double maxX)
{
double retval = (axisValue - shiftValue) / (double)maxX;
Modified: trunk/TODO.txt
===================================================================
--- trunk/TODO.txt 2011-10-26 02:52:06 UTC (rev 1294)
+++ trunk/TODO.txt 2011-10-26 04:03:11 UTC (rev 1295)
@@ -28,7 +28,7 @@
* Test ClipRects with AgateOTK
* Test / Debug writing pixel buffer to SDX surface.
Input
- * Add support for POV hats on joysticks.
+ D Add support for POV hats on joysticks.
Goals for 0.3.5
---------------------------------------------------
Modified: trunk/Tests/InputTests/Input/InputTester.cs
===================================================================
--- trunk/Tests/InputTests/Input/InputTester.cs 2011-10-26 02:52:06 UTC (rev 1294)
+++ trunk/Tests/InputTests/Input/InputTester.cs 2011-10-26 04:03:11 UTC (rev 1295)
@@ -26,7 +26,7 @@
if (setup.WasCanceled)
return;
- new Form1().ShowDialog();
+ new frmInputTester().ShowDialog();
}
}
}
Modified: trunk/Tests/InputTests/Input/frmInputTester.Designer.cs
===================================================================
--- trunk/Tests/InputTests/Input/frmInputTester.Designer.cs 2011-10-26 02:52:06 UTC (rev 1294)
+++ trunk/Tests/InputTests/Input/frmInputTester.Designer.cs 2011-10-26 04:03:11 UTC (rev 1295)
@@ -3,7 +3,7 @@
//
namespace Tests.InputTester
{
- partial class Form1
+ partial class frmInputTester
{
/// <summary>
/// Required designer variable.
@@ -31,17 +31,19 @@
/// </summary>
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
this.lblKeyPress = new System.Windows.Forms.Label();
this.lblMouseMove = new System.Windows.Forms.Label();
this.lblMouseButton = new System.Windows.Forms.Label();
this.lblKeyEvent = new System.Windows.Forms.Label();
this.lblKeyString = new System.Windows.Forms.Label();
- this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
- this.label1 = new System.Windows.Forms.Label();
- this.lblJoystick = new System.Windows.Forms.Label();
+ this.lblJoystick1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
+ this.timer1 = new System.Windows.Forms.Timer(this.components);
this.agateRenderTarget1 = new AgateLib.WinForms.AgateRenderTarget();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
+ this.lblJoystick2 = new System.Windows.Forms.Label();
+ this.lblJoystick3 = new System.Windows.Forms.Label();
+ this.lblJoystick4 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblKeyPress
@@ -86,32 +88,15 @@
this.lblKeyString.TabIndex = 5;
this.lblKeyString.Text = "Pressed Key String []";
//
- // numericUpDown1
+ // lblJoystick1
//
- this.numericUpDown1.Location = new System.Drawing.Point(297, 109);
- this.numericUpDown1.Name = "numericUpDown1";
- this.numericUpDown1.Size = new System.Drawing.Size(79, 20);
- this.numericUpDown1.TabIndex = 6;
- this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
+ this.lblJoystick1.AutoSize = true;
+ this.lblJoystick1.Location = new System.Drawing.Point(246, 111);
+ this.lblJoystick1.Name = "lblJoystick1";
+ this.lblJoystick1.Size = new System.Drawing.Size(66, 13);
+ this.lblJoystick1.TabIndex = 8;
+ this.lblJoystick1.Text = "Joystick Info";
//
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(246, 111);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(45, 13);
- this.label1.TabIndex = 7;
- this.label1.Text = "Joystick";
- //
- // lblJoystick
- //
- this.lblJoystick.AutoSize = true;
- this.lblJoystick.Location = new System.Drawing.Point(246, 142);
- this.lblJoystick.Name = "lblJoystick";
- this.lblJoystick.Size = new System.Drawing.Size(66, 13);
- this.lblJoystick.TabIndex = 8;
- this.lblJoystick.Text = "Joystick Info";
- //
// button1
//
this.button1.Location = new System.Drawing.Point(249, 80);
@@ -122,32 +107,65 @@
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
+ // timer1
+ //
+ this.timer1.Enabled = true;
+ this.timer1.Interval = 20;
+ this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
+ //
// agateRenderTarget1
//
this.agateRenderTarget1.Location = new System.Drawing.Point(12, 111);
this.agateRenderTarget1.Name = "agateRenderTarget1";
- this.agateRenderTarget1.Size = new System.Drawing.Size(200, 180);
+ this.agateRenderTarget1.Size = new System.Drawing.Size(200, 200);
this.agateRenderTarget1.TabIndex = 10;
//
- // Form1
+ // lblJoystick2
//
+ this.lblJoystick2.AutoSize = true;
+ this.lblJoystick2.Location = new System.Drawing.Point(366, 111);
+ this.lblJoystick2.Name = "lblJoystick2";
+ this.lblJoystick2.Size = new System.Drawing.Size(66, 13);
+ this.lblJoystick2.TabIndex = 11;
+ this.lblJoystick2.Text = "Joystick Info";
+ //
+ // lblJoystick3
+ //
+ this.lblJoystick3.AutoSize = true;
+ this.lblJoystick3.Location = new System.Drawing.Point(478, 111);
+ this.lblJoystick3.Name = "lblJoystick3";
+ this.lblJoystick3.Size = new System.Drawing.Size(66, 13);
+ this.lblJoystick3.TabIndex = 12;
+ this.lblJoystick3.Text = "Joystick Info";
+ //
+ // lblJoystick4
+ //
+ this.lblJoystick4.AutoSize = true;
+ this.lblJoystick4.Location = new System.Drawing.Point(581, 111);
+ this.lblJoystick4.Name = "lblJoystick4";
+ this.lblJoystick4.Size = new System.Drawing.Size(66, 13);
+ this.lblJoystick4.TabIndex = 13;
+ this.lblJoystick4.Text = "Joystick Info";
+ //
+ // frmInputTester
+ //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(382, 303);
+ this.ClientSize = new System.Drawing.Size(659, 326);
+ this.Controls.Add(this.lblJoystick4);
+ this.Controls.Add(this.lblJoystick3);
+ this.Controls.Add(this.lblJoystick2);
this.Controls.Add(this.agateRenderTarget1);
this.Controls.Add(this.button1);
- this.Controls.Add(this.lblJoystick);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.numericUpDown1);
+ this.Controls.Add(this.lblJoystick1);
this.Controls.Add(this.lblKeyString);
this.Controls.Add(this.lblKeyEvent);
this.Controls.Add(this.lblMouseButton);
this.Controls.Add(this.lblMouseMove);
this.Controls.Add(this.lblKeyPress);
- this.Name = "Form1";
- this.Text = "Form1";
+ this.Name = "frmInputTester";
+ this.Text = "Input Tester";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -160,11 +178,13 @@
private System.Windows.Forms.Label lblMouseButton;
private System.Windows.Forms.Label lblKeyEvent;
private System.Windows.Forms.Label lblKeyString;
- private System.Windows.Forms.NumericUpDown numericUpDown1;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Label lblJoystick;
+ private System.Windows.Forms.Label lblJoystick1;
private System.Windows.Forms.Button button1;
private AgateLib.WinForms.AgateRenderTarget agateRenderTarget1;
+ private System.Windows.Forms.Timer timer1;
+ private System.Windows.Forms.Label lblJoystick2;
+ private System.Windows.Forms.Label lblJoystick3;
+ private System.Windows.Forms.Label lblJoystick4;
}
}
Modified: trunk/Tests/InputTests/Input/frmInputTester.cs
===================================================================
--- trunk/Tests/InputTests/Input/frmInputTester.cs 2011-10-26 02:52:06 UTC (rev 1294)
+++ trunk/Tests/InputTests/Input/frmInputTester.cs 2011-10-26 04:03:11 UTC (rev 1295)
@@ -15,10 +15,11 @@
namespace Tests.InputTester
{
- public partial class Form1 : Form
+ public partial class frmInputTester : Form
{
+ private Label[] joystickLabels = new Label[4];
- public Form1()
+ public frmInputTester()
{
InitializeComponent();
@@ -33,51 +34,76 @@
new DisplayWindow(CreateWindowParams.FromControl(agateRenderTarget1));
- Application.Idle += new EventHandler(Application_Idle);
+ joystickLabels[0] = lblJoystick1;
+ joystickLabels[1] = lblJoystick2;
+ joystickLabels[2] = lblJoystick3;
+ joystickLabels[3] = lblJoystick4;
+
}
+ private void timer1_Tick(object sender, EventArgs e)
+ {
+ Application_Idle(sender, e);
+ }
void Application_Idle(object sender, EventArgs e)
{
- numericUpDown1.Maximum = JoystickInput.Joysticks.Count - 1;
- if (JoystickInput.Joysticks.Count > 0)
+ for (int i = 0; i < JoystickInput.Joysticks.Count; i++ )
{
- Joystick j = JoystickInput.Joysticks[(int)numericUpDown1.Value];
+ FillJoystickInfo(i, joystickLabels[i]);
+ }
+
+ Core.KeepAlive();
+ }
- StringBuilder b = new StringBuilder();
- b.AppendLine(j.Name);
- b.Append("Axis Count: ");
- b.AppendLine(j.AxisCount.ToString());
+ private void FillJoystickInfo(int index, Label label)
+ {
+ Joystick j = JoystickInput.Joysticks[index];
- for (int i = 0; i < j.AxisCount; i++)
- {
- b.Append("Axis ");
- b.Append(i.ToString());
- b.Append(": ");
- b.Append(j.GetAxisValue(i).ToString());
- b.AppendLine();
- }
+ StringBuilder b = new StringBuilder();
+ b.Append("Joystick ");
+ b.AppendLine(index.ToString());
+ b.AppendLine(j.Name);
+ b.Append("Axis Count: ");
+ b.AppendLine(j.AxisCount.ToString());
+ for (int i = 0; i < j.AxisCount; i++)
+ {
+ b.Append("Axis ");
+ b.Append(i.ToString());
+ b.Append(": ");
+ b.Append(j.GetAxisValue(i).ToString());
b.AppendLine();
+ }
- b.Append("X: ");
- b.AppendLine(j.Xaxis.ToString());
- b.Append("Y: ");
- b.AppendLine(j.Yaxis.ToString());
- b.AppendLine();
+ b.AppendLine();
- b.Append("Buttons: ");
+ b.Append("X: ");
+ b.AppendLine(j.Xaxis.ToString());
+ b.Append("Y: ");
+ b.AppendLine(j.Yaxis.ToString());
+ b.AppendLine();
- for (int i = 0; i < j.ButtonCount; i++)
- {
- if (j.GetButtonState(i))
- b.Append(i.ToString());
- }
+ b.Append("Buttons: ");
+ for (int i = 0; i < j.ButtonCount; i++)
+ {
+ if (j.GetButtonState(i))
+ b.Append(i.ToString());
+ }
- lblJoystick.Text = b.ToString();
+ b.AppendLine();
+ b.Append("Hats:");
+
+ for (int i = 0; i < j.HatCount; i++)
+ {
+ b.Append(" ");
+ b.Append(i.ToString());
+ b.Append(": ");
+ b.Append(j.GetHatState(i).ToString());
+ b.AppendLine();
}
- Core.KeepAlive();
+ label.Text = b.ToString();
}
void Mouse_MouseDoubleClickEvent(InputEventArgs e)
@@ -134,5 +160,6 @@
{
}
+
}
}
\ No newline at end of file
Modified: trunk/Tests/InputTests/Input/frmInputTester.resx
===================================================================
--- trunk/Tests/InputTests/Input/frmInputTester.resx 2011-10-26 02:52:06 UTC (rev 1294)
+++ trunk/Tests/InputTests/Input/frmInputTester.resx 2011-10-26 04:03:11 UTC (rev 1295)
@@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
</root>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-11-21 18:44:02
|
Revision: 1300
http://agate.svn.sourceforge.net/agate/?rev=1300&view=rev
Author: kanato
Date: 2011-11-21 18:43:49 +0000 (Mon, 21 Nov 2011)
Log Message:
-----------
Update copyright information.
Modified Paths:
--------------
trunk/AgateLib/AgateException.cs
trunk/AgateLib/AgateFileProvider.cs
trunk/AgateLib/AgateGame.cs
trunk/AgateLib/AgateSetup.cs
trunk/AgateLib/AppInitParameters.cs
trunk/AgateLib/AudioLib/Audio.cs
trunk/AgateLib/AudioLib/AudioCapsInfo.cs
trunk/AgateLib/AudioLib/ImplementationBase/AudioImpl.cs
trunk/AgateLib/AudioLib/ImplementationBase/MusicImpl.cs
trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferImpl.cs
trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferSessionImpl.cs
trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs
trunk/AgateLib/AudioLib/Music.cs
trunk/AgateLib/AudioLib/SoundBuffer.cs
trunk/AgateLib/AudioLib/SoundBufferSession.cs
trunk/AgateLib/AudioLib/SoundFormat.cs
trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs
trunk/AgateLib/BitmapFont/BitmapFontImpl.cs
trunk/AgateLib/BitmapFont/BitmapFontOptions.cs
trunk/AgateLib/BitmapFont/FontMetrics.cs
trunk/AgateLib/BitmapFont/GlyphMetrics.cs
trunk/AgateLib/Core.cs
trunk/AgateLib/Data/AgateColumn.cs
trunk/AgateLib/Data/AgateColumnDictionary.cs
trunk/AgateLib/Data/AgateDataHelper.cs
trunk/AgateLib/Data/AgateDatabase.cs
trunk/AgateLib/Data/AgateDatabaseException.cs
trunk/AgateLib/Data/AgateRow.cs
trunk/AgateLib/Data/AgateRowList.cs
trunk/AgateLib/Data/AgateTable.cs
trunk/AgateLib/Data/AgateTableDictionary.cs
trunk/AgateLib/Data/FieldType.cs
trunk/AgateLib/DisplayLib/Cache/FontStateCache.cs
trunk/AgateLib/DisplayLib/Cache/SurfaceStateCache.cs
trunk/AgateLib/DisplayLib/CreateWindowParams.cs
trunk/AgateLib/DisplayLib/Display.cs
trunk/AgateLib/DisplayLib/DisplayCapsInfo.cs
trunk/AgateLib/DisplayLib/DisplayWindow.cs
trunk/AgateLib/DisplayLib/FontState.cs
trunk/AgateLib/DisplayLib/FontSurface.cs
trunk/AgateLib/DisplayLib/FrameBuffer.cs
trunk/AgateLib/DisplayLib/ISurface.cs
trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs
trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs
trunk/AgateLib/DisplayLib/ImplementationBase/FontSurfaceImpl.cs
trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs
trunk/AgateLib/DisplayLib/ImplementationBase/IndexBufferImpl.cs
trunk/AgateLib/DisplayLib/ImplementationBase/ShaderCompilerImpl.cs
trunk/AgateLib/DisplayLib/ImplementationBase/SurfaceImpl.cs
trunk/AgateLib/DisplayLib/ImplementationBase/VertexBufferImpl.cs
trunk/AgateLib/DisplayLib/IndexBuffer.cs
trunk/AgateLib/DisplayLib/Origin.cs
trunk/AgateLib/DisplayLib/OriginAlignment.cs
trunk/AgateLib/DisplayLib/PixelBuffer.cs
trunk/AgateLib/DisplayLib/PixelFormat.cs
trunk/AgateLib/DisplayLib/PrimitiveType.cs
trunk/AgateLib/DisplayLib/RenderStateAdapter.cs
trunk/AgateLib/DisplayLib/ScreenMode.cs
trunk/AgateLib/DisplayLib/Shaders/AgateBuiltInShaders.cs
trunk/AgateLib/DisplayLib/Shaders/AgateShader.cs
trunk/AgateLib/DisplayLib/Shaders/AgateShaderCompileException.cs
trunk/AgateLib/DisplayLib/Shaders/Basic2DShader.cs
trunk/AgateLib/DisplayLib/Shaders/IShader2D.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/AgateInternalShader.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/AgateShaderImpl.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/Basic2DImpl.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/BuiltInShader.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/Effect.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/Lighting2DImpl.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/Lighting3DImpl.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/ShaderCompiler.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/ShaderLanguage.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/ShaderProgram.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/Technique.cs
trunk/AgateLib/DisplayLib/Shaders/Implementation/UniformState.cs
trunk/AgateLib/DisplayLib/Shaders/Lighting2D.cs
trunk/AgateLib/DisplayLib/Shaders/Lighting3D.cs
trunk/AgateLib/DisplayLib/StringTransformer.cs
trunk/AgateLib/DisplayLib/Surface.cs
trunk/AgateLib/DisplayLib/SurfaceState.cs
trunk/AgateLib/DisplayLib/TextLayout.cs
trunk/AgateLib/DisplayLib/VertexBuffer.cs
trunk/AgateLib/Drivers/AgateDriverInfo.cs
trunk/AgateLib/Drivers/AgateDriverReporter.cs
trunk/AgateLib/Drivers/AgateSandBoxLoader.cs
trunk/AgateLib/Drivers/DriverImplBase.cs
trunk/AgateLib/Drivers/IDesktopDriver.cs
trunk/AgateLib/Drivers/IUserSetSystems.cs
trunk/AgateLib/Drivers/NullInputImpl.cs
trunk/AgateLib/Drivers/NullSoundImpl.cs
trunk/AgateLib/Drivers/Registrar.cs
trunk/AgateLib/Drivers/TypeID.cs
trunk/AgateLib/Geometry/Builders/Cube.cs
trunk/AgateLib/Geometry/Builders/Terrain.cs
trunk/AgateLib/Geometry/Color.cs
trunk/AgateLib/Geometry/Gradient.cs
trunk/AgateLib/Geometry/Matrix4x4.cs
trunk/AgateLib/Geometry/Point.cs
trunk/AgateLib/Geometry/PointF.cs
trunk/AgateLib/Geometry/Rectangle.cs
trunk/AgateLib/Geometry/RectangleF.cs
trunk/AgateLib/Geometry/Size.cs
trunk/AgateLib/Geometry/SizeF.cs
trunk/AgateLib/Geometry/TypeConverters.cs
trunk/AgateLib/Geometry/Vector2.cs
trunk/AgateLib/Geometry/Vector3.cs
trunk/AgateLib/Geometry/Vector4.cs
trunk/AgateLib/Geometry/VertexTypes/PositionColor.cs
trunk/AgateLib/Geometry/VertexTypes/PositionTextureColor.cs
trunk/AgateLib/Geometry/VertexTypes/PositionTextureColorNormal.cs
trunk/AgateLib/Geometry/VertexTypes/PositionTextureNTB.cs
trunk/AgateLib/Geometry/VertexTypes/PositionTextureNormal.cs
trunk/AgateLib/Geometry/VertexTypes/PositionTextureNormalTangent.cs
trunk/AgateLib/Geometry/VertexTypes/VertexLayout.cs
trunk/AgateLib/IFileProvider.cs
trunk/AgateLib/InputLib/HatState.cs
trunk/AgateLib/InputLib/ImplementationBase/InputImpl.cs
trunk/AgateLib/InputLib/ImplementationBase/JoystickImpl.cs
trunk/AgateLib/InputLib/InputEventArgs.cs
trunk/AgateLib/InputLib/Joystick.cs
trunk/AgateLib/InputLib/JoystickInput.cs
trunk/AgateLib/InputLib/KeyCode.cs
trunk/AgateLib/InputLib/KeyModifiers.cs
trunk/AgateLib/InputLib/Keyboard.cs
trunk/AgateLib/InputLib/Mouse.cs
trunk/AgateLib/InternalResources/Data.cs
trunk/AgateLib/Platform.cs
trunk/AgateLib/PlatformType.cs
trunk/AgateLib/Properties/AssemblyInfo.cs
trunk/AgateLib/Resources/AgateResource.cs
trunk/AgateLib/Resources/AgateResourceCollection.cs
trunk/AgateLib/Resources/AgateResourceException.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/Serialization/Formatters/Xml/XmlFormatter.cs
trunk/AgateLib/Serialization/Xle/ITypeBinder.cs
trunk/AgateLib/Serialization/Xle/IXleSerializable.cs
trunk/AgateLib/Serialization/Xle/TypeBinder.cs
trunk/AgateLib/Serialization/Xle/XleSerializationException.cs
trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs
trunk/AgateLib/Serialization/Xle/XleSerializer.cs
trunk/AgateLib/Settings/PersistantSettings.cs
trunk/AgateLib/Settings/SettingsGroup.cs
trunk/AgateLib/Sprites/FrameList.cs
trunk/AgateLib/Sprites/IFrameList.cs
trunk/AgateLib/Sprites/ISprite.cs
trunk/AgateLib/Sprites/ISpriteFrame.cs
trunk/AgateLib/Sprites/Sprite.cs
trunk/AgateLib/Sprites/SpriteFrame.cs
trunk/AgateLib/Timing.cs
trunk/AgateLib/Utility/FileProviderList.cs
trunk/AgateLib/Utility/FileSystemProvider.cs
trunk/AgateLib/Utility/Ref.cs
trunk/AgateLib/Utility/SurfacePacker.cs
trunk/AgateLib/Utility/TgzFileProvider.cs
trunk/AgateLib/Utility/ZipFileProvider.cs
trunk/Drivers/AgateDrawing/Drawing_Display.cs
trunk/Drivers/AgateDrawing/Drawing_DisplayWindow.cs
trunk/Drivers/AgateDrawing/Drawing_FontSurface.cs
trunk/Drivers/AgateDrawing/Drawing_FrameBuffer.cs
trunk/Drivers/AgateDrawing/Drawing_Reporter.cs
trunk/Drivers/AgateDrawing/Drawing_Surface.cs
trunk/Drivers/AgateDrawing/Properties/AssemblyInfo.cs
trunk/Drivers/AgateFMOD/FMOD_Audio.cs
trunk/Drivers/AgateFMOD/FMOD_Music.cs
trunk/Drivers/AgateFMOD/FMOD_SoundBuffer.cs
trunk/Drivers/AgateFMOD/FMOD_SoundBufferSession.cs
trunk/Drivers/AgateFMOD/Reporter.cs
trunk/Drivers/AgateLib.WinForms/AgateRenderTarget.Designer.cs
trunk/Drivers/AgateLib.WinForms/AgateRenderTarget.cs
trunk/Drivers/AgateLib.WinForms/BitmapFontUtil.cs
trunk/Drivers/AgateLib.WinForms/BitmapFontUtilRenderers.cs
trunk/Drivers/AgateLib.WinForms/DisplayWindowForm.Designer.cs
trunk/Drivers/AgateLib.WinForms/DisplayWindowForm.cs
trunk/Drivers/AgateLib.WinForms/FormUtil.cs
trunk/Drivers/AgateLib.WinForms/FormsInterop.cs
trunk/Drivers/AgateLib.WinForms/Properties/AssemblyInfo.cs
trunk/Drivers/AgateLib.WinForms/SetSystemsForm.Designer.cs
trunk/Drivers/AgateLib.WinForms/SetSystemsForm.cs
trunk/Drivers/AgateLib.WinForms/WinFormsDriver.cs
trunk/Drivers/AgateLib.WinForms/WinFormsReporter.cs
trunk/Drivers/AgateOTK/AL_Audio.cs
trunk/Drivers/AgateOTK/ContextFB.cs
trunk/Drivers/AgateOTK/GL3/DrawBuffer.cs
trunk/Drivers/AgateOTK/GL3/FrameBuffer.cs
trunk/Drivers/AgateOTK/GL3/GLPrimitiveRenderer.cs
trunk/Drivers/AgateOTK/GL3/GLVertexBuffer.cs
trunk/Drivers/AgateOTK/GL3/Shaders/GL3_Basic2DShader.cs
trunk/Drivers/AgateOTK/GL3/Shaders/GlslFragmentProgram.cs
trunk/Drivers/AgateOTK/GL3/Shaders/GlslShader.cs
trunk/Drivers/AgateOTK/GL3/Shaders/GlslShaderCompiler.cs
trunk/Drivers/AgateOTK/GL3/Shaders/GlslVertexProgram.cs
trunk/Drivers/AgateOTK/GL3/Shaders/IGL3Shader.cs
trunk/Drivers/AgateOTK/GL3/Shaders/ShaderFactory3.cs
trunk/Drivers/AgateOTK/GLDrawBuffer.cs
trunk/Drivers/AgateOTK/GL_Display.cs
trunk/Drivers/AgateOTK/GL_DisplayControl.cs
trunk/Drivers/AgateOTK/GL_FrameBuffer.cs
trunk/Drivers/AgateOTK/GL_GameWindow.cs
trunk/Drivers/AgateOTK/GL_IndexBuffer.cs
trunk/Drivers/AgateOTK/GL_Surface.cs
trunk/Drivers/AgateOTK/GeoHelper.cs
trunk/Drivers/AgateOTK/Legacy/FixedFunction/FixedFunctionShaderFactory.cs
trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Basic2DShader.cs
trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Lighting2D.cs
trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Lighting3D.cs
trunk/Drivers/AgateOTK/Legacy/FrameBufferArb.cs
trunk/Drivers/AgateOTK/Legacy/FrameBufferExt.cs
trunk/Drivers/AgateOTK/Legacy/FrameBufferReadPixels.cs
trunk/Drivers/AgateOTK/Legacy/LegacyDrawBuffer.cs
trunk/Drivers/AgateOTK/Legacy/LegacyPrimitiveRenderer.cs
trunk/Drivers/AgateOTK/Legacy/LegacyVertexBuffer.cs
trunk/Drivers/AgateOTK/Otk_Reporter.cs
trunk/Drivers/AgateOTK/PrimitiveRenderer.cs
trunk/Drivers/AgateOTK/Properties/AssemblyInfo.cs
trunk/Drivers/AgateOTK/ShaderFactory.cs
trunk/Drivers/AgateOTK/TextureCoordinates.cs
trunk/Drivers/AgateOTK/frmFullScreen.Designer.cs
trunk/Drivers/AgateOTK/frmFullScreen.cs
trunk/Drivers/AgateSDL/Audio/SDL_Audio.cs
trunk/Drivers/AgateSDL/Audio/SDL_Music.cs
trunk/Drivers/AgateSDL/Audio/SDL_SoundBuffer.cs
trunk/Drivers/AgateSDL/Audio/SDL_SoundBufferSession.cs
trunk/Drivers/AgateSDL/Input/SDL_Input.cs
trunk/Drivers/AgateSDL/Reporter.cs
trunk/Drivers/AgateSDX/D3DDevice.cs
trunk/Drivers/AgateSDX/DrawBuffer.cs
trunk/Drivers/AgateSDX/EffectParameter.cs
trunk/Drivers/AgateSDX/FrameBufferSurface.cs
trunk/Drivers/AgateSDX/FrameBufferWindow.cs
trunk/Drivers/AgateSDX/GeoHelper.cs
trunk/Drivers/AgateSDX/HlslCompiler.cs
trunk/Drivers/AgateSDX/HlslEffect.cs
trunk/Drivers/AgateSDX/Reporter.cs
trunk/Drivers/AgateSDX/SDX_Display.cs
trunk/Drivers/AgateSDX/SDX_DisplayWindow.cs
trunk/Drivers/AgateSDX/SDX_Effect.cs
trunk/Drivers/AgateSDX/SDX_FrameBuffer.cs
trunk/Drivers/AgateSDX/SDX_IndexBuffer.cs
trunk/Drivers/AgateSDX/SDX_Input.cs
trunk/Drivers/AgateSDX/SDX_Surface.cs
trunk/Drivers/AgateSDX/SDX_VertexBuffer.cs
trunk/Drivers/AgateSDX/Shaders/FixedFunction/FixedFunctionShaderFactory.cs
trunk/Drivers/AgateSDX/Shaders/FixedFunction/SDX_FF_Basic2DShader.cs
trunk/Drivers/AgateSDX/Shaders/FixedFunction/SDX_FF_Lighting3D.cs
trunk/Drivers/AgateSDX/Shaders/ShaderFactory.cs
trunk/Drivers/AgateSDX/VertexFormats.cs
trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs
trunk/Drivers/AgateSDX/XAud2/XAudio2_Music.cs
trunk/Drivers/AgateSDX/XAud2/XAudio2_SoundBuffer.cs
trunk/Drivers/AgateSDX/XAud2/XAudio2_SoundBufferSession.cs
trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs
trunk/Drivers/AgateSDX/frmFullScreen.Designer.cs
trunk/Drivers/AgateSDX/frmFullScreen.cs
Modified: trunk/AgateLib/AgateException.cs
===================================================================
--- trunk/AgateLib/AgateException.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AgateException.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/AgateFileProvider.cs
===================================================================
--- trunk/AgateLib/AgateFileProvider.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AgateFileProvider.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/AgateGame.cs
===================================================================
--- trunk/AgateLib/AgateGame.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AgateGame.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -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-2011.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Modified: trunk/AgateLib/AgateSetup.cs
===================================================================
--- trunk/AgateLib/AgateSetup.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AgateSetup.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/AppInitParameters.cs
===================================================================
--- trunk/AgateLib/AppInitParameters.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AppInitParameters.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -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-2011.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Modified: trunk/AgateLib/AudioLib/Audio.cs
===================================================================
--- trunk/AgateLib/AudioLib/Audio.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AudioLib/Audio.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/AudioLib/AudioCapsInfo.cs
===================================================================
--- trunk/AgateLib/AudioLib/AudioCapsInfo.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AudioLib/AudioCapsInfo.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -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-2011.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Modified: trunk/AgateLib/AudioLib/ImplementationBase/AudioImpl.cs
===================================================================
--- trunk/AgateLib/AudioLib/ImplementationBase/AudioImpl.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AudioLib/ImplementationBase/AudioImpl.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/AudioLib/ImplementationBase/MusicImpl.cs
===================================================================
--- trunk/AgateLib/AudioLib/ImplementationBase/MusicImpl.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AudioLib/ImplementationBase/MusicImpl.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferImpl.cs
===================================================================
--- trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferImpl.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferImpl.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferSessionImpl.cs
===================================================================
--- trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferSessionImpl.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferSessionImpl.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs
===================================================================
--- trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/AudioLib/Music.cs
===================================================================
--- trunk/AgateLib/AudioLib/Music.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AudioLib/Music.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/AudioLib/SoundBuffer.cs
===================================================================
--- trunk/AgateLib/AudioLib/SoundBuffer.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AudioLib/SoundBuffer.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/AudioLib/SoundBufferSession.cs
===================================================================
--- trunk/AgateLib/AudioLib/SoundBufferSession.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AudioLib/SoundBufferSession.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/AudioLib/SoundFormat.cs
===================================================================
--- trunk/AgateLib/AudioLib/SoundFormat.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AudioLib/SoundFormat.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs
===================================================================
--- trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/BitmapFont/BitmapFontImpl.cs
===================================================================
--- trunk/AgateLib/BitmapFont/BitmapFontImpl.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/BitmapFont/BitmapFontImpl.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/BitmapFont/BitmapFontOptions.cs
===================================================================
--- trunk/AgateLib/BitmapFont/BitmapFontOptions.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/BitmapFont/BitmapFontOptions.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/BitmapFont/FontMetrics.cs
===================================================================
--- trunk/AgateLib/BitmapFont/FontMetrics.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/BitmapFont/FontMetrics.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/BitmapFont/GlyphMetrics.cs
===================================================================
--- trunk/AgateLib/BitmapFont/GlyphMetrics.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/BitmapFont/GlyphMetrics.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/Core.cs
===================================================================
--- trunk/AgateLib/Core.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/Core.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -11,7 +11,7 @@
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
-// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009.
+// Portions created by Erik Ylvisaker are Copyright (C) 2006-2011.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
Modified: trunk/AgateLib/Data/AgateColumn.cs
===================================================================
--- trunk/AgateLib/Data/AgateColumn.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ trunk/AgateLib/Data/AgateColumn.cs 2011-11-21 18:43:49 UTC (rev 1300)
@@ -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-2011.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Modified: trunk/AgateLib/Data/AgateColumnDictionary.cs
===================================================================
--- trunk/AgateLib/Data/AgateColumnDictionary.cs 2011-11-21 18:27:37 UTC (rev 1299)
+++ tr...
[truncated message content] |
|
From: <ka...@us...> - 2011-11-21 22:50:54
|
Revision: 1304
http://agate.svn.sourceforge.net/agate/?rev=1304&view=rev
Author: kanato
Date: 2011-11-21 22:50:40 +0000 (Mon, 21 Nov 2011)
Log Message:
-----------
Add drop down boxes in tester window for driver selection.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/AgateSetup.cs
trunk/AgateLib/Drivers/Registrar.cs
trunk/AgateLib/Settings/PersistantSettings.cs
trunk/AgateLib/Settings/SettingsGroup.cs
trunk/Drivers/AgateOTK/AgateOTK.csproj
trunk/Drivers/AgateSDL/AgateSDL.csproj
trunk/Tests/DisplayTests/Capabilities/frmCapabilities.cs
trunk/Tests/DisplayTests/MultipleWindows/MultipleWindowTest.cs
trunk/Tests/frmLauncher.Designer.cs
trunk/Tests/frmLauncher.cs
trunk/Tools/DatabaseEditor/DatabaseEditor.csproj
trunk/Tools/DatabaseEditor/frmDesignTable.cs
trunk/Tools/FontCreator/FontCreator.csproj
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2011-11-21 22:29:19 UTC (rev 1303)
+++ trunk/AgateLib/AgateLib.csproj 2011-11-21 22:50:40 UTC (rev 1304)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
Modified: trunk/AgateLib/AgateSetup.cs
===================================================================
--- trunk/AgateLib/AgateSetup.cs 2011-11-21 22:29:19 UTC (rev 1303)
+++ trunk/AgateLib/AgateSetup.cs 2011-11-21 22:50:40 UTC (rev 1304)
@@ -1,349 +1,349 @@
-// 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-2011.
-// All Rights Reserved.
-//
-// Contributor(s): Erik Ylvisaker
-//
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Text;
-
-using AgateLib.AudioLib;
-using AgateLib.DisplayLib;
-using AgateLib.Drivers;
-
-namespace AgateLib
-{
- /// <summary>
- /// Class which is designed to simplify initialization and de-initialization of the
- /// library. It is recommended to have a Setup object in a using block around your game
- /// code so that calling Dispose is guaranteed.
- ///
- /// If the program arguments are supplied, you can allow the user to choose which drivers
- /// are used, if the --choose option is specified.
- ///
- /// <example>This example shows a typical development pattern for the use of an AgateSetup object.
- /// <code>
- /// using System;
- /// using System.Collections.Generic;
- /// using AgateLib;
- ///
- /// public static void Main(string[] args)
- /// {
- /// using(AgateSetup setup = new AgateSetup("My Application Name", args))
- /// {
- /// setup.InitializeAll();
- /// if (setup.WasCanceled)
- /// return;
- ///
- /// // TODO: write game here
- /// }
- /// }
- /// </code>
- /// </example>
- /// </summary>
- public sealed class AgateSetup : IDisposable
- {
- private static AgateSetup sCreatedSetup;
-
- private bool mWasCanceled = false;
- private bool mAskUser = false;
- private bool mAlreadyAsked = false;
- private string mTitle = "AgateLib";
-
- private bool mUseDisplay = true;
- private bool mUseAudio = true;
- private bool mUseInput = true;
-
- private DisplayTypeID mPreferredDisplay = DisplayTypeID.AutoSelect;
- private AudioTypeID mPreferredAudio = AudioTypeID.AutoSelect;
- private InputTypeID mPreferredInput = InputTypeID.AutoSelect;
-
- private DisplayTypeID mSelectDisplay = DisplayTypeID.AutoSelect;
- private AudioTypeID mSelectAudio = AudioTypeID.AutoSelect;
- private InputTypeID mSelectInput = InputTypeID.AutoSelect;
-
- private string mCompanyName;
- private string mAppName;
-
- /// <summary>
- /// Indicates the display id that is preferred by the user or application.
- /// </summary>
- public DisplayTypeID PreferredDisplay
- {
- get { return mPreferredDisplay; }
- set { mPreferredDisplay = value; }
- }
- /// <summary>
- /// Indicates the audio id that is preferred by the user or application.
- /// </summary>
- public AudioTypeID PreferredAudio
- {
- get { return mPreferredAudio; }
- set { mPreferredAudio = value; }
- }
- /// <summary>
- /// Indicates the input id that is preferred by the user or application.
- /// </summary>
- public InputTypeID PreferredInput
- {
- get { return mPreferredInput; }
- set { mPreferredInput = value; }
- }
-
- /// <summary>
- /// Constructs a Setup object.
- /// </summary>
- public AgateSetup() : this("AgateLib", null)
- {
-
- Core.Initialize();
- }
- /// <summary>
- /// Constructs a Setup object.
- /// </summary>
- /// <param name="title"></param>
- public AgateSetup(string title)
- : this(title, null)
- {
- }
- /// <summary>
- /// Constructs a Setup object.
- /// </summary>
- /// <param name="args">Command line arguments to the program.</param>
- public AgateSetup(IEnumerable<string> args)
- : this("AgateLib", args)
- {
- }
- /// <summary>
- /// Constructs a Setup object.
- /// </summary>
- /// <param name="title"></param>
- /// <param name="args">Command line arguments to the program.</param>
- public AgateSetup(string title, IEnumerable<string> args)
- {
- if (sCreatedSetup != null)
- {
- throw new AgateException("Error: You have created a second AgateSetup object without disposing the previous one.");
- }
-
- sCreatedSetup = this;
-
- mTitle = title;
-
- if (args != null)
- {
- foreach (string s in args)
- {
- if (s == "--choose")
- mAskUser = true;
- }
- }
- }
- /// <summary>
- /// Initializes the specified components. This sets the values of UseDisplay,
- /// UseAudio, and UseInput to the values passed in.
- /// </summary>
- /// <param name="display"></param>
- /// <param name="audio"></param>
- /// <param name="input"></param>
- public void Initialize(bool display, bool audio, bool input)
- {
- mUseDisplay = display;
- mUseAudio = audio;
- mUseInput = input;
-
- InitializeAll();
- }
- /// <summary>
- /// Initializes the Display, Audio and Input controllers.
- /// </summary>
- public void InitializeAll()
- {
- if (mUseDisplay)
- InitializeDisplay();
-
- if (mUseAudio)
- InitializeAudio();
-
- if (mUseInput)
- InitializeInput();
-
- if (string.IsNullOrEmpty(mAppName) == false)
- {
- Core.Platform.SetFolderPaths(mCompanyName, mAppName);
- }
- }
-
- /// <summary>
- /// Gets or sets the company name.
- /// </summary>
- public string CompanyName { get { return mCompanyName; } set { mCompanyName = value; } }
- /// <summary>
- /// Gets or sets the application name.
- /// </summary>
- public string ApplicationName { get { return mAppName; } set { mAppName = value; } }
-
- /// <summary>
- /// Initializes the Display.
- /// Automatically selects the driver to use, or asks the user which
- /// driver to use if appropriate.
- /// </summary>
- private void InitializeDisplay()
- {
- DoAskUser();
- InitializeDisplay(mSelectDisplay);
- }
-
- /// <summary>
- /// Initializes the display to the specified subsystem.
- /// </summary>
- /// <param name="type"></param>
- public void InitializeDisplay(DisplayTypeID type)
- {
- if (WasCanceled)
- return;
-
- Display.Initialize(type);
- }
- /// <summary>
- /// Initializes the Audio subsystem.
- /// Automatically picks which driver to use.
- /// </summary>
- private void InitializeAudio()
- {
- DoAskUser();
- InitializeAudio(mSelectAudio);
- }
- /// <summary>
- /// Initializes the Audio subsystem, to the specified driver.
- /// </summary>
- /// <param name="type"></param>
- public void InitializeAudio(AudioTypeID type)
- {
- if (WasCanceled)
- return;
-
- AudioLib.Audio.Initialize(type);
- }
-
- /// <summary>
- /// Initializes the Input subsystem.
- /// Automatically picks which driver to use.
- /// </summary>
- private void InitializeInput()
- {
- DoAskUser();
- InitializeInput(mSelectInput);
- }
- /// <summary>
- /// Initializes the Input subsystem, to the specified driver.
- /// </summary>
- /// <param name="inputTypeID"></param>
- public void InitializeInput(InputTypeID inputTypeID)
- {
- if (WasCanceled)
- return;
-
- InputLib.JoystickInput.Initialize(inputTypeID);
-
- }
- /// <summary>
- /// Disposes of the SetupDisplay object and all initialized sub-systems.
- /// </summary>
- public void Dispose()
- {
- Display.Dispose();
- Audio.Dispose();
- InputLib.JoystickInput.Dispose();
-
- if (sCreatedSetup == this)
- sCreatedSetup = null;
- }
-
- /// <summary>
- /// Returns true if the user hit cancel in any dialog box that showed up
- /// asking the user what driver to use, or if initialization failed.
- /// </summary>
- public bool WasCanceled
- {
- get { return mWasCanceled; }
- }
- /// <summary>
- /// Gets or sets a bool value which indicates whether or not the user
- /// should be asked which driver(s) to use when Agate is initialized.
- /// </summary>
- /// <remarks>
- /// This setting can be useful for debugging, especially when comparing
- /// OpenGL vs. DirectX behavior and performance.
- /// It is recommended to have AskUser turned off for release builds, however.
- /// </remarks>
- public bool AskUser
- {
- get { return mAskUser; }
- set { mAskUser = value; }
- }
- /// <summary>
- /// Gets or sets a bool value which indicates whether or not the display
- /// should be initialized.
- /// </summary>
- public bool UseDisplay
- {
- get { return mUseDisplay; }
- set { mUseDisplay = value; }
- }
- /// <summary>
- /// Gets or sets a bool value which indicates whether or not the audio system
- /// should be initialized.
- /// </summary>
- public bool UseAudio
- {
- get { return mUseAudio; }
- set { mUseAudio = value; }
- }
- /// <summary>
- /// Gets or sets a bool value which indicates whether or not the input system
- /// should be initialized.
- /// </summary>
- public bool UseInput
- {
- get { return mUseInput; }
- set { mUseInput = value; }
- }
-
- /// <summary>
- /// Checks to see whether or not the user needs to be asked, and asks them
- /// if so.
- /// </summary>
- private void DoAskUser()
- {
- Core.Initialize();
-
- if (mAlreadyAsked)
- return;
- if (mAskUser == false)
- return;
-
- mWasCanceled = !Registrar.UserSelectDrivers(mUseDisplay, mUseAudio, mUseInput,
- mPreferredDisplay, mPreferredAudio, mPreferredInput ,
- out mSelectDisplay, out mSelectAudio, out mSelectInput);
-
- mAlreadyAsked = true;
- }
-
- }
-
-}
+// 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-2011.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Text;
+
+using AgateLib.AudioLib;
+using AgateLib.DisplayLib;
+using AgateLib.Drivers;
+
+namespace AgateLib
+{
+ /// <summary>
+ /// Class which is designed to simplify initialization and de-initialization of the
+ /// library. It is recommended to have a Setup object in a using block around your game
+ /// code so that calling Dispose is guaranteed.
+ ///
+ /// If the program arguments are supplied, you can allow the user to choose which drivers
+ /// are used, if the --choose option is specified.
+ ///
+ /// <example>This example shows a typical development pattern for the use of an AgateSetup object.
+ /// <code>
+ /// using System;
+ /// using System.Collections.Generic;
+ /// using AgateLib;
+ ///
+ /// public static void Main(string[] args)
+ /// {
+ /// using(AgateSetup setup = new AgateSetup("My Application Name", args))
+ /// {
+ /// setup.InitializeAll();
+ /// if (setup.WasCanceled)
+ /// return;
+ ///
+ /// // TODO: write game here
+ /// }
+ /// }
+ /// </code>
+ /// </example>
+ /// </summary>
+ public sealed class AgateSetup : IDisposable
+ {
+ private static AgateSetup sCreatedSetup;
+
+ private bool mWasCanceled = false;
+ private bool mAskUser = false;
+ private bool mAlreadyAsked = false;
+ private string mTitle = "AgateLib";
+
+ private bool mUseDisplay = true;
+ private bool mUseAudio = true;
+ private bool mUseInput = true;
+
+ private DisplayTypeID mPreferredDisplay = DisplayTypeID.AutoSelect;
+ private AudioTypeID mPreferredAudio = AudioTypeID.AutoSelect;
+ private InputTypeID mPreferredInput = InputTypeID.AutoSelect;
+
+ private DisplayTypeID mSelectDisplay = DisplayTypeID.AutoSelect;
+ private AudioTypeID mSelectAudio = AudioTypeID.AutoSelect;
+ private InputTypeID mSelectInput = InputTypeID.AutoSelect;
+
+ private string mCompanyName;
+ private string mAppName;
+
+ /// <summary>
+ /// Indicates the display id that is preferred by the user or application.
+ /// </summary>
+ public DisplayTypeID PreferredDisplay
+ {
+ get { return mPreferredDisplay; }
+ set { mPreferredDisplay = value; }
+ }
+ /// <summary>
+ /// Indicates the audio id that is preferred by the user or application.
+ /// </summary>
+ public AudioTypeID PreferredAudio
+ {
+ get { return mPreferredAudio; }
+ set { mPreferredAudio = value; }
+ }
+ /// <summary>
+ /// Indicates the input id that is preferred by the user or application.
+ /// </summary>
+ public InputTypeID PreferredInput
+ {
+ get { return mPreferredInput; }
+ set { mPreferredInput = value; }
+ }
+
+ /// <summary>
+ /// Constructs a Setup object.
+ /// </summary>
+ public AgateSetup() : this("AgateLib", null)
+ {
+
+ Core.Initialize();
+ }
+ /// <summary>
+ /// Constructs a Setup object.
+ /// </summary>
+ /// <param name="title"></param>
+ public AgateSetup(string title)
+ : this(title, null)
+ {
+ }
+ /// <summary>
+ /// Constructs a Setup object.
+ /// </summary>
+ /// <param name="args">Command line arguments to the program.</param>
+ public AgateSetup(IEnumerable<string> args)
+ : this("AgateLib", args)
+ {
+ }
+ /// <summary>
+ /// Constructs a Setup object.
+ /// </summary>
+ /// <param name="title"></param>
+ /// <param name="args">Command line arguments to the program.</param>
+ public AgateSetup(string title, IEnumerable<string> args)
+ {
+ if (sCreatedSetup != null)
+ {
+ throw new AgateException("Error: You have created a second AgateSetup object without disposing the previous one.");
+ }
+
+ sCreatedSetup = this;
+
+ mTitle = title;
+
+ if (args != null)
+ {
+ foreach (string s in args)
+ {
+ if (s == "--choose")
+ mAskUser = true;
+ }
+ }
+ }
+ /// <summary>
+ /// Initializes the specified components. This sets the values of UseDisplay,
+ /// UseAudio, and UseInput to the values passed in.
+ /// </summary>
+ /// <param name="display"></param>
+ /// <param name="audio"></param>
+ /// <param name="input"></param>
+ public void Initialize(bool display, bool audio, bool input)
+ {
+ mUseDisplay = display;
+ mUseAudio = audio;
+ mUseInput = input;
+
+ InitializeAll();
+ }
+ /// <summary>
+ /// Initializes the Display, Audio and Input controllers.
+ /// </summary>
+ public void InitializeAll()
+ {
+ if (mUseDisplay)
+ InitializeDisplay();
+
+ if (mUseAudio)
+ InitializeAudio();
+
+ if (mUseInput)
+ InitializeInput();
+
+ if (string.IsNullOrEmpty(mAppName) == false)
+ {
+ Core.Platform.SetFolderPaths(mCompanyName, mAppName);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the company name.
+ /// </summary>
+ public string CompanyName { get { return mCompanyName; } set { mCompanyName = value; } }
+ /// <summary>
+ /// Gets or sets the application name.
+ /// </summary>
+ public string ApplicationName { get { return mAppName; } set { mAppName = value; } }
+
+ /// <summary>
+ /// Initializes the Display.
+ /// Automatically selects the driver to use, or asks the user which
+ /// driver to use if appropriate.
+ /// </summary>
+ private void InitializeDisplay()
+ {
+ DoAskUser();
+ InitializeDisplay(mSelectDisplay);
+ }
+
+ /// <summary>
+ /// Initializes the display to the specified subsystem.
+ /// </summary>
+ /// <param name="type"></param>
+ public void InitializeDisplay(DisplayTypeID type)
+ {
+ if (WasCanceled)
+ return;
+
+ Display.Initialize(type);
+ }
+ /// <summary>
+ /// Initializes the Audio subsystem.
+ /// Automatically picks which driver to use.
+ /// </summary>
+ private void InitializeAudio()
+ {
+ DoAskUser();
+ InitializeAudio(mSelectAudio);
+ }
+ /// <summary>
+ /// Initializes the Audio subsystem, to the specified driver.
+ /// </summary>
+ /// <param name="type"></param>
+ public void InitializeAudio(AudioTypeID type)
+ {
+ if (WasCanceled)
+ return;
+
+ AudioLib.Audio.Initialize(type);
+ }
+
+ /// <summary>
+ /// Initializes the Input subsystem.
+ /// Automatically picks which driver to use.
+ /// </summary>
+ private void InitializeInput()
+ {
+ DoAskUser();
+ InitializeInput(mSelectInput);
+ }
+ /// <summary>
+ /// Initializes the Input subsystem, to the specified driver.
+ /// </summary>
+ /// <param name="inputTypeID"></param>
+ public void InitializeInput(InputTypeID inputTypeID)
+ {
+ if (WasCanceled)
+ return;
+
+ InputLib.JoystickInput.Initialize(inputTypeID);
+
+ }
+ /// <summary>
+ /// Disposes of the SetupDisplay object and all initialized sub-systems.
+ /// </summary>
+ public void Dispose()
+ {
+ Display.Dispose();
+ Audio.Dispose();
+ InputLib.JoystickInput.Dispose();
+
+ if (sCreatedSetup == this)
+ sCreatedSetup = null;
+ }
+
+ /// <summary>
+ /// Returns true if the user hit cancel in any dialog box that showed up
+ /// asking the user what driver to use, or if initialization failed.
+ /// </summary>
+ public bool WasCanceled
+ {
+ get { return mWasCanceled; }
+ }
+ /// <summary>
+ /// Gets or sets a bool value which indicates whether or not the user
+ /// should be asked which driver(s) to use when Agate is initialized.
+ /// </summary>
+ /// <remarks>
+ /// This setting can be useful for debugging, especially when comparing
+ /// OpenGL vs. DirectX behavior and performance.
+ /// It is recommended to have AskUser turned off for release builds, however.
+ /// </remarks>
+ public bool AskUser
+ {
+ get { return mAskUser; }
+ set { mAskUser = value; }
+ }
+ /// <summary>
+ /// Gets or sets a bool value which indicates whether or not the display
+ /// should be initialized.
+ /// </summary>
+ public bool UseDisplay
+ {
+ get { return mUseDisplay; }
+ set { mUseDisplay = value; }
+ }
+ /// <summary>
+ /// Gets or sets a bool value which indicates whether or not the audio system
+ /// should be initialized.
+ /// </summary>
+ public bool UseAudio
+ {
+ get { return mUseAudio; }
+ set { mUseAudio = value; }
+ }
+ /// <summary>
+ /// Gets or sets a bool value which indicates whether or not the input system
+ /// should be initialized.
+ /// </summary>
+ public bool UseInput
+ {
+ get { return mUseInput; }
+ set { mUseInput = value; }
+ }
+
+ /// <summary>
+ /// Checks to see whether or not the user needs to be asked, and asks them
+ /// if so.
+ /// </summary>
+ private void DoAskUser()
+ {
+ Core.Initialize();
+
+ if (mAlreadyAsked)
+ return;
+ if (mAskUser == false)
+ return;
+
+ mWasCanceled = !Registrar.UserSelectDrivers(mUseDisplay, mUseAudio, mUseInput,
+ mPreferredDisplay, mPreferredAudio, mPreferredInput ,
+ out mSelectDisplay, out mSelectAudio, out mSelectInput);
+
+ mAlreadyAsked = true;
+ }
+
+ }
+
+}
Modified: trunk/AgateLib/Drivers/Registrar.cs
===================================================================
--- trunk/AgateLib/Drivers/Registrar.cs 2011-11-21 22:29:19 UTC (rev 1303)
+++ trunk/AgateLib/Drivers/Registrar.cs 2011-11-21 22:50:40 UTC (rev 1304)
@@ -1,456 +1,497 @@
-// 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-2011.
-// All Rights Reserved.
-//
-// Contributor(s): Erik Ylvisaker
-//
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using AgateLib.AudioLib.ImplementationBase;
-using AgateLib.DisplayLib.ImplementationBase;
-using AgateLib.InputLib.ImplementationBase;
-using AgateLib.Utility;
-
-namespace AgateLib.Drivers
-{
- /// <summary>
- /// Static class with which drivers register themselves so that the library can
- /// instantiate them.
- /// </summary>
- public static class Registrar
- {
- private static List<AgateDriverInfo>
- displayDrivers = new List<AgateDriverInfo>(),
- audioDrivers = new List<AgateDriverInfo>(),
- inputDrivers = new List<AgateDriverInfo>(),
- desktopDrivers = new List<AgateDriverInfo>();
-
- private static bool mIsInitialized = false;
-
- private static IDesktopDriver mDesktop;
-
- private static readonly string[] KnownNativeLibraries = new string[]
- {
- "SDL.dll",
- };
-
-
- static bool Contains(this IEnumerable<AgateDriverInfo> list, DisplayTypeID type)
- {
- return list.Any(
- x => Comparator(x, DriverType.Display, (int)type));
- }
- static bool Contains(this IEnumerable<AgateDriverInfo> list, AudioTypeID type)
- {
- return list.Any(
- x => Comparator(x, DriverType.Audio, (int)type));
- }
- static bool Contains(this IEnumerable<AgateDriverInfo> list, InputTypeID type)
- {
- return list.Any(
- x => Comparator(x, DriverType.Input, (int)type));
- }
- static bool Comparator(AgateDriverInfo info, DriverType driverType, int type)
- {
- return info.DriverType == driverType && info.DriverTypeID == type;
- }
-
- static Registrar()
- {
- }
- /// <summary>
- /// Searches through FileManager.AssemblyPath for all *.dll files. These files
- /// are loaded and searched for classes which derive from DisplayImpl, AudioImpl, etc.
- /// </summary>
- internal static void Initialize()
- {
- if (mIsInitialized)
- return;
-
- RegisterNullDrivers();
-
- AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
- AppDomain sandbox = AppDomain.CreateDomain("AgateSandBox");
-
- AgateSandBoxLoader loader = (AgateSandBoxLoader)
- sandbox.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName,
- typeof(AgateSandBoxLoader).FullName);
-
- IEnumerable<string> files = AgateFileProvider.Assemblies.GetAllFiles("*.dll");
-
- foreach (string file in files)
+// 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-2011.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using AgateLib.AudioLib.ImplementationBase;
+using AgateLib.DisplayLib.ImplementationBase;
+using AgateLib.InputLib.ImplementationBase;
+using AgateLib.Utility;
+
+namespace AgateLib.Drivers
+{
+ /// <summary>
+ /// Static class with which drivers register themselves so that the library can
+ /// instantiate them.
+ /// </summary>
+ public static class Registrar
+ {
+ private static List<AgateDriverInfo>
+ displayDrivers = new List<AgateDriverInfo>(),
+ audioDrivers = new List<AgateDriverInfo>(),
+ inputDrivers = new List<AgateDriverInfo>(),
+ desktopDrivers = new List<AgateDriverInfo>();
+
+ private static bool mIsInitialized = false;
+
+ private static IDesktopDriver mDesktop;
+
+ private static readonly string[] KnownNativeLibraries = new string[]
+ {
+ "SDL.dll",
+ };
+
+
+ static bool Contains(this IEnumerable<AgateDriverInfo> list, DisplayTypeID type)
+ {
+ return list.Any(
+ x => Comparator(x, DriverType.Display, (int)type));
+ }
+ static bool Contains(this IEnumerable<AgateDriverInfo> list, AudioTypeID type)
+ {
+ return list.Any(
+ x => Comparator(x, DriverType.Audio, (int)type));
+ }
+ static bool Contains(this IEnumerable<AgateDriverInfo> list, InputTypeID type)
+ {
+ return list.Any(
+ x => Comparator(x, DriverType.Input, (int)type));
+ }
+ static bool Comparator(AgateDriverInfo info, DriverType driverType, int type)
+ {
+ return info.DriverType == driverType && info.DriverTypeID == type;
+ }
+
+ static Registrar()
+ {
+ }
+ /// <summary>
+ /// Searches through FileManager.AssemblyPath for all *.dll files. These files
+ /// are loaded and searched for classes which derive from DisplayImpl, AudioImpl, etc.
+ /// </summary>
+ internal static void Initialize()
+ {
+ if (mIsInitialized)
+ return;
+
+ RegisterNullDrivers();
+
+ AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
+ AppDomain sandbox = AppDomain.CreateDomain("AgateSandBox");
+
+ AgateSandBoxLoader loader = (AgateSandBoxLoader)
+ sandbox.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName,
+ typeof(AgateSandBoxLoader).FullName);
+
+ IEnumerable<string> files = AgateFileProvider.Assemblies.GetAllFiles("*.dll");
+
+ foreach (string file in files)
+ {
+ if (ShouldSkipLibrary(file))
+ continue;
+
+ foreach (AgateDriverInfo info in loader.ReportDrivers(file))
+ {
+ switch (info.DriverType)
+ {
+ case DriverType.Display:
+ displayDrivers.Add(info);
+ break;
+
+ case DriverType.Audio:
+ audioDrivers.Add(info);
+ break;
+
+ case DriverType.Input:
+ inputDrivers.Add(info);
+ break;
+
+ case DriverType.Desktop:
+ desktopDrivers.Add(info);
+ break;
+
+ default:
+ Core.ErrorReporting.Report(ErrorLevel.Warning, string.Format(
+ "Could not interpret DriverType returned by type {0} in assembly {1}.",
+ info.DriverTypeName, info.AssemblyFile), null);
+
+ break;
+ }
+ }
+ }
+
+ AppDomain.Unload(sandbox);
+
+ SortDriverInfo(displayDrivers);
+ SortDriverInfo(audioDrivers);
+ SortDriverInfo(inputDrivers);
+ SortDriverInfo(desktopDrivers);
+
+ mIsInitialized = true;
+ }
+ private static void SortDriverInfo(List<AgateDriverInfo> driverList)
+ {
+ // sorts the driver list in reverse order.
+ driverList.Sort(delegate(AgateDriverInfo a, AgateDriverInfo b)
+ {
+ return -a.Priority.CompareTo(b.Priority);
+ });
+ }
+
+ private static void RegisterNullDrivers()
+ {
+ Assembly thisAssembly = Assembly.GetExecutingAssembly();
+
+ AgateDriverInfo nullAudioInfo = new AgateDriverInfo(AudioTypeID.Silent,
+ typeof(NullSoundImpl), "No audio", -100);
+
+ nullAudioInfo.AssemblyFile = thisAssembly.CodeBase;
+ nullAudioInfo.AssemblyName = thisAssembly.FullName;
+
+ audioDrivers.Add(nullAudioInfo);
+
+ AgateDriverInfo nullInputInfo = new AgateDriverInfo(InputTypeID.Silent,
+ typeof(NullInputImpl), "No input", -100);
+
+ nullInputInfo.AssemblyFile = thisAssembly.CodeBase;
+ nullInputInfo.AssemblyName = thisAssembly.FullName;
+
+ inputDrivers.Add(nullInputInfo);
+ }
+
+ private static bool ShouldSkipLibrary(string file)
+ {
+ // Native libraries in the same directory will give an error when loaded,
+ // so skip any ones that we know about that will probably be in the same
+ // directory as the drivers.
+ if (IsKnownNativeLibrary(file))
+ return true;
+
+ // hack, because mono crashes if AgateMDX.dll is present.
+ // annoying, because it should report a failure to load the types in the
+ // assembly, and then the try catch should continue after that.
+ // TODO: this hack seems unnecessary in recent versions of Mono. Should it be removed?
+ if ((Environment.OSVersion.Platform == PlatformID.Unix ||
+ Environment.OSVersion.Platform == (Platform...
[truncated message content] |
|
From: <ka...@us...> - 2011-11-22 08:02:23
|
Revision: 1305
http://agate.svn.sourceforge.net/agate/?rev=1305&view=rev
Author: kanato
Date: 2011-11-22 08:02:14 +0000 (Tue, 22 Nov 2011)
Log Message:
-----------
Fixed selection of drivers based on settings.
Fixed double output of debug messages.
Removed unnecessary FrameBufferArb class, since the function entry points and behavior are exactly the same as for GL3.
Removed AskUser for all tests, leaving that functionality to the test launcher.
Fixed the display of the launcher.
Modified some comments.
Modified Paths:
--------------
trunk/AgateLib/Core.cs
trunk/AgateLib/Drivers/Registrar.cs
trunk/AgateLib/Platform.cs
trunk/Drivers/AgateOTK/AgateOTK.csproj
trunk/Drivers/AgateOTK/GL_Display.cs
trunk/Drivers/AgateOTK/GL_GameWindow.cs
trunk/Tests/AudioTests/AudioPlayer/AudioPlayer.cs
trunk/Tests/AudioTests/StreamAudio.cs
trunk/Tests/CoreTests/TgzProviderTester.cs
trunk/Tests/CoreTests/ZipProviderTester.cs
trunk/Tests/DisplayTests/BasicDrawing/BasicDrawing.cs
trunk/Tests/DisplayTests/Capabilities/Capabilities.cs
trunk/Tests/DisplayTests/ClipRect.cs
trunk/Tests/DisplayTests/ColorTest.cs
trunk/Tests/DisplayTests/PixelBufferMask.cs
trunk/Tests/DisplayTests/PixelBufferTest/PixelBufferTest.cs
trunk/Tests/DisplayTests/Prerendered.cs
trunk/Tests/DisplayTests/ScreenCapture.cs
trunk/Tests/DisplayTests/SurfaceTester/SurfaceTester.cs
trunk/Tests/DisplayTests/TileTester/TileTester.cs
trunk/Tests/DisplayTests/Tiling.cs
trunk/Tests/Fonts/BitmapFonts.cs
trunk/Tests/Fonts/FontLineTester.cs
trunk/Tests/Fonts/Fonts.cs
trunk/Tests/Fonts/Kerning.cs
trunk/Tests/InputTests/Input/InputTester.cs
trunk/Tests/Launcher.cs
trunk/Tests/Shaders/CoordinateSystem.cs
trunk/Tests/Shaders/Lighting3DTest.cs
trunk/Tests/Shaders/LightingTest/LightingTest.cs
trunk/Tests/frmLauncher.Designer.cs
trunk/Tests/frmLauncher.cs
Removed Paths:
-------------
trunk/Drivers/AgateOTK/Legacy/FrameBufferArb.cs
Modified: trunk/AgateLib/Core.cs
===================================================================
--- trunk/AgateLib/Core.cs 2011-11-21 22:50:40 UTC (rev 1304)
+++ trunk/AgateLib/Core.cs 2011-11-22 08:02:14 UTC (rev 1305)
@@ -302,7 +302,7 @@
{
}
/// <summary>
- /// Initializes Core class.
+ /// Initializes Core class. Also causes the Registrar to probe drivers.
/// Can be called multiple times without adverse effects.
/// </summary>
public static void Initialize()
@@ -312,7 +312,6 @@
Drivers.Registrar.Initialize();
-
sInititalized = true;
}
Modified: trunk/AgateLib/Drivers/Registrar.cs
===================================================================
--- trunk/AgateLib/Drivers/Registrar.cs 2011-11-21 22:50:40 UTC (rev 1304)
+++ trunk/AgateLib/Drivers/Registrar.cs 2011-11-22 08:02:14 UTC (rev 1305)
@@ -1,497 +1,519 @@
-// 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-2011.
-// All Rights Reserved.
-//
-// Contributor(s): Erik Ylvisaker
-//
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using AgateLib.AudioLib.ImplementationBase;
-using AgateLib.DisplayLib.ImplementationBase;
-using AgateLib.InputLib.ImplementationBase;
-using AgateLib.Utility;
-
-namespace AgateLib.Drivers
-{
- /// <summary>
- /// Static class with which drivers register themselves so that the library can
- /// instantiate them.
- /// </summary>
- public static class Registrar
- {
- private static List<AgateDriverInfo>
- displayDrivers = new List<AgateDriverInfo>(),
- audioDrivers = new List<AgateDriverInfo>(),
- inputDrivers = new List<AgateDriverInfo>(),
- desktopDrivers = new List<AgateDriverInfo>();
-
- private static bool mIsInitialized = false;
-
- private static IDesktopDriver mDesktop;
-
- private static readonly string[] KnownNativeLibraries = new string[]
- {
- "SDL.dll",
- };
-
-
- static bool Contains(this IEnumerable<AgateDriverInfo> list, DisplayTypeID type)
- {
- return list.Any(
- x => Comparator(x, DriverType.Display, (int)type));
- }
- static bool Contains(this IEnumerable<AgateDriverInfo> list, AudioTypeID type)
- {
- return list.Any(
- x => Comparator(x, DriverType.Audio, (int)type));
- }
- static bool Contains(this IEnumerable<AgateDriverInfo> list, InputTypeID type)
- {
- return list.Any(
- x => Comparator(x, DriverType.Input, (int)type));
- }
- static bool Comparator(AgateDriverInfo info, DriverType driverType, int type)
- {
- return info.DriverType == driverType && info.DriverTypeID == type;
- }
-
- static Registrar()
- {
- }
- /// <summary>
- /// Searches through FileManager.AssemblyPath for all *.dll files. These files
- /// are loaded and searched for classes which derive from DisplayImpl, AudioImpl, etc.
- /// </summary>
- internal static void Initialize()
- {
- if (mIsInitialized)
- return;
-
- RegisterNullDrivers();
-
- AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
- AppDomain sandbox = AppDomain.CreateDomain("AgateSandBox");
-
- AgateSandBoxLoader loader = (AgateSandBoxLoader)
- sandbox.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName,
- typeof(AgateSandBoxLoader).FullName);
-
- IEnumerable<string> files = AgateFileProvider.Assemblies.GetAllFiles("*.dll");
-
- foreach (string file in files)
- {
- if (ShouldSkipLibrary(file))
- continue;
-
- foreach (AgateDriverInfo info in loader.ReportDrivers(file))
- {
- switch (info.DriverType)
- {
- case DriverType.Display:
- displayDrivers.Add(info);
- break;
-
- case DriverType.Audio:
- audioDrivers.Add(info);
- break;
-
- case DriverType.Input:
- inputDrivers.Add(info);
- break;
-
- case DriverType.Desktop:
- desktopDrivers.Add(info);
- break;
-
- default:
- Core.ErrorReporting.Report(ErrorLevel.Warning, string.Format(
- "Could not interpret DriverType returned by type {0} in assembly {1}.",
- info.DriverTypeName, info.AssemblyFile), null);
-
- break;
- }
- }
- }
-
- AppDomain.Unload(sandbox);
-
- SortDriverInfo(displayDrivers);
- SortDriverInfo(audioDrivers);
- SortDriverInfo(inputDrivers);
- SortDriverInfo(desktopDrivers);
-
- mIsInitialized = true;
- }
- private static void SortDriverInfo(List<AgateDriverInfo> driverList)
- {
- // sorts the driver list in reverse order.
- driverList.Sort(delegate(AgateDriverInfo a, AgateDriverInfo b)
- {
- return -a.Priority.CompareTo(b.Priority);
- });
- }
-
- private static void RegisterNullDrivers()
- {
- Assembly thisAssembly = Assembly.GetExecutingAssembly();
-
- AgateDriverInfo nullAudioInfo = new AgateDriverInfo(AudioTypeID.Silent,
- typeof(NullSoundImpl), "No audio", -100);
-
- nullAudioInfo.AssemblyFile = thisAssembly.CodeBase;
- nullAudioInfo.AssemblyName = thisAssembly.FullName;
-
- audioDrivers.Add(nullAudioInfo);
-
- AgateDriverInfo nullInputInfo = new AgateDriverInfo(InputTypeID.Silent,
- typeof(NullInputImpl), "No input", -100);
-
- nullInputInfo.AssemblyFile = thisAssembly.CodeBase;
- nullInputInfo.AssemblyName = thisAssembly.FullName;
-
- inputDrivers.Add(nullInputInfo);
- }
-
- private static bool ShouldSkipLibrary(string file)
- {
- // Native libraries in the same directory will give an error when loaded,
- // so skip any ones that we know about that will probably be in the same
- // directory as the drivers.
- if (IsKnownNativeLibrary(file))
- return true;
-
- // hack, because mono crashes if AgateMDX.dll is present.
- // annoying, because it should report a failure to load the types in the
- // assembly, and then the try catch should continue after that.
- // TODO: this hack seems unnecessary in recent versions of Mono. Should it be removed?
- if ((Environment.OSVersion.Platform == PlatformID.Unix ||
- Environment.OSVersion.Platform == (PlatformID)128) &&
- (System.IO.Path.GetFileName(file).ToLower().Contains("agatemdx.dll") ||
- System.IO.Path.GetFileName(file).ToLower().Contains("agatesdx.dll")))
- {
- Core.ErrorReporting.Report(ErrorLevel.Comment,
- string.Format("DirectX not supported on non-Windows platforms. {0}Remove {1} to eliminate this message.",
- Environment.NewLine, System.IO.Path.GetFileName(file)), null);
-
- return true;
- }
-
- // Skip the agatelib dll.
- if (System.IO.Path.GetFileName(file).ToLower().Contains("agatelib.dll"))
- return true;
-
- return false;
- }
- private static bool IsKnownNativeLibrary(string path)
- {
- string filename = System.IO.Path.GetFileName(path).ToLowerInvariant();
-
- for (int i = 0; i < KnownNativeLibraries.Length; i++)
- {
- if (KnownNativeLibraries[i].ToLowerInvariant() == filename)
- return true;
- }
- return false;
- }
-
-
- /// <summary>
- /// Asks the user to select which drivers to use.
- /// </summary>
- /// <param name="chooseDisplay"></param>
- /// <param name="chooseAudio"></param>
- /// <param name="chooseInput"></param>
- /// <param name="selectedDisplay"></param>
- /// <param name="selectedAudio"></param>
- /// <param name="selectedInput"></param>
- /// <returns></returns>
- internal static bool UserSelectDrivers(bool chooseDisplay, bool chooseAudio, bool chooseInput,
- DisplayTypeID preferredDisplay, AudioTypeID preferredAudio, InputTypeID preferredInput,
- out DisplayTypeID selectedDisplay, out AudioTypeID selectedAudio, out InputTypeID selectedInput)
- {
- if (mDesktop == null)
- {
- CreateDesktopDriver();
-
- if (mDesktop == null)
- {
- SelectBestDrivers(chooseDisplay, chooseAudio, chooseInput,
- preferredDisplay, preferredAudio, preferredInput,
- out selectedDisplay, out selectedAudio, out selectedInput);
-
- return true;
- }
- }
-
- IUserSetSystems frm = mDesktop.CreateUserSetSystems();
-
- // set default values.
- selectedDisplay = DisplayTypeID.AutoSelect;
- selectedAudio = AudioTypeID.AutoSelect;
- selectedInput = InputTypeID.AutoSelect;
-
- foreach (AgateDriverInfo info in displayDrivers)
- {
- frm.AddDisplayType(info);
- }
- foreach (AgateDriverInfo info in audioDrivers)
- {
- frm.AddAudioType(info);
- }
- foreach (AgateDriverInfo info in inputDrivers)
- {
- frm.AddInputType(info);
- }
-
- frm.SetChoices(chooseDisplay, chooseAudio, chooseInput,
- preferredDisplay, preferredAudio, preferredInput);
-
- // run the dialog asking user which drivers to use.
- if (frm.RunDialog() == SetSystemsDialogResult.Cancel)
- {
- return false;
- }
-
- selectedDisplay = frm.DisplayType;
- selectedAudio = frm.AudioType;
- selectedInput = frm.InputType;
-
- return true;
-
- }
-
- private static void SelectBestDrivers(bool chooseDisplay, bool chooseAudio, bool chooseInput,
- DisplayTypeID preferredDisplay, AudioTypeID preferredAudio, InputTypeID preferredInput,
- out DisplayTypeID selectedDisplay, out AudioTypeID selectedAudio, out InputTypeID selectedInput)
- {
- // initial return values if a driver isn't selected.
- selectedDisplay = DisplayTypeID.AutoSelect;
- selectedAudio = AudioTypeID.AutoSelect;
- selectedInput = InputTypeID.AutoSelect;
-
- if (preferredDisplay != DisplayTypeID.AutoSelect && displayDrivers.Contains(preferredDisplay))
- selectedDisplay = preferredDisplay;
- else if (displayDrivers.Count > 0)
- selectedDisplay = (DisplayTypeID)displayDrivers[0].DriverTypeID;
-
- if (preferredAudio != AudioTypeID.AutoSelect && audioDrivers.Contains(preferredAudio))
- selectedAudio = preferredAudio;
- else if (audioDrivers.Count > 0)
- selectedAudio = (AudioTypeID)audioDrivers[0].DriverTypeID;
-
- if (preferredInput != InputTypeID.AutoSelect && inputDrivers.Contains(preferredInput))
- selectedInput = preferredInput;
- else if (inputDrivers.Count > 0)
- selectedInput = (InputTypeID)inputDrivers[0].DriverTypeID;
- }
-
- private static void CreateDesktopDriver()
- {
- if (desktopDrivers.Count == 0)
- return;
-
- mDesktop = (IDesktopDriver)CreateDriverInstance(desktopDrivers[0]);
- }
-
- internal static IDesktopDriver WinForms
- {
- get { return mDesktop; }
- }
-
- internal static DisplayImpl CreateDisplayDriver(DisplayTypeID displayType)
- {
- if (displayDrivers.Count == 0)
- throw new AgateException("No display drivers registered.");
-
- AgateDriverInfo info;
- string text;
-
- if (displayType == DisplayTypeID.AutoSelect &&
- Core.Settings["AgateLib"].TryGetValue("DisplayDriver", out text))
- {
- info = FindDriverInfo(displayDrivers, text);
- }
- else
- info = FindDriverInfo(displayDrivers, (int)displayType);
-
- if (info == null)
- throw new AgateException(string.Format("Could not find the driver {0}.", displayType));
-
- return (DisplayImpl)CreateDriverInstance(info);
- }
- internal static AudioImpl CreateAudioDriver(AudioTypeID audioType)
- {
- if (audioDrivers.Count == 0)
- throw new AgateException("No audio drivers registered.");
+// 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-2011.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using AgateLib.AudioLib.ImplementationBase;
+using AgateLib.DisplayLib.ImplementationBase;
+using AgateLib.InputLib.ImplementationBase;
+using AgateLib.Utility;
+
+namespace AgateLib.Drivers
+{
+ /// <summary>
+ /// Static class with which drivers register themselves so that the library can
+ /// instantiate them.
+ /// </summary>
+ public static class Registrar
+ {
+ private static List<AgateDriverInfo>
+ displayDrivers = new List<AgateDriverInfo>(),
+ audioDrivers = new List<AgateDriverInfo>(),
+ inputDrivers = new List<AgateDriverInfo>(),
+ desktopDrivers = new List<AgateDriverInfo>();
+
+ private static bool mIsInitialized = false;
+
+ private static IDesktopDriver mDesktop;
+
+ private static readonly string[] KnownNativeLibraries = new string[]
+ {
+ "SDL.dll",
+ "SDL_mixer.dll",
+ "libogg-0.dll",
+ "libvorbis-0.dll",
+ "libvorbisfile-3.dll",
+ };
+
+
+ static bool Contains(this IEnumerable<AgateDriverInfo> list, DisplayTypeID type)
+ {
+ return list.Any(
+ x => Comparator(x, DriverType.Display, (int)type));
+ }
+ static bool Contains(this IEnumerable<AgateDriverInfo> list, AudioTypeID type)
+ {
+ return list.Any(
+ x => Comparator(x, DriverType.Audio, (int)type));
+ }
+ static bool Contains(this IEnumerable<AgateDriverInfo> list, InputTypeID type)
+ {
+ return list.Any(
+ x => Comparator(x, DriverType.Input, (int)type));
+ }
+ static bool Comparator(AgateDriverInfo info, DriverType driverType, int type)
+ {
+ return info.DriverType == driverType && info.DriverTypeID == type;
+ }
+
+ static Registrar()
+ {
+ }
+ /// <summary>
+ /// Searches through FileManager.AssemblyPath for all *.dll files. These files
+ /// are loaded and searched for classes which derive from DisplayImpl, AudioImpl, etc.
+ /// </summary>
+ internal static void Initialize()
+ {
+ if (mIsInitialized)
+ return;
+
+ RegisterNullDrivers();
+
+ AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
+ AppDomain sandbox = AppDomain.CreateDomain("AgateSandBox");
+
+ AgateSandBoxLoader loader = (AgateSandBoxLoader)
+ sandbox.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName,
+ typeof(AgateSandBoxLoader).FullName);
+
+ IEnumerable<string> files = AgateFileProvider.Assemblies.GetAllFiles("*.dll");
+
+ foreach (string file in files)
+ {
+ if (ShouldSkipLibrary(file))
+ continue;
+
+ foreach (AgateDriverInfo info in loader.ReportDrivers(file))
+ {
+ switch (info.DriverType)
+ {
+ case DriverType.Display:
+ displayDrivers.Add(info);
+ break;
+
+ case DriverType.Audio:
+ audioDrivers.Add(info);
+ break;
+
+ case DriverType.Input:
+ inputDrivers.Add(info);
+ break;
+
+ case DriverType.Desktop:
+ desktopDrivers.Add(info);
+ break;
+
+ default:
+ Core.ErrorReporting.Report(ErrorLevel.Warning, string.Format(
+ "Could not interpret DriverType returned by type {0} in assembly {1}.",
+ info.DriverTypeName, info.AssemblyFile), null);
+
+ break;
+ }
+ }
+ }
+
+ AppDomain.Unload(sandbox);
+
+ SortDriverInfo(displayDrivers);
+ SortDriverInfo(audioDrivers);
+ SortDriverInfo(inputDrivers);
+ SortDriverInfo(desktopDrivers);
+
+ mIsInitialized = true;
+ }
+ private static void SortDriverInfo(List<AgateDriverInfo> driverList)
+ {
+ // sorts the driver list in reverse order.
+ driverList.Sort(delegate(AgateDriverInfo a, AgateDriverInfo b)
+ {
+ return -a.Priority.CompareTo(b.Priority);
+ });
+ }
+
+ private static void RegisterNullDrivers()
+ {
+ Assembly thisAssembly = Assembly.GetExecutingAssembly();
+
+ AgateDriverInfo nullAudioInfo = new AgateDriverInfo(AudioTypeID.Silent,
+ typeof(NullSoundImpl), "No audio", -100);
+
+ nullAudioInfo.AssemblyFile = thisAssembly.CodeBase;
+ nullAudioInfo.AssemblyName = thisAssembly.FullName;
+
+ audioDrivers.Add(nullAudioInfo);
+
+ AgateDriverInfo nullInputInfo = new AgateDriverInfo(InputTypeID.Silent,
+ typeof(NullInputImpl), "No input", -100);
+
+ nullInputInfo.AssemblyFile = thisAssembly.CodeBase;
+ nullInputInfo.AssemblyName = thisAssembly.FullName;
+
+ inputDrivers.Add(nullInputInfo);
+ }
+
+ private static bool ShouldSkipLibrary(string file)
+ {
+ // Native libraries in the same directory will give an error when loaded,
+ // so skip any ones that we know about that will probably be in the same
+ // directory as the drivers.
+ if (IsKnownNativeLibrary(file))
+ return true;
+
+ // hack, because mono crashes if AgateMDX.dll is present.
+ // annoying, because it should report a failure to load the types in the
+ // assembly, and then the try catch should continue after that.
+ // TODO: this hack seems unnecessary in recent versions of Mono. Should it be removed?
+ if ((Environment.OSVersion.Platform == PlatformID.Unix ||
+ Environment.OSVersion.Platform == (PlatformID)128) &&
+ (System.IO.Path.GetFileName(file).ToLower().Contains("agatemdx.dll") ||
+ System.IO.Path.GetFileName(file).ToLower().Contains("agatesdx.dll")))
+ {
+ Core.ErrorReporting.Report(ErrorLevel.Comment,
+ string.Format("DirectX not supported on non-Windows platforms. {0}Remove {1} to eliminate this message.",
+ Environment.NewLine, System.IO.Path.GetFileName(file)), null);
+
+ return true;
+ }
+
+ // Skip the agatelib dll.
+ if (System.IO.Path.GetFileName(file).ToLower().Contains("agatelib.dll"))
+ return true;
+
+ return false;
+ }
+ private static bool IsKnownNativeLibrary(string path)
+ {
+ string filename = System.IO.Path.GetFileName(path).ToLowerInvariant();
+
+ for (int i = 0; i < KnownNativeLibraries.Length; i++)
+ {
+ if (KnownNativeLibraries[i].ToLowerInvariant() == filename)
+ return true;
+ }
+ return false;
+ }
+
+
+ /// <summary>
+ /// Asks the user to select which drivers to use.
+ /// </summary>
+ /// <param name="chooseDisplay"></param>
+ /// <param name="chooseAudio"></param>
+ /// <param name="chooseInput"></param>
+ /// <param name="selectedDisplay"></param>
+ /// <param name="selectedAudio"></param>
+ /// <param name="selectedInput"></param>
+ /// <returns></returns>
+ internal static bool UserSelectDrivers(bool chooseDisplay, bool chooseAudio, bool chooseInput,
+ DisplayTypeID preferredDisplay, AudioTypeID preferredAudio, InputTypeID preferredInput,
+ out DisplayTypeID selectedDisplay, out AudioTypeID selectedAudio, out InputTypeID selectedInput)
+ {
+ if (mDesktop == null)
+ {
+ CreateDesktopDriver();
+
+ if (mDesktop == null)
+ {
+ SelectBestDrivers(chooseDisplay, chooseAudio, chooseInput,
+ preferredDisplay, preferredAudio, preferredInput,
+ out selectedDisplay, out selectedAudio, out selectedInput);
+
+ return true;
+ }
+ }
+
+ IUserSetSystems frm = mDesktop.CreateUserSetSystems();
+
+ // set default values.
+ selectedDisplay = DisplayTypeID.AutoSelect;
+ selectedAudio = AudioTypeID.AutoSelect;
+ selectedInput = InputTypeID.AutoSelect;
+
+ foreach (AgateDriverInfo info in displayDrivers)
+ {
+ frm.AddDisplayType(info);
+ }
+ foreach (AgateDriverInfo info in audioDrivers)
+ {
+ frm.AddAudioType(info);
+ }
+ foreach (AgateDriverInfo info in inputDrivers)
+ {
+ frm.AddInputType(info);
+ }
+
+ frm.SetChoices(chooseDisplay, chooseAudio, chooseInput,
+ preferredDisplay, preferredAudio, preferredInput);
+
+ // run the dialog asking user which drivers to use.
+ if (frm.RunDialog() == SetSystemsDialogResult.Cancel)
+ {
+ return false;
+ }
+
+ selectedDisplay = frm.DisplayType;
+ selectedAudio = frm.AudioType;
+ selectedInput = frm.InputType;
+
+ return true;
+
+ }
+
+ private static void SelectBestDrivers(bool chooseDisplay, bool chooseAudio, bool chooseInput,
+ DisplayTypeID preferredDisplay, AudioTypeID preferredAudio, InputTypeID preferredInput,
+ out DisplayTypeID selectedDisplay, out AudioTypeID selectedAudio, out InputTypeID selectedInput)
+ {
+ // initial return values if a driver isn't selected.
+ selectedDisplay = DisplayTypeID.AutoSelect;
+ selectedAudio = AudioTypeID.AutoSelect;
+ selectedInput = InputTypeID.AutoSelect;
+
+ if (preferredDisplay != DisplayTypeID.AutoSelect && displayDrivers.Contains(preferredDisplay))
+ selectedDisplay = preferredDisplay;
+ else if (displayDrivers.Count > 0)
+ selectedDisplay = (DisplayTypeID)displayDrivers[0].DriverTypeID;
+
+ if (preferredAudio != AudioTypeID.AutoSelect && audioDrivers.Contains(preferredAudio))
+ selectedAudio = preferredAudio;
+ else if (audioDrivers.Count > 0)
+ selectedAudio = (AudioTypeID)audioDrivers[0].DriverTypeID;
+
+ if (preferredInput != InputTypeID.AutoSelect && inputDrivers.Contains(preferredInput))
+ selectedInput = preferredInput;
+ else if (inputDrivers.Count > 0)
+ selectedInput = (InputTypeID)inputDrivers[0].DriverTypeID;
+ }
+
+ private static void CreateDesktopDriver()
+ {
+ if (desktopDrivers.Count == 0)
+ return;
+
+ mDesktop = (IDesktopDriver)CreateDriverInstance(desktopDrivers[0]);
+ }
+
+ internal static IDesktopDriver WinForms
+ {
+ get { return mDesktop; }
+ }
+
+ internal static DisplayImpl CreateDisplayDriver(DisplayTypeID displayType)
+ {
+ if (displayDrivers.Count == 0)
+ throw new AgateException("No display drivers registered.");
- AgateDriverInfo info;
+ AgateDriverInfo info = null;
string text;
+
+ bool settingsSelect = displayType == DisplayTypeID.AutoSelect;
+ settingsSelect &= Core.Settings["AgateLib"].TryGetValue("DisplayDriver", out text);
+
+ if (settingsSelect)
+ {
+ info = FindDriverInfo(displayDrivers, text);
+
+ if (info == null)
+ settingsSelect = false;
+ }
- if (audioType == AudioTypeID.AutoSelect &&
- Core.Settings["AgateLib"].TryGetValue("AudioDriver", out text))
+ if (settingsSelect == false)
+ info = FindDriverInfo(displayDrivers, (int)displayType);
+
+ if (info == null)
+ throw new AgateException(string.Format("Could not find the driver {0}.", displayType));
+
+ return (DisplayImpl)CreateDriverInstance(info);
+ }
+ internal static AudioImpl CreateAudioDriver(AudioTypeID audioType)
+ {
+ if (audioDrivers.Count == 0)
+ throw new AgateException("No audio drivers registered.");
+
+ AgateDriverInfo info = null;
+ string text;
+
+ bool settingsSelect = audioType == AudioTypeID.AutoSelect;
+ settingsSelect &= Core.Settings["AgateLib"].TryGetValue("AudioDriver", out text);
+
+ if (settingsSelect)
{
info = FindDriverInfo(audioDrivers, text);
+
+ if (info == null)
+ settingsSelect = false;
}
- else
- info = FindDriverInfo(audioDrivers, (int)audioType);
-
- if (info == null)
- throw new AgateException(string.Format("Could not find the driver {0}.", audioType));
-
- return (AudioImpl)CreateDriverInstance(info);
- }
- internal static InputImpl CreateInputDriver(InputTypeID inputType)
- {
- if (inputDrivers.Count == 0)
- throw new AgateException("No audio drivers registered.");
- AgateDriverInfo info;
+ if (settingsSelect == false)
+ info = FindDriverInfo(audioDrivers, (int)audioType);
+
+ if (info == null)
+ throw new AgateException(string.Format("Could not find the driver {0}.", audioType));
+
+ return (AudioImpl)CreateDriverInstance(info);
+ }
+ internal static InputImpl CreateInputDriver(InputTypeID inputType)
+ {
+ if (inputDrivers.Count == 0)
+ throw new AgateException("No audio drivers registered.");
+
+ AgateDriverInfo info = null;
string text;
-
- if (inputType == InputTypeID.AutoSelect &&
- Core.Settings["AgateLib"].TryGetValue("InputDriver", out text))
+
+ bool settingsSelect = inputType == InputTypeID.AutoSelect;
+ settingsSelect &= Core.Settings["AgateLib"].TryGetValue("AudioDriver", out text);
+
+ if (settingsSelect)
{
info = FindDriverInfo(inputDrivers, text);
+
+ if (info == null)
+ settingsSelect = false;
}
- else
+
+ if (settingsSelect == false)
info = FindDriverInfo(inputDrivers, (int)inputType);
-
- if (info == null)
- throw new AgateException(string.Format("Could not find the driver {0}.", inputType));
-
- return (InputImpl)CreateDriverInstance(info);
- }
-
- private static AgateDriverInfo FindDriverInfo(List<AgateDriverInfo> driverList, string matchText)
- {
- AgateDriverInfo retval = null;
-
- if (driverList.Count == 0)
- return null;
-
- foreach(AgateDriverInfo info in driverList)
- {
- if (info.FriendlyName.Contains(matchText))
- retval = info;
- }
-
- return retval;
- }
- private static AgateDriverInfo FindDriverInfo(List<AgateDriverInfo> driverList, int typeID)
- {
- AgateDriverInfo theInfo = null;
-
- if (driverList.Count == 0)
- return null;
-
- // autoselect ID's are all zero
- if (typeID == 0)
- return driverList[0];
-
- foreach (AgateDriverInfo info in driverList)
- {
- if (info.DriverTypeID != typeID)
- continue;
-
- theInfo = info;
- }
- return theInfo;
- }
- private static AgateDriverInfo FindDriverInfo(IEnumerable<AgateDriverInfo> driverList, string assemblyFullName)
- {
- AgateDriverInfo theInfo = null;
-
- foreach (AgateDriverInfo info in driverList)
- {
- if (info.AssemblyName != assemblyFullName)
- continue;
-
- theInfo = info;
- }
- return theInfo;
- }
-
- private static object CreateDriverInstance(AgateDriverInfo info)
- {
- Assembly ass = Assembly.Load(info.AssemblyName);
-
- Type driverType = ass.GetType(info.DriverTypeName, false);
-
- if (driverType == null)
- throw new AgateException(string.Format(
- "Could not find the type {0} in the library {1}.",
- info.DriverTypeName,
- ass.FullName));
-
- return Activator.CreateInstance(driverType);
- }
-
- private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
- {
- AgateDriverInfo info = null;
-
- info = info ?? FindDriverInfo(displayDrivers, args.Name);
- info = info ?? FindDriverInfo(audioDrivers, args.Name);
- info = info ?? FindDriverInfo(inputDrivers, args.Name);
- info = info ?? FindDriverInfo(desktopDrivers, args.Name);
-
- if (info == null)
- return null;
-
- return LoadAssemblyLoadFrom(info);
- }
-
- private static Assembly LoadAssemblyLoadFrom(AgateDriverInfo info)
- {
- Core.ErrorReporting.Report(ErrorLevel.Warning,
- string.Format("Assembly {0} was loaded in the LoadFrom context. Move it to the application directory to load in the Load context.", info.AssemblyName), null);
- return Assembly.LoadFrom(info.AssemblyFile);
- }
-
- /// <summary>
- /// Returns a collection with all the DriverInfo<DisplayTypeID> structures for
- /// registered display drivers.
- /// </summary>
- /// <returns></returns>
- public static List<AgateDriverInfo> DisplayDrivers
- {
- get { return displayDrivers; }
- }
- /// <summary>
- /// Returns a collection with all the DriverInfo<AudioTypeID> structures for
- /// registered display drivers.
- /// </summary>
- /// <returns></returns>
- public static List<AgateDriverInfo> AudioDrivers
- {
- get { return audioDrivers; }
- }
- /// <summary>
- /// Returns a collection with all the DriverInfo<InputTypeID> structures for
- /// registered display drivers.
- /// </summary>
- /// <returns></returns>
- public static List<AgateDriverInfo> InputDrivers
- {
- get { return inputDr...
[truncated message content] |
|
From: <ka...@us...> - 2011-11-22 21:13:03
|
Revision: 1307
http://agate.svn.sourceforge.net/agate/?rev=1307&view=rev
Author: kanato
Date: 2011-11-22 21:12:54 +0000 (Tue, 22 Nov 2011)
Log Message:
-----------
Storing testing settings in a file.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/Drivers/Registrar.cs
trunk/AgateLib/Platform.cs
trunk/AgateLib/Settings/PersistantSettings.cs
trunk/AgateLib/Settings/SettingsGroup.cs
trunk/Drivers/AgateOTK/GL_Display.cs
trunk/Tests/Tests.csproj
trunk/Tests/frmLauncher.cs
Added Paths:
-----------
trunk/AgateLib/Settings/ISettingsTracer.cs
trunk/Tests/settings_list.txt
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2011-11-22 17:57:40 UTC (rev 1306)
+++ trunk/AgateLib/AgateLib.csproj 2011-11-22 21:12:54 UTC (rev 1307)
@@ -584,6 +584,7 @@
<LastGenOutput>DataResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<Compile Include="DisplayLib\Shaders\IShader2D.cs" />
+ <Compile Include="Settings\ISettingsTracer.cs" />
</ItemGroup>
<ItemGroup>
<None Include="InternalResources\agate-black-gui.zip" />
Modified: trunk/AgateLib/Drivers/Registrar.cs
===================================================================
--- trunk/AgateLib/Drivers/Registrar.cs 2011-11-22 17:57:40 UTC (rev 1306)
+++ trunk/AgateLib/Drivers/Registrar.cs 2011-11-22 21:12:54 UTC (rev 1307)
@@ -1,519 +1,519 @@
-// 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-2011.
-// All Rights Reserved.
-//
-// Contributor(s): Erik Ylvisaker
-//
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using AgateLib.AudioLib.ImplementationBase;
-using AgateLib.DisplayLib.ImplementationBase;
-using AgateLib.InputLib.ImplementationBase;
-using AgateLib.Utility;
-
-namespace AgateLib.Drivers
-{
- /// <summary>
- /// Static class with which drivers register themselves so that the library can
- /// instantiate them.
- /// </summary>
- public static class Registrar
- {
- private static List<AgateDriverInfo>
- displayDrivers = new List<AgateDriverInfo>(),
- audioDrivers = new List<AgateDriverInfo>(),
- inputDrivers = new List<AgateDriverInfo>(),
- desktopDrivers = new List<AgateDriverInfo>();
-
- private static bool mIsInitialized = false;
-
- private static IDesktopDriver mDesktop;
-
- private static readonly string[] KnownNativeLibraries = new string[]
- {
- "SDL.dll",
- "SDL_mixer.dll",
- "libogg-0.dll",
- "libvorbis-0.dll",
- "libvorbisfile-3.dll",
- };
-
-
- static bool Contains(this IEnumerable<AgateDriverInfo> list, DisplayTypeID type)
- {
- return list.Any(
- x => Comparator(x, DriverType.Display, (int)type));
- }
- static bool Contains(this IEnumerable<AgateDriverInfo> list, AudioTypeID type)
- {
- return list.Any(
- x => Comparator(x, DriverType.Audio, (int)type));
- }
- static bool Contains(this IEnumerable<AgateDriverInfo> list, InputTypeID type)
- {
- return list.Any(
- x => Comparator(x, DriverType.Input, (int)type));
- }
- static bool Comparator(AgateDriverInfo info, DriverType driverType, int type)
- {
- return info.DriverType == driverType && info.DriverTypeID == type;
- }
-
- static Registrar()
- {
- }
- /// <summary>
- /// Searches through FileManager.AssemblyPath for all *.dll files. These files
- /// are loaded and searched for classes which derive from DisplayImpl, AudioImpl, etc.
- /// </summary>
- internal static void Initialize()
- {
- if (mIsInitialized)
- return;
-
- RegisterNullDrivers();
-
- AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
- AppDomain sandbox = AppDomain.CreateDomain("AgateSandBox");
-
- AgateSandBoxLoader loader = (AgateSandBoxLoader)
- sandbox.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName,
- typeof(AgateSandBoxLoader).FullName);
-
- IEnumerable<string> files = AgateFileProvider.Assemblies.GetAllFiles("*.dll");
-
- foreach (string file in files)
- {
- if (ShouldSkipLibrary(file))
- continue;
-
- foreach (AgateDriverInfo info in loader.ReportDrivers(file))
- {
- switch (info.DriverType)
- {
- case DriverType.Display:
- displayDrivers.Add(info);
- break;
-
- case DriverType.Audio:
- audioDrivers.Add(info);
- break;
-
- case DriverType.Input:
- inputDrivers.Add(info);
- break;
-
- case DriverType.Desktop:
- desktopDrivers.Add(info);
- break;
-
- default:
- Core.ErrorReporting.Report(ErrorLevel.Warning, string.Format(
- "Could not interpret DriverType returned by type {0} in assembly {1}.",
- info.DriverTypeName, info.AssemblyFile), null);
-
- break;
- }
- }
- }
-
- AppDomain.Unload(sandbox);
-
- SortDriverInfo(displayDrivers);
- SortDriverInfo(audioDrivers);
- SortDriverInfo(inputDrivers);
- SortDriverInfo(desktopDrivers);
-
- mIsInitialized = true;
- }
- private static void SortDriverInfo(List<AgateDriverInfo> driverList)
- {
- // sorts the driver list in reverse order.
- driverList.Sort(delegate(AgateDriverInfo a, AgateDriverInfo b)
- {
- return -a.Priority.CompareTo(b.Priority);
- });
- }
-
- private static void RegisterNullDrivers()
- {
- Assembly thisAssembly = Assembly.GetExecutingAssembly();
-
- AgateDriverInfo nullAudioInfo = new AgateDriverInfo(AudioTypeID.Silent,
- typeof(NullSoundImpl), "No audio", -100);
-
- nullAudioInfo.AssemblyFile = thisAssembly.CodeBase;
- nullAudioInfo.AssemblyName = thisAssembly.FullName;
-
- audioDrivers.Add(nullAudioInfo);
-
- AgateDriverInfo nullInputInfo = new AgateDriverInfo(InputTypeID.Silent,
- typeof(NullInputImpl), "No input", -100);
-
- nullInputInfo.AssemblyFile = thisAssembly.CodeBase;
- nullInputInfo.AssemblyName = thisAssembly.FullName;
-
- inputDrivers.Add(nullInputInfo);
- }
-
- private static bool ShouldSkipLibrary(string file)
- {
- // Native libraries in the same directory will give an error when loaded,
- // so skip any ones that we know about that will probably be in the same
- // directory as the drivers.
- if (IsKnownNativeLibrary(file))
- return true;
-
- // hack, because mono crashes if AgateMDX.dll is present.
- // annoying, because it should report a failure to load the types in the
- // assembly, and then the try catch should continue after that.
- // TODO: this hack seems unnecessary in recent versions of Mono. Should it be removed?
- if ((Environment.OSVersion.Platform == PlatformID.Unix ||
- Environment.OSVersion.Platform == (PlatformID)128) &&
- (System.IO.Path.GetFileName(file).ToLower().Contains("agatemdx.dll") ||
- System.IO.Path.GetFileName(file).ToLower().Contains("agatesdx.dll")))
- {
- Core.ErrorReporting.Report(ErrorLevel.Comment,
- string.Format("DirectX not supported on non-Windows platforms. {0}Remove {1} to eliminate this message.",
- Environment.NewLine, System.IO.Path.GetFileName(file)), null);
-
- return true;
- }
-
- // Skip the agatelib dll.
- if (System.IO.Path.GetFileName(file).ToLower().Contains("agatelib.dll"))
- return true;
-
- return false;
- }
- private static bool IsKnownNativeLibrary(string path)
- {
- string filename = System.IO.Path.GetFileName(path).ToLowerInvariant();
-
- for (int i = 0; i < KnownNativeLibraries.Length; i++)
- {
- if (KnownNativeLibraries[i].ToLowerInvariant() == filename)
- return true;
- }
- return false;
- }
-
-
- /// <summary>
- /// Asks the user to select which drivers to use.
- /// </summary>
- /// <param name="chooseDisplay"></param>
- /// <param name="chooseAudio"></param>
- /// <param name="chooseInput"></param>
- /// <param name="selectedDisplay"></param>
- /// <param name="selectedAudio"></param>
- /// <param name="selectedInput"></param>
- /// <returns></returns>
- internal static bool UserSelectDrivers(bool chooseDisplay, bool chooseAudio, bool chooseInput,
- DisplayTypeID preferredDisplay, AudioTypeID preferredAudio, InputTypeID preferredInput,
- out DisplayTypeID selectedDisplay, out AudioTypeID selectedAudio, out InputTypeID selectedInput)
- {
- if (mDesktop == null)
- {
- CreateDesktopDriver();
-
- if (mDesktop == null)
- {
- SelectBestDrivers(chooseDisplay, chooseAudio, chooseInput,
- preferredDisplay, preferredAudio, preferredInput,
- out selectedDisplay, out selectedAudio, out selectedInput);
-
- return true;
- }
- }
-
- IUserSetSystems frm = mDesktop.CreateUserSetSystems();
-
- // set default values.
- selectedDisplay = DisplayTypeID.AutoSelect;
- selectedAudio = AudioTypeID.AutoSelect;
- selectedInput = InputTypeID.AutoSelect;
-
- foreach (AgateDriverInfo info in displayDrivers)
- {
- frm.AddDisplayType(info);
- }
- foreach (AgateDriverInfo info in audioDrivers)
- {
- frm.AddAudioType(info);
- }
- foreach (AgateDriverInfo info in inputDrivers)
- {
- frm.AddInputType(info);
- }
-
- frm.SetChoices(chooseDisplay, chooseAudio, chooseInput,
- preferredDisplay, preferredAudio, preferredInput);
-
- // run the dialog asking user which drivers to use.
- if (frm.RunDialog() == SetSystemsDialogResult.Cancel)
- {
- return false;
- }
-
- selectedDisplay = frm.DisplayType;
- selectedAudio = frm.AudioType;
- selectedInput = frm.InputType;
-
- return true;
-
- }
-
- private static void SelectBestDrivers(bool chooseDisplay, bool chooseAudio, bool chooseInput,
- DisplayTypeID preferredDisplay, AudioTypeID preferredAudio, InputTypeID preferredInput,
- out DisplayTypeID selectedDisplay, out AudioTypeID selectedAudio, out InputTypeID selectedInput)
- {
- // initial return values if a driver isn't selected.
- selectedDisplay = DisplayTypeID.AutoSelect;
- selectedAudio = AudioTypeID.AutoSelect;
- selectedInput = InputTypeID.AutoSelect;
-
- if (preferredDisplay != DisplayTypeID.AutoSelect && displayDrivers.Contains(preferredDisplay))
- selectedDisplay = preferredDisplay;
- else if (displayDrivers.Count > 0)
- selectedDisplay = (DisplayTypeID)displayDrivers[0].DriverTypeID;
-
- if (preferredAudio != AudioTypeID.AutoSelect && audioDrivers.Contains(preferredAudio))
- selectedAudio = preferredAudio;
- else if (audioDrivers.Count > 0)
- selectedAudio = (AudioTypeID)audioDrivers[0].DriverTypeID;
-
- if (preferredInput != InputTypeID.AutoSelect && inputDrivers.Contains(preferredInput))
- selectedInput = preferredInput;
- else if (inputDrivers.Count > 0)
- selectedInput = (InputTypeID)inputDrivers[0].DriverTypeID;
- }
-
- private static void CreateDesktopDriver()
- {
- if (desktopDrivers.Count == 0)
- return;
-
- mDesktop = (IDesktopDriver)CreateDriverInstance(desktopDrivers[0]);
- }
-
- internal static IDesktopDriver WinForms
- {
- get { return mDesktop; }
- }
-
- internal static DisplayImpl CreateDisplayDriver(DisplayTypeID displayType)
- {
- if (displayDrivers.Count == 0)
- throw new AgateException("No display drivers registered.");
-
- AgateDriverInfo info = null;
- string text;
-
- bool settingsSelect = displayType == DisplayTypeID.AutoSelect;
- settingsSelect &= Core.Settings["AgateLib"].TryGetValue("DisplayDriver", out text);
-
- if (settingsSelect)
- {
- info = FindDriverInfo(displayDrivers, text);
-
- if (info == null)
- settingsSelect = false;
- }
-
- if (settingsSelect == false)
- info = FindDriverInfo(displayDrivers, (int)displayType);
-
- if (info == null)
- throw new AgateException(string.Format("Could not find the driver {0}.", displayType));
-
- return (DisplayImpl)CreateDriverInstance(info);
- }
- internal static AudioImpl CreateAudioDriver(AudioTypeID audioType)
- {
- if (audioDrivers.Count == 0)
- throw new AgateException("No audio drivers registered.");
-
- AgateDriverInfo info = null;
- string text;
-
- bool settingsSelect = audioType == AudioTypeID.AutoSelect;
- settingsSelect &= Core.Settings["AgateLib"].TryGetValue("AudioDriver", out text);
-
- if (settingsSelect)
- {
- info = FindDriverInfo(audioDrivers, text);
-
- if (info == null)
- settingsSelect = false;
- }
-
- if (settingsSelect == false)
- info = FindDriverInfo(audioDrivers, (int)audioType);
-
- if (info == null)
- throw new AgateException(string.Format("Could not find the driver {0}.", audioType));
-
- return (AudioImpl)CreateDriverInstance(info);
- }
- internal static InputImpl CreateInputDriver(InputTypeID inputType)
- {
- if (inputDrivers.Count == 0)
- throw new AgateException("No audio drivers registered.");
-
- AgateDriverInfo info = null;
- string text;
-
- bool settingsSelect = inputType == InputTypeID.AutoSelect;
- settingsSelect &= Core.Settings["AgateLib"].TryGetValue("AudioDriver", out text);
-
- if (settingsSelect)
- {
- info = FindDriverInfo(inputDrivers, text);
-
- if (info == null)
- settingsSelect = false;
- }
-
- if (settingsSelect == false)
- info = FindDriverInfo(inputDrivers, (int)inputType);
-
- if (info == null)
- throw new AgateException(string.Format("Could not find the driver {0}.", inputType));
-
- return (InputImpl)CreateDriverInstance(info);
- }
-
- private static AgateDriverInfo FindDriverInfo(List<AgateDriverInfo> driverList, string matchText)
- {
- AgateDriverInfo retval = null;
-
- if (driverList.Count == 0)
- return null;
-
- foreach(AgateDriverInfo info in driverList)
- {
- if (info.FriendlyName.Contains(matchText))
- retval = info;
- }
-
- return retval;
- }
- private static AgateDriverInfo FindDriverInfo(List<AgateDriverInfo> driverList, int typeID)
- {
- AgateDriverInfo theInfo = null;
-
- if (driverList.Count == 0)
- return null;
-
- // autoselect ID's are all zero
- if (typeID == 0)
- return driverList[0];
-
- foreach (AgateDriverInfo info in driverList)
- {
- if (info.DriverTypeID != typeID)
- continue;
-
- theInfo = info;
- }
- return theInfo;
- }
- private static AgateDriverInfo FindDriverInfo(IEnumerable<AgateDriverInfo> driverList, string assemblyFullName)
- {
- AgateDriverInfo theInfo = null;
-
- foreach (AgateDriverInfo info in driverList)
- {
- if (info.AssemblyName != assemblyFullName)
- continue;
-
- theInfo = info;
- }
- return theInfo;
- }
-
- private static object CreateDriverInstance(AgateDriverInfo info)
- {
- Assembly ass = Assembly.Load(info.AssemblyName);
-
- Type driverType = ass.GetType(info.DriverTypeName, false);
-
- if (driverType == null)
- throw new AgateException(string.Format(
- "Could not find the type {0} in the library {1}.",
- info.DriverTypeName,
- ass.FullName));
-
- return Activator.CreateInstance(driverType);
- }
-
- private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
- {
- AgateDriverInfo info = null;
-
- info = info ?? FindDriverInfo(displayDrivers, args.Name);
- info = info ?? FindDriverInfo(audioDrivers, args.Name);
- info = info ?? FindDriverInfo(inputDrivers, args.Name);
- info = info ?? FindDriverInfo(desktopDrivers, args.Name);
-
- if (info == null)
- return null;
-
- return LoadAssemblyLoadFrom(info);
- }
-
- private static Assembly LoadAssemblyLoadFrom(AgateDriverInfo info)
- {
- Core.ErrorReporting.Report(ErrorLevel.Warning,
- string.Format("Assembly {0} was loaded in the LoadFrom context. Move it to the application directory to load in the Load context.", info.AssemblyName), null);
- return Assembly.LoadFrom(info.AssemblyFile);
- }
-
- /// <summary>
- /// Returns a collection with all the DriverInfo<DisplayTypeID> structures for
- /// registered display drivers.
- /// </summary>
- /// <returns></returns>
- public static List<AgateDriverInfo> DisplayDrivers
- {
- get { return displayDrivers; }
- }
- /// <summary>
- /// Returns a collection with all the DriverInfo<AudioTypeID> structures for
- /// registered display drivers.
- /// </summary>
- /// <returns></returns>
- public static List<AgateDriverInfo> AudioDrivers
- {
- get { return audioDrivers; }
- }
- /// <summary>
- /// Returns a collection with all the DriverInfo<InputTypeID> structures for
- /// registered display drivers.
- /// </summary>
- /// <returns></returns>
- public static List<AgateDriverInfo> InputDrivers
- {
- get { return inputDrivers; }
- }
-
-
- }
-}
+// 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-2011.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using AgateLib.AudioLib.ImplementationBase;
+using AgateLib.DisplayLib.ImplementationBase;
+using AgateLib.InputLib.ImplementationBase;
+using AgateLib.Utility;
+
+namespace AgateLib.Drivers
+{
+ /// <summary>
+ /// Static class with which drivers register themselves so that the library can
+ /// instantiate them.
+ /// </summary>
+ public static class Registrar
+ {
+ private static List<AgateDriverInfo>
+ displayDrivers = new List<AgateDriverInfo>(),
+ audioDrivers = new List<AgateDriverInfo>(),
+ inputDrivers = new List<AgateDriverInfo>(),
+ desktopDrivers = new List<AgateDriverInfo>();
+
+ private static bool mIsInitialized = false;
+
+ private static IDesktopDriver mDesktop;
+
+ private static readonly string[] KnownNativeLibraries = new string[]
+ {
+ "SDL.dll",
+ "SDL_mixer.dll",
+ "libogg-0.dll",
+ "libvorbis-0.dll",
+ "libvorbisfile-3.dll",
+ };
+
+
+ static bool Contains(this IEnumerable<AgateDriverInfo> list, DisplayTypeID type)
+ {
+ return list.Any(
+ x => Comparator(x, DriverType.Display, (int)type));
+ }
+ static bool Contains(this IEnumerable<AgateDriverInfo> list, AudioTypeID type)
+ {
+ return list.Any(
+ x => Comparator(x, DriverType.Audio, (int)type));
+ }
+ static bool Contains(this IEnumerable<AgateDriverInfo> list, InputTypeID type)
+ {
+ return list.Any(
+ x => Comparator(x, DriverType.Input, (int)type));
+ }
+ static bool Comparator(AgateDriverInfo info, DriverType driverType, int type)
+ {
+ return info.DriverType == driverType && info.DriverTypeID == type;
+ }
+
+ static Registrar()
+ {
+ }
+ /// <summary>
+ /// Searches through FileManager.AssemblyPath for all *.dll files. These files
+ /// are loaded and searched for classes which derive from DisplayImpl, AudioImpl, etc.
+ /// </summary>
+ internal static void Initialize()
+ {
+ if (mIsInitialized)
+ return;
+
+ RegisterNullDrivers();
+
+ AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
+ AppDomain sandbox = AppDomain.CreateDomain("AgateSandBox");
+
+ AgateSandBoxLoader loader = (AgateSandBoxLoader)
+ sandbox.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName,
+ typeof(AgateSandBoxLoader).FullName);
+
+ IEnumerable<string> files = AgateFileProvider.Assemblies.GetAllFiles("*.dll");
+
+ foreach (string file in files)
+ {
+ if (ShouldSkipLibrary(file))
+ continue;
+
+ foreach (AgateDriverInfo info in loader.ReportDrivers(file))
+ {
+ switch (info.DriverType)
+ {
+ case DriverType.Display:
+ displayDrivers.Add(info);
+ break;
+
+ case DriverType.Audio:
+ audioDrivers.Add(info);
+ break;
+
+ case DriverType.Input:
+ inputDrivers.Add(info);
+ break;
+
+ case DriverType.Desktop:
+ desktopDrivers.Add(info);
+ break;
+
+ default:
+ Core.ErrorReporting.Report(ErrorLevel.Warning, string.Format(
+ "Could not interpret DriverType returned by type {0} in assembly {1}.",
+ info.DriverTypeName, info.AssemblyFile), null);
+
+ break;
+ }
+ }
+ }
+
+ AppDomain.Unload(sandbox);
+
+ SortDriverInfo(displayDrivers);
+ SortDriverInfo(audioDrivers);
+ SortDriverInfo(inputDrivers);
+ SortDriverInfo(desktopDrivers);
+
+ mIsInitialized = true;
+ }
+ private static void SortDriverInfo(List<AgateDriverInfo> driverList)
+ {
+ // sorts the driver list in reverse order.
+ driverList.Sort(delegate(AgateDriverInfo a, AgateDriverInfo b)
+ {
+ return -a.Priority.CompareTo(b.Priority);
+ });
+ }
+
+ private static void RegisterNullDrivers()
+ {
+ Assembly thisAssembly = Assembly.GetExecutingAssembly();
+
+ AgateDriverInfo nullAudioInfo = new AgateDriverInfo(AudioTypeID.Silent,
+ typeof(NullSoundImpl), "No audio", -100);
+
+ nullAudioInfo.AssemblyFile = thisAssembly.CodeBase;
+ nullAudioInfo.AssemblyName = thisAssembly.FullName;
+
+ audioDrivers.Add(nullAudioInfo);
+
+ AgateDriverInfo nullInputInfo = new AgateDriverInfo(InputTypeID.Silent,
+ typeof(NullInputImpl), "No input", -100);
+
+ nullInputInfo.AssemblyFile = thisAssembly.CodeBase;
+ nullInputInfo.AssemblyName = thisAssembly.FullName;
+
+ inputDrivers.Add(nullInputInfo);
+ }
+
+ private static bool ShouldSkipLibrary(string file)
+ {
+ // Native libraries in the same directory will give an error when loaded,
+ // so skip any ones that we know about that will probably be in the same
+ // directory as the drivers.
+ if (IsKnownNativeLibrary(file))
+ return true;
+
+ // hack, because mono crashes if AgateMDX.dll is present.
+ // annoying, because it should report a failure to load the types in the
+ // assembly, and then the try catch should continue after that.
+ // TODO: this hack seems unnecessary in recent versions of Mono. Should it be removed?
+ if ((Environment.OSVersion.Platform == PlatformID.Unix ||
+ Environment.OSVersion.Platform == (PlatformID)128) &&
+ (System.IO.Path.GetFileName(file).ToLower().Contains("agatemdx.dll") ||
+ System.IO.Path.GetFileName(file).ToLower().Contains("agatesdx.dll")))
+ {
+ Core.ErrorReporting.Report(ErrorLevel.Comment,
+ string.Format("DirectX not supported on non-Windows platforms. {0}Remove {1} to eliminate this message.",
+ Environment.NewLine, System.IO.Path.GetFileName(file)), null);
+
+ return true;
+ }
+
+ // Skip the agatelib dll.
+ if (System.IO.Path.GetFileName(file).ToLower().Contains("agatelib.dll"))
+ return true;
+
+ return false;
+ }
+ private static bool IsKnownNativeLibrary(string path)
+ {
+ string filename = System.IO.Path.GetFileName(path).ToLowerInvariant();
+
+ for (int i = 0; i < KnownNativeLibraries.Length; i++)
+ {
+ if (KnownNativeLibraries[i].ToLowerInvariant() == filename)
+ return true;
+ }
+ return false;
+ }
+
+
+ /// <summary>
+ /// Asks the user to select which drivers to use.
+ /// </summary>
+ /// <param name="chooseDisplay"></param>
+ /// <param name="chooseAudio"></param>
+ /// <param name="chooseInput"></param>
+ /// <param name="selectedDisplay"></param>
+ /// <param name="selectedAudio"></param>
+ /// <param name="selectedInput"></param>
+ /// <returns></returns>
+ internal static bool UserSelectDrivers(bool chooseDisplay, bool chooseAudio, bool chooseInput,
+ DisplayTypeID preferredDisplay, AudioTypeID preferredAudio, InputTypeID preferredInput,
+ out DisplayTypeID selectedDisplay, out AudioTypeID selectedAudio, out InputTypeID selectedInput)
+ {
+ if (mDesktop == null)
+ {
+ CreateDesktopDriver();
+
+ if (mDesktop == null)
+ {
+ SelectBestDrivers(chooseDisplay, chooseAudio, chooseInput,
+ preferredDisplay, preferredAudio, preferredInput,
+ out selectedDisplay, out selectedAudio, out selectedInput);
+
+ return true;
+ }
+ }
+
+ IUserSetSystems frm = mDesktop.CreateUserSetSystems();
+
+ // set default values.
+ selectedDisplay = DisplayTypeID.AutoSelect;
+ selectedAudio = AudioTypeID.AutoSelect;
+ selectedInput = InputTypeID.AutoSelect;
+
+ foreach (AgateDriverInfo info in displayDrivers)
+ {
+ frm.AddDisplayType(info);
+ }
+ foreach (AgateDriverInfo info in audioDrivers)
+ {
+ frm.AddAudioType(info);
+ }
+ foreach (AgateDriverInfo info in inputDrivers)
+ {
+ frm.AddInputType(info);
+ }
+
+ frm.SetChoices(chooseDisplay, chooseAudio, chooseInput,
+ preferredDisplay, preferredAudio, preferredInput);
+
+ // run the dialog asking user which drivers to use.
+ if (frm.RunDialog() == SetSystemsDialogResult.Cancel)
+ {
+ return false;
+ }
+
+ selectedDisplay = frm.DisplayType;
+ selectedAudio = frm.AudioType;
+ selectedInput = frm.InputType;
+
+ return true;
+
+ }
+
+ private static void SelectBestDrivers(bool chooseDisplay, bool chooseAudio, bool chooseInput,
+ DisplayTypeID preferredDisplay, AudioTypeID preferredAudio, InputTypeID preferredInput,
+ out DisplayTypeID selectedDisplay, out AudioTypeID selectedAudio, out InputTypeID selectedInput)
+ {
+ // initial return values if a driver isn't selected.
+ selectedDisplay = DisplayTypeID.AutoSelect;
+ selectedAudio = AudioTypeID.AutoSelect;
+ selectedInput = InputTypeID.AutoSelect;
+
+ if (preferredDisplay != DisplayTypeID.AutoSelect && displayDrivers.Contains(preferredDisplay))
+ selectedDisplay = preferredDisplay;
+ else if (displayDrivers.Count > 0)
+ selectedDisplay = (DisplayTypeID)displayDrivers[0].DriverTypeID;
+
+ if (preferredAudio != AudioTypeID.AutoSelect && audioDrivers.Contains(preferredAudio))
+ selectedAudio = preferredAudio;
+ else if (audioDrivers.Count > 0)
+ selectedAudio = (AudioTypeID)audioDrivers[0].DriverTypeID;
+
+ if (preferredInput != InputTypeID.AutoSelect && inputDrivers.Contains(preferredInput))
+ selectedInput = preferredInput;
+ else if (inputDrivers.Count > 0)
+ selectedInput = (InputTypeID)inputDrivers[0].DriverTypeID;
+ }
+
+ private static void CreateDesktopDriver()
+ {
+ if (desktopDrivers.Count == 0)
+ return;
+
+ mDesktop = (IDesktopDriver)CreateDriverInstance(desktopDrivers[0]);
+ }
+
+ internal static IDesktopDriver WinForms
+ {
+ get { return mDesktop; }
+ }
+
+ internal static DisplayImpl CreateDisplayDriver(DisplayTypeID displayType)
+ {
+ if (displayDrivers.Count == 0)
+ throw new AgateException("No display drivers registered.");
+
+ AgateDriverInfo info = null;
+ string text;
+
+ bool settingsSelect = displayType == DisplayTypeID.AutoSelect;
+ settingsSelect &= Core.Settings["AgateLib"].TryGetValue("DisplayDriver", out text);
+
+ if (settingsSelect)
+ {
+ info = FindDriverInfo(displayDrivers, text);
+
+ if (info == null)
+ settingsSelect = false;
+ }
+
+ if (settingsSelect == false)
+ info = FindDriverInfo(displayDrivers, (int)displayType);
+
+ if (info == null)
+ throw new AgateException(string.Format("Could not find the driver {0}.", displayType));
+
+ return (DisplayImpl)CreateDriverInstance(info);
+ }
+ internal static AudioImpl CreateAudioDriver(AudioTypeID audioType)
+ {
+ if (audioDrivers.Count == 0)
+ throw new AgateException("No audio drivers registered.");
+
+ AgateDriverInfo info = null;
+ string text;
+
+ bool settingsSelect = audioType == AudioTypeID.AutoSelect;
+ settingsSelect &= Core.Settings["AgateLib"].TryGetValue("AudioDriver", out text);
+
+ if (settingsSelect)
+ {
+ info = FindDriverInfo(audioDrivers, text);
+
+ if (info == null)
+ settingsSelect = false;
+ }
+
+ if (settingsSelect == false)
+ info = FindDriverInfo(audioDrivers, (int)audioType);
+
+ if (info == null)
+ throw new AgateException(string.Format("Could not find the driver {0}.", audioType));
+
+ return (AudioImpl)CreateDriverInstance(info);
+ }
+ internal static InputImpl CreateInputDriver(InputTypeID inputType)
+ {
+ if (inputDrivers.Count == 0)
+ throw new AgateException("No audio drivers registered.");
+
+ AgateDriverInfo info = null;
+ string text;
+
+ bool settingsSelect = inputType == InputTypeID.AutoSelect;
+ settingsSelect &= Core.Settings["AgateLib"].TryGetValue("InputDriver", out text);
+
+ if (settingsSelect)
+ {
+ info = FindDriverInfo(inputDrivers, text);
+
+ if (info == null)
+ settingsSelect = false;
+ }
+
+ if (settingsSelect == false)
+ info = FindDriverInfo(inputDrivers, (int)inputType);
+
+ if (info == null)
+ throw new AgateException(string.Format("Could not find the driver {0}.", inputType));
+
+ return (InputImpl)CreateDriverInstance(info);
+ }
+
+ private static AgateDriverInfo FindDriverInfo(List<AgateDriverInfo> driverList, string matchText)
+ {
+ AgateDriverInfo retval = null;
+
+ if (driverList.Count == 0)
+ return null;
+
+ foreach(AgateDriverInfo info in driverList)
+ {
+ if (info.FriendlyName.Contains(matchText))
+ retval = info;
+ }
+
+ return retval;
+ }
+ private static AgateDriverInfo FindDriverInfo(List<AgateDriverInfo> driverList, int typeI...
[truncated message content] |
|
From: <ka...@us...> - 2011-11-23 04:33:29
|
Revision: 1308
http://agate.svn.sourceforge.net/agate/?rev=1308&view=rev
Author: kanato
Date: 2011-11-23 04:33:21 +0000 (Wed, 23 Nov 2011)
Log Message:
-----------
Another attempt at GL3 primitives. Not working.
Modified Paths:
--------------
trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs
trunk/AgateLib/Geometry/RectangleF.cs
trunk/Drivers/AgateOTK/GL3/GLPrimitiveRenderer.cs
trunk/Drivers/AgateOTK/GL_Display.cs
trunk/Tests/DisplayTests/BasicDrawing/BasicDrawing.cs
trunk/Tests/frmLauncher.cs
trunk/Tests/settings_list.txt
Modified: trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs 2011-11-22 21:12:54 UTC (rev 1307)
+++ trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs 2011-11-23 04:33:21 UTC (rev 1308)
@@ -505,7 +505,7 @@
/// <param name="color"></param>
public virtual void DrawLines(Point[] pt, int startIndex, int length, Color color)
{
- for (int i = startIndex; i < startIndex + pt.Length - 1; i++)
+ for (int i = startIndex; i < startIndex + length - 1; i++)
DrawLine(pt[i], pt[i + 1], color);
}
/// <summary>
Modified: trunk/AgateLib/Geometry/RectangleF.cs
===================================================================
--- trunk/AgateLib/Geometry/RectangleF.cs 2011-11-22 21:12:54 UTC (rev 1307)
+++ trunk/AgateLib/Geometry/RectangleF.cs 2011-11-23 04:33:21 UTC (rev 1308)
@@ -234,6 +234,16 @@
return !a.Equals(b);
}
+ /// <summary>
+ /// Conversion to Rectangle structure.
+ /// </summary>
+ /// <param name="r"></param>
+ /// <returns></returns>
+ public static explicit operator Rectangle(RectangleF r)
+ {
+ return new Rectangle((int)r.X, (int)r.Y, (int)r.Width, (int)r.Height);
+ }
+
#endregion
#region --- Object Overrides ---
Modified: trunk/Drivers/AgateOTK/GL3/GLPrimitiveRenderer.cs
===================================================================
--- trunk/Drivers/AgateOTK/GL3/GLPrimitiveRenderer.cs 2011-11-22 21:12:54 UTC (rev 1307)
+++ trunk/Drivers/AgateOTK/GL3/GLPrimitiveRenderer.cs 2011-11-23 04:33:21 UTC (rev 1308)
@@ -36,49 +36,28 @@
/// </summary>
class GLPrimitiveRenderer : PrimitiveRenderer
{
- PositionColor[] mVerts = new PositionColor[6];
+ PositionTextureColor[] mVerts = new PositionTextureColor[12];
int mBufferID;
int mVaoID;
+ GL_Display mDisplay;
+
public GLPrimitiveRenderer()
{
+ mDisplay = (GL_Display)Display.Impl;
+
GL.GenBuffers(1, out mBufferID);
GL.GenVertexArrays(1, out mVaoID);
Debug.Print("GL3 PrimitiveRenderer: Draw buffer ID: {0}", mBufferID);
}
- public void SetGLColor(Color color)
+ GL_Surface WhiteSurface
{
- GL.Color4(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, color.A / 255.0f);
+ get { return (GL_Surface) mDisplay.WhiteSurface.Impl; }
}
- public override void DrawLine(Point a, Point b, Color color)
- {
- mVerts[0].Position.X = a.X;
- mVerts[0].Position.Y = a.Y;
- mVerts[0].Color = color.ToArgb();
-
- mVerts[1].Position.X = b.X;
- mVerts[1].Position.Y = b.Y;
- mVerts[1].Color = color.ToArgb();
-
- BufferData();
-
- GL_Display display = (GL_Display)Display.Impl;
- Shaders.IGL3Shader shader = (Shaders.IGL3Shader)display.Shader.Impl;
-
- shader.SetVertexAttributes(PositionColor.VertexLayout);
-
- GL.ActiveTexture(TextureUnit.Texture0);
- GL.BindTexture(TextureTarget.Texture2D, 0);
- shader.SetTexture(0);
-
- GL.DrawArrays(BeginMode.Lines, 0, 1);
-
- }
-
private void BufferData()
{
GL.BindVertexArray(mVaoID);
@@ -97,8 +76,8 @@
IntPtr ptr = handle.AddrOfPinnedObject();
- GL.BufferData(BufferTarget.ArrayBuffer,
- (IntPtr)bufferSize, ptr,
+ GL.BufferData(BufferTarget.ArrayBuffer,
+ (IntPtr)bufferSize, ptr,
BufferUsageHint.StaticDraw);
}
finally
@@ -108,78 +87,122 @@
}
}
- public override void DrawRect(RectangleF rect, Color color)
+ public override void DrawLine(Point a, Point b, Color color)
{
- SetGLColor(color);
+ mVerts[0].Position.X = a.X;
+ mVerts[0].Position.Y = a.Y;
+ mVerts[0].TexCoord.X = 0;
+ mVerts[0].TexCoord.Y = 0;
+ mVerts[0].Color = color.ToArgb();
- GL.Disable(EnableCap.Texture2D);
- GL.Begin(BeginMode.Lines);
+ mVerts[1].Position.X = b.X;
+ mVerts[1].Position.Y = b.Y;
+ mVerts[1].TexCoord.X = 1;
+ mVerts[1].TexCoord.Y = 1;
+ mVerts[1].Color = color.ToArgb();
- GL.Vertex2(rect.Left, rect.Top);
- GL.Vertex2(rect.Right, rect.Top);
+ BufferData();
- GL.Vertex2(rect.Right, rect.Top);
- GL.Vertex2(rect.Right, rect.Bottom);
+ Shaders.IGL3Shader shader = (Shaders.IGL3Shader)mDisplay.Shader.Impl;
- GL.Vertex2(rect.Left, rect.Bottom);
- GL.Vertex2(rect.Right, rect.Bottom);
+ shader.SetVertexAttributes(PositionColor.VertexLayout);
- GL.Vertex2(rect.Left, rect.Top);
- GL.Vertex2(rect.Left, rect.Bottom);
+ GL.ActiveTexture(TextureUnit.Texture0);
+ GL.BindTexture(TextureTarget.Texture2D, WhiteSurface.GLTextureID);
+ shader.SetTexture(0);
- GL.End();
- GL.Enable(EnableCap.Texture2D);
+ GL.DrawArrays(BeginMode.Lines, 0, 1);
}
- public override void FillRect(RectangleF rect, Color color)
+ public override void DrawRect(RectangleF rect, Color color)
{
- SetGLColor(color);
+ mVerts[0].Position.X = rect.Left;
+ mVerts[0].Position.Y = rect.Top;
+ mVerts[0].TexCoord.X = 0;
+ mVerts[0].TexCoord.Y = 0;
- GL.Disable(EnableCap.Texture2D);
+ mVerts[1].Position.X = rect.Right;
+ mVerts[1].Position.Y = rect.Top;
+ mVerts[1].TexCoord.X = 1;
+ mVerts[1].TexCoord.Y = 0;
- GL.Begin(BeginMode.Quads);
- GL.Vertex3(rect.Left, rect.Top, 0); // Top Left
- GL.Vertex3(rect.Right, rect.Top, 0); // Top Right
- GL.Vertex3(rect.Right, rect.Bottom, 0); // Bottom Right
- GL.Vertex3(rect.Left, rect.Bottom, 0); // Bottom Left
- GL.End(); // Done Drawing The Quad
+ mVerts[2] = mVerts[1];
+
+ mVerts[3].Position.X = rect.Right;
+ mVerts[3].Position.Y = rect.Bottom;
+ mVerts[3].TexCoord.X = 1;
+ mVerts[3].TexCoord.Y = 1;
+
+ mVerts[4] = mVerts[3];
- GL.Enable(EnableCap.Texture2D);
- }
- public override void FillRect(RectangleF rect, Gradient color)
- {
- GL.Disable(EnableCap.Texture2D);
+ mVerts[5].Position.X = rect.Left;
+ mVerts[5].Position.Y = rect.Bottom;
+ mVerts[5].TexCoord.X = 0;
+ mVerts[5].TexCoord.Y = 1;
+
+ mVerts[6] = mVerts[3];
- GL.Begin(BeginMode.Quads);
- SetGLColor(color.TopLeft);
- GL.Vertex3(rect.Left, rect.Top, 0); // Top Left
+ mVerts[7].Position.X = rect.Left;
+ mVerts[7].Position.Y = rect.Top;
+ mVerts[7].TexCoord.X = 0;
+ mVerts[7].TexCoord.Y = 0;
+
+ int colorValue = color.ToArgb();
+ for (int i = 0; i < 7; i++)
+ {
+ mVerts[i].Color = colorValue;
+ }
- SetGLColor(color.TopRight);
- GL.Vertex3(rect.Right, rect.Top, 0); // Top Right
+ BufferData();
- SetGLColor(color.BottomRight);
- GL.Vertex3(rect.Right, rect.Bottom, 0); // Bottom Right
+ GL_Display display = (GL_Display)Display.Impl;
+ Shaders.IGL3Shader shader = (Shaders.IGL3Shader)display.Shader.Impl;
- SetGLColor(color.BottomLeft);
- GL.Vertex3(rect.Left, rect.Bottom, 0); // Bottom Left
- GL.End(); // Done Drawing The Quad
+ shader.SetVertexAttributes(PositionColor.VertexLayout);
- GL.Enable(EnableCap.Texture2D);
+ GL.ActiveTexture(TextureUnit.Texture0);
+ GL.BindTexture(TextureTarget.Texture2D, WhiteSurface.GLTextureID);
+ shader.SetTexture(0);
+
+ GL.DrawArrays(BeginMode.Lines, 0, 4);
}
+ public override void FillRect(RectangleF rect, Color color)
+ {
+ mDisplay.WhiteSurface.Color = color;
+ mDisplay.WhiteSurface.Draw((Rectangle)rect);
+ mDisplay.WhiteSurface.Color = Color.White;
+ }
+ public override void FillRect(RectangleF rect, Gradient color)
+ {
+ mDisplay.WhiteSurface.ColorGradient = color;
+ mDisplay.WhiteSurface.Draw((Rectangle)rect);
+ mDisplay.WhiteSurface.Color = Color.White;
+ }
public override void FillPolygon(PointF[] pts, int startIndex, int length, Color color)
{
- GL.Disable(EnableCap.Texture2D);
+ if (mVerts.Length < pts.Length + 1)
+ mVerts = new PositionTextureColor[pts.Length+1];
- SetGLColor(color);
-
- GL.Begin(BeginMode.TriangleFan);
- for (int i = 0; i < length; i++)
+ for (int i = 0; i < pts.Length; i++)
{
- GL.Vertex3(pts[startIndex + i].X, pts[startIndex + i].Y, 0);
+ mVerts[i].Position.X = pts[i].X;
+ mVerts[i].Position.Y = pts[i].Y;
+ mVerts[i].TexCoord.X = 0;
+ mVerts[i].TexCoord.Y = 0;
+ mVerts[i].Color = color.ToArgb();
}
- GL.End(); // Done Drawing The Quad
- GL.Enable(EnableCap.Texture2D);
+ mVerts[pts.Length] = mVerts[0];
+
+ Shaders.IGL3Shader shader = (Shaders.IGL3Shader)mDisplay.Shader.Impl;
+
+ shader.SetVertexAttributes(PositionColor.VertexLayout);
+
+ GL.ActiveTexture(TextureUnit.Texture0);
+ GL.BindTexture(TextureTarget.Texture2D, WhiteSurface.GLTextureID);
+ shader.SetTexture(0);
+
+ GL.DrawArrays(BeginMode.Lines, 0, 1);
}
}
Modified: trunk/Drivers/AgateOTK/GL_Display.cs
===================================================================
--- trunk/Drivers/AgateOTK/GL_Display.cs 2011-11-22 21:12:54 UTC (rev 1307)
+++ trunk/Drivers/AgateOTK/GL_Display.cs 2011-11-23 04:33:21 UTC (rev 1308)
@@ -1,619 +1,648 @@
-// 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-2011.
-// All Rights Reserved.
-//
-// Contributor(s): Erik Ylvisaker
-//
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Runtime.InteropServices;
-using AgateLib.BitmapFont;
-using AgateLib.DisplayLib;
-using AgateLib.DisplayLib.ImplementationBase;
-using AgateLib.Drivers;
-using AgateLib.Geometry;
-using AgateLib.Geometry.VertexTypes;
-using OpenTK.Graphics.OpenGL;
-using PixelFormat = AgateLib.DisplayLib.PixelFormat;
-
-namespace AgateOTK
-{
- /// <summary>
- /// OpenGL 3.1 compatible.
- /// </summary>
- public sealed class GL_Display : DisplayImpl
- {
- GL_FrameBuffer mRenderTarget;
- 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;
-
- System.Windows.Forms.Form mFakeWindow;
- DisplayWindow mFakeDisplayWindow;
-
- PrimitiveRenderer mPrimitives;
-
- bool mGL3;
-
- public bool SupportsNonPowerOf2Textures
- {
- get { return mNonPowerOf2Textures; }
- private set { mNonPowerOf2Textures = value; }
- }
-
- internal event EventHandler ProcessEventsEvent;
-
- protected override void ProcessEvents()
- {
- if (ProcessEventsEvent != null)
- ProcessEventsEvent(this, EventArgs.Empty);
- }
-
- protected override void OnRenderTargetChange(FrameBuffer oldRenderTarget)
- {
- mRenderTarget = RenderTarget.Impl as GL_FrameBuffer;
- mRenderTarget.MakeCurrent();
-
- OnRenderTargetResize();
- }
- protected override void OnRenderTargetResize()
- {
-
- }
-
- public override PixelFormat DefaultSurfaceFormat
- {
- get { return PixelFormat.RGBA8888; }
- }
-
- #region --- Object Factory ---
-
- protected override AgateLib.DisplayLib.Shaders.Implementation.AgateShaderImpl CreateBuiltInShader(AgateLib.DisplayLib.Shaders.Implementation.BuiltInShader builtInShaderType)
- {
- return ShaderFactory.CreateBuiltInShader(builtInShaderType);
- }
- public override DisplayWindowImpl CreateDisplayWindow(CreateWindowParams windowParams)
- {
- if (windowParams.IsFullScreen && windowParams.RenderToControl == false)
- return new GL_GameWindow(windowParams);
- else
- return new GL_DisplayControl(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)
- return new GL3.GLVertexBuffer(layout, vertexCount);
- else
- return new Legacy.LegacyVertexBuffer(layout, vertexCount);
- }
- protected override IndexBufferImpl CreateIndexBuffer(IndexBufferType type, int size)
- {
- return new GL_IndexBuffer(type, size);
- }
-
- public override SurfaceImpl CreateSurface(Size surfaceSize)
- {
- 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, FontStyle style)
- {
- BitmapFontOptions options = new BitmapFontOptions(fontFamily, sizeInPoints, style);
-
- return AgateLib.WinForms.BitmapFontUtil.ConstructFromOSFont(options);
- }
- public override FontSurfaceImpl CreateFont(BitmapFontOptions bitmapOptions)
- {
- return AgateLib.WinForms.BitmapFontUtil.ConstructFromOSFont(bitmapOptions);
- }
-
- protected override FrameBufferImpl CreateFrameBuffer(Size size)
- {
- if (mGL3 || (mSupportsFramebufferArb && ReadSettingsBool("DisableFramebufferArb") == false))
- return new GL3.FrameBuffer(size);
- else if (mSupportsFramebufferExt && ReadSettingsBool("DisableFramebufferExt") == false)
- {
- try
- {
- return new Legacy.FrameBufferExt(size);
- }
- 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 Legacy.FrameBufferReadPixels(size);
- }
-
- bool ReadSettingsBool(string name)
- {
- string value;
-
- if (AgateLib.Core.Settings["AgateLib.OpenGL"].TryGetValue(name, out value) == false)
- return false;
-
- if (value == "false" || value == "0")
- return false;
-
- return true;
- }
-
- public GLDrawBuffer CreateDrawBuffer()
- {
- if (mGL3)
- return new GL3.DrawBuffer();
- else
- return new Legacy.LegacyDrawBuffer();
- }
-
-
- #endregion
-
- protected override void OnBeginFrame()
- {
- mRenderTarget.BeginRender();
-
- GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
- }
- protected override void OnEndFrame()
- {
- DrawBuffer.Flush();
-
- mRenderTarget.EndRender();
-
- FlushDeleteQueue();
- }
-
- internal GLDrawBuffer DrawBuffer
- {
- get { return ((GL_FrameBuffer)RenderTarget.Impl).DrawBuffer; }
- }
-
- // TODO: Test clip rect stuff.
- public override void SetClipRect(Rectangle newClipRect)
- {
- GL.Viewport(newClipRect.X, mRenderTarget.Height - newClipRect.Bottom,
- newClipRect.Width, newClipRect.Height);
-
- if (Display.Shader is AgateLib.DisplayLib.Shaders.IShader2D)
- {
- AgateLib.DisplayLib.Shaders.IShader2D s = (AgateLib.DisplayLib.Shaders.IShader2D)Display.Shader ;
-
- s.CoordinateSystem = newClipRect;
- }
-
- mCurrentClip = newClipRect;
- }
-
- public override void FlushDrawBuffer()
- {
- DrawBuffer.Flush();
- }
-
- public override void Clear(Color color)
- {
- DrawBuffer.Flush();
-
- GL.ClearColor(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, color.A / 255.0f);
-
- ClearBufferMask mask = ClearBufferMask.ColorBufferBit;
-
- mask |= RenderTarget.HasDepthBuffer ? ClearBufferMask.DepthBufferBit : 0;
- mask |= RenderTarget.HasStencilBuffer ? ClearBufferMask.StencilBufferBit : 0;
-
- GL.Clear(mask);
- }
- public override void Clear(Color color, Rectangle destRect)
- {
- DrawBuffer.Flush();
-
- DrawRect(destRect, Color.FromArgb(255, color));
- }
-
- #region --- Drawing Primitives ---
-
- public override void DrawLine(Point a, Point b, Color color)
- {
- DrawBuffer.Flush();
- mPrimitives.DrawLine(a, b, color);
- }
-
- public override void DrawRect(Rectangle rect, Color color)
- {
- DrawRect(new RectangleF(rect.X, rect.Y, rect.Width, rect.Height), color);
- }
- public override void DrawRect(RectangleF rect, Color color)
- {
- DrawBuffer.Flush();
- mPrimitives.DrawRect(rect, color);
- }
-
- public override void FillRect(Rectangle rect, Color color)
- {
- FillRect(new RectangleF(rect.X, rect.Y, rect.Width, rect.Height), color);
- }
- public override void FillRect(RectangleF rect, Color color)
- {
- DrawBuffer.Flush();
- mPrimitives.FillRect(rect, color);
- }
-
- public override void FillRect(Rectangle rect, Gradient color)
- {
- FillRect(new RectangleF(rect.X, rect.Y, rect.Width, rect.Height), color);
- }
- public override void FillRect(RectangleF rect, Gradient color)
- {
- DrawBuffer.Flush();
- mPrimitives.FillRect(rect, color);
- }
-
- public override void FillPolygon(PointF[] pts, int startIndex, int length, Color color)
- {
- DrawBuffer.Flush();
- mPrimitives.FillPolygon(pts, startIndex, length, color);
- }
-
- #endregion
- #region --- Initialization ---
-
- public override void Initialize()
- {
- CreateFakeWindow();
-
- Report("OpenTK / OpenGL driver instantiated for display.");
- }
- public void InitializeCurrentContext()
- {
- GL.ClearColor(0, 0, 0, 1.0f); // Black Background
- GL.ClearDepth(1); // Depth Buffer Setup
- GL.Enable(EnableCap.DepthTest); // Enables Depth Testing
- GL.DepthFunc(DepthFunction.Lequal); // The Type Of Depth Testing To Do
- }
-
- private void CreateFakeWindow()
- {
- mFakeWindow = new System.Windows.Forms.Form();
- mFakeDisplayWindow = DisplayWindow.CreateFromControl(mFakeWindow);
-
- mFakeWindow.Visible = false;
-
- string vendor = GL.GetString(StringName.Vendor);
- mSupportsShaders = false;
-
- mGLVersion = DetectOpenGLVersion();
- if (mGLVersion >= 3m)
- {
- if (ReadSettingsBool("EnableGL3"))
- {
- mGL3 = true;
- }
- else
- {
- mGL3 = false;
- mGLVersion = 2.1m;
- }
- }
-
- LoadExtensions();
-
- mSupportsFramebufferArb = SupportsExtension("GL_ARB_FRAMEBUFFER_OBJECT");
- mSupportsFramebufferExt = SupportsExtension("GL_EXT_FRAMEBUFFER_OBJECT");
- mNonPowerOf2Textures = SupportsExtension("GL_ARB_NON_POWER_OF_TWO");
-
- if (mGLVersion >= 3m)
- {
- mNonPowerOf2Textures = true;
- mSupportsShaders = true;
- }
- if (mGLVersion >= 2m)
- {
- mNonPowerOf2Textures = true;
- mSupportsShaders = true;
- }
-
- if (mGL3)
- mPrimitives = new GL3.GLPrimitiveRenderer();
- else
- mPrimitives = new Legacy.LegacyPrimitiveRenderer();
-
- if (SupportsExtension("GL_ARB_FRAGMENT_PROGRAM"))
- {
- mSupportsShaders = true;
- }
-
- ShaderFactory.Initialize(mGL3);
-
- Trace.WriteLine(string.Format("OpenGL version {0} from vendor {1} detected.", mGLVersion, vendor));
- Trace.WriteLine("NPOT: " + mNonPowerOf2Textures.ToString());
- Trace.WriteLine("Shaders: " + mSupportsShaders.ToString());
- }
-
- string[] extensions;
- private void LoadExtensions()
- {
- if (mGL3)
- {
- // Forward compatible context (GL 3.0+)
- int num_extensions;
- GL.GetInteger(GetPName.NumExtensions, out num_extensions);
-
- if (GL.GetError() != ErrorCode.NoError)
- throw new OpenTK.Graphics.GraphicsErrorException("Not 3.0 context.");
-
- extensions = new string[num_extensions];
-
- for (int i = 0; i < num_extensions; i++)
- extensions[i] = GL.GetString(StringName.Extensions, i).ToLowerInvariant();
- }
- else
- {
- string ext = GL.GetString(StringName.Extensions);
-
- extensions = ext.Split(' ');
-
- for (int i = 0; i < extensions.Length; i++)
- {
- Debug.Print(extensions[i]);
- extensions[i] = extensions[i].ToLowerInvariant();
- }
- }
- }
- private bool SupportsExtension(string name)
- {
- return extensions.Contains(name.ToLowerInvariant());
- }
-
- private static decimal DetectOpenGLVersion()
- {
- string versionString = GL.GetString(StringName.Version).Trim();
-
- // Not sure whether OpenGL drivers will universally report version in the machine's
- // culture settings or not. So we switch the current decimal separator with a period.
- versionString = versionString.Replace(System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator, ".");
- int pointLoc = versionString.IndexOf(".");
-
- // Remove any additional version information. Some drivers report version string as
- // something like 2.1.8577, which will be problematic for the decimal.Parse call below.
- // We are only interested in the first two numbers, so discard everything else.
- if (versionString.IndexOf(".", pointLoc + 1) > -1)
- {
- versionString = versionString.Substring(0, versionString.IndexOf(".", pointLoc + 1));
- }
-
- // Some drivers report a version like "2.0 Chromium 1", so dump everything after the space.
- if (versionString.Contains(" "))
- {
- versionString = versionString.Substring(0, versionString.IndexOf(" "));
- }
-
- decimal retval;
-
- if (decimal.TryParse(versionString, System.Globalization.NumberStyles.Number,
- System.Globalization.CultureInfo.InvariantCulture, out retval) == false)
- {
- Trace.WriteLine("AgateOTK was unable to parse the OpenGL version string.");
- Trace.WriteLine(" The reported string was: " + versionString);
- Trace.WriteLine(" Please report this issue to http://www.agatelib.org along");
- Trace.WriteLine(" with details about your operating system and graphics drivers.");
- Trace.WriteLine(" Falling back to OpenGL 1.1 supported functionality.");
-
- retval = 1.1m;
- }
-
- return retval;
- }
-
- #endregion
-
- #region --- Shaders ---
-
- public override void Dispose()
- {
- mFakeDisplayWindow.Dispose();
- mFakeWindow.Dispose();
- }
-
-
- private void SetArray(float[] array, Vector3 vec)
- {
- array[0] = vec.X;
- array[1] = vec.Y;
- array[2] = vec.Z;
- }
- private void SetArray(float[] array, Color color)
- {
- array[0] = color.R / 255.0f;
- array[1] = color.G / 255.0f;
- array[2] = color.B / 255.0f;
- array[3] = color.A / 255.0f;
- }
-
- #endregion
-
-
- protected override void SavePixelBuffer(PixelBuffer pixelBuffer, string filename, ImageFileFormat format)
- {
- AgateLib.WinForms.FormUtil.SavePixelBuffer(pixelBuffer, filename, format);
- }
-
- protected override void HideCursor()
- {
- System.Windows.Forms.Cursor.Hide();
-
- if (Display.CurrentWindow != null)
- {
- DisplayWindowImpl impl = Display.CurrentWindow.Impl;
- //((GL_DisplayW)impl).HideCursor();
- }
- }
- protected override void ShowCursor()
- {
- System.Windows.Forms.Cursor.Show();
-
- if (Display.CurrentWindow != null)
- {
- DisplayWindowImpl impl = Display.CurrentWindow.Impl;
-
- //((GL_FrameBufferExt)impl).ShowCursor();
- }
- }
-
- #region --- Display Capabilities ---
-
- public override bool CapsBool(DisplayBoolCaps caps)
- {
- switch (caps)
- {
- case DisplayBoolCaps.Scaling: return true;
- case DisplayBoolCaps.Rotation: return true;
- case DisplayBoolCaps.Color: return true;
- case DisplayBoolCaps.Gradient: return true;
- case DisplayBoolCaps.SurfaceAlpha: return true;
- case DisplayBoolCaps.PixelAlpha: return true;
- case DisplayBoolCaps.IsHardwareAccelerated: return true;
- case DisplayBoolCaps.FullScreen: return true;
- case DisplayBoolCaps.FullScreenModeSwitching: return true;
- case DisplayBoolCaps.CustomShaders: return false;
- case DisplayBoolCaps.CanCreateBitmapFont: return true;
- }
-
- return false;
- }
- public override Size CapsSize(DisplaySizeCaps displaySizeCaps)
- {
- switch (displaySizeCaps)
- {
- case DisplaySizeCaps.MaxSurfaceSize:
- int val;
- GL.GetInteger(GetPName.MaxTextureSize, out val);
-
- return new Size(val, val);
- }
-
- return new Size(0, 0);
- }
- public override IEnumerable<AgateLib.DisplayLib.Shaders.ShaderLanguage> SupportedShaderLanguages
- {
- get { yield return AgateLib.DisplayLib.Shaders.ShaderLanguage.Glsl; }
- }
-
- #endregion
- #region --- Render States ---
-
- bool mAlphaBlend;
-
- protected override bool GetRenderState(RenderStateBool renderStateBool)
- {
- switch (renderStateBool)
- {
- case RenderStateBool.WaitForVerticalBlank: return mVSync;
- case RenderStateBool.AlphaBlend: return mAlphaBlend;
-
- default:
- throw new NotSupportedException(string.Format(
- "The specified render state, {0}, is not supported by this driver."));
- }
- }
- protected override void SetRenderState(RenderStateBool renderStateBool, bool value)
- {
- switch (renderStateBool)
- {
- case RenderStateBool.WaitForVerticalBlank:
- mVSync = value;
- break;
-
- case RenderStateBool.AlphaBlend:
- mAlphaBlend = value;
- if (value)
- GL.Enable(EnableCap.Blend);
- else
- GL.Disable(EnableCap.Blend);
- break;
-
- default:
- throw new NotSupportedException(string.Format(
- "The specified render state, {0}, is not supported by this driver."));
- }
- }
-
- #endregion
-
- #region --- Deletion queuing ---
-
- List<int> mTexturesToDelete = new List<int>();
-
-
- private void FlushDeleteQueue()
- {
- lock (mTexturesToDelete)
- {
- if (mTexturesToDelete.Count == 0)
- return;
-
- int[] tex = mTexturesToDelete.ToArray();
- mTexturesToDelete.Clear();
-
- GL.DeleteTextures(mTexturesToDelete.Count, tex);
- }
- }
-
- internal void QueueDeleteTexture(int p)
- {
- lock (mTexturesToDelete)
- {
- mTexturesToDelete.Add(p);
- }
- }
-
- #endregion
-
- }
+// 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-2011.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Runtime.InteropServices;
+using AgateLib.BitmapFont;
+using AgateLib.DisplayLib;
+using AgateLib.DisplayLib.ImplementationBase;
+using AgateLib.Drivers;
+using AgateLib.Geometry;
+using AgateLib.Geometry.VertexTypes;
+using OpenTK.Graphics.OpenGL;
+using PixelFormat = AgateLib.DisplayLib.PixelFormat;
+
+namespace AgateOTK
+{
+ /// <summary>
+ /// OpenGL 3.1 compatible.
+ /// </summary>
+ public sealed class GL_Display : DisplayImpl
+ {
+ GL_FrameBuffer mRenderTarget;
+ 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;
+
+ System.Windows.Forms.Form mFakeWindow;
+ DisplayWindow mFakeDisplayWindow;
+
+ PrimitiveRenderer mPrimitives;
+
+ bool mGL3;
+
+ internal Surface WhiteSurface
+ {
+ get;
+ private set;
+ }
+ public bool SupportsNonPowerOf2Textures
+ {
+ get { return mNonPowerOf2Textures; }
+ private set { mNonPowerOf2Textures = value; }
+ }
+
+ internal event EventHandler ProcessEventsEvent;
+
+ protected override void ProcessEvents()
+ {
+ if (ProcessEventsEvent != null)
+ ProcessEventsEvent(this, EventArgs.Empty);
+ }
+
+ protected override void OnRenderTargetChange(FrameBuffer oldRenderTarget)
+ {
+ mRenderTarget = RenderTarget.Impl as GL_FrameBuffer;
+ mRenderTarget.MakeCurrent();
+
+ OnRenderTargetResize();
+ }
+ protected override void OnRenderTargetResize()
+ {
+
+ }
+
+ public override PixelFormat DefaultSurfaceFormat
+ {
+ get { return PixelFormat.RGBA8888; }
+ }
+
+ #region --- Object Factory ---
+
+ protected override AgateLib.DisplayLib.Shaders.Implementation.AgateShaderImpl CreateBuiltInShader(AgateLib.DisplayLib.Shaders.Implementation.BuiltInShader builtInShaderType)
+ {
+ return ShaderFactory.CreateBuiltInShader(built...
[truncated message content] |
|
From: <ka...@us...> - 2011-11-29 07:10:43
|
Revision: 1314
http://agate.svn.sourceforge.net/agate/?rev=1314&view=rev
Author: kanato
Date: 2011-11-29 07:10:37 +0000 (Tue, 29 Nov 2011)
Log Message:
-----------
Implement GL3/FrameBuffer.Dispose method.
Modified Paths:
--------------
trunk/AgateLib/DisplayLib/DisplayWindow.cs
trunk/Drivers/AgateOTK/GL3/FrameBuffer.cs
Modified: trunk/AgateLib/DisplayLib/DisplayWindow.cs
===================================================================
--- trunk/AgateLib/DisplayLib/DisplayWindow.cs 2011-11-29 02:48:54 UTC (rev 1313)
+++ trunk/AgateLib/DisplayLib/DisplayWindow.cs 2011-11-29 07:10:37 UTC (rev 1314)
@@ -84,7 +84,7 @@
"Did you forget to call AgateSetup.Initialize or Display.Initialize?");
mImpl = Display.Impl.CreateDisplayWindow(windowParams);
-
+
Display.RenderTarget = FrameBuffer;
Display.DisposeDisplay += new Display.DisposeDisplayHandler(Dispose);
Modified: trunk/Drivers/AgateOTK/GL3/FrameBuffer.cs
===================================================================
--- trunk/Drivers/AgateOTK/GL3/FrameBuffer.cs 2011-11-29 02:48:54 UTC (rev 1313)
+++ trunk/Drivers/AgateOTK/GL3/FrameBuffer.cs 2011-11-29 07:10:37 UTC (rev 1314)
@@ -83,16 +83,19 @@
mHasDepth = true;
mHasStencil = true;
}
+ public override void Dispose()
+ {
+ GL.DeleteFramebuffers(1, ref mFramebufferID);
+ GL.DeleteRenderbuffers(1, ref mDepthBuffer);
+ // TODO: Should we delete the surface also?
+ }
+
public override SurfaceImpl RenderTarget
{
get { return mTexture; }
}
- public override void Dispose()
- {
- throw new NotImplementedException();
- }
-
+
public override AgateLib.Geometry.Size Size
{
get { return mSize; }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-11-30 06:13:35
|
Revision: 1316
http://agate.svn.sourceforge.net/agate/?rev=1316&view=rev
Author: kanato
Date: 2011-11-30 06:13:29 +0000 (Wed, 30 Nov 2011)
Log Message:
-----------
Fix playing of sounds in SDL.
Modified Paths:
--------------
trunk/Drivers/AgateSDL/Audio/SDL_Audio.cs
trunk/Drivers/AgateSDL/Audio/SDL_SoundBufferSession.cs
trunk/Tests/Launcher.cs
trunk/Tests/Tests.csproj
Added Paths:
-----------
trunk/Tests/AudioTests/SoundbufferStopTester.cs
trunk/Tests/Data/snda.wav
trunk/Tests/Data/sndb.wav
Modified: trunk/Drivers/AgateSDL/Audio/SDL_Audio.cs
===================================================================
--- trunk/Drivers/AgateSDL/Audio/SDL_Audio.cs 2011-11-29 07:10:53 UTC (rev 1315)
+++ trunk/Drivers/AgateSDL/Audio/SDL_Audio.cs 2011-11-30 06:13:29 UTC (rev 1316)
@@ -29,6 +29,8 @@
public class SDL_Audio : AudioImpl
{
List<string> tempfiles = new List<string>();
+ Dictionary<int, SDL_SoundBufferSession> mChannels = new Dictionary<int, SDL_SoundBufferSession>();
+ SdlMixer.ChannelFinishedDelegate mChannelFinishedDelegate;
~SDL_Audio()
{
@@ -102,13 +104,27 @@
throw new AgateLib.AgateException("Failed to initialize SDL_mixer.");
}
+ mChannelFinishedDelegate = ChannelFinished;
+
+ SdlMixer.Mix_ChannelFinished(mChannelFinishedDelegate);
+
Report("SDL driver instantiated for audio.");
}
+ void ChannelFinished(int channel)
+ {
+ mChannels[channel].mIsPlaying = false;
+
+ mChannels.Remove(channel);
+ }
+
internal void RegisterTempFile(string filename)
{
tempfiles.Add(filename);
}
-
+ internal void RegisterChannel(int channel, SDL_SoundBufferSession session)
+ {
+ mChannels[channel] = session;
+ }
}
}
Modified: trunk/Drivers/AgateSDL/Audio/SDL_SoundBufferSession.cs
===================================================================
--- trunk/Drivers/AgateSDL/Audio/SDL_SoundBufferSession.cs 2011-11-29 07:10:53 UTC (rev 1315)
+++ trunk/Drivers/AgateSDL/Audio/SDL_SoundBufferSession.cs 2011-11-30 06:13:29 UTC (rev 1316)
@@ -36,19 +36,26 @@
bool loop;
Stopwatch watch = new Stopwatch();
SDL_SoundBuffer buffer;
+ SDL_Audio audio;
+ public bool mIsPlaying;
+
public SDL_SoundBufferSession(SDL_SoundBuffer buffer)
{
this.buffer = buffer;
loop = buffer.Loop;
sound = buffer.SoundChunk;
- channel = SdlMixer.Mix_PlayChannel(-1, sound, LoopCount);
volume = buffer.Volume;
+ channel = SdlMixer.Mix_PlayChannel(-1, sound, LoopCount);
+ audio = (SDL_Audio)AgateLib.AudioLib.Audio.Impl;
+ SetPanning();
+
watch.Reset();
watch.Start();
+ audio.RegisterChannel(channel, this);
}
public override void Dispose()
{
@@ -62,7 +69,7 @@
public override bool IsPlaying
{
- get { return SdlMixer.Mix_Playing(channel) != 0; }
+ get { return mIsPlaying; }
}
public override double Pan
@@ -96,11 +103,23 @@
public override void Play()
{
- SdlMixer.Mix_PlayChannel(channel, sound, LoopCount);
+ if (IsPlaying == false)
+ {
+ channel = SdlMixer.Mix_PlayChannel(-1, sound, LoopCount);
+ }
+ else
+ {
+ SdlMixer.Mix_PlayChannel(channel, sound, LoopCount);
+ }
+
SetPanning();
watch.Reset();
watch.Start();
+
+ audio.RegisterChannel(channel, this);
+
+ mIsPlaying = true;
}
int LoopCount
Added: trunk/Tests/AudioTests/SoundbufferStopTester.cs
===================================================================
--- trunk/Tests/AudioTests/SoundbufferStopTester.cs (rev 0)
+++ trunk/Tests/AudioTests/SoundbufferStopTester.cs 2011-11-30 06:13:29 UTC (rev 1316)
@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using AgateLib;
+using AgateLib.AudioLib;
+using AgateLib.DisplayLib;
+using AgateLib.Geometry;
+using AgateLib.InputLib;
+
+namespace Tests.AudioTests
+{
+ class SoundbufferStopTester : IAgateTest
+ {
+ #region IAgateTest Members
+
+ public string Name
+ {
+ get { return "SoundBuffer Stop"; }
+ }
+
+ public string Category
+ {
+ get { return "Audio"; }
+ }
+
+ SoundBuffer snda, sndb;
+
+ public void Main(string[] args)
+ {
+ using (AgateSetup setup = new AgateSetup())
+ {
+ setup.Initialize(true, true, false);
+ if (setup.WasCanceled)
+ return;
+
+ DisplayWindow wind = new DisplayWindow(CreateWindowParams.Windowed(
+ "Sound Buffer Tester", 640, 480, false, null));
+
+ snda = new SoundBuffer("snda.wav");
+ sndb = new SoundBuffer("sndb.wav");
+
+ FontSurface font = FontSurface.AgateSans14;
+
+ Keyboard.KeyDown += new InputEventHandler(Keyboard_KeyDown);
+
+ while (wind.IsClosed == false)
+ {
+ Display.BeginFrame();
+ Display.Clear();
+
+ font.Color = Color.White;
+ font.DrawText("Press a for first sound, b for second sound.");
+
+ if (snda.IsPlaying)
+ font.DrawText(0, 30, "first sound is playing");
+ if (sndb.IsPlaying)
+ font.DrawText(0, 60, "second sound is playing");
+
+ Display.EndFrame();
+ Core.KeepAlive();
+ }
+ }
+ }
+
+ void Keyboard_KeyDown(InputEventArgs e)
+ {
+ if (e.KeyCode == KeyCode.A)
+ snda.Play();
+
+ if (e.KeyCode == KeyCode.B)
+ sndb.Play();
+ }
+
+ #endregion
+ }
+}
Added: trunk/Tests/Data/snda.wav
===================================================================
(Binary files differ)
Property changes on: trunk/Tests/Data/snda.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/Tests/Data/sndb.wav
===================================================================
(Binary files differ)
Property changes on: trunk/Tests/Data/sndb.wav
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/Tests/Launcher.cs
===================================================================
--- trunk/Tests/Launcher.cs 2011-11-29 07:10:53 UTC (rev 1315)
+++ trunk/Tests/Launcher.cs 2011-11-30 06:13:29 UTC (rev 1316)
@@ -13,6 +13,7 @@
public static void Main(string[] args)
{
AgateFileProvider.Images.AddPath("Data");
+ AgateFileProvider.Sounds.AddPath("Data");
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Modified: trunk/Tests/Tests.csproj
===================================================================
--- trunk/Tests/Tests.csproj 2011-11-29 07:10:53 UTC (rev 1315)
+++ trunk/Tests/Tests.csproj 2011-11-30 06:13:29 UTC (rev 1316)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
@@ -122,6 +122,7 @@
<Compile Include="AgateTestAttribute.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="AudioTests\SoundbufferStopTester.cs" />
<Compile Include="AudioTests\StreamAudio.cs" />
<Compile Include="CoreTests\PersistantSettingsTest.cs" />
<Compile Include="CoreTests\PlatformDetection\PlatformDetection.cs">
@@ -534,6 +535,12 @@
<Content Include="Data\mask_circle.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+ <Content Include="Data\snda.wav">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Data\sndb.wav">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-01-13 21:02:56
|
Revision: 1317
http://agate.svn.sourceforge.net/agate/?rev=1317&view=rev
Author: kanato
Date: 2012-01-13 21:02:50 +0000 (Fri, 13 Jan 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/Drivers/AgateLib.WinForms/AgateLib.WinForms.csproj
trunk/Drivers/AgateOTK/AgateOTK.csproj
trunk/Drivers/AgateSDL/AgateSDL.csproj
trunk/Tools/AgateDataLib/AgateDataLib.csproj
trunk/Tools/DatabaseEditor/DatabaseEditor.csproj
Modified: trunk/Drivers/AgateLib.WinForms/AgateLib.WinForms.csproj
===================================================================
--- trunk/Drivers/AgateLib.WinForms/AgateLib.WinForms.csproj 2011-11-30 06:13:29 UTC (rev 1316)
+++ trunk/Drivers/AgateLib.WinForms/AgateLib.WinForms.csproj 2012-01-13 21:02:50 UTC (rev 1317)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
@@ -14,7 +14,7 @@
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<OutputType>Library</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
@@ -23,6 +23,7 @@
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<BaseAddress>285212672</BaseAddress>
Modified: trunk/Drivers/AgateOTK/AgateOTK.csproj
===================================================================
--- trunk/Drivers/AgateOTK/AgateOTK.csproj 2011-11-30 06:13:29 UTC (rev 1316)
+++ trunk/Drivers/AgateOTK/AgateOTK.csproj 2012-01-13 21:02:50 UTC (rev 1317)
@@ -14,7 +14,7 @@
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<OutputType>Library</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
@@ -23,6 +23,7 @@
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Modified: trunk/Drivers/AgateSDL/AgateSDL.csproj
===================================================================
--- trunk/Drivers/AgateSDL/AgateSDL.csproj 2011-11-30 06:13:29 UTC (rev 1316)
+++ trunk/Drivers/AgateSDL/AgateSDL.csproj 2012-01-13 21:02:50 UTC (rev 1317)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
@@ -14,7 +14,7 @@
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<OutputType>Library</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
@@ -23,6 +23,7 @@
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Modified: trunk/Tools/AgateDataLib/AgateDataLib.csproj
===================================================================
--- trunk/Tools/AgateDataLib/AgateDataLib.csproj 2011-11-30 06:13:29 UTC (rev 1316)
+++ trunk/Tools/AgateDataLib/AgateDataLib.csproj 2012-01-13 21:02:50 UTC (rev 1317)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,12 +10,13 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DataLib</RootNamespace>
<AssemblyName>DataLib</AssemblyName>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Modified: trunk/Tools/DatabaseEditor/DatabaseEditor.csproj
===================================================================
--- trunk/Tools/DatabaseEditor/DatabaseEditor.csproj 2011-11-30 06:13:29 UTC (rev 1316)
+++ trunk/Tools/DatabaseEditor/DatabaseEditor.csproj 2012-01-13 21:02:50 UTC (rev 1317)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -10,12 +10,13 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AgateDatabaseEditor</RootNamespace>
<AssemblyName>DatabaseEditor</AssemblyName>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -153,6 +154,7 @@
<DependentUpon>TableEditor.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
+ <None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -179,10 +181,6 @@
<Project>{9490B719-829E-43A7-A5FE-8001F8A81759}</Project>
<Name>AgateLib</Name>
</ProjectReference>
- <ProjectReference Include="..\AgateDataLib\AgateDataLib.csproj">
- <Project>{2F7A686B-2272-4803-9EF9-0B34BA7802DC}</Project>
- <Name>AgateDataLib</Name>
- </ProjectReference>
<ProjectReference Include="..\NotebookLib\NotebookLib\NotebookLib.csproj">
<Project>{91F57346-B574-4D52-9EB0-AA191B552C94}</Project>
<Name>NotebookLib</Name>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-01-13 21:53:19
|
Revision: 1318
http://agate.svn.sourceforge.net/agate/?rev=1318&view=rev
Author: kanato
Date: 2012-01-13 21:53:11 +0000 (Fri, 13 Jan 2012)
Log Message:
-----------
Converted all projects to target .NET 4.0 framework.
Removed ERY prefix on NotebookLib namespaces.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/Drivers/AgateDrawing/AgateDrawing.csproj
trunk/Drivers/AgateFMOD/AgateFMOD.csproj
trunk/Drivers/AgateOTK/GL_Display.cs
trunk/Drivers/AgateOTK/Legacy/LegacyDrawBuffer.cs
trunk/Drivers/AgateSDX/AgateSDX.csproj
trunk/Examples/BallBuster.Net/BallBuster.Net.csproj
trunk/Examples/BallBuster.Net/main.cs
trunk/Examples/Pong/Pong.csproj
trunk/Examples/ShootTheTraps/ShootTheTraps.csproj
trunk/Tests/Tests.csproj
trunk/Tools/DatabaseEditor/DatabaseEditor.csproj
trunk/Tools/DatabaseEditor/Import/frmImportTable.Designer.cs
trunk/Tools/FontCreator/EditGlyphs.Designer.cs
trunk/Tools/FontCreator/FontCreator.csproj
trunk/Tools/FontCreator/app.config
trunk/Tools/NotebookLib/NotebookLib/CloseTabEventArgs.cs
trunk/Tools/NotebookLib/NotebookLib/DesignerClass/EditPagesList.cs
trunk/Tools/NotebookLib/NotebookLib/DesignerClass/MySplitterDesigner.cs
trunk/Tools/NotebookLib/NotebookLib/DesignerClass/NotebookDesigner.cs
trunk/Tools/NotebookLib/NotebookLib/DesignerClass/PageDesigner.cs
trunk/Tools/NotebookLib/NotebookLib/FlatTabs/FlatTabNavigator.cs
trunk/Tools/NotebookLib/NotebookLib/FlatTabs/FlatTabProperties.cs
trunk/Tools/NotebookLib/NotebookLib/HSeparator.Designer.cs
trunk/Tools/NotebookLib/NotebookLib/HSeparator.cs
trunk/Tools/NotebookLib/NotebookLib/INavigator.cs
trunk/Tools/NotebookLib/NotebookLib/ListBookNavigator/ListBookNavigator.cs
trunk/Tools/NotebookLib/NotebookLib/ListBookNavigator/ListBookProperties.cs
trunk/Tools/NotebookLib/NotebookLib/NavigatorFactory.cs
trunk/Tools/NotebookLib/NotebookLib/NavigatorLocation.cs
trunk/Tools/NotebookLib/NotebookLib/NavigatorProperties.cs
trunk/Tools/NotebookLib/NotebookLib/NoNavigator/NoNavigator.cs
trunk/Tools/NotebookLib/NotebookLib/NoNavigator/NoNavigatorProperties.cs
trunk/Tools/NotebookLib/NotebookLib/Notebook.Designer.cs
trunk/Tools/NotebookLib/NotebookLib/Notebook.cs
trunk/Tools/NotebookLib/NotebookLib/NotebookLib.csproj
trunk/Tools/NotebookLib/NotebookLib/NotebookPage.Designer.cs
trunk/Tools/NotebookLib/NotebookLib/NotebookPage.cs
trunk/Tools/NotebookLib/NotebookLib/Properties/Resources.Designer.cs
trunk/Tools/NotebookLib/NotebookLib/Properties/Settings.Designer.cs
trunk/Tools/PackedSpriteCreator/PackedSpriteCreator.csproj
trunk/Tools/ResourceEditor/ResourceEditor.csproj
trunk/Tools/ResourceEditor/StringTable/StringEntry.Designer.cs
trunk/Tools/ResourceEditor/frmResourceEditor.Designer.cs
Added Paths:
-----------
trunk/Drivers/AgateSDX/Shaders/Hlsl/
trunk/Examples/BallBuster.Net/app.config
trunk/Examples/Pong/app.config
trunk/Examples/ShootTheTraps/app.config
trunk/Tests/app.config
trunk/Tools/PackedSpriteCreator/app.config
trunk/Tools/ResourceEditor/app.config
Property Changed:
----------------
trunk/Examples/BallBuster.Net/
trunk/Examples/Pong/
trunk/Examples/ShootTheTraps/
trunk/Tests/
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/AgateLib/AgateLib.csproj 2012-01-13 21:53:11 UTC (rev 1318)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
@@ -14,7 +14,7 @@
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<OutputType>Library</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
@@ -23,6 +23,7 @@
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Modified: trunk/Drivers/AgateDrawing/AgateDrawing.csproj
===================================================================
--- trunk/Drivers/AgateDrawing/AgateDrawing.csproj 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Drivers/AgateDrawing/AgateDrawing.csproj 2012-01-13 21:53:11 UTC (rev 1318)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
@@ -14,7 +14,7 @@
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<OutputType>Library</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
@@ -23,6 +23,7 @@
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<BaseAddress>285212672</BaseAddress>
Modified: trunk/Drivers/AgateFMOD/AgateFMOD.csproj
===================================================================
--- trunk/Drivers/AgateFMOD/AgateFMOD.csproj 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Drivers/AgateFMOD/AgateFMOD.csproj 2012-01-13 21:53:11 UTC (rev 1318)
@@ -16,7 +16,7 @@
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<OutputType>Library</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
@@ -27,6 +27,7 @@
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
Modified: trunk/Drivers/AgateOTK/GL_Display.cs
===================================================================
--- trunk/Drivers/AgateOTK/GL_Display.cs 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Drivers/AgateOTK/GL_Display.cs 2012-01-13 21:53:11 UTC (rev 1318)
@@ -385,7 +385,15 @@
mNonPowerOf2Textures = true;
mSupportsShaders = true;
}
+ if (mGLVersion < 1.2m)
+ {
+ System.Windows.Forms.MessageBox.Show(
+ "Error: OpenGL 1.2 or higher is required, but your system only supports OpenGL " + mGLVersion.ToString(),
+ "OpenGL 1.2 not aviable", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Stop);
+ throw new AgateLib.AgateException("OpenGL 1.2 or higher is required, but this system only supports OpenGL " + mGLVersion.ToString() + ".");
+ }
+
if (mGL3)
mPrimitives = new GL3.GLPrimitiveRenderer();
else
Modified: trunk/Drivers/AgateOTK/Legacy/LegacyDrawBuffer.cs
===================================================================
--- trunk/Drivers/AgateOTK/Legacy/LegacyDrawBuffer.cs 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Drivers/AgateOTK/Legacy/LegacyDrawBuffer.cs 2012-01-13 21:53:11 UTC (rev 1318)
@@ -32,8 +32,7 @@
namespace AgateOTK.Legacy
{
/// <summary>
- /// Not GL3 compatible. Need replacements for
- /// EnableClientState,TexCoordPointer, etc.
+ /// Uses
/// </summary>
public class LegacyDrawBuffer: GLDrawBuffer
{
@@ -87,6 +86,7 @@
int mIndex;
int mCurrentTexture;
+ bool mValid = true;
InterpolationMode lastInterpolation = (InterpolationMode)(-1);
PointF[] cachePts = new PointF[4];
@@ -95,10 +95,22 @@
public LegacyDrawBuffer()
{
- GL.GenBuffers(1, out mBufferID);
- Debug.Print("LegacyDrawBuffer: Draw buffer ID: {0}", mBufferID);
+ try
+ {
+ GL.GenBuffers(1, out mBufferID);
+ Debug.Print("LegacyDrawBuffer: Draw buffer ID: {0}", mBufferID);
- SetBufferSize(1000);
+ SetBufferSize(1000);
+ }
+ catch (EntryPointNotFoundException e)
+ {
+ mValid = false;
+
+ Trace.WriteLine("ERROR: Failed to create draw buffer.");
+ Trace.WriteLine("\tEntry point for glGenBuffers was not found.");
+ Trace.WriteLine("\tIt is likely that only a very old OpenGL is available.");
+
+ }
}
private void SetBufferSize(int size)
Modified: trunk/Drivers/AgateSDX/AgateSDX.csproj
===================================================================
--- trunk/Drivers/AgateSDX/AgateSDX.csproj 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Drivers/AgateSDX/AgateSDX.csproj 2012-01-13 21:53:11 UTC (rev 1318)
@@ -16,7 +16,7 @@
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<OutputType>Library</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
@@ -27,6 +27,7 @@
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
@@ -105,7 +106,7 @@
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
- <Reference Include="SlimDX, Version=2.0.8.42, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9, processorArchitecture=x86" />
+ <Reference Include="SlimDX, Version=4.0.12.43, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9, processorArchitecture=x86" />
<Reference Include="System">
<Name>System</Name>
</Reference>
Property changes on: trunk/Examples/BallBuster.Net
___________________________________________________________________
Added: svn:ignore
+ [Bb]in
obj
[Dd]ebug
[Rr]elease
*.user
*.aps
*.eto
Modified: trunk/Examples/BallBuster.Net/BallBuster.Net.csproj
===================================================================
--- trunk/Examples/BallBuster.Net/BallBuster.Net.csproj 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Examples/BallBuster.Net/BallBuster.Net.csproj 2012-01-13 21:53:11 UTC (rev 1318)
@@ -30,7 +30,8 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -115,6 +116,7 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
+ <None Include="app.config" />
<None Include="OpenTK.dll.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Added: trunk/Examples/BallBuster.Net/app.config
===================================================================
--- trunk/Examples/BallBuster.Net/app.config (rev 0)
+++ trunk/Examples/BallBuster.Net/app.config 2012-01-13 21:53:11 UTC (rev 1318)
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Modified: trunk/Examples/BallBuster.Net/main.cs
===================================================================
--- trunk/Examples/BallBuster.Net/main.cs 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Examples/BallBuster.Net/main.cs 2012-01-13 21:53:11 UTC (rev 1318)
@@ -983,7 +983,7 @@
}
powerupLeft = 755;
- powerupTop = 10 + img.font.StringDisplayHeight("A");
+ powerupTop = 10 + img.font.FontHeight;
for (int i = 0; i < lastPowerups.Count; i++)
{
@@ -1128,7 +1128,8 @@
if (start > -1)
{
- int fw = img.font.StringDisplayWidth(time);
+ Size size = img.font.MeasureString(time);
+ int fw = size.Width;
int pos = powerupLeft + (40 - fw) / 2;
img.font.Color = Color.Black;
@@ -3495,8 +3496,9 @@
img.font.SetScale(scale, scale);
- int width = img.font.StringDisplayWidth (str);
- int height = img.font.StringDisplayHeight(str);
+ Size size = img.font.MeasureString(str);
+ int width = size.Width;
+ int height = size.Height;
myx -= width / 2;
myy -= height / 2;
@@ -4115,7 +4117,7 @@
{
editorState.Menu.Clear();
- int height = img.font.StringDisplayHeight("M");
+ int height = img.font.FontHeight;
editorState.Menu.Add(new Point(13, 500), "[TITLE SCREEN]");
editorState.Menu.Add(new Point(13, 516), "[NEW LEVEL]");
Property changes on: trunk/Examples/Pong
___________________________________________________________________
Added: svn:ignore
+ [Bb]in
obj
[Dd]ebug
[Rr]elease
*.user
*.aps
*.eto
Modified: trunk/Examples/Pong/Pong.csproj
===================================================================
--- trunk/Examples/Pong/Pong.csproj 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Examples/Pong/Pong.csproj 2012-01-13 21:53:11 UTC (rev 1318)
@@ -15,7 +15,8 @@
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -93,6 +94,7 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
+ <None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Added: trunk/Examples/Pong/app.config
===================================================================
--- trunk/Examples/Pong/app.config (rev 0)
+++ trunk/Examples/Pong/app.config 2012-01-13 21:53:11 UTC (rev 1318)
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Property changes on: trunk/Examples/ShootTheTraps
___________________________________________________________________
Added: svn:ignore
+ [Bb]in
obj
[Dd]ebug
[Rr]elease
*.user
*.aps
*.eto
Modified: trunk/Examples/ShootTheTraps/ShootTheTraps.csproj
===================================================================
--- trunk/Examples/ShootTheTraps/ShootTheTraps.csproj 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Examples/ShootTheTraps/ShootTheTraps.csproj 2012-01-13 21:53:11 UTC (rev 1318)
@@ -15,7 +15,8 @@
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -104,6 +105,9 @@
<Name>AgateOTK</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- 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.
Added: trunk/Examples/ShootTheTraps/app.config
===================================================================
--- trunk/Examples/ShootTheTraps/app.config (rev 0)
+++ trunk/Examples/ShootTheTraps/app.config 2012-01-13 21:53:11 UTC (rev 1318)
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Property changes on: trunk/Tests
___________________________________________________________________
Modified: svn:ignore
- *.suo
obj
+ *.suo
obj
[Bb]in
[Dd]ebug
[Rr]elease
*.user
*.aps
*.eto
Modified: trunk/Tests/Tests.csproj
===================================================================
--- trunk/Tests/Tests.csproj 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Tests/Tests.csproj 2012-01-13 21:53:11 UTC (rev 1318)
@@ -14,7 +14,7 @@
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
@@ -24,6 +24,7 @@
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<BaseAddress>285212672</BaseAddress>
@@ -441,6 +442,7 @@
<SubType>Designer</SubType>
<DependentUpon>LightingTestForm.cs</DependentUpon>
</EmbeddedResource>
+ <None Include="app.config" />
<None Include="Data\9ball.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Added: trunk/Tests/app.config
===================================================================
--- trunk/Tests/app.config (rev 0)
+++ trunk/Tests/app.config 2012-01-13 21:53:11 UTC (rev 1318)
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Modified: trunk/Tools/DatabaseEditor/DatabaseEditor.csproj
===================================================================
--- trunk/Tools/DatabaseEditor/DatabaseEditor.csproj 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Tools/DatabaseEditor/DatabaseEditor.csproj 2012-01-13 21:53:11 UTC (rev 1318)
@@ -181,6 +181,10 @@
<Project>{9490B719-829E-43A7-A5FE-8001F8A81759}</Project>
<Name>AgateLib</Name>
</ProjectReference>
+ <ProjectReference Include="..\AgateDataLib\AgateDataLib.csproj">
+ <Project>{2F7A686B-2272-4803-9EF9-0B34BA7802DC}</Project>
+ <Name>AgateDataLib</Name>
+ </ProjectReference>
<ProjectReference Include="..\NotebookLib\NotebookLib\NotebookLib.csproj">
<Project>{91F57346-B574-4D52-9EB0-AA191B552C94}</Project>
<Name>NotebookLib</Name>
Modified: trunk/Tools/DatabaseEditor/Import/frmImportTable.Designer.cs
===================================================================
--- trunk/Tools/DatabaseEditor/Import/frmImportTable.Designer.cs 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Tools/DatabaseEditor/Import/frmImportTable.Designer.cs 2012-01-13 21:53:11 UTC (rev 1318)
@@ -31,7 +31,7 @@
this.txtFileContents = new System.Windows.Forms.TextBox();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
- this.hSeparator1 = new ERY.NotebookLib.HSeparator();
+ this.hSeparator1 = new NotebookLib.HSeparator();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.chkMergeDelimiters = new System.Windows.Forms.CheckBox();
this.txtOther = new System.Windows.Forms.TextBox();
@@ -387,7 +387,7 @@
private System.Windows.Forms.TextBox txtFileContents;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
- private ERY.NotebookLib.HSeparator hSeparator1;
+ private NotebookLib.HSeparator hSeparator1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox txtOther;
private System.Windows.Forms.CheckBox chkOther;
Modified: trunk/Tools/FontCreator/EditGlyphs.Designer.cs
===================================================================
--- trunk/Tools/FontCreator/EditGlyphs.Designer.cs 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Tools/FontCreator/EditGlyphs.Designer.cs 2012-01-13 21:53:11 UTC (rev 1318)
@@ -32,7 +32,7 @@
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
this.pctImage = new System.Windows.Forms.PictureBox();
this.pctZoom = new System.Windows.Forms.PictureBox();
- this.hSeparator1 = new ERY.NotebookLib.HSeparator();
+ this.hSeparator1 = new NotebookLib.HSeparator();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.lstItems = new System.Windows.Forms.ListBox();
this.properties = new System.Windows.Forms.PropertyGrid();
@@ -242,7 +242,7 @@
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.PropertyGrid properties;
private System.Windows.Forms.ListBox lstItems;
- private ERY.NotebookLib.HSeparator hSeparator1;
+ private NotebookLib.HSeparator hSeparator1;
private System.Windows.Forms.PictureBox pctZoom;
private System.Windows.Forms.SplitContainer splitContainer3;
private System.Windows.Forms.ToolStrip toolStrip1;
Modified: trunk/Tools/FontCreator/FontCreator.csproj
===================================================================
--- trunk/Tools/FontCreator/FontCreator.csproj 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Tools/FontCreator/FontCreator.csproj 2012-01-13 21:53:11 UTC (rev 1318)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
@@ -14,7 +14,7 @@
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
@@ -23,6 +23,7 @@
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<BaseAddress>285212672</BaseAddress>
@@ -133,6 +134,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
+ <None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Modified: trunk/Tools/FontCreator/app.config
===================================================================
--- trunk/Tools/FontCreator/app.config 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Tools/FontCreator/app.config 2012-01-13 21:53:11 UTC (rev 1318)
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0"?>
<configuration>
<configSections>
- <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
- <section name="FontCreator.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
+ <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <section name="FontCreator.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<userSettings>
@@ -12,4 +12,4 @@
</setting>
</FontCreator.Properties.Settings>
</userSettings>
-</configuration>
\ No newline at end of file
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Modified: trunk/Tools/NotebookLib/NotebookLib/CloseTabEventArgs.cs
===================================================================
--- trunk/Tools/NotebookLib/NotebookLib/CloseTabEventArgs.cs 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Tools/NotebookLib/NotebookLib/CloseTabEventArgs.cs 2012-01-13 21:53:11 UTC (rev 1318)
@@ -3,7 +3,7 @@
using System.ComponentModel;
using System.Text;
-namespace ERY.NotebookLib
+namespace NotebookLib
{
public class ClosePageQueryEventArgs : CancelEventArgs
{
Modified: trunk/Tools/NotebookLib/NotebookLib/DesignerClass/EditPagesList.cs
===================================================================
--- trunk/Tools/NotebookLib/NotebookLib/DesignerClass/EditPagesList.cs 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Tools/NotebookLib/NotebookLib/DesignerClass/EditPagesList.cs 2012-01-13 21:53:11 UTC (rev 1318)
@@ -4,7 +4,7 @@
using System.ComponentModel.Design;
using System.ComponentModel;
-namespace ERY.NotebookLib.DesignerClass
+namespace NotebookLib.DesignerClass
{
class EditPagesList : DesignerActionList
{
Modified: trunk/Tools/NotebookLib/NotebookLib/DesignerClass/MySplitterDesigner.cs
===================================================================
--- trunk/Tools/NotebookLib/NotebookLib/DesignerClass/MySplitterDesigner.cs 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Tools/NotebookLib/NotebookLib/DesignerClass/MySplitterDesigner.cs 2012-01-13 21:53:11 UTC (rev 1318)
@@ -7,7 +7,7 @@
using System.Windows.Forms.Design;
using System.Text;
-namespace ERY.NotebookLib.DesignerClass
+namespace NotebookLib.DesignerClass
{
class MySplitterDesigner : ControlDesigner
{
Modified: trunk/Tools/NotebookLib/NotebookLib/DesignerClass/NotebookDesigner.cs
===================================================================
--- trunk/Tools/NotebookLib/NotebookLib/DesignerClass/NotebookDesigner.cs 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Tools/NotebookLib/NotebookLib/DesignerClass/NotebookDesigner.cs 2012-01-13 21:53:11 UTC (rev 1318)
@@ -9,7 +9,7 @@
using System.Windows.Forms.Design;
using System.Windows.Forms.Design.Behavior;
-namespace ERY.NotebookLib.DesignerClass
+namespace NotebookLib.DesignerClass
{
class NotebookDesigner : ParentControlDesigner
{
Modified: trunk/Tools/NotebookLib/NotebookLib/DesignerClass/PageDesigner.cs
===================================================================
--- trunk/Tools/NotebookLib/NotebookLib/DesignerClass/PageDesigner.cs 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Tools/NotebookLib/NotebookLib/DesignerClass/PageDesigner.cs 2012-01-13 21:53:11 UTC (rev 1318)
@@ -7,7 +7,7 @@
using System.Windows.Forms.Design;
using System.Text;
-namespace ERY.NotebookLib.DesignerClass
+namespace NotebookLib.DesignerClass
{
class PageDesigner : ParentControlDesigner
{
Modified: trunk/Tools/NotebookLib/NotebookLib/FlatTabs/FlatTabNavigator.cs
===================================================================
--- trunk/Tools/NotebookLib/NotebookLib/FlatTabs/FlatTabNavigator.cs 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Tools/NotebookLib/NotebookLib/FlatTabs/FlatTabNavigator.cs 2012-01-13 21:53:11 UTC (rev 1318)
@@ -6,7 +6,7 @@
using System.Text;
using System.Windows.Forms;
-namespace ERY.NotebookLib.FlatTabs
+namespace NotebookLib.FlatTabs
{
[ToolboxItem(false)]
class FlatTabNavigator : Control, INavigator
Modified: trunk/Tools/NotebookLib/NotebookLib/FlatTabs/FlatTabProperties.cs
===================================================================
--- trunk/Tools/NotebookLib/NotebookLib/FlatTabs/FlatTabProperties.cs 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Tools/NotebookLib/NotebookLib/FlatTabs/FlatTabProperties.cs 2012-01-13 21:53:11 UTC (rev 1318)
@@ -5,7 +5,7 @@
using System.Text;
using System.Windows.Forms;
-namespace ERY.NotebookLib.FlatTabs
+namespace NotebookLib.FlatTabs
{
class FlatTabProperties : NavigatorProperties
{
Modified: trunk/Tools/NotebookLib/NotebookLib/HSeparator.Designer.cs
===================================================================
--- trunk/Tools/NotebookLib/NotebookLib/HSeparator.Designer.cs 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Tools/NotebookLib/NotebookLib/HSeparator.Designer.cs 2012-01-13 21:53:11 UTC (rev 1318)
@@ -1,4 +1,4 @@
-namespace ERY.NotebookLib
+namespace NotebookLib
{
partial class HSeparator
{
Modified: trunk/Tools/NotebookLib/NotebookLib/HSeparator.cs
===================================================================
--- trunk/Tools/NotebookLib/NotebookLib/HSeparator.cs 2012-01-13 21:02:50 UTC (rev 1317)
+++ trunk/Tools/NotebookLib/NotebookLib/HSeparator.cs 2012-01-13 21:53:11 UTC (rev 1318)
@@ -6,7 +6,7 @@
using System.Text;
using System.Windows.Forms;
-namespace ERY.NotebookLib
+namespace NotebookLib
{
public partial class HSeparator : UserControl
{
Modified: trunk/Tools/NotebookLib/NotebookLib/INavigator.cs
===================================================================
--- trunk/Tools/NotebookLib/NotebookLib/INavigator.cs 2012-01-13 21...
[truncated message content] |
|
From: <ka...@us...> - 2012-01-17 08:24:12
|
Revision: 1320
http://agate.svn.sourceforge.net/agate/?rev=1320&view=rev
Author: kanato
Date: 2012-01-17 08:24:00 +0000 (Tue, 17 Jan 2012)
Log Message:
-----------
Added Closed and Closing events for DisplayWindow.
SlimDX does not work; need to wait for updated version for .NET 4.0.
Fixed bug where drawing text with a FontSurface object would crash if null text was passed.
Modified Paths:
--------------
trunk/AgateLib/DisplayLib/DisplayWindow.cs
trunk/AgateLib/DisplayLib/FontState.cs
trunk/AgateLib/DisplayLib/FontSurface.cs
trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs
trunk/Drivers/AgateDrawing/Drawing_DisplayWindow.cs
trunk/Drivers/AgateOTK/GL_DisplayControl.cs
trunk/Drivers/AgateOTK/GL_GameWindow.cs
trunk/Drivers/AgateSDX/AgateSDX.csproj
trunk/Tests/Tests.csproj
Added Paths:
-----------
trunk/Tests/DisplayTests/DisplayWindowEvents.cs
Modified: trunk/AgateLib/DisplayLib/DisplayWindow.cs
===================================================================
--- trunk/AgateLib/DisplayLib/DisplayWindow.cs 2012-01-14 17:18:04 UTC (rev 1319)
+++ trunk/AgateLib/DisplayLib/DisplayWindow.cs 2012-01-17 08:24:00 UTC (rev 1320)
@@ -84,7 +84,7 @@
"Did you forget to call AgateSetup.Initialize or Display.Initialize?");
mImpl = Display.Impl.CreateDisplayWindow(windowParams);
-
+
Display.RenderTarget = FrameBuffer;
Display.DisposeDisplay += new Display.DisposeDisplayHandler(Dispose);
@@ -177,7 +177,7 @@
/// </summary>
public FrameBuffer FrameBuffer
{
- get
+ get
{
if (mFrameBuffer == null || mFrameBuffer.Impl != Impl.FrameBuffer)
{
@@ -345,13 +345,32 @@
/// <summary>
/// Event raised when the window is resized by the user.
/// </summary>
- public event EventHandler Resize;
+ public event EventHandler Resize
+ {
+ add { mImpl.Resize += value; }
+ remove { mImpl.Resize -= value; }
+ }
- internal void OnResize()
+ /// <summary>
+ /// Event raised when the window is closed by the user.
+ /// </summary>
+ public event EventHandler Closed
{
- if (Resize != null)
- Resize(this, EventArgs.Empty);
+ add { mImpl.Closed += value; }
+ remove { mImpl.Closed -= value; }
}
+ /// <summary>
+ /// Event raised when the user clicks the close box but before the window is closed.
+ /// </summary>
+ public event CancelEventHandler Closing
+ {
+ add { mImpl.Closing += value; }
+ remove { mImpl.Closing -= value; }
+ }
+
}
+
+ public delegate void CancelEventHandler(object sender, ref bool cancel);
+
}
\ No newline at end of file
Modified: trunk/AgateLib/DisplayLib/FontState.cs
===================================================================
--- trunk/AgateLib/DisplayLib/FontState.cs 2012-01-14 17:18:04 UTC (rev 1319)
+++ trunk/AgateLib/DisplayLib/FontState.cs 2012-01-17 08:24:00 UTC (rev 1320)
@@ -35,7 +35,7 @@
private double mScaleWidth = 1.0;
private double mScaleHeight = 1.0;
private PointF mLocation;
- private string mText;
+ private string mText = string.Empty;
private FontStateCache mCache;
private string mTransformedText;
Modified: trunk/AgateLib/DisplayLib/FontSurface.cs
===================================================================
--- trunk/AgateLib/DisplayLib/FontSurface.cs 2012-01-14 17:18:04 UTC (rev 1319)
+++ trunk/AgateLib/DisplayLib/FontSurface.cs 2012-01-17 08:24:00 UTC (rev 1320)
@@ -313,7 +313,7 @@
[Obsolete("Use MeasureString instead.", true)]
public int StringDisplayWidth(string text)
{
- return StringDisplaySize(text).Width;
+ return MeasureString(text).Width;
}
/// <summary>
/// Measures the display height of the specified string.
@@ -323,7 +323,7 @@
[Obsolete("Use MeasureString instead.", true)]
public int StringDisplayHeight(string text)
{
- return StringDisplaySize(text).Height;
+ return MeasureString(text).Height;
}
/// <summary>
/// Measures the display size of the specified string.
@@ -411,6 +411,9 @@
/// <param name="text"></param>
public void DrawText(string text)
{
+ if (string.IsNullOrEmpty(text))
+ return;
+
mState.Location = PointF.Empty;
mState.Text = mTransformer.Transform(text);
Modified: trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs 2012-01-14 17:18:04 UTC (rev 1319)
+++ trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs 2012-01-17 08:24:00 UTC (rev 1320)
@@ -109,5 +109,53 @@
/// </summary>
public abstract Point MousePosition { get; set; }
+
+ /// <summary>
+ /// Event raised when the window is resized by the user.
+ /// Be sure to call the base class method so that client events are raised.
+ /// </summary>
+ protected virtual void OnResize()
+ {
+ if (Resize != null)
+ Resize(this, EventArgs.Empty);
+ }
+
+ /// <summary>
+ /// Event raised when the window is closed by the user.
+ /// Be sure to call the base class method so that client events are raised.
+ /// </summary>
+ protected virtual void OnClosed()
+ {
+ if (Closed != null)
+ Closed(this, EventArgs.Empty);
+ }
+
+ /// <summary>
+ /// Event raised when the user clicks the close box but before the window is closed.
+ /// Be sure to call the base class method so that client events are raised.
+ /// </summary>
+ protected virtual void OnClosing(ref bool cancel)
+ {
+ if (Closing != null)
+ {
+ Closing(this, ref cancel);
+ }
+ }
+
+ /// <summary>
+ /// Event raised when the window is resized by the user.
+ /// </summary>
+ public event EventHandler Resize;
+
+ /// <summary>
+ /// Event raised when the window is closed by the user.
+ /// </summary>
+ public event EventHandler Closed;
+
+ /// <summary>
+ /// Event raised when the user clicks the close box but before the window is closed.
+ /// </summary>
+ public event CancelEventHandler Closing;
+
}
}
\ No newline at end of file
Modified: trunk/Drivers/AgateDrawing/Drawing_DisplayWindow.cs
===================================================================
--- trunk/Drivers/AgateDrawing/Drawing_DisplayWindow.cs 2012-01-14 17:18:04 UTC (rev 1319)
+++ trunk/Drivers/AgateDrawing/Drawing_DisplayWindow.cs 2012-01-17 08:24:00 UTC (rev 1320)
@@ -53,7 +53,7 @@
AttachEvents();
- OnResize();
+ RecreateBackBuffer();
}
else
{
@@ -73,7 +73,7 @@
AttachEvents();
// and create the back buffer
- OnResize();
+ RecreateBackBuffer();
}
mFrameBuffer = new Drawing_FrameBuffer(mBackBuffer);
@@ -117,44 +117,10 @@
form.KeyDown += new System.Windows.Forms.KeyEventHandler(form_KeyDown);
form.KeyUp += new System.Windows.Forms.KeyEventHandler(form_KeyUp);
- // TODO: This can probably be removed as of 11/2011.
- // fuck, it seems that FormClosing had a different name in .NET 1.1, which is
- // the version of windows that Mono implements.
- // So here's an ugly System.Reflection hack around it.
- {
- EventInfo formClosing = GetFormEvent("FormClosing", "Closing");
- MethodInfo method = this.GetType().GetMethod("form_FormClosing");
-
- Delegate d = Delegate.CreateDelegate(formClosing.EventHandlerType, this, method);
-
- formClosing.AddEventHandler(form, d);
- }
- {
- EventInfo formClosed = GetFormEvent("FormClosed", "Closed");
- MethodInfo method = this.GetType().GetMethod("form_FormClosed");
-
- Delegate d = Delegate.CreateDelegate(formClosed.EventHandlerType, this, method);
-
- formClosed.AddEventHandler(form, d);
- }
+ form.FormClosed += new FormClosedEventHandler(form_FormClosed);
+ form.FormClosing += new FormClosingEventHandler(form_FormClosing);
}
- private EventInfo GetFormEvent(params string[] eventNames)
- {
- Type formType = typeof(System.Windows.Forms.Form);
-
- foreach (string name in eventNames)
- {
- EventInfo evt = formType.GetEvent(name);
-
- if (evt != null)
- return evt;
- }
-
- return null;
- }
-
-
Mouse.MouseButtons GetButtons(MouseButtons buttons)
{
Mouse.MouseButtons retval = Mouse.MouseButtons.None;
@@ -173,14 +139,23 @@
return retval;
}
- public void form_FormClosed(object sender, EventArgs e)
+
+ void form_FormClosed(object sender, FormClosedEventArgs e)
{
mIsClosed = true;
+
+ OnClosed();
}
- public void form_FormClosing(object sender, EventArgs e)
+
+ void form_FormClosing(object sender, FormClosingEventArgs e)
{
+ bool cancel = false;
+ OnClosing(ref cancel);
+
+ e.Cancel = cancel;
}
+
void form_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
Keyboard.Keys[FormUtil.TransformWinFormsKey(e.KeyCode)] = false;
@@ -237,17 +212,23 @@
{
OnResize();
}
+ protected override void OnResize()
+ {
+ RecreateBackBuffer();
- private void OnResize()
+ base.OnResize();
+ }
+
+ private void RecreateBackBuffer()
{
if (mRenderTarget.ClientSize.Width == 0 || mRenderTarget.ClientSize.Height == 0)
return;
-
+
if (mBackBuffer != null)
mBackBuffer.Dispose();
mBackBuffer = new Bitmap(mRenderTarget.ClientSize.Width, mRenderTarget.ClientSize.Height);
-
+
if (mFrameBuffer != null)
mFrameBuffer.BackBufferBitmap = mBackBuffer;
}
Modified: trunk/Drivers/AgateOTK/GL_DisplayControl.cs
===================================================================
--- trunk/Drivers/AgateOTK/GL_DisplayControl.cs 2012-01-14 17:18:04 UTC (rev 1319)
+++ trunk/Drivers/AgateOTK/GL_DisplayControl.cs 2012-01-17 08:24:00 UTC (rev 1320)
@@ -380,12 +380,15 @@
mRenderTarget.MouseDown += new System.Windows.Forms.MouseEventHandler(pct_MouseDown);
mRenderTarget.MouseUp += new System.Windows.Forms.MouseEventHandler(pct_MouseUp);
mRenderTarget.DoubleClick += new EventHandler(mRenderTarget_DoubleClick);
+
System.Windows.Forms.Form form = (mRenderTarget.TopLevelControl as System.Windows.Forms.Form);
+ form.KeyPreview = true;
- form.KeyPreview = true;
form.KeyDown += new System.Windows.Forms.KeyEventHandler(form_KeyDown);
form.KeyUp += new System.Windows.Forms.KeyEventHandler(form_KeyUp);
-
+ form.FormClosing += new FormClosingEventHandler(form_FormClosing);
+ form.FormClosed += new FormClosedEventHandler(form_FormClosed);
+
}
private void DetachEvents()
{
@@ -400,13 +403,30 @@
mRenderTarget.MouseDown -= new System.Windows.Forms.MouseEventHandler(pct_MouseDown);
mRenderTarget.MouseUp -= new System.Windows.Forms.MouseEventHandler(pct_MouseUp);
mRenderTarget.DoubleClick -= new EventHandler(mRenderTarget_DoubleClick);
+
System.Windows.Forms.Form form = (mRenderTarget.TopLevelControl as System.Windows.Forms.Form);
form.KeyDown -= new System.Windows.Forms.KeyEventHandler(form_KeyDown);
form.KeyUp -= new System.Windows.Forms.KeyEventHandler(form_KeyUp);
+ form.FormClosing -= new FormClosingEventHandler(form_FormClosing);
+ form.FormClosed -= new FormClosedEventHandler(form_FormClosed);
+
+ }
+ void form_FormClosed(object sender, FormClosedEventArgs e)
+ {
+ OnClosed();
}
+ void form_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ bool cancel = false;
+
+ OnClosing(ref cancel);
+
+ e.Cancel = cancel;
+ }
+
Mouse.MouseButtons GetButtons(System.Windows.Forms.MouseButtons buttons)
{
Mouse.MouseButtons retval = Mouse.MouseButtons.None;
@@ -433,9 +453,10 @@
{
mContext.Update(mWindowInfo);
mFrameBuffer.SetSize(new Size(mRenderTarget.Width, mRenderTarget.Height));
+
+ OnResize();
}
-
void mRenderTarget_DoubleClick(object sender, EventArgs e)
{
Mouse.OnMouseDoubleClick(Mouse.MouseButtons.Primary);
@@ -465,11 +486,6 @@
mIsClosed = true;
}
-
- void form_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
- {
- mIsClosed = true;
- }
void form_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
Keyboard.Keys[FormUtil.TransformWinFormsKey(e.KeyCode)] = false;
@@ -478,6 +494,7 @@
{
Keyboard.Keys[FormUtil.TransformWinFormsKey(e.KeyCode)] = true;
}
+
public override bool IsClosed
{
get { return mIsClosed; }
Modified: trunk/Drivers/AgateOTK/GL_GameWindow.cs
===================================================================
--- trunk/Drivers/AgateOTK/GL_GameWindow.cs 2012-01-14 17:18:04 UTC (rev 1319)
+++ trunk/Drivers/AgateOTK/GL_GameWindow.cs 2012-01-17 08:24:00 UTC (rev 1320)
@@ -209,6 +209,8 @@
mDisplay.InitializeCurrentContext();
mDrawBuffer = mDisplay.CreateDrawBuffer();
+
+
}
public override FrameBufferImpl FrameBuffer
@@ -222,11 +224,8 @@
}
bool done = false;
- void mWindow_CloseWindow(object sender, EventArgs e)
- {
- done = true;
- }
+
void Keyboard_KeyDown(object sender, OpenTK.Input.KeyboardKeyEventArgs e)
{
KeyCode code = TransformKey(e.Key);
@@ -289,7 +288,8 @@
private void AttachEvents()
{
- mWindow.Closing += mWindow_CloseWindow;
+ mWindow.Closed += new EventHandler<EventArgs>(mWindow_Closed);
+ mWindow.Closing += new EventHandler<System.ComponentModel.CancelEventArgs>(mWindow_Closing);
mWindow.Resize += new EventHandler<EventArgs>(mWindow_Resize);
mWindow.Keyboard.KeyRepeat = true;
@@ -301,24 +301,28 @@
mWindow.Mouse.Move += new EventHandler<OpenTK.Input.MouseMoveEventArgs>(Mouse_Move);
}
- private void DetachEvents()
+ void mWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
- mWindow.Closing -= mWindow_CloseWindow;
- mWindow.Resize -= mWindow_Resize;
+ bool cancel = false;
- mWindow.Keyboard.KeyDown -= Keyboard_KeyDown;
- mWindow.Keyboard.KeyUp -= Keyboard_KeyUp;
+ OnClosing(ref cancel);
- mWindow.Mouse.ButtonDown -= Mouse_ButtonDown;
- mWindow.Mouse.ButtonUp -= Mouse_ButtonUp;
- mWindow.Mouse.Move -= Mouse_Move;
+ e.Cancel = cancel;
}
+ void mWindow_Closed(object sender, EventArgs e)
+ {
+ done = true;
+ OnClosed();
+ }
+
void mWindow_Resize(object sender, EventArgs e)
{
Debug.Print("Reseting viewport to {0}x{1}", mWindow.Width, mWindow.Height);
GL.Viewport(0, 0, mWindow.Width, mWindow.Height);
+
+ OnResize();
}
private void CreateWindowedDisplay()
Modified: trunk/Drivers/AgateSDX/AgateSDX.csproj
===================================================================
--- trunk/Drivers/AgateSDX/AgateSDX.csproj 2012-01-14 17:18:04 UTC (rev 1319)
+++ trunk/Drivers/AgateSDX/AgateSDX.csproj 2012-01-17 08:24:00 UTC (rev 1320)
@@ -106,7 +106,7 @@
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
- <Reference Include="SlimDX, Version=4.0.12.43, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9, processorArchitecture=x86" />
+ <Reference Include="SlimDX, Version=2.0.12.43, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9, processorArchitecture=x86" />
<Reference Include="System">
<Name>System</Name>
</Reference>
Added: trunk/Tests/DisplayTests/DisplayWindowEvents.cs
===================================================================
--- trunk/Tests/DisplayTests/DisplayWindowEvents.cs (rev 0)
+++ trunk/Tests/DisplayTests/DisplayWindowEvents.cs 2012-01-17 08:24:00 UTC (rev 1320)
@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using AgateLib;
+using AgateLib.DisplayLib;
+
+namespace Tests.DisplayTests
+{
+ class DisplayWindowEvents : IAgateTest
+ {
+ public string Name
+ {
+ get { return "Display Window Events"; }
+ }
+
+ public string Category
+ {
+ get { return "Display"; }
+ }
+
+ string text;
+ bool closedEvent;
+ bool closingEvent;
+
+ public void Main(string[] args)
+ {
+ using (AgateSetup setup = new AgateSetup(args))
+ {
+ setup.InitializeAll();
+ if (setup.WasCanceled)
+ return;
+
+ DisplayWindow wind = DisplayWindow.CreateWindowed("Display Window Events", 640, 480, true);
+
+ wind.Resize += new EventHandler(wind_Resize);
+ wind.Closed += new EventHandler(wind_Closed);
+ wind.Closing += new CancelEventHandler(wind_Closing);
+
+ while (wind.IsClosed == false)
+ {
+ Display.BeginFrame();
+ Display.Clear();
+
+ FontSurface.AgateSans24.DrawText(text);
+
+ Display.EndFrame();
+ Core.KeepAlive();
+ }
+ }
+
+ if (closedEvent == false)
+ {
+ System.Windows.Forms.MessageBox.Show(
+ "Closed event did not fire!");
+ }
+ }
+
+ void wind_Closing(object sender, ref bool cancel)
+ {
+ if (closingEvent == false)
+ {
+ text = "Closing event fired!" + Environment.NewLine + "Press close again to exit test.";
+
+ closingEvent = true;
+ cancel = true;
+ }
+ }
+
+ void wind_Closed(object sender, EventArgs e)
+ {
+ closedEvent = true;
+ }
+
+ void wind_Resize(object sender, EventArgs e)
+ {
+ text = "Resize event fired!";
+ }
+
+ }
+}
Modified: trunk/Tests/Tests.csproj
===================================================================
--- trunk/Tests/Tests.csproj 2012-01-14 17:18:04 UTC (rev 1319)
+++ trunk/Tests/Tests.csproj 2012-01-17 08:24:00 UTC (rev 1320)
@@ -141,6 +141,7 @@
<DependentUpon>frmCapabilities.cs</DependentUpon>
</Compile>
<Compile Include="DisplayTests\ColorTest.cs" />
+ <Compile Include="DisplayTests\DisplayWindowEvents.cs" />
<Compile Include="DisplayTests\PixelBufferMask.cs" />
<Compile Include="DisplayTests\ClipRect.cs" />
<Compile Include="DisplayTests\Prerendered.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-02-06 18:56:00
|
Revision: 1325
http://agate.svn.sourceforge.net/agate/?rev=1325&view=rev
Author: kanato
Date: 2012-02-06 18:55:54 +0000 (Mon, 06 Feb 2012)
Log Message:
-----------
Fixed a bug where OpenGL FrameBuffers would be rendered upside-down.
Modified Paths:
--------------
trunk/Drivers/AgateOTK/GL3/FrameBuffer.cs
trunk/Drivers/AgateOTK/GL_Surface.cs
trunk/Drivers/AgateOTK/Legacy/FrameBufferExt.cs
trunk/Tests/Tests.csproj
Added Paths:
-----------
trunk/Tests/DisplayTests/RenderTargetContinuous.cs
Modified: trunk/Drivers/AgateOTK/GL3/FrameBuffer.cs
===================================================================
--- trunk/Drivers/AgateOTK/GL3/FrameBuffer.cs 2012-02-05 01:58:45 UTC (rev 1324)
+++ trunk/Drivers/AgateOTK/GL3/FrameBuffer.cs 2012-02-06 18:55:54 UTC (rev 1325)
@@ -46,7 +46,8 @@
// AgateLib.DisplayLib.PixelFormat.RGBA8888, mSize);
mTexture = new GL_Surface(mSize);
-
+ mTexture.FlipVertical = true;
+
// generate the frame buffer
GL.GenFramebuffers(1, out mFramebufferID);
GL.BindFramebuffer(FramebufferTarget.Framebuffer, mFramebufferID);
Modified: trunk/Drivers/AgateOTK/GL_Surface.cs
===================================================================
--- trunk/Drivers/AgateOTK/GL_Surface.cs 2012-02-05 01:58:45 UTC (rev 1324)
+++ trunk/Drivers/AgateOTK/GL_Surface.cs 2012-02-06 18:55:54 UTC (rev 1325)
@@ -486,6 +486,13 @@
(srcRect.Right) / (float)mTextureSize.Width,
(srcRect.Bottom) / (float)mTextureSize.Height);
+ if (FlipVertical)
+ {
+ var t = coords.Top;
+ coords.Top = coords.Bottom;
+ coords.Bottom = t;
+ }
+
return coords;
}
private TextureCoordinates GetTextureCoords(RectangleF srcRect)
@@ -496,8 +503,19 @@
(srcRect.Right) / (float)mTextureSize.Width,
(srcRect.Bottom) / (float)mTextureSize.Height);
+ if (FlipVertical)
+ {
+ var t = coords.Top;
+ coords.Top = coords.Bottom;
+ coords.Bottom = t;
+ }
+
return coords;
}
+ /// <summary>
+ /// Used for framebuffer surfaces which need to be flipped vertically for some reason.
+ /// </summary>
+ public bool FlipVertical { get; set; }
}
}
Modified: trunk/Drivers/AgateOTK/Legacy/FrameBufferExt.cs
===================================================================
--- trunk/Drivers/AgateOTK/Legacy/FrameBufferExt.cs 2012-02-05 01:58:45 UTC (rev 1324)
+++ trunk/Drivers/AgateOTK/Legacy/FrameBufferExt.cs 2012-02-06 18:55:54 UTC (rev 1325)
@@ -48,6 +48,9 @@
void InitializeFramebuffer()
{
+ mTexture = new GL_Surface(mSize);
+ mTexture.FlipVertical = true;
+
// try to initialize with both depth and stencil buffers.
if (sDepthSupported && sStencilSupported)
{
@@ -104,8 +107,6 @@
void InitializeFramebuffer(bool depth, bool stencil)
{
- mTexture = new GL_Surface(mSize);
-
// generate the frame buffer
GL.Ext.GenFramebuffers(1, out mFramebufferID);
GL.Ext.BindFramebuffer(FramebufferTarget.Framebuffer, mFramebufferID);
Added: trunk/Tests/DisplayTests/RenderTargetContinuous.cs
===================================================================
--- trunk/Tests/DisplayTests/RenderTargetContinuous.cs (rev 0)
+++ trunk/Tests/DisplayTests/RenderTargetContinuous.cs 2012-02-06 18:55:54 UTC (rev 1325)
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using AgateLib;
+using AgateLib.DisplayLib;
+using AgateLib.Geometry;
+
+namespace Tests.DisplayTests
+{
+ class RenderTargetContinuous : IAgateTest
+ {
+ public string Name
+ {
+ get { return "Render Target Continuous"; }
+ }
+
+ public string Category
+ {
+ get { return "Display"; }
+ }
+
+ public void Main(string[] args)
+ {
+ using (AgateSetup setup = new AgateSetup())
+ {
+ setup.Initialize(true, false, false);
+ if (setup.WasCanceled) return;
+
+ DisplayWindow wind = DisplayWindow.CreateWindowed(Name, 300, 300);
+ FrameBuffer buffer = new FrameBuffer(300, 300);
+
+ FontSurface font = FontSurface.AgateSans24;
+ font.Color = Color.White;
+
+ while (wind.IsClosed == false)
+ {
+ Display.RenderTarget = buffer;
+ Display.BeginFrame();
+ Display.Clear(Color.Gray);
+
+ font.DrawText(string.Format("Time: {0}", Timing.TotalSeconds.ToString("0.0")));
+
+ Display.EndFrame();
+
+ Display.RenderTarget = wind.FrameBuffer;
+ Display.BeginFrame();
+ Display.Clear(Color.Gray);
+
+ buffer.RenderTarget.Draw();
+
+ Display.EndFrame();
+ Core.KeepAlive();
+ }
+ }
+ }
+ }
+}
Modified: trunk/Tests/Tests.csproj
===================================================================
--- trunk/Tests/Tests.csproj 2012-02-05 01:58:45 UTC (rev 1324)
+++ trunk/Tests/Tests.csproj 2012-02-06 18:55:54 UTC (rev 1325)
@@ -145,6 +145,7 @@
<Compile Include="DisplayTests\PixelBufferMask.cs" />
<Compile Include="DisplayTests\ClipRect.cs" />
<Compile Include="DisplayTests\Prerendered.cs" />
+ <Compile Include="DisplayTests\RenderTargetContinuous.cs" />
<Compile Include="Fonts\Builtin.cs" />
<Compile Include="Fonts\Kerning.cs" />
<Compile Include="frmLauncher.cs">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-02-20 02:05:36
|
Revision: 1330
http://agate.svn.sourceforge.net/agate/?rev=1330&view=rev
Author: kanato
Date: 2012-02-20 02:05:27 +0000 (Mon, 20 Feb 2012)
Log Message:
-----------
Add option to enforce monospace numbers in font generation.
Correct calculation of text width.
Modified Paths:
--------------
trunk/AgateLib/BitmapFont/BitmapFontImpl.cs
trunk/AgateLib/BitmapFont/BitmapFontOptions.cs
trunk/Drivers/AgateLib.WinForms/BitmapFontUtil.cs
trunk/Tests/Data/TestResourceFile.xml
trunk/Tests/Tests.csproj
trunk/Tools/FontCreator/CreateFont.Designer.cs
trunk/Tools/FontCreator/CreateFont.cs
trunk/Tools/FontCreator/CreateFont.resx
Added Paths:
-----------
trunk/Tests/Data/fonts/MedievalSharp14.png
trunk/Tests/Data/fonts/MedievalSharp18.png
trunk/Tests/Data/fonts/MedievalSharpBold14.png
trunk/Tests/Data/fonts/MedievalSharpBold18.png
trunk/Tests/Data/fonts/MedievalSharpBold22.png
trunk/Tests/Fonts/FontAlignment.cs
Modified: trunk/AgateLib/BitmapFont/BitmapFontImpl.cs
===================================================================
--- trunk/AgateLib/BitmapFont/BitmapFontImpl.cs 2012-02-17 02:25:24 UTC (rev 1329)
+++ trunk/AgateLib/BitmapFont/BitmapFontImpl.cs 2012-02-20 02:05:27 UTC (rev 1330)
@@ -210,7 +210,7 @@
if (mFontMetrics.ContainsKey(line[j]) == false)
continue;
- lineWidth += mFontMetrics[line[j]].Width;
+ lineWidth += mFontMetrics[line[j]].LayoutWidth;
}
if (lineWidth > highestLineWidth)
Modified: trunk/AgateLib/BitmapFont/BitmapFontOptions.cs
===================================================================
--- trunk/AgateLib/BitmapFont/BitmapFontOptions.cs 2012-02-17 02:25:24 UTC (rev 1329)
+++ trunk/AgateLib/BitmapFont/BitmapFontOptions.cs 2012-02-20 02:05:27 UTC (rev 1330)
@@ -96,6 +96,7 @@
private FontStyle mStyle;
private bool mUseTextRenderer = true;
private bool mCreateBorder;
+ private bool mMonospaceNumbers = true;
private Color mBorderColor = Color.FromArgb(128, Color.Black);
private BitmapFontEdgeOptions mEdgeOptions;
private List<CharacterRange> mRanges = new List<CharacterRange>();
@@ -288,6 +289,21 @@
/// Indicates how much to increase the bottom margin of letters. Can be negative.
/// </summary>
public int BottomMarginAdjust { get; set; }
+
+ /// <summary>
+ /// Set to true to force the digits 0-9 to be generated at the same width.
+ /// </summary>
+ public bool MonospaceNumbers
+ {
+ get { return mMonospaceNumbers; }
+ set { mMonospaceNumbers = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the number of pixels the width of numbers is to be increased or decreased.
+ /// This value is only used if MonospaceNumbers is enabled.
+ /// </summary>
+ public int NumberWidthAdjust { get; set; }
}
}
Modified: trunk/Drivers/AgateLib.WinForms/BitmapFontUtil.cs
===================================================================
--- trunk/Drivers/AgateLib.WinForms/BitmapFontUtil.cs 2012-02-17 02:25:24 UTC (rev 1329)
+++ trunk/Drivers/AgateLib.WinForms/BitmapFontUtil.cs 2012-02-20 02:05:27 UTC (rev 1330)
@@ -99,6 +99,7 @@
int x = rend.Padding, y = 2;
int height = 0;
char lastChar = ' ';
+ int digitWidth = 0;
// first measure the required height of the image.
foreach (BitmapFontOptions.CharacterRange range in options.CharacterRanges)
@@ -134,6 +135,9 @@
glyphs[i] = new GlyphMetrics(new Rectangle(0, 0, sourceSize.Width, sourceSize.Height));
+ if ('0' <= i && i <= '9')
+ digitWidth = Math.Max(digitWidth, sourceSize.Width);
+
lastChar = i;
}
}
@@ -189,11 +193,11 @@
if (font.SizeInPoints >= 14.0)
{
- glyphs[i].LeftOverhang = 1;
- glyphs[i].RightOverhang = 1;
+ glyphs[i].LeftOverhang += 1;
+ glyphs[i].RightOverhang += 1;
}
else
- glyphs[i].RightOverhang = 1;
+ glyphs[i].RightOverhang += 1;
}
else
@@ -215,6 +219,22 @@
rend.ModifyMetrics(glyphs, g);
+ if (options.MonospaceNumbers)
+ {
+ digitWidth += options.NumberWidthAdjust;
+
+ for (char i = '0'; i <= '9'; i++)
+ {
+ int delta = digitWidth - glyphs[i].Width;
+
+ int leftShift = -delta / 2;
+ int rightShift = -delta - leftShift;
+
+ glyphs[i].LeftOverhang = leftShift;
+ glyphs[i].RightOverhang = rightShift;
+ }
+ }
+
g.Dispose();
// do post processing of chars.
Modified: trunk/Tests/Data/TestResourceFile.xml
===================================================================
--- trunk/Tests/Data/TestResourceFile.xml 2012-02-17 02:25:24 UTC (rev 1329)
+++ trunk/Tests/Data/TestResourceFile.xml 2012-02-20 02:05:27 UTC (rev 1330)
@@ -120,4 +120,974 @@
<Glyph char="126" source="{X=127,Y=110,Width=11,Height=24}" leftOverhang="1" rightOverhang="1" />
</Metrics>
</BitmapFont>
+ <BitmapFont name="MedievalSharp18" image="fonts/MedievalSharp18.png">
+ <Metrics>
+ <Glyph char="32" source="{X=0,Y=2,Width=8,Height=34}" rightOverhang="1" />
+ <Glyph char="33" source="{X=10,Y=2,Width=8,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="34" source="{X=20,Y=2,Width=11,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="35" source="{X=33,Y=2,Width=18,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="36" source="{X=53,Y=2,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="37" source="{X=70,Y=2,Width=19,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="38" source="{X=91,Y=2,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="39" source="{X=110,Y=2,Width=7,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="40" source="{X=119,Y=2,Width=11,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="41" source="{X=132,Y=2,Width=11,Height=34}" rightOverhang="1" />
+ <Glyph char="42" source="{X=145,Y=2,Width=16,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="43" source="{X=163,Y=2,Width=16,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="44" source="{X=181,Y=2,Width=8,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="45" source="{X=191,Y=2,Width=16,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="46" source="{X=209,Y=2,Width=7,Height=34}" rightOverhang="1" />
+ <Glyph char="47" source="{X=218,Y=2,Width=14,Height=34}" rightOverhang="1" />
+ <Glyph char="48" source="{X=234,Y=2,Width=17,Height=34}" leftOverhang="1" rightOverhang="2" />
+ <Glyph char="49" source="{X=0,Y=39,Width=10,Height=34}" leftOverhang="-2" rightOverhang="-2" />
+ <Glyph char="50" source="{X=12,Y=39,Width=15,Height=34}" rightOverhang="1" />
+ <Glyph char="51" source="{X=29,Y=39,Width=15,Height=34}" rightOverhang="1" />
+ <Glyph char="52" source="{X=46,Y=39,Width=16,Height=34}" leftOverhang="1" rightOverhang="1" />
+ <Glyph char="53" source="{X=64,Y=39,Width=15,Height=34}" rightOverhang="1" />
+ <Glyph char="54" source="{X=81,Y=39,Width=16,Height=34}" leftOverhang="1" rightOverhang="1" />
+ <Glyph char="55" source="{X=99,Y=39,Width=13,Height=34}" rightOverhang="-1" />
+ <Glyph char="56" source="{X=114,Y=39,Width=15,Height=34}" rightOverhang="1" />
+ <Glyph char="57" source="{X=131,Y=39,Width=16,Height=34}" leftOverhang="1" rightOverhang="1" />
+ <Glyph char="58" source="{X=149,Y=39,Width=7,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="59" source="{X=158,Y=39,Width=8,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="60" source="{X=168,Y=39,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="61" source="{X=187,Y=39,Width=16,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="62" source="{X=205,Y=39,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="63" source="{X=224,Y=39,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="64" source="{X=241,Y=39,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="65" source="{X=0,Y=76,Width=16,Height=34}" rightOverhang="1" />
+ <Glyph char="66" source="{X=18,Y=76,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="67" source="{X=37,Y=76,Width=16,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="68" source="{X=55,Y=76,Width=18,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="69" source="{X=75,Y=76,Width=14,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="70" source="{X=91,Y=76,Width=13,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="71" source="{X=106,Y=76,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="72" source="{X=125,Y=76,Width=17,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="73" source="{X=144,Y=76,Width=8,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="74" source="{X=154,Y=76,Width=15,Height=34}" rightOverhang="1" />
+ <Glyph char="75" source="{X=171,Y=76,Width=16,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="76" source="{X=189,Y=76,Width=15,Height=34}" leftOverhang="-2" rightOverhang="5" />
+ <Glyph char="77" source="{X=206,Y=76,Width=21,Height=34}" rightOverhang="1" />
+ <Glyph char="78" source="{X=229,Y=76,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="79" source="{X=0,Y=113,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="80" source="{X=19,Y=113,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="81" source="{X=38,Y=113,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="82" source="{X=57,Y=113,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="83" source="{X=76,Y=113,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="84" source="{X=93,Y=113,Width=14,Height=34}" rightOverhang="1" />
+ <Glyph char="85" source="{X=109,Y=113,Width=18,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="86" source="{X=129,Y=113,Width=16,Height=34}" rightOverhang="1" />
+ <Glyph char="87" source="{X=147,Y=113,Width=22,Height=34}" rightOverhang="1" />
+ <Glyph char="88" source="{X=171,Y=113,Width=15,Height=34}" rightOverhang="1" />
+ <Glyph char="89" source="{X=188,Y=113,Width=15,Height=34}" rightOverhang="1" />
+ <Glyph char="90" source="{X=205,Y=113,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="91" source="{X=222,Y=113,Width=11,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="92" source="{X=235,Y=113,Width=14,Height=34}" rightOverhang="1" />
+ <Glyph char="93" source="{X=0,Y=150,Width=11,Height=34}" rightOverhang="1" />
+ <Glyph char="94" source="{X=13,Y=150,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="95" source="{X=32,Y=150,Width=16,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="96" source="{X=50,Y=150,Width=9,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="97" source="{X=61,Y=150,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="98" source="{X=77,Y=150,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="99" source="{X=94,Y=150,Width=13,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="100" source="{X=109,Y=150,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="101" source="{X=125,Y=150,Width=13,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="102" source="{X=140,Y=150,Width=13,Height=34}" leftOverhang="1" rightOverhang="2" />
+ <Glyph char="103" source="{X=155,Y=150,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="104" source="{X=172,Y=150,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="105" source="{X=189,Y=150,Width=7,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="106" source="{X=198,Y=150,Width=9,Height=34}" leftOverhang="1" rightOverhang="2" />
+ <Glyph char="107" source="{X=209,Y=150,Width=15,Height=34}" leftOverhang="-1" rightOverhang="4" />
+ <Glyph char="108" source="{X=226,Y=150,Width=7,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="109" source="{X=0,Y=187,Width=22,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="110" source="{X=24,Y=187,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="111" source="{X=41,Y=187,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="112" source="{X=57,Y=187,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="113" source="{X=73,Y=187,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="114" source="{X=90,Y=187,Width=13,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="115" source="{X=105,Y=187,Width=12,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="116" source="{X=119,Y=187,Width=10,Height=34}" rightOverhang="1" />
+ <Glyph char="117" source="{X=131,Y=187,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="118" source="{X=148,Y=187,Width=13,Height=34}" rightOverhang="1" />
+ <Glyph char="119" source="{X=163,Y=187,Width=22,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="120" source="{X=187,Y=187,Width=14,Height=34}" rightOverhang="3" />
+ <Glyph char="121" source="{X=203,Y=187,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="122" source="{X=220,Y=187,Width=12,Height=34}" rightOverhang="1" />
+ <Glyph char="123" source="{X=234,Y=187,Width=13,Height=34}" rightOverhang="1" />
+ <Glyph char="124" source="{X=0,Y=224,Width=8,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="125" source="{X=10,Y=224,Width=13,Height=34}" rightOverhang="1" />
+ <Glyph char="126" source="{X=25,Y=224,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="161" source="{X=42,Y=224,Width=8,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="162" source="{X=52,Y=224,Width=13,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="163" source="{X=67,Y=224,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="164" source="{X=84,Y=224,Width=19,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="165" source="{X=105,Y=224,Width=16,Height=34}" rightOverhang="1" />
+ <Glyph char="166" source="{X=123,Y=224,Width=9,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="167" source="{X=134,Y=224,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="168" source="{X=150,Y=224,Width=11,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="169" source="{X=163,Y=224,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="170" source="{X=182,Y=224,Width=13,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="171" source="{X=197,Y=224,Width=19,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="172" source="{X=218,Y=224,Width=16,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="173" source="{X=236,Y=224,Width=16,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="174" source="{X=0,Y=261,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="175" source="{X=19,Y=261,Width=16,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="176" source="{X=37,Y=261,Width=11,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="177" source="{X=50,Y=261,Width=16,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="178" source="{X=68,Y=261,Width=11,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="179" source="{X=81,Y=261,Width=11,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="180" source="{X=94,Y=261,Width=9,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="181" source="{X=105,Y=261,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="182" source="{X=122,Y=261,Width=13,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="183" source="{X=137,Y=261,Width=7,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="184" source="{X=146,Y=261,Width=8,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="185" source="{X=156,Y=261,Width=9,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="186" source="{X=167,Y=261,Width=13,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="187" source="{X=182,Y=261,Width=19,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="188" source="{X=203,Y=261,Width=18,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="189" source="{X=223,Y=261,Width=19,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="190" source="{X=0,Y=298,Width=20,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="191" source="{X=22,Y=298,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="192" source="{X=39,Y=298,Width=16,Height=34}" rightOverhang="1" />
+ <Glyph char="193" source="{X=57,Y=298,Width=16,Height=34}" rightOverhang="1" />
+ <Glyph char="194" source="{X=75,Y=298,Width=16,Height=34}" rightOverhang="1" />
+ <Glyph char="195" source="{X=93,Y=298,Width=16,Height=34}" rightOverhang="1" />
+ <Glyph char="196" source="{X=111,Y=298,Width=18,Height=34}" rightOverhang="3" />
+ <Glyph char="197" source="{X=131,Y=298,Width=18,Height=34}" rightOverhang="3" />
+ <Glyph char="198" source="{X=151,Y=298,Width=22,Height=34}" rightOverhang="1" />
+ <Glyph char="199" source="{X=175,Y=298,Width=16,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="200" source="{X=193,Y=298,Width=14,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="201" source="{X=209,Y=298,Width=14,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="202" source="{X=225,Y=298,Width=14,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="203" source="{X=241,Y=298,Width=14,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="204" source="{X=0,Y=335,Width=8,Height=34}" rightOverhang="1" />
+ <Glyph char="205" source="{X=10,Y=335,Width=8,Height=34}" leftOverhang="-2" rightOverhang="3" />
+ <Glyph char="206" source="{X=20,Y=335,Width=8,Height=34}" rightOverhang="1" />
+ <Glyph char="207" source="{X=30,Y=335,Width=8,Height=34}" rightOverhang="1" />
+ <Glyph char="208" source="{X=40,Y=335,Width=18,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="209" source="{X=60,Y=335,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="210" source="{X=79,Y=335,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="211" source="{X=98,Y=335,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="212" source="{X=117,Y=335,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="213" source="{X=136,Y=335,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="214" source="{X=155,Y=335,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="215" source="{X=174,Y=335,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="216" source="{X=190,Y=335,Width=17,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="217" source="{X=209,Y=335,Width=18,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="218" source="{X=229,Y=335,Width=18,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="219" source="{X=0,Y=372,Width=18,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="220" source="{X=20,Y=372,Width=18,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="221" source="{X=40,Y=372,Width=15,Height=34}" rightOverhang="1" />
+ <Glyph char="222" source="{X=57,Y=372,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="223" source="{X=74,Y=372,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="224" source="{X=91,Y=372,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="225" source="{X=107,Y=372,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="226" source="{X=123,Y=372,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="227" source="{X=139,Y=372,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="228" source="{X=155,Y=372,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="229" source="{X=171,Y=372,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="230" source="{X=187,Y=372,Width=21,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="231" source="{X=210,Y=372,Width=13,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="232" source="{X=225,Y=372,Width=13,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="233" source="{X=240,Y=372,Width=13,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="234" source="{X=0,Y=409,Width=13,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="235" source="{X=15,Y=409,Width=13,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="236" source="{X=30,Y=409,Width=9,Height=34}" leftOverhang="1" rightOverhang="2" />
+ <Glyph char="237" source="{X=41,Y=409,Width=9,Height=34}" leftOverhang="-1" rightOverhang="4" />
+ <Glyph char="238" source="{X=52,Y=409,Width=7,Height=34}" rightOverhang="1" />
+ <Glyph char="239" source="{X=61,Y=409,Width=7,Height=34}" rightOverhang="1" />
+ <Glyph char="240" source="{X=70,Y=409,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="241" source="{X=87,Y=409,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="242" source="{X=104,Y=409,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="243" source="{X=120,Y=409,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="244" source="{X=136,Y=409,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="245" source="{X=152,Y=409,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="246" source="{X=168,Y=409,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="247" source="{X=184,Y=409,Width=16,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="248" source="{X=202,Y=409,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="249" source="{X=218,Y=409,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="250" source="{X=235,Y=409,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="251" source="{X=0,Y=446,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="252" source="{X=17,Y=446,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="253" source="{X=34,Y=446,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="254" source="{X=51,Y=446,Width=14,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="255" source="{X=67,Y=446,Width=15,Height=34}" leftOverhang="-1" rightOverhang="2" />
+ </Metrics>
+ </BitmapFont>
+ <BitmapFont name="MedievalSharp14" image="fonts/MedievalSharp14.png">
+ <Metrics>
+ <Glyph char="32" source="{X=0,Y=2,Width=7,Height=27}" rightOverhang="1" />
+ <Glyph char="33" source="{X=9,Y=2,Width=7,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="34" source="{X=18,Y=2,Width=9,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="35" source="{X=29,Y=2,Width=14,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="36" source="{X=45,Y=2,Width=12,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="37" source="{X=59,Y=2,Width=15,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="38" source="{X=76,Y=2,Width=14,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="39" source="{X=92,Y=2,Width=6,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="40" source="{X=100,Y=2,Width=9,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="41" source="{X=111,Y=2,Width=9,Height=27}" rightOverhang="1" />
+ <Glyph char="42" source="{X=122,Y=2,Width=12,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="43" source="{X=136,Y=2,Width=13,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="44" source="{X=151,Y=2,Width=7,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="45" source="{X=160,Y=2,Width=13,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="46" source="{X=175,Y=2,Width=6,Height=27}" rightOverhang="1" />
+ <Glyph char="47" source="{X=183,Y=2,Width=11,Height=27}" rightOverhang="1" />
+ <Glyph char="48" source="{X=196,Y=2,Width=14,Height=27}" leftOverhang="1" rightOverhang="2" />
+ <Glyph char="49" source="{X=212,Y=2,Width=8,Height=27}" leftOverhang="-1" rightOverhang="-2" />
+ <Glyph char="50" source="{X=222,Y=2,Width=12,Height=27}" rightOverhang="1" />
+ <Glyph char="51" source="{X=236,Y=2,Width=12,Height=27}" rightOverhang="1" />
+ <Glyph char="52" source="{X=0,Y=32,Width=12,Height=27}" rightOverhang="1" />
+ <Glyph char="53" source="{X=14,Y=32,Width=12,Height=27}" rightOverhang="1" />
+ <Glyph char="54" source="{X=28,Y=32,Width=13,Height=27}" leftOverhang="1" rightOverhang="1" />
+ <Glyph char="55" source="{X=43,Y=32,Width=10,Height=27}" rightOverhang="-1" />
+ <Glyph char="56" source="{X=55,Y=32,Width=12,Height=27}" rightOverhang="1" />
+ <Glyph char="57" source="{X=69,Y=32,Width=13,Height=27}" leftOverhang="1" rightOverhang="1" />
+ <Glyph char="58" source="{X=84,Y=32,Width=6,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="59" source="{X=92,Y=32,Width=7,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="60" source="{X=101,Y=32,Width=14,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="61" source="{X=117,Y=32,Width=13,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="62" source="{X=132,Y=32,Width=14,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="63" source="{X=148,Y=32,Width=12,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="64" source="{X=162,Y=32,Width=12,Height=27}" rightOverhang="1" />
+ <Glyph char="65" source="{X=176,Y=32,Width=13,Height=27}" rightOverhang="1" />
+ <Glyph char="66" source="{X=191,Y=32,Width=14,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="67" source="{X=207,Y=32,Width=13,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="68" source="{X=222,Y=32,Width=14,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="69" source="{X=238,Y=32,Width=11,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="70" source="{X=0,Y=62,Width=11,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="71" source="{X=13,Y=62,Width=14,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="72" source="{X=29,Y=62,Width=14,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="73" source="{X=45,Y=62,Width=7,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="74" source="{X=54,Y=62,Width=12,Height=27}" rightOverhang="1" />
+ <Glyph char="75" source="{X=68,Y=62,Width=13,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="76" source="{X=83,Y=62,Width=11,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="77" source="{X=96,Y=62,Width=17,Height=27}" rightOverhang="1" />
+ <Glyph char="78" source="{X=115,Y=62,Width=14,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="79" source="{X=131,Y=62,Width=14,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="80" source="{X=147,Y=62,Width=13,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="81" source="{X=162,Y=62,Width=14,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="82" source="{X=178,Y=62,Width=14,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="83" source="{X=194,Y=62,Width=12,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="84" source="{X=208,Y=62,Width=15,Height=27}" leftOverhang="1" rightOverhang="4" />
+ <Glyph char="85" source="{X=225,Y=62,Width=14,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="86" source="{X=241,Y=62,Width=13,Height=27}" rightOverhang="1" />
+ <Glyph char="87" source="{X=0,Y=92,Width=18,Height=27}" rightOverhang="1" />
+ <Glyph char="88" source="{X=20,Y=92,Width=12,Height=27}" rightOverhang="1" />
+ <Glyph char="89" source="{X=34,Y=92,Width=12,Height=27}" rightOverhang="1" />
+ <Glyph char="90" source="{X=48,Y=92,Width=12,Height=27}" rightOverhang="1" />
+ <Glyph char="91" source="{X=62,Y=92,Width=9,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Glyph char="92" source="{X=73,Y=92,Width=11,Height=27}" rightOverhang="1" />
+ <Glyph char="93" source="{X=86,Y=92,Width=9,Height=27}" rightOverhang="1" />
+ <Glyph char="94" source="{X=97,Y=92,Width=14,Height=27}" leftOverhang="-1" rightOverhang="2" />
+ <Gl...
[truncated message content] |
|
From: <ka...@us...> - 2012-02-23 22:05:32
|
Revision: 1331
http://agate.svn.sourceforge.net/agate/?rev=1331&view=rev
Author: kanato
Date: 2012-02-23 22:05:25 +0000 (Thu, 23 Feb 2012)
Log Message:
-----------
Add correction for CurrentWindow property of Display when the render target is changed.
Fixed stack overflow issue with PersistantSettings loading.
Registrar saves driver selection in settings now.
SlimDX for .NET 4.0 (Jan 2012) is referenced in AgateSDX.
Modified Paths:
--------------
trunk/AgateLib/DisplayLib/Display.cs
trunk/AgateLib/DisplayLib/DisplayWindow.cs
trunk/AgateLib/DisplayLib/FrameBuffer.cs
trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs
trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs
trunk/AgateLib/Drivers/Registrar.cs
trunk/AgateLib/Settings/PersistantSettings.cs
trunk/AgateLib/Settings/SettingsGroup.cs
trunk/Drivers/AgateDrawing/Drawing_Display.cs
trunk/Drivers/AgateDrawing/Drawing_DisplayWindow.cs
trunk/Drivers/AgateDrawing/Drawing_FrameBuffer.cs
trunk/Drivers/AgateOTK/ContextFB.cs
trunk/Drivers/AgateOTK/GL3/FrameBuffer.cs
trunk/Drivers/AgateOTK/GL_Display.cs
trunk/Drivers/AgateOTK/GL_DisplayControl.cs
trunk/Drivers/AgateOTK/GL_GameWindow.cs
trunk/Drivers/AgateOTK/Legacy/FrameBufferExt.cs
trunk/Drivers/AgateOTK/Legacy/FrameBufferReadPixels.cs
trunk/Drivers/AgateSDX/AgateSDX.csproj
trunk/Drivers/AgateSDX/FrameBufferSurface.cs
trunk/Drivers/AgateSDX/FrameBufferWindow.cs
trunk/Drivers/AgateSDX/SDX_Display.cs
trunk/Drivers/AgateSDX/SDX_DisplayWindow.cs
trunk/Tests/frmLauncher.cs
Modified: trunk/AgateLib/DisplayLib/Display.cs
===================================================================
--- trunk/AgateLib/DisplayLib/Display.cs 2012-02-20 02:05:27 UTC (rev 1330)
+++ trunk/AgateLib/DisplayLib/Display.cs 2012-02-23 22:05:25 UTC (rev 1331)
@@ -196,9 +196,8 @@
sImpl.RenderTarget = value;
- // TODO: replace this with an ActiveWindow property.
- //if (value is DisplayWindow)
- // mCurrentWindow = (DisplayWindow)value;
+ if (value.AttachedWindow != null)
+ sCurrentWindow = value.AttachedWindow;
}
}
Modified: trunk/AgateLib/DisplayLib/DisplayWindow.cs
===================================================================
--- trunk/AgateLib/DisplayLib/DisplayWindow.cs 2012-02-20 02:05:27 UTC (rev 1330)
+++ trunk/AgateLib/DisplayLib/DisplayWindow.cs 2012-02-23 22:05:25 UTC (rev 1331)
@@ -58,14 +58,14 @@
CreateWindowParams par = CreateWindowParams.FullScreen(
disp.Title, disp.Size.Width, disp.Size.Height, disp.Bpp);
- mImpl = Display.Impl.CreateDisplayWindow(par);
+ mImpl = Display.Impl.CreateDisplayWindow(this, par);
}
else
{
CreateWindowParams par = CreateWindowParams.Windowed(
disp.Title, disp.Size.Width, disp.Size.Height, disp.AllowResize, null);
- mImpl = Display.Impl.CreateDisplayWindow(par);
+ mImpl = Display.Impl.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(windowParams);
+ mImpl = Display.Impl.CreateDisplayWindow(this, windowParams);
Display.RenderTarget = FrameBuffer;
Display.DisposeDisplay += new Display.DisposeDisplayHandler(Dispose);
Modified: trunk/AgateLib/DisplayLib/FrameBuffer.cs
===================================================================
--- trunk/AgateLib/DisplayLib/FrameBuffer.cs 2012-02-20 02:05:27 UTC (rev 1330)
+++ trunk/AgateLib/DisplayLib/FrameBuffer.cs 2012-02-23 22:05:25 UTC (rev 1331)
@@ -117,6 +117,15 @@
}
/// <summary>
+ /// Gets the window that this frame buffer is attached to. Returns null
+ /// if this FrameBuffer is not attached to any window.
+ /// </summary>
+ public DisplayWindow AttachedWindow
+ {
+ get { return Impl.AttachedWindow; }
+ }
+
+ /// <summary>
/// Returns true if the RenderTarget property is readable, and this surface that is
/// rendered to can be used to draw from.
/// </summary>
Modified: trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs 2012-02-20 02:05:27 UTC (rev 1330)
+++ trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs 2012-02-23 22:05:25 UTC (rev 1331)
@@ -124,7 +124,7 @@
/// </summary>
/// <param name="windowParams"></param>
/// <returns></returns>
- public abstract DisplayWindowImpl CreateDisplayWindow(CreateWindowParams windowParams);
+ public abstract DisplayWindowImpl CreateDisplayWindow(DisplayWindow owner, CreateWindowParams windowParams);
/// <summary>
/// Creates a SurfaceImpl derived object.
Modified: trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs
===================================================================
--- trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs 2012-02-20 02:05:27 UTC (rev 1330)
+++ trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs 2012-02-23 22:05:25 UTC (rev 1331)
@@ -81,5 +81,11 @@
{
get { throw new AgateException("Cannot access the back buffer in this frame buffer."); }
}
+
+ /// <summary>
+ /// Gets the window that this frame buffer is attached to. Returns null
+ /// if this FrameBuffer is not attached to any window.
+ /// </summary>
+ public abstract DisplayWindow AttachedWindow { get; }
}
}
Modified: trunk/AgateLib/Drivers/Registrar.cs
===================================================================
--- trunk/AgateLib/Drivers/Registrar.cs 2012-02-20 02:05:27 UTC (rev 1330)
+++ trunk/AgateLib/Drivers/Registrar.cs 2012-02-23 22:05:25 UTC (rev 1331)
@@ -341,7 +341,9 @@
info = FindDriverInfo(displayDrivers, (int)displayType);
if (info == null)
- throw new AgateException(string.Format("Could not find the driver {0}.", displayType));
+ throw new AgateException(string.Format("Could not find the driver {0}.", displayType));
+
+ Core.Settings["AgateLib"]["DisplayDriver"] = info.FriendlyName;
return (DisplayImpl)CreateDriverInstance(info);
}
Modified: trunk/AgateLib/Settings/PersistantSettings.cs
===================================================================
--- trunk/AgateLib/Settings/PersistantSettings.cs 2012-02-20 02:05:27 UTC (rev 1330)
+++ trunk/AgateLib/Settings/PersistantSettings.cs 2012-02-23 22:05:25 UTC (rev 1331)
@@ -1,191 +1,196 @@
-// 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-2011.
-// All Rights Reserved.
-//
-// Contributor(s): Erik Ylvisaker
-//
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Xml;
-
-namespace AgateLib.Settings
-{
- /// <summary>
- /// Class which stores a simple list of persistant settings. The settings exist
- /// in named groups, and within each group an individual setting is a key/value pair.
- /// These settings are stored on a per-user basis.
- /// </summary>
- /// <remarks>On Windows Vista and up the file is stored in
- /// %HOME%\AppData\Company Name\Application Name\settings.xml.
- /// On Unix the file is stored at
- /// $HOME/.config/Company Name/Application Name/settings.xml.
- /// </remarks>
- public class PersistantSettings
- {
- Dictionary<string, SettingsGroup> mSettings = new Dictionary<string, SettingsGroup>();
-
- internal PersistantSettings()
- {
- LoadSettings();
- }
+// 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-2011.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace AgateLib.Settings
+{
+ /// <summary>
+ /// Class which stores a simple list of persistant settings. The settings exist
+ /// in named groups, and within each group an individual setting is a key/value pair.
+ /// These settings are stored on a per-user basis.
+ /// </summary>
+ /// <remarks>On Windows Vista and up the file is stored in
+ /// %HOME%\AppData\Company Name\Application Name\settings.xml.
+ /// On Unix the file is stored at
+ /// $HOME/.config/Company Name/Application Name/settings.xml.
+ /// </remarks>
+ public class PersistantSettings
+ {
+ Dictionary<string, SettingsGroup> mSettings = new Dictionary<string, SettingsGroup>();
- public ISettingsTracer SettingsTracer { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether this <see cref="AgateLib.Settings.PersistantSettings"/> is in
- /// debugging mode. If true, every access to a setting value will be echoed to System.Diagnostics.Trace.
- /// </summary>
- /// <value>
- /// <c>true</c> if debug; otherwise, <c>false</c>.
- /// </value>
- public bool Debug { get; set; }
-
- internal void TraceSettingsRead(string groupName, string key, string value)
- {
- if (Debug)
- {
- Trace.WriteLine(string.Format("Settings[\"{0}\"][\"{1}\"] read.", groupName, key));
- }
-
- if (SettingsTracer == null) return;
-
+ #region --- Static Members ---
+
+ public static ISettingsTracer SettingsTracer { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether PersistantSettings objects are in
+ /// debugging mode. If true, every access to a setting value will be echoed to System.Diagnostics.Trace.
+ /// </summary>
+ /// <value>
+ /// <c>true</c> if debug; otherwise, <c>false</c>.
+ /// </value>
+ public static bool Debug { get; set; }
+
+ internal static void TraceSettingsRead(string groupName, string key, string value)
+ {
+ if (Debug)
+ {
+ Trace.WriteLine(string.Format("Settings[\"{0}\"][\"{1}\"] read.", groupName, key));
+ }
+
+ if (SettingsTracer == null) return;
+
SettingsTracer.OnReadSetting(groupName, key, value);
}
- internal void TraceSettingsWrite(string groupName, string key, string value)
- {
- if (Debug)
- {
- Trace.WriteLine(string.Format("Settings[\"{0}\"][\"{1}\"] written.", groupName, key));
- }
-
+ internal static void TraceSettingsWrite(string groupName, string key, string value)
+ {
+ if (Debug)
+ {
+ Trace.WriteLine(string.Format("Settings[\"{0}\"][\"{1}\"] written.", groupName, key));
+ }
+
if (SettingsTracer == null) return;
-
+
SettingsTracer.OnWriteSetting(groupName, key, value);
}
-
- private SettingsGroup GetOrCreateSettingsGroup(string name)
- {
- if (name.Contains(" "))
- throw new AgateException("Settings group name cannot contain a space.");
-
- if (mSettings.ContainsKey(name) == false)
- {
- mSettings[name] = new SettingsGroup();
- mSettings[name].Name = name;
- }
-
- return mSettings[name];
- }
-
- /// <summary>
- /// Gets a settings group, or creates it if it does not exist.
- /// </summary>
- /// <param name="name">The name of the group is case-sensitive, and must not contain any spaces
- /// or special characters.</param>
- /// <returns></returns>
- public SettingsGroup this[string name]
- {
- get { return GetOrCreateSettingsGroup(name); }
- }
- /// <summary>
- /// Gets the full path to the location where the settings file is stored.
- /// </summary>
- public string SettingsFilename
- {
- get
- {
- return System.IO.Path.Combine(Core.Platform.AppDataDirectory, "settings.xml");
- }
- }
-
- /// <summary>
- /// Saves the settings to the persistant storage on disk.
- /// </summary>
- public void SaveSettings()
- {
- XmlDocument doc = new XmlDocument();
- XmlElement root = doc.CreateElement("Settings");
-
- foreach (string group in mSettings.Keys)
- {
- XmlElement groupNode = doc.CreateElement(group);
-
- foreach (var kvp in mSettings[group])
- {
- XmlElement set = doc.CreateElement(kvp.Key);
- set.InnerText = kvp.Value;
-
- groupNode.AppendChild(set);
- }
-
- root.AppendChild(groupNode);
- }
-
- doc.AppendChild(root);
-
- System.Diagnostics.Trace.WriteLine("Saving settings to " + SettingsFilename);
-
- Core.Platform.EnsureAppDataDirectoryExists();
-
- doc.Save(SettingsFilename);
- }
-
- private void LoadSettings()
- {
- XmlDocument doc = new XmlDocument();
- try
- {
- doc.Load(SettingsFilename);
- }
- catch (FileNotFoundException)
- {
- return;
- }
- catch (DirectoryNotFoundException)
- {
- return;
- }
- catch (XmlException e)
- {
- System.Diagnostics.Trace.WriteLine("Error reading settings file:" + Environment.NewLine +
- e.Message);
-
- return;
- }
- XmlElement root = doc.ChildNodes[0] as XmlElement;
-
- if (root.Name != "Settings")
- throw new AgateException("Could not understand settings file\n" + SettingsFilename +
- "\nYou may need to delete it.");
-
- foreach (XmlElement node in root.ChildNodes)
- {
- SettingsGroup g = new SettingsGroup();
-
- foreach (XmlElement pair in node.ChildNodes)
- {
- g.Add(pair.Name, pair.InnerXml);
- }
-
- g.Name = node.Name;
- mSettings.Add(node.Name, g);
- }
- }
- }
-}
+
+ #endregion
+
+ internal PersistantSettings()
+ {
+ LoadSettings();
+ }
+
+
+ private SettingsGroup GetOrCreateSettingsGroup(string name)
+ {
+ if (name.Contains(" "))
+ throw new AgateException("Settings group name cannot contain a space.");
+
+ if (mSettings.ContainsKey(name) == false)
+ {
+ mSettings[name] = new SettingsGroup();
+ mSettings[name].Name = name;
+ }
+
+ return mSettings[name];
+ }
+
+ /// <summary>
+ /// Gets a settings group, or creates it if it does not exist.
+ /// </summary>
+ /// <param name="name">The name of the group is case-sensitive, and must not contain any spaces
+ /// or special characters.</param>
+ /// <returns></returns>
+ public SettingsGroup this[string name]
+ {
+ get { return GetOrCreateSettingsGroup(name); }
+ }
+ /// <summary>
+ /// Gets the full path to the location where the settings file is stored.
+ /// </summary>
+ public string SettingsFilename
+ {
+ get
+ {
+ return System.IO.Path.Combine(Core.Platform.AppDataDirectory, "settings.xml");
+ }
+ }
+
+ /// <summary>
+ /// Saves the settings to the persistant storage on disk.
+ /// </summary>
+ public void SaveSettings()
+ {
+ XmlDocument doc = new XmlDocument();
+ XmlElement root = doc.CreateElement("Settings");
+
+ foreach (string group in mSettings.Keys)
+ {
+ XmlElement groupNode = doc.CreateElement(group);
+
+ foreach (var kvp in mSettings[group])
+ {
+ XmlElement set = doc.CreateElement(kvp.Key);
+ set.InnerText = kvp.Value;
+
+ groupNode.AppendChild(set);
+ }
+
+ root.AppendChild(groupNode);
+ }
+
+ doc.AppendChild(root);
+
+ System.Diagnostics.Trace.WriteLine("Saving settings to " + SettingsFilename);
+
+ Core.Platform.EnsureAppDataDirectoryExists();
+
+ doc.Save(SettingsFilename);
+ }
+
+ private void LoadSettings()
+ {
+ XmlDocument doc = new XmlDocument();
+ try
+ {
+ doc.Load(SettingsFilename);
+ }
+ catch (FileNotFoundException)
+ {
+ return;
+ }
+ catch (DirectoryNotFoundException)
+ {
+ return;
+ }
+ catch (XmlException e)
+ {
+ System.Diagnostics.Trace.WriteLine("Error reading settings file:" + Environment.NewLine +
+ e.Message);
+
+ return;
+ }
+ XmlElement root = doc.ChildNodes[0] as XmlElement;
+
+ if (root.Name != "Settings")
+ throw new AgateException("Could not understand settings file\n" + SettingsFilename +
+ "\nYou may need to delete it.");
+
+ foreach (XmlElement node in root.ChildNodes)
+ {
+ SettingsGroup g = new SettingsGroup();
+
+ foreach (XmlElement pair in node.ChildNodes)
+ {
+ g.Add(pair.Name, pair.InnerXml);
+ }
+
+ g.Name = node.Name;
+ mSettings.Add(node.Name, g);
+ }
+ }
+ }
+}
Modified: trunk/AgateLib/Settings/SettingsGroup.cs
===================================================================
--- trunk/AgateLib/Settings/SettingsGroup.cs 2012-02-20 02:05:27 UTC (rev 1330)
+++ trunk/AgateLib/Settings/SettingsGroup.cs 2012-02-23 22:05:25 UTC (rev 1331)
@@ -1,198 +1,198 @@
-// 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-2011.
-// All Rights Reserved.
-//
-// Contributor(s): Erik Ylvisaker
-//
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Text;
-
-namespace AgateLib.Settings
-{
- /// <summary>
- /// A group of settings. This is essentially just a Dictionary object
- /// where both key and value types are strings.
- /// </summary>
- public class SettingsGroup : IDictionary<string, string>
- {
- Dictionary<string, string> mStore = new Dictionary<string, string>();
-
- /// <summary>
- /// Gets or sets the name.
- /// </summary>
- /// <value>
- /// The name.
- /// </value>
- public string Name { get; internal set; }
-
-
- /// <summary>
- /// Returns true if this settings group has no members.
- /// </summary>
- public bool IsEmpty
- {
- get { return Count == 0; }
- }
-
- #region --- IDictionary<string,string> Members ---
-
- /// <summary>
- /// Adds a setting to the group.
- /// </summary>
- /// <param name="key"></param>
- /// <param name="value"></param>
- public void Add(string key, string value)
- {
- Core.Settings.TraceSettingsWrite(Name, key, value);
-
- mStore.Add(key, value);
- }
-
- /// <summary>
- /// Returns whether or not the specified key is present.
- /// </summary>
- /// <param name="key"></param>
- /// <returns></returns>
- public bool ContainsKey(string key)
+// 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-2011.
+// All Rights Reserved.
+//
+// Contributor(s): Erik Ylvisaker
+//
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+
+namespace AgateLib.Settings
+{
+ /// <summary>
+ /// A group of settings. This is essentially just a Dictionary object
+ /// where both key and value types are strings.
+ /// </summary>
+ public class SettingsGroup : IDictionary<string, string>
+ {
+ Dictionary<string, string> mStore = new Dictionary<string, string>();
+
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ /// <value>
+ /// The name.
+ /// </value>
+ public string Name { get; internal set; }
+
+
+ /// <summary>
+ /// Returns true if this settings group has no members.
+ /// </summary>
+ public bool IsEmpty
{
- Core.Settings.TraceSettingsRead(Name, key, (mStore.ContainsKey(key) ? mStore[key] : null));
-
- return mStore.ContainsKey(key);
- }
-
- /// <summary>
- /// Gets the collection of keys.
- /// </summary>
- public ICollection<string> Keys
- {
- get { return mStore.Keys; }
- }
-
- /// <summary>
- /// Removes a key/value pair.
- /// </summary>
- /// <param name="key"></param>
- /// <returns></returns>
- public bool Remove(string key)
- {
- return mStore.Remove(key);
- }
- /// <summary>
- /// Trys to get a value from the SettingsGroup.
- /// </summary>
- /// <param name="key"></param>
- /// <param name="value"></param>
- /// <returns></returns>
- public bool TryGetValue(string key, out string value)
- {
- Core.Settings.TraceSettingsRead(Name, key, (mStore.ContainsKey(key) ? mStore[key] : null));
-
- return mStore.TryGetValue(key, out value);
- }
-
- /// <summary>
- /// Gets a collection of the values.
- /// </summary>
- public ICollection<string> Values
- {
- get { return mStore.Values; }
- }
-
- /// <summary>
- /// Gets or sets a value in the SettingsGroup.
- /// </summary>
- /// <param name="key"></param>
- /// <returns></returns>
- public string this[string key]
- {
- get
+ get { return Count == 0; }
+ }
+
+ #region --- IDictionary<string,string> Members ---
+
+ /// <summary>
+ /// Adds a setting to the group.
+ /// </summary>
+ /// <param name="key"></param>
+ /// <param name="value"></param>
+ public void Add(string key, string value)
+ {
+ PersistantSettings.TraceSettingsWrite(Name, key, value);
+
+ mStore.Add(key, value);
+ }
+
+ /// <summary>
+ /// Returns whether or not the specified key is present.
+ /// </summary>
+ /// <param name="key"></param>
+ /// <returns></returns>
+ public bool ContainsKey(string key)
+ {
+ PersistantSettings.TraceSettingsRead(Name, key, (mStore.ContainsKey(key) ? mStore[key] : null));
+
+ return mStore.ContainsKey(key);
+ }
+
+ /// <summary>
+ /// Gets the collection of keys.
+ /// </summary>
+ public ICollection<string> Keys
+ {
+ get { return mStore.Keys; }
+ }
+
+ /// <summary>
+ /// Removes a key/value pair.
+ /// </summary>
+ /// <param name="key"></param>
+ /// <returns></returns>
+ public bool Remove(string key)
+ {
+ return mStore.Remove(key);
+ }
+ /// <summary>
+ /// Trys to get a value from the SettingsGroup.
+ /// </summary>
+ /// <param name="key"></param>
+ /// <param name="value"></param>
+ /// <returns></returns>
+ public bool TryGetValue(string key, out string value)
+ {
+ PersistantSettings.TraceSettingsRead(Name, key, (mStore.ContainsKey(key) ? mStore[key] : null));
+
+ return mStore.TryGetValue(key, out value);
+ }
+
+ /// <summary>
+ /// Gets a collection of the values.
+ /// </summary>
+ public ICollection<string> Values
+ {
+ get { return mStore.Values; }
+ }
+
+ /// <summary>
+ /// Gets or sets a value in the SettingsGroup.
+ /// </summary>
+ /// <param name="key"></param>
+ /// <returns></returns>
+ public string this[string key]
+ {
+ get
{
- Core.Settings.TraceSettingsRead(Name, key, (mStore.ContainsKey(key) ? mStore[key] : null));
-
- return mStore[key];
- }
- set
+ PersistantSettings.TraceSettingsRead(Name, key, (mStore.ContainsKey(key) ? mStore[key] : null));
+
+ return mStore[key];
+ }
+ set
{
- Core.Settings.TraceSettingsWrite(Name, key, value);
-
- mStore[key] = value;
- }
- }
-
- #endregion
- #region --- ICollection<KeyValuePair<string,string>> Members ---
-
- /// <summary>
- /// Returns the number of settings in the group.
- /// </summary>
- public int Count
- {
- get { return mStore.Count; }
- }
- /// <summary>
- /// Clears the settings from the group.
- /// </summary>
- public void Clear()
- {
- mStore.Clear();
- }
-
- void ICollection<KeyValuePair<string, string>>.Add(KeyValuePair<string, string> item)
- {
- Add(item.Key, item.Value);
- }
- void ICollection<KeyValuePair<string, string>>.CopyTo(KeyValuePair<string, string>[] array, int arrayIndex)
- {
- ((ICollection<KeyValuePair<string, string>>)mStore).CopyTo(array, arrayIndex);
- }
- bool ICollection<KeyValuePair<string, string>>.Contains(KeyValuePair<string, string> item)
- {
- return ((ICollection<KeyValuePair<string, string>>)mStore).Contains(item);
- }
- bool ICollection<KeyValuePair<string, string>>.IsReadOnly
- {
- get { return false; }
- }
- bool ICollection<KeyValuePair<string, string>>.Remove(KeyValuePair<string, string> item)
- {
- return Remove(item.Key);
- }
-
- #endregion
- #region --- IEnumerable<KeyValuePair<string,string>> Members ---
-
- /// <summary>
- /// Enumerates the KeyValuePair objects.
- /// </summary>
- /// <returns></returns>
- public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
- {
- return mStore.GetEnumerator();
- }
-
- #endregion
- #region --- IEnumerable Members ---
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- #endregion
- }
-}
+ PersistantSettings.TraceSettingsWrite(Name, key, value);
+
+ mStore[key] = value;
+ }
+ }
+
+ #endregion
+ #region --- ICollection<KeyValuePair<string,string>> Members ---
+
+ /// <summary>
+ /// Returns the number of settings in the group.
+ /// </summary>
+ public int Count
+ {
+ get { return mStore.Count; }
+ }
+ /// <summary>
+ /// Clears the settings from the group.
+ /// </summary>
+ public void Clear()
+ {
+ mStore.Clear();
+ }
+
+ void ICollection<KeyValuePair<string, string>>.Add(KeyValuePair<string, string> item)
+ {
+ Add(item.Key, item.Value);
+ }
+ void ICollection<KeyValuePair<string, string>>.CopyTo(KeyValuePair<string, string>[] array, int arrayIndex)
+ {
+ ((ICollection<KeyValuePair<string, string>>)mStore).CopyTo(array, arrayIndex);
+ }
+ bool ICollection<KeyValuePair<string, string>>.Contains(KeyValuePair<string, string> item)
+ {
+ return ((ICollection<KeyValuePair<string, string>>)mStore).Contains(item);
+ }
+ bool ICollection<KeyValuePair<string, string>>.IsReadOnly
+ {
+ get { return false; }
+ }
+ bool ICollection<KeyValuePair<string, string>>.Remove(KeyValuePair<string, string> item)
+ {
+ return Remove(item.Key);
+ }
+
+ #endregion
+ #region --- IEnumerable<KeyValuePair<string,string>> Members ---
+
+ /// <summary>
+ /// Enumerates the KeyValuePair objects.
+ /// </summary>
+ /// <returns></returns>
+ public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
+ {
+ return mStore.GetEnumerator();
+ }
+
+ #endregion
+ #region --- IEnumerable Members ---
+
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ #endregion
+ }
+}
Modified: trunk/Drivers/AgateDrawing/Drawing_Display.cs
===================================================================
--- trunk/Drivers/AgateDrawing/Drawing_Display.cs 2012-02-20 02:05:27 UTC (rev 1330)
+++ trunk/Drivers/AgateDrawing/Drawing_Display.cs 2012-02-23 22:05:25 UTC (rev 1331)
@@ -106,9 +106,9 @@
{
return new Drawing_Surface(surfaceSize);
}
- public override DisplayWindowImpl CreateDisplayWindow(CreateWindowParams windowParams)
+ public override DisplayWindowImpl CreateDisplayWindow(DisplayWindow owner, CreateWindowParams windowParams)
{
- return new Drawing_DisplayWindow(windowParams);
+ return new Drawing_DisplayWindow(owner, windowParams);
}
public override FontSurfaceImpl CreateFont(string fontFamily, float sizeInPoints, FontStyle style)
{
Modified: trunk/Drivers/AgateDrawing/Drawing_DisplayWindow.cs
===================================================================
--- trunk/Drivers/AgateDrawing/Drawing_DisplayWindow.cs 2012-02-20 02:05:27 UTC (rev 1330)
+++ trunk/Drivers/AgateDrawing/Drawing_DisplayWindow.cs 2012-02-23 22:05:25 UTC (rev 1331)
@@ -40,9 +40,12 @@
Icon mIcon;
Bitmap mBackBuffer;
+ DisplayWindow mOwner;
- public Drawing_DisplayWindow(CreateWindowParams windowParams)
+ public Drawing_DisplayWindow(DisplayWindow owner, CreateWindowParams windowParams)
{
+ mOwner = owner;
+
if (windowParams.RenderToControl == true)
{
if (typeof(Control).IsAssignableFrom(windowParams.RenderTarget.GetType()) == false)
@@ -78,6 +81,8 @@
mFrameBuffer = new Drawing_FrameBuffer(mBackBuffer);
mFrameBuffer.EndRenderEvent += new EventHandler(mFrameBuffer_EndRenderEvent);
+ mFrameBuffer.mAttachedWindow = mOwner;
+
}
void mFrameBuffer_EndRenderEvent(object sender, EventArgs e)
Modified: trunk/Drivers/AgateDrawing/Drawing_FrameBuffer.cs
===================================================================
--- trunk/Drivers/AgateDrawing/Drawing_FrameBuffer.cs 2012-02-20 02:05:27 UTC (rev 1330)
+++ trunk/Drivers/AgateDrawing/Drawing_FrameBuffer.cs 2012-02-23 22:05:25 UTC (rev 1331)
@@ -30,6 +30,7 @@
class Drawing_FrameBuffer: FrameBufferImpl
{
Bitmap backBuffer;
+ internal AgateLib.DisplayLib.DisplayWindow mAttachedWindow;
public Drawing_FrameBuffer(Size size)
{
@...
[truncated message content] |
|
From: <ka...@us...> - 2012-02-24 18:20:32
|
Revision: 1333
http://agate.svn.sourceforge.net/agate/?rev=1333&view=rev
Author: kanato
Date: 2012-02-24 18:20:22 +0000 (Fri, 24 Feb 2012)
Log Message:
-----------
Implement window events in AgateSDX.
Modified Paths:
--------------
trunk/Drivers/AgateSDX/SDX_Display.cs
trunk/Drivers/AgateSDX/SDX_DisplayWindow.cs
trunk/Drivers/AgateSDX/Shaders/FixedFunction/SDX_FF_Basic2DShader.cs
trunk/Tests/DisplayTests/Capabilities/frmCapabilities.cs
trunk/Tests/InputTests/Input/frmInputTester.cs
trunk/Tests/Tests.csproj
Modified: trunk/Drivers/AgateSDX/SDX_Display.cs
===================================================================
--- trunk/Drivers/AgateSDX/SDX_Display.cs 2012-02-23 23:04:27 UTC (rev 1332)
+++ trunk/Drivers/AgateSDX/SDX_Display.cs 2012-02-24 18:20:22 UTC (rev 1333)
@@ -959,10 +959,11 @@
case RenderStateBool.ZBufferTest: return mDevice.Device.GetRenderState<bool>(RenderState.ZEnable);
case RenderStateBool.StencilBufferTest: return mDevice.Device.GetRenderState<bool>(RenderState.StencilEnable);
case RenderStateBool.AlphaBlend: return mDevice.AlphaBlend;
+ case RenderStateBool.ZBufferWrite: return mDevice.Device.GetRenderState<bool>(RenderState.ZWriteEnable);
default:
throw new NotSupportedException(string.Format(
- "The specified render state, {0}, is not supported by this driver."));
+ "The specified render state, {0}, is not supported by this driver.", renderStateBool));
}
}
@@ -987,6 +988,10 @@
mDevice.AlphaBlend = value;
break;
+ case RenderStateBool.ZBufferWrite:
+ mDevice.Device.SetRenderState(RenderState.ZWriteEnable, value);
+ break;
+
default:
throw new NotSupportedException(string.Format(
"The specified render state, {0}, is not supported by this driver."));
Modified: trunk/Drivers/AgateSDX/SDX_DisplayWindow.cs
===================================================================
--- trunk/Drivers/AgateSDX/SDX_DisplayWindow.cs 2012-02-23 23:04:27 UTC (rev 1332)
+++ trunk/Drivers/AgateSDX/SDX_DisplayWindow.cs 2012-02-24 18:20:22 UTC (rev 1333)
@@ -188,10 +188,15 @@
void form_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
{
mIsClosed = true;
+ OnClosed();
+
}
void form_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
{
+ bool cancel = e.Cancel;
+ OnClosing(ref cancel);
+ e.Cancel = cancel;
}
void form_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
Modified: trunk/Drivers/AgateSDX/Shaders/FixedFunction/SDX_FF_Basic2DShader.cs
===================================================================
--- trunk/Drivers/AgateSDX/Shaders/FixedFunction/SDX_FF_Basic2DShader.cs 2012-02-23 23:04:27 UTC (rev 1332)
+++ trunk/Drivers/AgateSDX/Shaders/FixedFunction/SDX_FF_Basic2DShader.cs 2012-02-24 18:20:22 UTC (rev 1333)
@@ -76,7 +76,16 @@
// TODO: figure out why this method sometimes gets called when mDevice is null?
if (mDevice != null)
- mDevice.SetTransform(TransformState.Projection, orthoProj);
+ {
+ try
+ {
+ mDevice.SetTransform(TransformState.Projection, orthoProj);
+ }
+ catch (NullReferenceException e)
+ {
+ System.Diagnostics.Debug.Print("NullReferenceException when setting transformation.");
+ }
+ }
}
public override void Begin()
Modified: trunk/Tests/DisplayTests/Capabilities/frmCapabilities.cs
===================================================================
--- trunk/Tests/DisplayTests/Capabilities/frmCapabilities.cs 2012-02-23 23:04:27 UTC (rev 1332)
+++ trunk/Tests/DisplayTests/Capabilities/frmCapabilities.cs 2012-02-24 18:20:22 UTC (rev 1333)
@@ -13,8 +13,10 @@
{
public frmCapabilities()
{
- InitializeComponent();
-
+ InitializeComponent();
+
+ AgateLib.DisplayLib.DisplayWindow wind = AgateLib.DisplayLib.DisplayWindow.CreateFromControl(this);
+
Text += " ";
Text += AgateLib.Drivers.Registrar.DisplayDrivers[0].FriendlyName;
Modified: trunk/Tests/InputTests/Input/frmInputTester.cs
===================================================================
--- trunk/Tests/InputTests/Input/frmInputTester.cs 2012-02-23 23:04:27 UTC (rev 1332)
+++ trunk/Tests/InputTests/Input/frmInputTester.cs 2012-02-24 18:20:22 UTC (rev 1333)
@@ -51,8 +51,11 @@
{
FillJoystickInfo(i, joystickLabels[i]);
}
-
+
+ timer1.Enabled = false;
Core.KeepAlive();
+
+ timer1.Enabled = true;
}
private void FillJoystickInfo(int index, Label label)
Modified: trunk/Tests/Tests.csproj
===================================================================
--- trunk/Tests/Tests.csproj 2012-02-23 23:04:27 UTC (rev 1332)
+++ trunk/Tests/Tests.csproj 2012-02-24 18:20:22 UTC (rev 1333)
@@ -490,6 +490,7 @@
</None>
<None Include="Data\TestResourceFile.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ <SubType>Designer</SubType>
</None>
<None Include="Data\wallpaper.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-03-06 05:28:11
|
Revision: 1337
http://agate.svn.sourceforge.net/agate/?rev=1337&view=rev
Author: kanato
Date: 2012-03-06 05:28:04 +0000 (Tue, 06 Mar 2012)
Log Message:
-----------
Added option to encode arrays as comma separated lists in the xml file.
Reorganized XleSerializationInfo file.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs
trunk/Tools/FontCreator/FontCreator.csproj
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2012-02-27 20:12:52 UTC (rev 1336)
+++ trunk/AgateLib/AgateLib.csproj 2012-03-06 05:28:04 UTC (rev 1337)
@@ -180,6 +180,7 @@
<Compile Include="PlatformType.cs" />
<Compile Include="Resources\ImageResource.cs" />
<Compile Include="Serialization\Xle\CompressionType.cs" />
+ <Compile Include="Serialization\Xle\NumericEncoding.cs" />
<Compile Include="Settings\SettingsGroup.cs" />
<Compile Include="Timing.cs">
<SubType>Code</SubType>
Modified: trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs
===================================================================
--- trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs 2012-02-27 20:12:52 UTC (rev 1336)
+++ trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs 2012-03-06 05:28:04 UTC (rev 1337)
@@ -36,11 +36,6 @@
XmlDocument doc;
Stack<XmlElement> nodes = new Stack<XmlElement>();
- /// <summary>
- /// The ITypeBinder object used.
- /// </summary>
- public ITypeBinder Binder { get; internal set; }
-
internal XleSerializationInfo()
{
doc = new XmlDocument();
@@ -93,6 +88,8 @@
#region --- Writing methods ---
+ #region --- Writing single values to the XML ---
+
/// <summary>
/// Writes a field to the XML data as an element.
/// </summary>
@@ -302,29 +299,115 @@
}
/// <summary>
+ /// Writes an object implementing IXleSerializable to the XML data as an element.
+ /// </summary>
+ /// <param name="name">The name of the XML element used.</param>
+ /// <param name="value">The object data to write.</param>
+ public void Write(string name, IXleSerializable value)
+ {
+ XmlElement element = CreateElement(name);
+
+ if (value == null)
+ AddAttribute(element, "type", "null");
+ else
+ {
+ AddAttribute(element, "type", value.GetType().ToString());
+
+ nodes.Push(element);
+
+ Serialize(value);
+
+ nodes.Pop();
+ }
+ }
+ private XmlElement WriteAsElement<T>(string name, T value) where T : IConvertible
+ {
+ XmlElement element = doc.CreateElement(name);
+
+ element.InnerText = value.ToString();
+
+ CurrentNode.AppendChild(element);
+
+ return element;
+ }
+ private void WriteAsAttribute<T>(string name, T value) where T : IConvertible
+ {
+ AddAttribute(CurrentNode, name, Convert.ToString(value));
+ }
+
+ private XmlElement CreateElement(string name)
+ {
+ XmlElement element = doc.CreateElement(name);
+
+ for (int i = 0; i < CurrentNode.ChildNodes.Count; i++)
+ {
+ if (CurrentNode.ChildNodes[i].Name == name)
+ throw new XleSerializationException("The name " + name + " already exists.");
+ }
+
+ CurrentNode.AppendChild(element);
+
+ return element;
+ }
+ #endregion
+ #region --- Writing arrays ---
+
+ /// <summary>
/// Writes an int[] array to the XML data as an element.
/// </summary>
/// <param name="name">The name of the XML element used.</param>
/// <param name="value">The array data to write.</param>
public void Write(string name, int[] value)
{
- byte[] array = new byte[value.Length * 4];
+ WriteImpl(name, value, NumericEncoding.Base64);
+ }
+ /// <summary>
+ /// Writes an int[] array to the XML data as an element with the specified encoding.
+ /// </summary>
+ /// <param name="name"></param>
+ /// <param name="value"></param>
+ /// <param name="encoding"></param>
+ public void Write(string name, int[] value, NumericEncoding encoding)
+ {
+ WriteImpl(name, value, encoding);
+ }
- if (array.Length > 0)
+ private void WriteImpl(string name, int[] value, NumericEncoding encoding)
+ {
+ switch (encoding)
{
- unsafe
- {
- fixed (int* val = value)
+ case NumericEncoding.Base64:
+ byte[] array = new byte[value.Length * 4];
+
+ if (array.Length > 0)
{
- Marshal.Copy((IntPtr)val, array, 0, array.Length);
+ unsafe
+ {
+ fixed (int* val = value)
+ {
+ Marshal.Copy((IntPtr)val, array, 0, array.Length);
+ }
+ }
}
- }
+
+ WriteBase64Encoded(name, array);
+ break;
+
+ case NumericEncoding.Csv:
+ string newValue = string.Join(",", value);
+
+ XmlElement el = WriteAsElement(name, newValue);
+
+ AddAttribute(el, "array", "true");
+ AddAttribute(el, "encoding", "Csv");
+
+ break;
+
+ default:
+ throw new ArgumentException("Value of encoding is not understood.");
}
- Write(name, array);
-
}
-
/// <summary>
/// Writes a bool[] array to the XML data as an element.
/// </summary>
@@ -336,8 +419,8 @@
for (int i = 0; i < value.Length; i++)
array[i] = (byte)(value[i] ? 1 : 0);
-
- Write(name, array);
+
+ WriteBase64Encoded(name, array);
}
/// <summary>
@@ -356,49 +439,10 @@
Marshal.Copy((IntPtr)val, array, 0, array.Length);
}
}
- Write(name, array);
+ WriteBase64Encoded(name, array);
}
- /// <summary>
- /// Writes a binary stream to the XML data as an element.
- /// Compresses the stream using GZip compression.
- /// </summary>
- /// <param name="name">The name of the XML element used.</param>
- /// <param name="value">The stream of data to write.</param>
- public void Write(string name, Stream value)
- {
- Write(name, value, CompressionType.GZip);
- }
- /// <summary>
- /// Writes a binary stream to the XML data as an element.
- /// </summary>
- /// <param name="name">The name of the XML element used.</param>
- /// <param name="value">The stream of data to write.</param>
- /// <param name="compression">The compression algorithm to use.</param>
- public void Write(string name, Stream value, CompressionType compression)
- {
- WriteImpl(name, value, compression);
- }
- private void WriteImpl(string name, Stream value, CompressionType compression)
- {
- MemoryStream ms = new MemoryStream();
- Stream compressed = TranslateStream(ms, compression, CompressionMode.Compress);
-
- byte[] uncompressedData = ReadFromStream(value);
- compressed.Write(uncompressedData, 0, uncompressedData.Length);
-
- byte[] buffer = ms.GetBuffer();
-
- string newValue = Convert.ToBase64String(
- buffer/*, Base64FormattingOptions.InsertLineBreaks*/);
-
- XmlElement el = WriteAsElement(name, newValue);
- AddAttribute(el, "stream", "true");
- AddAttribute(el, "compression", compression.ToString());
- AddAttribute(el, "encoding", "Base64");
- }
-
/// <summary>
/// Writes a byte[] array to the XML data as an element.
/// </summary>
@@ -406,35 +450,20 @@
/// <param name="value">The array data to write.</param>
public void Write(string name, byte[] value)
{
+ WriteBase64Encoded(name, value);
+ }
+
+ private void WriteBase64Encoded(string name, byte[] value)
+ {
string newValue = Convert.ToBase64String(value, Base64FormattingOptions.InsertLineBreaks);
XmlElement el = WriteAsElement(name, newValue);
+
AddAttribute(el, "array", "true");
AddAttribute(el, "encoding", "Base64");
}
- /// <summary>
- /// Writes an object implementing IXleSerializable to the XML data as an element.
- /// </summary>
- /// <param name="name">The name of the XML element used.</param>
- /// <param name="value">The object data to write.</param>
- public void Write(string name, IXleSerializable value)
- {
- XmlElement element = CreateElement(name);
- if (value == null)
- AddAttribute(element, "type", "null");
- else
- {
- AddAttribute(element, "type", value.GetType().ToString());
- nodes.Push(element);
-
- Serialize(value);
-
- nodes.Pop();
- }
- }
-
/// <summary>
/// Writes an array of objects implementing IXleSerializable to the XML data as an element.
/// </summary>
@@ -496,11 +525,11 @@
/// </summary>
/// <param name="name">The name of the XML element used.</param>
/// <param name="value">The list data to write.</param>
- public void Write(string name, List<string> value)
+ public void Write(string name, List<string> value)
{
XmlElement element = CreateElement(name);
AddAttribute(element, "array", "true");
-
+
nodes.Push(element);
for (int i = 0; i < value.Count; i++)
@@ -619,36 +648,50 @@
nodes.Pop();
}
- private XmlElement WriteAsElement<T>(string name, T value) where T : IConvertible
+ #endregion
+ #region --- Writing Streams ---
+
+ /// <summary>
+ /// Writes a binary stream to the XML data as an element.
+ /// Compresses the stream using GZip compression.
+ /// </summary>
+ /// <param name="name">The name of the XML element used.</param>
+ /// <param name="value">The stream of data to write.</param>
+ public void Write(string name, Stream value)
{
- XmlElement element = doc.CreateElement(name);
-
- element.InnerText = value.ToString();
-
- CurrentNode.AppendChild(element);
-
- return element;
+ Write(name, value, CompressionType.GZip);
}
- private void WriteAsAttribute<T>(string name, T value) where T : IConvertible
+ /// <summary>
+ /// Writes a binary stream to the XML data as an element.
+ /// </summary>
+ /// <param name="name">The name of the XML element used.</param>
+ /// <param name="value">The stream of data to write.</param>
+ /// <param name="compression">The compression algorithm to use.</param>
+ public void Write(string name, Stream value, CompressionType compression)
{
- AddAttribute(CurrentNode, name, Convert.ToString(value));
+ WriteImpl(name, value, compression);
}
- private XmlElement CreateElement(string name)
+ private void WriteImpl(string name, Stream value, CompressionType compression)
{
- XmlElement element = doc.CreateElement(name);
+ MemoryStream ms = new MemoryStream();
+ Stream compressed = TranslateStream(ms, compression, CompressionMode.Compress);
- for (int i = 0; i < CurrentNode.ChildNodes.Count; i++)
- {
- if (CurrentNode.ChildNodes[i].Name == name)
- throw new XleSerializationException("The name " + name + " already exists.");
- }
+ byte[] uncompressedData = ReadFromStream(value);
+ compressed.Write(uncompressedData, 0, uncompressedData.Length);
- CurrentNode.AppendChild(element);
+ byte[] buffer = ms.GetBuffer();
- return element;
+ string newValue = Convert.ToBase64String(
+ buffer/*, Base64FormattingOptions.InsertLineBreaks*/);
+
+ XmlElement el = WriteAsElement(name, newValue);
+ AddAttribute(el, "stream", "true");
+ AddAttribute(el, "compression", compression.ToString());
+ AddAttribute(el, "encoding", "Base64");
}
+ #endregion
#endregion
#region --- Reading methods ---
@@ -673,130 +716,9 @@
return true;
}
- private Type GetType(string name)
- {
- return Binder.GetType(name);
- }
+ #region --- Reading single values ---
/// <summary>
- /// Reads a dictionary type from the XML data.
- /// The key type must implement IConvertible and the value type must implement
- /// IXleSerializable.
- /// </summary>
- /// <typeparam name="TKey"></typeparam>
- /// <typeparam name="TValue"></typeparam>
- /// <param name="name"></param>
- /// <returns></returns>
- [CLSCompliant(false)]
- public Dictionary<TKey, TValue> ReadDictionary<TKey, TValue>(string name)
- where TKey : IConvertible
- where TValue : IXleSerializable
- {
- XmlElement element = (XmlElement)CurrentNode[name];
-
- if (element == null)
- throw new XleSerializationException("Node " + name + " was not found.");
-
- nodes.Push(element);
-
- Dictionary<TKey, TValue> retval = new Dictionary<TKey, TValue>();
-
- for (int i = 0; i < element.ChildNodes.Count; i++)
- {
- XmlElement current = (XmlElement)CurrentNode.ChildNodes[i];
- string keyString = current.GetAttribute("key");
- TKey key = (TKey)Convert.ChangeType(keyString, typeof(TKey));
-
- nodes.Push(current);
- TValue val = (TValue)DeserializeObject(typeof(TValue));
- nodes.Pop();
-
- retval.Add(key, val);
- }
-
- nodes.Pop();
-
- return retval;
- }
- /// <summary>
- /// Reads a dictionary type of strings from the XML data.
- /// The key type must implement IConvertible and the value type must implement
- /// IXleSerializable.
- /// </summary>
- /// <typeparam name="Tkey">The key type of the dictionary.</typeparam>
- /// <param name="name">The name of the element in the XML stream to decode.</param>
- /// <returns></returns>
- [CLSCompliant(false)]
- [Obsolete("Use ReadDictionaryString instead.")]
- public Dictionary<Tkey, string> ReadDictionary<Tkey>(string name)
- where Tkey : IConvertible
- {
- return ReadDictionaryString<Tkey>(name);
- }
- /// <summary>
- /// Reads a dictionary type of strings from the XML data.
- /// The key type must implement IConvertible and the value type must implement
- /// IXleSerializable.
- /// </summary>
- /// <typeparam name="Tkey">The key type of the dictionary.</typeparam>
- /// <param name="name">The name of the element in the XML stream to decode.</param>
- /// <returns></returns>
- [CLSCompliant(false)]
- public Dictionary<Tkey, string> ReadDictionaryString<Tkey>(string name)
- where Tkey : IConvertible
- {
- XmlElement element = (XmlElement)CurrentNode[name];
-
- nodes.Push(element);
-
- Dictionary<Tkey, string> retval = new Dictionary<Tkey, string>();
-
- for (int i = 0; i < element.ChildNodes.Count; i++)
- {
- XmlElement current = (XmlElement)CurrentNode.ChildNodes[i];
- string keyString = current.GetAttribute("key");
- Tkey key = (Tkey)Convert.ChangeType(keyString, typeof(Tkey));
-
- string valueString = current.GetAttribute("value");
-
- retval.Add(key, valueString);
- }
-
- nodes.Pop();
-
- return retval;
- }
-
- /// <summary>
- /// Reads a dictionary of the form Dictionary<Tkey, int>.
- /// </summary>
- /// <typeparam name="Tkey"></typeparam>
- /// <param name="name"></param>
- /// <returns></returns>
- public Dictionary<Tkey, int> ReadDictionaryInt32<Tkey>(string name)
- {
- XmlElement element = (XmlElement)CurrentNode[name];
-
- nodes.Push(element);
-
- Dictionary<Tkey, int> retval = new Dictionary<Tkey, int>();
-
- for (int i = 0; i < element.ChildNodes.Count; i++)
- {
- XmlElement current = (XmlElement)CurrentNode.ChildNodes[i];
- string keyString = current.GetAttribute("key");
- Tkey key = (Tkey)Convert.ChangeType(keyString, typeof(Tkey));
-
- string valueString = current.GetAttribute("value");
-
- retval.Add(key, int.Parse(valueString));
- }
-
- nodes.Pop();
-
- return retval;
- }
- /// <summary>
/// Reads an object from the XML data.
/// </summary>
/// <param name="name"></param>
@@ -851,48 +773,7 @@
{
return ReadStringImpl(name, false, string.Empty);
}
- /// <summary>
- /// Reads binary data stored as a stream.
- /// </summary>
- /// <param name="name"></param>
- /// <returns></returns>
- public Stream ReadStream(string name)
- {
- XmlElement element = (XmlElement)CurrentNode[name];
- if (element == null)
- throw new XleSerializationException("Field " + name + " was not found.");
-
- if (element.Attributes["stream"] == null || element.Attributes["stream"].Value != "true")
- throw new XleSerializationException("Field " + name + " is not a stream.");
- if (element.Attributes["encoding"] == null)
- throw new XleSerializationException("Field " + name + " does not have encoding information.");
-
- string encoding = element.Attributes["encoding"].Value;
- byte[] bytes;
-
- if (encoding == "Base64")
- {
- bytes = Convert.FromBase64String(element.InnerText);
- }
- else
- throw new XleSerializationException("Unrecognized encoding " + encoding);
-
- CompressionType compression = CompressionType.None;
-
- if (element.Attributes["compression"] != null)
- {
- compression = (CompressionType)
- Enum.Parse(typeof(CompressionType), element.Attributes["compression"].Value, true);
- }
-
- MemoryStream ms = new MemoryStream(bytes);
- ms.Position = 0;
- Stream uncompressed = TranslateStream(ms, compression, CompressionMode.Decompress);
-
- return uncompressed;
- }
-
private string ReadStringImpl(string name, bool haveDefault, string defaultValue)
{
string attribute = CurrentNode.GetAttribute(name);
@@ -1068,7 +949,49 @@
return float.Parse(element.InnerText);
}
+
+ #endregion
+ #region --- Reading array values ---
+
+ private string GetEncoding(string name)
+ {
+ XmlElement element = (XmlElement)CurrentNode[name];
+
+ if (element == null)
+ throw new XleSerializationException("Node " + name + " not found.");
+ if (element.Attributes["encoding"] == null)
+ throw new XleSerializationException("Element " + name + " does not have encoding information.");
+
+ return element.Attributes["encoding"].Value;
+ }
+
/// <summary>
+ /// Reads a byte array from the XML data. If the name is not present
+ /// an XleSerializationException is thrown.
+ /// </summary>
+ /// <param name="name">Name of the field.</param>
+ /// <returns></returns>
+ public byte[] ReadByteArray(string name)
+ {
+ XmlElement element = (XmlElement)CurrentNode[name];
+
+ string encoding = GetEncoding(name);
+
+ if (element.Attributes["array"] == null || element.Attributes["array"].Value != "true")
+ throw new XleSerializationException("Element " + name + " is not an array.");
+
+ if (encoding == "Base64")
+ {
+ byte[] array = Convert.FromBase64String(element.InnerText);
+ return array;
+ }
+ else
+ {
+ throw new XleSerializationException("Unrecognized encoding " + element.Attributes["encoding"]);
+ }
+ }
+
+ /// <summary>
/// Reads a integer array from the XML data. If the name is not present
/// an XleSerializationException is thrown.
/// </summary>
@@ -1076,25 +999,46 @@
/// <returns></returns>
public int[] ReadInt32Array(string name)
{
- byte[] array = ReadByteArray(name);
- int[] result = new int[array.Length / 4];
+ XmlElement element = (XmlElement)CurrentNode[name];
+ string encoding = GetEncoding(name);
+ int[] result;
- if (array.Length % 4 != 0)
- throw new XleSerializationException("Encoded array is wrong size!");
+ switch ((NumericEncoding)Enum.Parse(typeof(NumericEncoding), encoding))
+ {
+ case NumericEncoding.Base64:
+ byte[] array = ReadByteArray(name);
+ result = new int[array.Length / 4];
- if (array.Length > 0)
- {
- unsafe
- {
- fixed (byte* ar = array)
+ if (array.Length % 4 != 0)
+ throw new XleSerializationException("Encoded array is wrong size!");
+
+ if (array.Length > 0)
{
- Marshal.Copy((IntPtr)ar, result, 0, result.Length);
+ unsafe
+ {
+ fixed (byte* ar = array)
+ {
+ Marshal.Copy((IntPtr)ar, result, 0, result.Length);
+ }
+ }
}
- }
+
+ return result;
+
+ case NumericEncoding.Csv:
+ string value = element.InnerText;
+ string[] vals = value.Split(new char[] { ',' },
+ StringSplitOptions.RemoveEmptyEntries);
+
+ result = vals.Select(x => int.Parse(x)).ToArray();
+
+ return result;
+
+ default:
+ throw new XleSerializationException("Encoding information could not be parsed.");
}
+ }
- return result;
- }
/// <summary>
/// Reads a boolean array from the XML data. If the name is not present
/// an XleSerializationException is thrown.
@@ -1203,7 +1147,7 @@
{
list.Add(item.InnerText);
}
- else
+ else
{
nodes.Push(item);
@@ -1236,50 +1180,190 @@
else
ar = ReadArrayImpl(name, typeof(T));
- List<T> retval = new List<T>();
- retval.AddRange((T[])ar);
+ return ((T[])ar).ToList();
+ }
+ /// <summary>
+ /// Reads a dictionary type from the XML data.
+ /// The key type must implement IConvertible and the value type must implement
+ /// IXleSerializable.
+ /// </summary>
+ /// <typeparam name="TKey"></typeparam>
+ /// <typeparam name="TValue"></typeparam>
+ /// <param name="name"></param>
+ /// <returns></returns>
+ [CLSCompliant(false)]
+ public Dictionary<TKey, TValue> ReadDictionary<TKey, TValue>(string name)
+ where TKey : IConvertible
+ where TValue : IXleSerializable
+ {
+ XmlElement element = (XmlElement)CurrentNode[name];
+
+ if (element == null)
+ throw new XleSerializationException("Node " + name + " was not found.");
+
+ nodes.Push(element);
+
+ Dictionary<TKey, TValue> retval = new Dictionary<TKey, TValue>();
+
+ for (int i = 0; i < element.ChildNodes.Count; i++)
+ {
+ XmlElement current = (XmlElement)CurrentNode.ChildNodes[i];
+ string keyString = current.GetAttribute("key");
+ TKey key = (TKey)Convert.ChangeType(keyString, typeof(TKey));
+
+ nodes.Push(current);
+ TValue val = (TValue)DeserializeObject(typeof(TValue));
+ nodes.Pop();
+
+ retval.Add(key, val);
+ }
+
+ nodes.Pop();
+
return retval;
}
+ /// <summary>
+ /// Reads a dictionary type of strings from the XML data.
+ /// The key type must implement IConvertible and the value type must implement
+ /// IXleSerializable.
+ /// </summary>
+ /// <typeparam name="Tkey">The key type of the dictionary.</typeparam>
+ /// <param name="name">The name of the element in the XML stream to decode.</param>
+ /// <returns></returns>
+ [CLSCompliant(false)]
+ [Obsolete("Use ReadDictionaryString instead.")]
+ public Dictionary<Tkey, string> ReadDictionary<Tkey>(string name)
+ where Tkey : IConvertible
+ {
+ return ReadDictionaryString<Tkey>(name);
+ }
+ /// <summary>
+ /// Reads a dictionary type of strings from the XML data.
+ /// The key type must implement IConvertible and the value type must implement
+ /// IXleSerializable.
+ /// </summary>
+ /// <typeparam name="Tkey">The key type of the dictionary.</typeparam>
+ /// <param name="name">The name of the element in the XML stream to decode.</param>
+ /// <returns></returns>
+ [CLSCompliant(false)]
+ public Dictionary<Tkey, string> ReadDictionaryString<Tkey>(string name)
+ where Tkey : IConvertible
+ {
+ XmlElement element = (XmlElement)CurrentNode[name];
+ nodes.Push(element);
+ Dictionary<Tkey, string> retval = new Dictionary<Tkey, string>();
+
+ for (int i = 0; i < element.ChildNodes.Count; i++)
+ {
+ XmlElement current = (XmlElement)CurrentNode.ChildNodes[i];
+ string keyString = current.GetAttribute("key");
+ Tkey key = (Tkey)Convert.ChangeType(keyString, typeof(Tkey));
+
+ string valueString = current.GetAttribute("value");
+
+ retval.Add(key, valueString);
+ }
+
+ nodes.Pop();
+
+ return retval;
+ }
+
/// <summary>
- /// Reads a byte array from the XML data. If the name is not present
- /// an XleSerializationException is thrown.
+ /// Reads a dictionary of the form Dictionary<Tkey, int>.
/// </summary>
- /// <param name="name">Name of the field.</param>
+ /// <typeparam name="Tkey"></typeparam>
+ /// <param name="name"></param>
/// <returns></returns>
- public byte[] ReadByteArray(string name)
+ public Dictionary<Tkey, int> ReadDictionaryInt32<Tkey>(string name)
{
XmlElement element = (XmlElement)CurrentNode[name];
+ nodes.Push(element);
+
+ Dictionary<Tkey, int> retval = new Dictionary<Tkey, int>();
+
+ for (int i = 0; i < element.ChildNodes.Count; i++)
+ {
+ XmlElement current = (XmlElement)CurrentNode.ChildNodes[i];
+ string keyString = current.GetAttribute("key");
+ Tkey key = (Tkey)Convert.ChangeType(keyString, typeof(Tkey));
+
+ string valueString = current.GetAttribute("value");
+
+ retval.Add(key, int.Parse(valueString));
+ }
+
+ nodes.Pop();
+
+ return retval;
+ }
+
+ #endregion
+ #region --- Reading streams ---
+ /// <summary>
+ /// Reads binary data stored as a stream.
+ /// </summary>
+ /// <param name="name"></param>
+ /// <returns></returns>
+ public Stream ReadStream(string name)
+ {
+ XmlElement element = (XmlElement)CurrentNode[name];
+
if (element == null)
- throw new XleSerializationException("Node " + name + " not found.");
+ throw new XleSerializationException("Field " + name + " was not found.");
- if (element.Attributes["array"] == null || element.Attributes["array"].Value != "true")
- throw new XleSerializationException("Element " + name + " is not an array.");
+ if (element.Attributes["stream"] == null || element.Attributes["stream"].Value != "true")
+ throw new XleSerializationException("Field " + name + " is not a stream.");
if (element.Attributes["encoding"] == null)
- throw new XleSerializationException("Element " + name + " does not have encoding information.");
+ throw new XleSerializationException("Field " + name + " does not have encoding information.");
- if (element.Attributes["encoding"].Value == "Base64")
+ string encoding = element.Attributes["encoding"].Value;
+ byte[] bytes;
+
+ if (encoding == "Base64")
{
- byte[] array = Convert.FromBase64String(element.InnerText);
- return array;
+ bytes = Convert.FromBase64String(element.InnerText);
}
else
+ throw new XleSerializationException("Unrecognized encoding " + encoding);
+
+ CompressionType compression = CompressionType.None;
+
+ if (element.Attributes["compression"] != null)
{
- throw new XleSerializationException("Unrecognized encoding " + element.Attributes["encoding"]);
+ compression = (CompressionType)
+ Enum.Parse(typeof(CompressionType), element.Attributes["compression"].Value, true);
}
+ MemoryStream ms = new MemoryStream(bytes);
+ ms.Position = 0;
+ Stream uncompressed = TranslateStream(ms, compression, CompressionMode.Decompress);
+
+ return uncompressed;
}
+ #endregion
+ #endregion
+ #region --- Type Binding ---
+ private Type GetType(string name)
+ {
+ return Binder.GetType(name);
+ }
+
+ /// <summary>
+ /// The ITypeBinder object used.
+ /// </summary>
+ public ITypeBinder Binder { get; internal set; }
+
#endregion
-
#region --- Dealing with streams ---
-
/// <summary>
/// Reads data from a stream until the end is reached. The
/// data is returned as a byte array. An IOException is
@@ -1303,7 +1387,6 @@
}
}
-
private Stream TranslateStream(Stream value, CompressionType compression, CompressionMode mode)
{
switch (compression)
Modified: trunk/Tools/FontCreator/FontCreator.csproj
===================================================================
--- trunk/Tools/FontCreator/FontCreator.csproj 2012-02-27 20:12:52 UTC (rev 1336)
+++ trunk/Tools/FontCreator/FontCreator.csproj 2012-03-06 05:28:04 UTC (rev 1337)
@@ -124,6 +124,10 @@
<Name>AgateLib</Name>
<Project>{9490B719-829E-43A7-A5FE-8001F8A81759}</Project>
</ProjectReference>
+ <ProjectReference Include="..\..\Drivers\AgateDrawing\AgateDrawing.csproj">
+ <Project>{164A785D-924E-40FB-A517-D7E677F3B53A}</Project>
+ <Name>AgateDrawing</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Drivers\AgateLib.WinForms\AgateLib.WinForms.csproj">
<Name>AgateLib.WinForms</Name>
<Project>{BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}</Project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-03-25 21:10:56
|
Revision: 1340
http://agate.svn.sourceforge.net/agate/?rev=1340&view=rev
Author: kanato
Date: 2012-03-25 21:10:50 +0000 (Sun, 25 Mar 2012)
Log Message:
-----------
Some documentation fixes.
Fix to XleSerializationInfo.ReadStringImpl when an attribute value had an empty string.
Modified Paths:
--------------
trunk/AgateLib/Drivers/AgateDriverInfo.cs
trunk/AgateLib/Geometry/Rectangle.cs
trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs
trunk/AgateLib/Settings/PersistantSettings.cs
trunk/Drivers/AgateSDL/Audio/SDL_Audio.cs
Modified: trunk/AgateLib/Drivers/AgateDriverInfo.cs
===================================================================
--- trunk/AgateLib/Drivers/AgateDriverInfo.cs 2012-03-08 01:45:25 UTC (rev 1339)
+++ trunk/AgateLib/Drivers/AgateDriverInfo.cs 2012-03-25 21:10:50 UTC (rev 1340)
@@ -186,7 +186,7 @@
/// <returns></returns>
public override string ToString()
{
- return "AgateDriverInfo: " + AssemblyFile;
+ return "AgateDriverInfo: " + DriverTypeName + " in " + AssemblyFile;
}
}
Modified: trunk/AgateLib/Geometry/Rectangle.cs
===================================================================
--- trunk/AgateLib/Geometry/Rectangle.cs 2012-03-08 01:45:25 UTC (rev 1339)
+++ trunk/AgateLib/Geometry/Rectangle.cs 2012-03-25 21:10:50 UTC (rev 1340)
@@ -222,11 +222,12 @@
}
/// <summary>
- /// Returns a rectangle contracted expanded the rectangle by the specified amount.
+ /// Returns a rectangle contracted or expanded by the specified amount.
/// The center of the rectangle remains in the same place,
/// so this subtracts amount to X and Y, and adds amount*2 from Width and Height.
/// </summary>
- /// <param name="amount"></param>
+ /// <param name="amount">The amount to expand the rectangle by. If this value is negative,
+ /// the rectangle is contracted.</param>
public Rectangle Expand(int amount)
{
var retval = this;
Modified: trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs
===================================================================
--- trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs 2012-03-08 01:45:25 UTC (rev 1339)
+++ trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs 2012-03-25 21:10:50 UTC (rev 1340)
@@ -776,10 +776,10 @@
private string ReadStringImpl(string name, bool haveDefault, string defaultValue)
{
- string attribute = CurrentNode.GetAttribute(name);
+ var attrib = CurrentNode.Attributes[name];
- if (string.IsNullOrEmpty(attribute) == false)
- return attribute;
+ if (attrib != null)
+ return attrib.Value;
XmlElement element = (XmlElement)CurrentNode[name];
Modified: trunk/AgateLib/Settings/PersistantSettings.cs
===================================================================
--- trunk/AgateLib/Settings/PersistantSettings.cs 2012-03-08 01:45:25 UTC (rev 1339)
+++ trunk/AgateLib/Settings/PersistantSettings.cs 2012-03-25 21:10:50 UTC (rev 1340)
@@ -154,6 +154,7 @@
private void LoadSettings()
{
XmlDocument doc = new XmlDocument();
+
try
{
doc.Load(SettingsFilename);
@@ -173,6 +174,7 @@
return;
}
+
XmlElement root = doc.ChildNodes[0] as XmlElement;
if (root.Name != "Settings")
Modified: trunk/Drivers/AgateSDL/Audio/SDL_Audio.cs
===================================================================
--- trunk/Drivers/AgateSDL/Audio/SDL_Audio.cs 2012-03-08 01:45:25 UTC (rev 1339)
+++ trunk/Drivers/AgateSDL/Audio/SDL_Audio.cs 2012-03-25 21:10:50 UTC (rev 1340)
@@ -57,7 +57,6 @@
System.Diagnostics.Trace.WriteLine(string.Format(
"Failed to delete the temp file {0}.", file));
}
-
}
tempfiles.Clear();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-04-04 02:31:29
|
Revision: 1342
http://agate.svn.sourceforge.net/agate/?rev=1342&view=rev
Author: kanato
Date: 2012-04-04 02:31:22 +0000 (Wed, 04 Apr 2012)
Log Message:
-----------
Applied optimizations to pixel conversion when loading surfaces for OpenGL. This should result in almost a 30% speedup when loading large images.
Modified Paths:
--------------
trunk/AgateLib/AgateLib.csproj
trunk/AgateLib/DisplayLib/PixelBuffer.cs
trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs
trunk/AgateLib-Windows.sln
trunk/Drivers/AgateDrawing/AgateDrawing.csproj
trunk/Drivers/AgateFMOD/AgateFMOD.csproj
trunk/Drivers/AgateLib.WinForms/AgateLib.WinForms.csproj
trunk/Drivers/AgateOTK/AgateOTK.csproj
trunk/Drivers/AgateSDL/AgateSDL.csproj
trunk/Drivers/AgateSDL/Audio/SDL_Music.cs
trunk/Tests/Tests.csproj
Added Paths:
-----------
trunk/Tests/Data/largeimage.png
trunk/Tests/DisplayTests/LargeImage.cs
Modified: trunk/AgateLib/AgateLib.csproj
===================================================================
--- trunk/AgateLib/AgateLib.csproj 2012-03-27 16:13:34 UTC (rev 1341)
+++ trunk/AgateLib/AgateLib.csproj 2012-04-04 02:31:22 UTC (rev 1342)
@@ -94,7 +94,7 @@
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <OutputPath>bin\x86\Release\</OutputPath>
+ <OutputPath>..\Binaries\Release\</OutputPath>
<DefineConstants>TRACE;</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Modified: trunk/AgateLib/DisplayLib/PixelBuffer.cs
===================================================================
--- trunk/AgateLib/DisplayLib/PixelBuffer.cs 2012-03-27 16:13:34 UTC (rev 1341)
+++ trunk/AgateLib/DisplayLib/PixelBuffer.cs 2012-04-04 02:31:22 UTC (rev 1342)
@@ -718,17 +718,43 @@
int destIndex = 0;
IntPtr rowPtr = data;
byte* dataPtr = (byte*)data;
+ int width = Width;
+ int destPixelStride = PixelStride;
for (int y = 0; y < Height; y++)
{
Marshal.Copy(rowPtr, srcPixel, 0, srcRowStride);
+
+ // check for common Win32 - OpenGL conversion case
+ if (this.PixelFormat == PixelFormat.RGBA8888 &&
+ srcFormat == PixelFormat.BGRA8888)
+ {
+ // this setup here is OPTIMIZED.
+ // Calling ConvertPixel for each pixel when loading a large
+ // image adds about 35% more CPU time to do the conversion.
+ // By eliminating the function call and processing this special
+ // case here we save some time on image loading.
+ int srcIndex = 0;
- for (int x = 0; x < Width; x++)
+ for (int x = 0; x < width; x++)
+ {
+ mData[destIndex] = srcPixel[srcIndex + 2];
+ mData[destIndex + 1] = srcPixel[srcIndex + 1];
+ mData[destIndex + 2] = srcPixel[srcIndex];
+ mData[destIndex + 3] = srcPixel[srcIndex + 3];
+
+ destIndex += destPixelStride;
+ srcIndex += sourceStride;
+ }
+ }
+ else
{
- //Marshal.Copy(pixelPtr, srcPixel, 0, sourceStride);
- ConvertPixel(mData, destIndex, this.PixelFormat, srcPixel, x * sourceStride, srcFormat);
+ for (int x = 0; x < width; x++)
+ {
+ ConvertPixel(mData, destIndex, this.PixelFormat, srcPixel, x * sourceStride, srcFormat);
- destIndex += PixelStride;
+ destIndex += destPixelStride;
+ }
}
dataPtr += srcRowStride;
@@ -851,6 +877,7 @@
public static void ConvertPixel(byte[] dest, int destIndex, PixelFormat destFormat, byte[] src, int srcIndex, PixelFormat srcFormat)
{
// check for trivial case.
+ // this is commented because it should be checked for above this method.
//if (destFormat == srcFormat)
//{
// for (int i = 0; i < GetPixelStride(destFormat); i++)
@@ -859,6 +886,21 @@
// return;
//}
+ // check for common Win32 - OpenGL conversion case
+ if (destFormat == PixelFormat.RGBA8888 &&
+ srcFormat == PixelFormat.BGRA8888)
+ {
+ dest[destIndex] = src[srcIndex + 2];
+ dest[destIndex + 1] = src[srcIndex + 1];
+ dest[destIndex + 2] = src[srcIndex];
+ dest[destIndex + 3] = src[srcIndex + 3];
+
+ return;
+ }
+
+ // This approach is very slow partly because it uses floating point
+ // arithmetic. It is especially slow if you have a profiler attached
+ // to your process and are loading large images.
double a, r, g, b;
GetSourcePixelAttributes(src, srcIndex, srcFormat, out a, out r, out g, out b);
Modified: trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs
===================================================================
--- trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs 2012-03-27 16:13:34 UTC (rev 1341)
+++ trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs 2012-04-04 02:31:22 UTC (rev 1342)
@@ -313,11 +313,16 @@
{
AddAttribute(element, "type", value.GetType().ToString());
- nodes.Push(element);
+ try
+ {
+ nodes.Push(element);
- Serialize(value);
-
- nodes.Pop();
+ Serialize(value);
+ }
+ finally
+ {
+ nodes.Pop();
+ }
}
}
private XmlElement WriteAsElement<T>(string name, T value) where T : IConvertible
@@ -489,27 +494,38 @@
AddAttribute(element, "array", "true");
AddAttribute(element, "type", listType.ToString());
- nodes.Push(element);
-
- for (int i = 0; i < value.Count; i++)
+ try
{
- XmlElement item = doc.CreateElement("Item");
- CurrentNode.AppendChild(item);
+ nodes.Push(element);
- if (value[i] == null)
- AddAttribute(item, "type", "null");
- else
+ for (int i = 0; i < value.Count; i++)
{
- if (value[i].GetType() != listType)
- AddAttribute(item, "type", value[i].GetType().ToString());
+ XmlElement item = doc.CreateElement("Item");
+ CurrentNode.AppendChild(item);
- nodes.Push(item);
- Serialize(value[i]);
- nodes.Pop();
+ if (value[i] == null)
+ AddAttribute(item, "type", "null");
+ else
+ {
+ if (value[i].GetType() != listType)
+ AddAttribute(item, "type", value[i].GetType().ToString());
+
+ try
+ {
+ nodes.Push(item);
+ Serialize(value[i]);
+ }
+ finally
+ {
+ nodes.Pop();
+ }
+ }
}
}
-
- nodes.Pop();
+ finally
+ {
+ nodes.Pop();
+ }
}
/// <summary>
/// Writes an array of strings to the XML data as an element.
@@ -530,16 +546,21 @@
XmlElement element = CreateElement(name);
AddAttribute(element, "array", "true");
- nodes.Push(element);
+ try
+ {
+ nodes.Push(element);
- for (int i = 0; i < value.Count; i++)
+ for (int i = 0; i < value.Count; i++)
+ {
+ XmlElement item = doc.CreateElement("Item");
+ CurrentNode.AppendChild(item);
+ item.InnerText = value[i];
+ }
+ }
+ finally
{
- XmlElement item = doc.CreateElement("Item");
- CurrentNode.AppendChild(item);
- item.InnerText = value[i];
+ nodes.Pop();
}
-
- nodes.Pop();
}
/// <summary>
/// Writes a Dictionary of objects implementing IXleSerializable to the XML data as an element.
@@ -560,27 +581,38 @@
//AddAttribute(element, "keytype", keyType.ToString());
//AddAttribute(element, "valuetype", valueType.ToString());
- nodes.Push(element);
-
- foreach (KeyValuePair<Tkey, Tvalue> kvp in value)
+ try
{
- XmlElement item = doc.CreateElement("Item");
- CurrentNode.AppendChild(item);
+ nodes.Push(element);
- AddAttribute(item, "key", kvp.Key.ToString());
+ foreach (KeyValuePair<Tkey, Tvalue> kvp in value)
+ {
+ XmlElement item = doc.CreateElement("Item");
+ CurrentNode.AppendChild(item);
- //if (keyType != kvp.Key.GetType())
- // AddAttribute(item, "IDtype", kvp.Key.GetType().ToString());
+ AddAttribute(item, "key", kvp.Key.ToString());
- if (kvp.Value.GetType() != valueType)
- AddAttribute(item, "type", kvp.Value.GetType().ToString());
+ //if (keyType != kvp.Key.GetType())
+ // AddAttribute(item, "IDtype", kvp.Key.GetType().ToString());
- nodes.Push(item);
- Serialize(kvp.Value);
+ if (kvp.Value.GetType() != valueType)
+ AddAttribute(item, "type", kvp.Value.GetType().ToString());
+
+ try
+ {
+ nodes.Push(item);
+ Serialize(kvp.Value);
+ }
+ finally
+ {
+ nodes.Pop();
+ }
+ }
+ }
+ finally
+ {
nodes.Pop();
}
-
- nodes.Pop();
}
/// <summary>
/// Writes a Dictionary of integers to the XML data as an element.
@@ -599,18 +631,23 @@
//AddAttribute(element, "keytype", keyType.ToString());
//AddAttribute(element, "valuetype", valueType.ToString());
- nodes.Push(element);
-
- foreach (KeyValuePair<Tkey, int> kvp in value)
+ try
{
- XmlElement item = doc.CreateElement("Item");
- CurrentNode.AppendChild(item);
+ nodes.Push(element);
- AddAttribute(item, "key", kvp.Key.ToString());
- AddAttribute(item, "value", kvp.Value.ToString());
+ foreach (KeyValuePair<Tkey, int> kvp in value)
+ {
+ XmlElement item = doc.CreateElement("Item");
+ CurrentNode.AppendChild(item);
+
+ AddAttribute(item, "key", kvp.Key.ToString());
+ AddAttribute(item, "value", kvp.Value.ToString());
+ }
}
-
- nodes.Pop();
+ finally
+ {
+ nodes.Pop();
+ }
}
/// <summary>
/// Writes a Dictionary of strings implementing IXleSerializable to the XML data as an element.
@@ -630,22 +667,27 @@
//AddAttribute(element, "keytype", keyType.ToString());
//AddAttribute(element, "valuetype", typeof(string).ToString());
- nodes.Push(element);
-
- foreach (KeyValuePair<Tkey, string> kvp in value)
+ try
{
- XmlElement item = doc.CreateElement("Item");
- CurrentNode.AppendChild(item);
+ nodes.Push(element);
- AddAttribute(item, "key", kvp.Key.ToString());
+ foreach (KeyValuePair<Tkey, string> kvp in value)
+ {
+ XmlElement item = doc.CreateElement("Item");
+ CurrentNode.AppendChild(item);
- //if (keyType != kvp.Key.GetType())
- // AddAttribute(item, "keytype", kvp.Key.GetType().ToString());
+ AddAttribute(item, "key", kvp.Key.ToString());
- AddAttribute(item, "value", kvp.Value.ToString());
+ //if (keyType != kvp.Key.GetType())
+ // AddAttribute(item, "keytype", kvp.Key.GetType().ToString());
+
+ AddAttribute(item, "value", kvp.Value.ToString());
+ }
}
-
- nodes.Pop();
+ finally
+ {
+ nodes.Pop();
+ }
}
#endregion
@@ -1149,12 +1191,17 @@
}
else
{
- nodes.Push(item);
+ try
+ {
+ nodes.Push(item);
- object o = DeserializeObject(type);
- list.Add(o);
-
- nodes.Pop();
+ object o = DeserializeObject(type);
+ list.Add(o);
+ }
+ finally
+ {
+ nodes.Pop();
+ }
}
}
@@ -1202,26 +1249,37 @@
if (element == null)
throw new XleSerializationException("Node " + name + " was not found.");
- nodes.Push(element);
+ try
+ {
+ nodes.Push(element);
- Dictionary<TKey, TValue> retval = new Dictionary<TKey, TValue>();
+ Dictionary<TKey, TValue> retval = new Dictionary<TKey, TValue>();
- for (int i = 0; i < element.ChildNodes.Count; i++)
- {
- XmlElement current = (XmlElement)CurrentNode.ChildNodes[i];
- string keyString = current.GetAttribute("key");
- TKey key = (TKey)Convert.ChangeType(keyString, typeof(TKey));
+ for (int i = 0; i < element.ChildNodes.Count; i++)
+ {
+ XmlElement current = (XmlElement)CurrentNode.ChildNodes[i];
+ string keyString = current.GetAttribute("key");
+ TKey key = (TKey)Convert.ChangeType(keyString, typeof(TKey));
- nodes.Push(current);
- TValue val = (TValue)DeserializeObject(typeof(TValue));
- nodes.Pop();
+ try
+ {
+ nodes.Push(current);
+ TValue val = (TValue)DeserializeObject(typeof(TValue));
- retval.Add(key, val);
+ retval.Add(key, val);
+ }
+ finally
+ {
+ nodes.Pop();
+ }
+ }
+
+ return retval;
}
-
- nodes.Pop();
-
- return retval;
+ finally
+ {
+ nodes.Pop();
+ }
}
/// <summary>
/// Reads a dictionary type of strings from the XML data.
@@ -1252,24 +1310,30 @@
{
XmlElement element = (XmlElement)CurrentNode[name];
- nodes.Push(element);
+ try
+ {
+ nodes.Push(element);
- Dictionary<Tkey, string> retval = new Dictionary<Tkey, string>();
+ Dictionary<Tkey, string> retval = new Dictionary<Tkey, string>();
- for (int i = 0; i < element.ChildNodes.Count; i++)
- {
- XmlElement current = (XmlElement)CurrentNode.ChildNodes[i];
- string keyString = current.GetAttribute("key");
- Tkey key = (Tkey)Convert.ChangeType(keyString, typeof(Tkey));
+ for (int i = 0; i < element.ChildNodes.Count; i++)
+ {
+ XmlElement current = (XmlElement)CurrentNode.ChildNodes[i];
+ string keyString = current.GetAttribute("key");
+ Tkey key = (Tkey)Convert.ChangeType(keyString, typeof(Tkey));
- string valueString = current.GetAttribute("value");
+ string valueString = current.GetAttribute("value");
- retval.Add(key, valueString);
+ retval.Add(key, valueString);
+ }
+
+ return retval;
}
+ finally
+ {
+ nodes.Pop();
+ }
- nodes.Pop();
-
- return retval;
}
/// <summary>
@@ -1282,24 +1346,29 @@
{
XmlElement element = (XmlElement)CurrentNode[name];
- nodes.Push(element);
+ try
+ {
+ nodes.Push(element);
- Dictionary<Tkey, int> retval = new Dictionary<Tkey, int>();
+ Dictionary<Tkey, int> retval = new Dictionary<Tkey, int>();
- for (int i = 0; i < element.ChildNodes.Count; i++)
- {
- XmlElement current = (XmlElement)CurrentNode.ChildNodes[i];
- string keyString = current.GetAttribute("key");
- Tkey key = (Tkey)Convert.ChangeType(keyString, typeof(Tkey));
+ for (int i = 0; i < element.ChildNodes.Count; i++)
+ {
+ XmlElement current = (XmlElement)CurrentNode.ChildNodes[i];
+ string keyString = current.GetAttribute("key");
+ Tkey key = (Tkey)Convert.ChangeType(keyString, typeof(Tkey));
- string valueString = current.GetAttribute("value");
+ string valueString = current.GetAttribute("value");
- retval.Add(key, int.Parse(valueString));
+ retval.Add(key, int.Parse(valueString));
+ }
+
+ return retval;
}
-
- nodes.Pop();
-
- return retval;
+ finally
+ {
+ nodes.Pop();
+ }
}
#endregion
@@ -1413,14 +1482,20 @@
if (root.Name != "XleRoot")
throw new XleSerializationException("Could not understand stream. Expected to find an XleRoot element, but found " + root.Name + ".");
- nodes.Push(root);
+ try
+ {
+ nodes.Push(root);
- object retval = DeserializeObject();
+ object retval = DeserializeObject();
- System.Diagnostics.Debug.Assert(nodes.Count == 1);
- nodes.Pop();
+ System.Diagnostics.Debug.Assert(nodes.Count == 1);
- return retval;
+ return retval;
+ }
+ finally
+ {
+ nodes.Pop();
+ }
}
private object DeserializeObject()
Modified: trunk/AgateLib-Windows.sln
===================================================================
--- trunk/AgateLib-Windows.sln 2012-03-27 16:13:34 UTC (rev 1341)
+++ trunk/AgateLib-Windows.sln 2012-04-04 02:31:22 UTC (rev 1342)
@@ -8,6 +8,12 @@
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}"
+ ProjectSection(ProjectDependencies) = postProject
+ {9E095F03-BA3F-4EAD-A905-2A2647CE4405} = {9E095F03-BA3F-4EAD-A905-2A2647CE4405}
+ {EF993B30-D9A9-4962-80BB-6826D39B3465} = {EF993B30-D9A9-4962-80BB-6826D39B3465}
+ {164A785D-924E-40FB-A517-D7E677F3B53A} = {164A785D-924E-40FB-A517-D7E677F3B53A}
+ {00C7FA95-98F4-43D9-9B63-34122B1DB003} = {00C7FA95-98F4-43D9-9B63-34122B1DB003}
+ EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgateLib.WinForms", "Drivers\AgateLib.WinForms\AgateLib.WinForms.csproj", "{BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}"
EndProject
Modified: trunk/Drivers/AgateDrawing/AgateDrawing.csproj
===================================================================
--- trunk/Drivers/AgateDrawing/AgateDrawing.csproj 2012-03-27 16:13:34 UTC (rev 1341)
+++ trunk/Drivers/AgateDrawing/AgateDrawing.csproj 2012-04-04 02:31:22 UTC (rev 1342)
@@ -89,7 +89,7 @@
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <OutputPath>bin\x86\Release\</OutputPath>
+ <OutputPath>..\..\Binaries\Release\</OutputPath>
<DefineConstants>TRACE;</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<Optimize>true</Optimize>
Modified: trunk/Drivers/AgateFMOD/AgateFMOD.csproj
===================================================================
--- trunk/Drivers/AgateFMOD/AgateFMOD.csproj 2012-03-27 16:13:34 UTC (rev 1341)
+++ trunk/Drivers/AgateFMOD/AgateFMOD.csproj 2012-04-04 02:31:22 UTC (rev 1342)
@@ -94,7 +94,7 @@
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <OutputPath>bin\x86\Release\</OutputPath>
+ <OutputPath>..\..\Binaries\Release\</OutputPath>
<DefineConstants>TRACE;</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<Optimize>true</Optimize>
Modified: trunk/Drivers/AgateLib.WinForms/AgateLib.WinForms.csproj
===================================================================
--- trunk/Drivers/AgateLib.WinForms/AgateLib.WinForms.csproj 2012-03-27 16:13:34 UTC (rev 1341)
+++ trunk/Drivers/AgateLib.WinForms/AgateLib.WinForms.csproj 2012-04-04 02:31:22 UTC (rev 1342)
@@ -89,7 +89,7 @@
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <OutputPath>bin\x86\Release\</OutputPath>
+ <OutputPath>..\..\Binaries\Release\</OutputPath>
<DefineConstants>TRACE;</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<DocumentationFile>AgateLib.WinForms.xml</DocumentationFile>
Modified: trunk/Drivers/AgateOTK/AgateOTK.csproj
===================================================================
--- trunk/Drivers/AgateOTK/AgateOTK.csproj 2012-03-27 16:13:34 UTC (rev 1341)
+++ trunk/Drivers/AgateOTK/AgateOTK.csproj 2012-04-04 02:31:22 UTC (rev 1342)
@@ -94,7 +94,7 @@
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <OutputPath>bin\x86\Release\</OutputPath>
+ <OutputPath>..\..\Binaries\Release\</OutputPath>
<DefineConstants>TRACE;</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Modified: trunk/Drivers/AgateSDL/AgateSDL.csproj
===================================================================
--- trunk/Drivers/AgateSDL/AgateSDL.csproj 2012-03-27 16:13:34 UTC (rev 1341)
+++ trunk/Drivers/AgateSDL/AgateSDL.csproj 2012-04-04 02:31:22 UTC (rev 1342)
@@ -94,7 +94,7 @@
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <OutputPath>bin\x86\Release\</OutputPath>
+ <OutputPath>..\..\Binaries\Release\</OutputPath>
<DefineConstants>TRACE;</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Modified: trunk/Drivers/AgateSDL/Audio/SDL_Music.cs
===================================================================
--- trunk/Drivers/AgateSDL/Audio/SDL_Music.cs 2012-03-27 16:13:34 UTC (rev 1341)
+++ trunk/Drivers/AgateSDL/Audio/SDL_Music.cs 2012-04-04 02:31:22 UTC (rev 1342)
@@ -110,6 +110,7 @@
public override void Play()
{
SdlMixer.Mix_PlayMusic(music, IsLooping ? -1 : 1);
+ mVolume = SdlMixer.Mix_VolumeMusic(-1) / (double)SdlMixer.MIX_MAX_VOLUME;
}
public override void Stop()
@@ -125,8 +126,13 @@
}
set
{
- SdlMixer.Mix_VolumeMusic((int)(value * SdlMixer.MIX_MAX_VOLUME));
mVolume = value;
+ if (mVolume < 0) mVolume = 0;
+ if (mVolume > 1) mVolume = 1;
+
+ int v = (int)(mVolume * SdlMixer.MIX_MAX_VOLUME);
+
+ SdlMixer.Mix_VolumeMusic(v);
}
}
}
Copied: trunk/Tests/Data/largeimage.png (from rev 1338, trunk/Tests/Data/9ball.png)
===================================================================
(Binary files differ)
Copied: trunk/Tests/DisplayTests/LargeImage.cs (from rev 1338, trunk/Tests/DisplayTests/ScreenCapture.cs)
===================================================================
--- trunk/Tests/DisplayTests/LargeImage.cs (rev 0)
+++ trunk/Tests/DisplayTests/LargeImage.cs 2012-04-04 02:31:22 UTC (rev 1342)
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+using AgateLib;
+using AgateLib.DisplayLib;
+using AgateLib.Geometry;
+using AgateLib.InputLib;
+
+namespace Tests.ScreenCaptureExample
+{
+ class LargeImageTest : IAgateTest
+ {
+
+ #region IAgateTest Members
+
+ public string Name { get { return "Large Image"; } }
+ public string Category { get { return "Display"; } }
+
+ #endregion
+
+ public void Main(string[] args)
+ {
+ using (AgateSetup setup = new AgateSetup())
+ {
+ setup.Initialize(true, false, false);
+ if (setup.WasCanceled) return;
+
+ DisplayWindow wind = DisplayWindow.CreateWindowed("Hello", 800, 600);
+
+ System.Diagnostics.Stopwatch watch = new Stopwatch();
+ watch.Start();
+ Surface someSurface = new Surface("largeimage.png");
+ watch.Stop();
+ double loadTime = watch.ElapsedMilliseconds / 1000.0;
+
+ while (wind.IsClosed == false)
+ {
+ Display.BeginFrame();
+ Display.Clear(Color.White);
+
+ someSurface.Draw();
+ FontSurface.AgateSans24.DrawText(0,0, "Load took {0} seconds.", loadTime);
+
+ Display.EndFrame();
+
+ Core.KeepAlive();
+ System.Threading.Thread.Sleep(10);
+ }
+ }
+ }
+ }
+}
Modified: trunk/Tests/Tests.csproj
===================================================================
--- trunk/Tests/Tests.csproj 2012-03-27 16:13:34 UTC (rev 1341)
+++ trunk/Tests/Tests.csproj 2012-04-04 02:31:22 UTC (rev 1342)
@@ -90,7 +90,7 @@
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <OutputPath>bin\x86\Release\</OutputPath>
+ <OutputPath>..\Binaries\Release\</OutputPath>
<DefineConstants>TRACE;</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<Optimize>true</Optimize>
@@ -141,6 +141,7 @@
<DependentUpon>frmCapabilities.cs</DependentUpon>
</Compile>
<Compile Include="DisplayTests\ColorTest.cs" />
+ <Compile Include="DisplayTests\LargeImage.cs" />
<Compile Include="DisplayTests\DisplayWindowEvents.cs" />
<Compile Include="DisplayTests\PixelBufferMask.cs" />
<Compile Include="DisplayTests\ClipRect.cs" />
@@ -535,6 +536,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
+ <None Include="Data\largeimage.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
<Content Include="Data\fonts\MedievalSharp14.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-04-05 17:23:08
|
Revision: 1343
http://agate.svn.sourceforge.net/agate/?rev=1343&view=rev
Author: kanato
Date: 2012-04-05 17:23:01 +0000 (Thu, 05 Apr 2012)
Log Message:
-----------
Add Rectangle.Inflate method.
Added test to draw from a surface to a surface to MultipleRenderTest.
Modified Paths:
--------------
trunk/AgateLib/Geometry/Rectangle.cs
trunk/Tests/DisplayTests/MultipleWindows/MultipleRenderTargetExample.Designer.cs
trunk/Tests/DisplayTests/MultipleWindows/MultipleRenderTargetExample.resx
trunk/Tests/DisplayTests/MultipleWindows/MultipleWindowTest.cs
Modified: trunk/AgateLib/Geometry/Rectangle.cs
===================================================================
--- trunk/AgateLib/Geometry/Rectangle.cs 2012-04-04 02:31:22 UTC (rev 1342)
+++ trunk/AgateLib/Geometry/Rectangle.cs 2012-04-05 17:23:01 UTC (rev 1343)
@@ -29,7 +29,7 @@
/// </summary>
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]
- public struct Rectangle : IXleSerializable
+ public struct Rectangle : IXleSerializable
{
Point pt;
Size sz;
@@ -485,5 +485,33 @@
Math.Abs(a.X - b.X),
Math.Abs(a.Y - b.Y));
}
+
+ /// <summary>
+ /// Expands the rectangle structure by the specified
+ /// size structure. Actually, the size is increased by
+ /// double the amount because the rectangle is expanded
+ /// in all directions.
+ /// </summary>
+ /// <param name="size"></param>
+ public void Inflate(Size size)
+ {
+ X -= size.Width;
+ Y -= size.Height;
+
+ Width += size.Width * 2;
+ Height += size.Height * 2;
+ }
+ /// <summary>
+ /// Expands the rectangle structure by the specified
+ /// size. Actually, the size is increased by
+ /// double the amount specified because the rectangle is expanded
+ /// in all directions.
+ /// </summary>
+ /// <param name="width"></param>
+ /// <param name="height"></param>
+ public void Inflate(int width, int height)
+ {
+ Inflate(new Size(width, height));
+ }
}
}
\ No newline at end of file
Modified: trunk/Tests/DisplayTests/MultipleWindows/MultipleRenderTargetExample.Designer.cs
===================================================================
--- trunk/Tests/DisplayTests/MultipleWindows/MultipleRenderTargetExample.Designer.cs 2012-04-04 02:31:22 UTC (rev 1342)
+++ trunk/Tests/DisplayTests/MultipleWindows/MultipleRenderTargetExample.Designer.cs 2012-04-05 17:23:01 UTC (rev 1343)
@@ -43,12 +43,15 @@
this.btnClearSurface = new System.Windows.Forms.Button();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
+ this.btnDrawText = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
@@ -120,7 +123,7 @@
// btnDraw
//
this.btnDraw.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btnDraw.Location = new System.Drawing.Point(208, 208);
+ this.btnDraw.Location = new System.Drawing.Point(127, 208);
this.btnDraw.Name = "btnDraw";
this.btnDraw.Size = new System.Drawing.Size(75, 39);
this.btnDraw.TabIndex = 6;
@@ -131,7 +134,7 @@
// btnClearSurface
//
this.btnClearSurface.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btnClearSurface.Location = new System.Drawing.Point(127, 208);
+ this.btnClearSurface.Location = new System.Drawing.Point(46, 208);
this.btnClearSurface.Name = "btnClearSurface";
this.btnClearSurface.Size = new System.Drawing.Size(75, 39);
this.btnClearSurface.TabIndex = 8;
@@ -150,6 +153,7 @@
//
// splitContainer1.Panel2
//
+ this.splitContainer1.Panel2.Controls.Add(this.btnDrawText);
this.splitContainer1.Panel2.Controls.Add(this.label3);
this.splitContainer1.Panel2.Controls.Add(this.btnClearSurface);
this.splitContainer1.Panel2.Controls.Add(this.pictureBox3);
@@ -178,6 +182,17 @@
this.splitContainer2.SplitterDistance = 126;
this.splitContainer2.TabIndex = 0;
//
+ // btnDrawText
+ //
+ this.btnDrawText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnDrawText.Location = new System.Drawing.Point(208, 208);
+ this.btnDrawText.Name = "btnDrawText";
+ this.btnDrawText.Size = new System.Drawing.Size(75, 39);
+ this.btnDrawText.TabIndex = 9;
+ this.btnDrawText.Text = "Draw Text On Surface";
+ this.toolTip1.SetToolTip(this.btnDrawText, "Tests using a surface as a render target\r\nby drawing directly to the surface.");
+ this.btnDrawText.UseVisualStyleBackColor = true;
+ //
// MultipleRenderTargetExample
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -193,11 +208,13 @@
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.Panel2.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel1.PerformLayout();
this.splitContainer2.Panel2.ResumeLayout(false);
this.splitContainer2.Panel2.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.ResumeLayout(false);
@@ -216,6 +233,7 @@
public System.Windows.Forms.Button btnClearSurface;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.SplitContainer splitContainer2;
+ public System.Windows.Forms.Button btnDrawText;
}
}
Modified: trunk/Tests/DisplayTests/MultipleWindows/MultipleRenderTargetExample.resx
===================================================================
--- trunk/Tests/DisplayTests/MultipleWindows/MultipleRenderTargetExample.resx 2012-04-04 02:31:22 UTC (rev 1342)
+++ trunk/Tests/DisplayTests/MultipleWindows/MultipleRenderTargetExample.resx 2012-04-05 17:23:01 UTC (rev 1343)
@@ -112,12 +112,12 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
Modified: trunk/Tests/DisplayTests/MultipleWindows/MultipleWindowTest.cs
===================================================================
--- trunk/Tests/DisplayTests/MultipleWindows/MultipleWindowTest.cs 2012-04-04 02:31:22 UTC (rev 1342)
+++ trunk/Tests/DisplayTests/MultipleWindows/MultipleWindowTest.cs 2012-04-05 17:23:01 UTC (rev 1343)
@@ -46,7 +46,7 @@
// this is the code that will be called when the button is pressed
myForm.btnDraw.Click += new EventHandler(btnDraw_Click);
myForm.btnClearSurface.Click += new EventHandler(btnClear_Click);
-
+ myForm.btnDrawText.Click += new EventHandler(btnDrawText_Click);
Surface image1 = new Surface("jellybean.png");
Surface image2 = new Surface("9ball.png");
image1.DisplayWidth = 40;
@@ -102,6 +102,27 @@
}
+ void btnDrawText_Click(object sender, EventArgs e)
+ {
+ Display.RenderTarget = buffer;
+
+ Display.BeginFrame();
+
+ int x = rand.Next(20, 100);
+ int y = rand.Next(20, 100);
+
+ Color clr = Color.White;
+
+ FontSurface.AgateSans14.DrawText(x, y, "Sample Text");
+
+ Display.EndFrame();
+
+ surf.SaveTo("test.png", ImageFileFormat.Png);
+
+ System.Diagnostics.Debug.Print("Wrote text to {0},{1}.", x,y);
+ System.Diagnostics.Debug.Flush();
+ }
+
void wnd_3_Resize(object sender, EventArgs e)
{
var ctrl = (System.Windows.Forms.Control )sender;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|