<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="SelectableList.cs" />
+ <Compile Include="UI\Image.cs" />
+ <Compile Include="UI\Element.cs" />
+ <Compile Include="UI\Framework.cs" />
<Compile Include="XML\SerializableDictionary.cs" />
<Compile Include="XML\Serializer.cs" />
<Compile Include="カウンタ\Counter.cs" />
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using FDK;
+using FDK.メディア;
+
+namespace FDK.UI
+{
+ public class Element : IDisposable
+ {
+ public System.Drawing.PointF Location
+ {
+ get;
+ set;
+ } = new System.Drawing.PointF( 0f, 0f );
+
+
+ public Element()
+ {
+ }
+
+ public void Dispose()
+ {
+ // (1) 自分を解放する。
+ this.OnDispose();
+
+ // (2) 子を解放する。
+ foreach( var child in this._子要素リスト )
+ child.Dispose();
+ this._子要素リスト.Clear();
+ }
+
+ public void AddChild( Element child, bool isAbove, Element refChild = null )
+ {
+ if( isAbove )
+ {
+ this._子要素リスト.Insert( 0, child );
+ }
+ else if( null != refChild )
+ {
+ int n = this._子要素リスト.IndexOf( refChild );
+
+ if( 0 <= n )
+ {
+ this._子要素リスト.Insert( n + 1, child );
+ }
+ else
+ {
+ Log.ERRORandTHROW( "指定された要素が存在しません。", new ArgumentException() );
+ }
+ }
+ else
+ {
+ Log.ERRORandTHROW( "指定された要素が無効です。", new ArgumentNullException() );
+ }
+ }
+
+ public void Render( グラフィックデバイス gd, PointF upperLeft )
+ {
+ // (1) 自分を描画する。
+ this.OnRender( gd, upperLeft );
+
+ // (2) 子要素を昇順に描画する。
+ upperLeft += new SizeF( this.Location );
+ for( int i = 0; i < this._子要素リスト.Count; i++ )
+ this._子要素リスト[ i ].Render( gd, upperLeft );
+ }
+
+
+ protected readonly List<Element> _子要素リスト = new List<Element>();
+
+ // 以下、派生クラスで実装する。
+
+ protected virtual void OnRender( グラフィックデバイス gd, PointF upperLeft ) { }
+
+ protected virtual void OnDispose() { }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using FDK;
+using FDK.メディア;
+
+namespace FDK.UI
+{
+ public class Framework : IDisposable
+ {
+ public Element Root
+ {
+ get;
+ set;
+ } = null;
+
+
+ public Framework()
+ {
+ }
+
+ public void Dispose()
+ {
+ this.Root?.Dispose();
+ this.Root = null;
+ }
+
+ public void Render( グラフィックデバイス gd )
+ {
+ this.Root?.Render( gd, new PointF( 0f, 0f ) ); // Root == null は OK
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SharpDX;
+using FDK;
+using FDK.メディア;
+using System.Drawing;
+
+namespace FDK.UI
+{
+ public class Image : Element
+ {
+ public Size2F Size
+ {
+ get
+ => this._画像.サイズ;
+ }
+
+
+ public Image( グラフィックデバイス gd, string imagePath )
+ {
+ this._画像 = new 画像( imagePath );
+ this._画像.活性化する( gd );
+ }
+
+ protected override void OnDispose()
+ {
+ this._画像?.非活性化する( null ); // このクラスは null でも OK
+ this._画像 = null;
+ }
+
+ protected override void OnRender( グラフィックデバイス gd, PointF upperLeft )
+ {
+ upperLeft += new SizeF( this.Location );
+ this._画像.描画する( gd, upperLeft.X, upperLeft.Y );
+ }
+
+
+ private 画像 _画像 = null;
+ }
+}
protected set;
}
+ public static FDK.UI.Framework UIフレームワーク
+ {
+ get;
+ protected set;
+ } = null;
+
#endregion
App.最後に取得したビュアーメッセージ = null;
App.ビュアー用ノード = null;
+ App.UIフレームワーク = new FDK.UI.Framework();
+
#region " メインフォームを初期化する。"
//----------------
this.Text = $"{Application.ProductName} {Application.ProductVersion}";
//----------------
#endregion
- #region " (2) 現在のステージの進行描画を行う。"
+ #region " (2) ç\8f¾å\9c¨ã\81®ã\82¹ã\83\86ã\83¼ã\82¸ã\81¨UIã\83\95ã\83¬ã\83¼ã\83 ã\83¯ã\83¼ã\82¯ã\81®é\80²è¡\8cæ\8f\8fç\94»ã\82\92è¡\8cã\81\86ã\80\82"
//----------------
App.ステージ管理.現在のステージ.進行描画する( gd );
+ App.UIフレームワーク.Render( gd );
//----------------
#endregion
{
using( Log.Block( FDKUtilities.現在のメソッド名 ) )
{
+ App.UIフレームワーク.Dispose();
+
if( App.ステージ管理.現在のステージ?.活性化している ?? false )
App.ステージ管理.現在のステージ?.非活性化する( App.グラフィックデバイス );