• R/O
  • SSH
  • HTTPS

nlgp1: Commit


Commit MetaInfo

Revision629 (tree)
Time2011-01-08 18:40:12
Authorbiikame

Log Message

ゲーム内の演算用の浮動小数点数型をdoubleからfloatに変更

Change Summary

Incremental Difference

--- trunk/Nlgp1/Nlgp1/Characters/CharacterFactory.cs (revision 628)
+++ trunk/Nlgp1/Nlgp1/Characters/CharacterFactory.cs (revision 629)
@@ -39,7 +39,7 @@
3939 #region ゆっくりと左に歩いてくる
4040 character.Sprite.ActionEvent += new EventHandler<SpriteActionEventArgs>( ( sender , e ) => {
4141 e.Target.AdvancingDirectionType = AdvancingDirectionType.Left;
42- e.Target.WalkingAcceleration = 0.01;
42+ e.Target.WalkingAcceleration = 0.01f;
4343 } );
4444 #endregion
4545 break;
@@ -48,7 +48,7 @@
4848 #region ゆっくりと右に歩いてくる
4949 character.Sprite.ActionEvent += new EventHandler<SpriteActionEventArgs>( ( sender , e ) => {
5050 e.Target.AdvancingDirectionType = AdvancingDirectionType.Right;
51- e.Target.WalkingAcceleration = 0.01;
51+ e.Target.WalkingAcceleration = 0.01f;
5252 } );
5353 #endregion
5454 break;
@@ -59,7 +59,7 @@
5959 character.Sprite.JumpingMaxVelocity = 4;
6060 character.Sprite.ActionEvent += new EventHandler<SpriteActionEventArgs>( ( sender , e ) => {
6161 e.Target.AdvancingDirectionType = AdvancingDirectionType.Left;
62- e.Target.WalkingAcceleration = 0.01;
62+ e.Target.WalkingAcceleration = 0.01f;
6363 e.Target.StartJumping();
6464 } );
6565 #endregion
@@ -70,7 +70,7 @@
7070 character.Sprite.JumpingMaxVelocity = 4;
7171 character.Sprite.ActionEvent += new EventHandler<SpriteActionEventArgs>( ( sender , e ) => {
7272 e.Target.AdvancingDirectionType = AdvancingDirectionType.Right;
73- e.Target.WalkingAcceleration = 0.01;
73+ e.Target.WalkingAcceleration = 0.01f;
7474 e.Target.StartJumping();
7575 } );
7676 #endregion
--- trunk/Nlgp1/Nlgp1/Parameters/Bounds.cs (revision 628)
+++ trunk/Nlgp1/Nlgp1/Parameters/Bounds.cs (revision 629)
@@ -25,7 +25,7 @@
2525 /// <summary>
2626 /// 横幅を取得します。
2727 /// </summary>
28- public double Width {
28+ public float Width {
2929 get {
3030 return this.box.Width;
3131 }
@@ -33,7 +33,7 @@
3333 /// <summary>
3434 /// 縦幅を取得します。
3535 /// </summary>
36- public double Height {
36+ public float Height {
3737 get {
3838 return this.box.Height;
3939 }
@@ -43,7 +43,7 @@
4343 /// <summary>
4444 /// 左端の座標を取得します。
4545 /// </summary>
46- public double Left {
46+ public float Left {
4747 get {
4848 return this.sprite.X + this.box.Left;
4949 }
@@ -54,7 +54,7 @@
5454 /// <summary>
5555 /// 上端の座標を取得します。
5656 /// </summary>
57- public double Top {
57+ public float Top {
5858 get {
5959 return this.sprite.Y + this.box.Top;
6060 }
@@ -65,7 +65,7 @@
6565 /// <summary>
6666 /// 右端の座標を取得します。
6767 /// </summary>
68- public double Right {
68+ public float Right {
6969 get {
7070 return this.sprite.X + this.box.Right;
7171 }
@@ -76,7 +76,7 @@
7676 /// <summary>
7777 /// 下端の座標を取得します。
7878 /// </summary>
79- public double Bottom {
79+ public float Bottom {
8080 get {
8181 return this.sprite.Y + this.box.Bottom;
8282 }
@@ -84,22 +84,22 @@
8484 this.sprite.Y = value - this.box.Bottom;
8585 }
8686 }
87- public double PreviousLeft {
87+ public float PreviousLeft {
8888 get {
8989 return this.sprite.PreviousX + this.box.Left;
9090 }
9191 }
92- public double PreviousTop {
92+ public float PreviousTop {
9393 get {
9494 return this.sprite.PreviousY + this.box.Top;
9595 }
9696 }
97- public double PreviousRight {
97+ public float PreviousRight {
9898 get {
9999 return this.sprite.PreviousX + this.box.Right;
100100 }
101101 }
102- public double PreviousBottom {
102+ public float PreviousBottom {
103103 get {
104104 return this.sprite.PreviousY + this.box.Bottom;
105105 }
@@ -137,7 +137,7 @@
137137 /// <param name="dir">衝突方向</param>
138138 /// <param name="bounds">対象の短形</param>
139139 /// <returns>重なってる部分の距離</returns>
140- public double GetHittingDistance( DirectionType dir , Bounds bounds ) {
140+ public float GetHittingDistance( DirectionType dir , Bounds bounds ) {
141141 if( this.IsHitting( bounds ) == false )
142142 return 0;
143143 if( ( dir == DirectionType.Left || dir == DirectionType.Right ) && this.IsHitting( bounds , AxisType.X ) ) {
--- trunk/Nlgp1/Nlgp1/Drawers/StageDrawer.cs (revision 628)
+++ trunk/Nlgp1/Nlgp1/Drawers/StageDrawer.cs (revision 629)
@@ -34,22 +34,22 @@
3434 /// </summary>
3535 private static readonly int ViewCellCountY = 7;
3636 // 画面内のプレーヤーの表示位置
37- private static readonly double ScrollParameterX = 8 * ChipImage.SizeSide;
38- private static readonly double ScrollParameterY = 6 * ChipImage.SizeSide;
37+ private static readonly float ScrollParameterX = 8 * ChipImage.SizeSide;
38+ private static readonly float ScrollParameterY = 6 * ChipImage.SizeSide;
3939 // 描画されるチップの範囲を表す
40- private static double xStart = 0;
41- private static double yStart = 0;
42- private static double xEnd = 0;
43- private static double yEnd = 0;
40+ private static float xStart = 0;
41+ private static float yStart = 0;
42+ private static float xEnd = 0;
43+ private static float yEnd = 0;
4444
4545 /// <summary>
4646 /// 横方向のスクロール量
4747 /// </summary>
48- private static double scrollX = 0;
48+ private static float scrollX = 0;
4949 /// <summary>
5050 /// 縦方向のスクロール量
5151 /// </summary>
52- private static double scrollY = 0;
52+ private static float scrollY = 0;
5353
5454 /// <summary>
5555 /// ステージを読み込みます。
@@ -74,8 +74,8 @@
7474 scrollY = player.Location.Y - ScrollParameterY;
7575
7676 #region 可視範囲内でマップの描画
77- double chipX = player.Location.X / ChipImage.SizeSide;
78- double chipY = player.Location.Y / ChipImage.SizeSide;
77+ float chipX = player.Location.X / ChipImage.SizeSide;
78+ float chipY = player.Location.Y / ChipImage.SizeSide;
7979
8080 xStart = chipX - ViewCellCountX; // 画面左端にスペースができるのでその分のチップを多めに描画する
8181 yStart = chipY - ViewCellCountY;
@@ -87,7 +87,7 @@
8787 #region オブジェクトの描画
8888 foreach( var drawable in drawables )
8989 if( IsVisibleCell( drawable.Location.X , drawable.Location.Y ) )
90- drawable.Draw( new Vector( drawable.Location.X - scrollX - ChipImage.SizeSide / 2.0 , drawable.Location.Y - scrollY - ChipImage.SizeSide / 2.0 ) );
90+ drawable.Draw( new Vector( drawable.Location.X - scrollX - ChipImage.SizeSide / 2.0f , drawable.Location.Y - scrollY - ChipImage.SizeSide / 2.0f ) );
9191 #endregion
9292 }
9393
@@ -98,9 +98,9 @@
9898 /// <param name="column">ピクチップ単位で表されるY座標</param>
9999 /// <param name="blankCells">許容する描画範囲外のチップ数</param>
100100 /// <returns>描画範囲かどうか</returns>
101- public static bool IsVisibleCell( double x , double y ) {
102- double chipX = x / ChipImage.SizeSide;
103- double chipY = y / ChipImage.SizeSide;
101+ public static bool IsVisibleCell( float x , float y ) {
102+ float chipX = x / ChipImage.SizeSide;
103+ float chipY = y / ChipImage.SizeSide;
104104 return xStart <= chipX && xEnd >= chipX && yStart <= chipY && yEnd >= chipY;
105105 }
106106 }
--- trunk/Nlgp1/Nlgp1/Sprites/ActionParameter.cs (revision 628)
+++ trunk/Nlgp1/Nlgp1/Sprites/ActionParameter.cs (revision 629)
@@ -20,7 +20,7 @@
2020 /// <summary>
2121 /// 角度
2222 /// </summary>
23- public double Angle{
23+ public float Angle{
2424 get;
2525 set;
2626 }
@@ -27,7 +27,7 @@
2727 /// <summary>
2828 /// 半径
2929 /// </summary>
30- public double Radius{
30+ public float Radius{
3131 get;
3232 set;
3333 }
@@ -34,7 +34,7 @@
3434 /// <summary>
3535 /// 距離制限
3636 /// </summary>
37- public double LimitDistance{
37+ public float LimitDistance{
3838 get;
3939 set;
4040 }
@@ -41,7 +41,7 @@
4141 /// <summary>
4242 /// 速度
4343 /// </summary>
44- public double Speed{
44+ public float Speed{
4545 get;
4646 set;
4747 }
--- trunk/Nlgp1/Nlgp1/Sprites/Sprite.cs (revision 628)
+++ trunk/Nlgp1/Nlgp1/Sprites/Sprite.cs (revision 629)
@@ -67,13 +67,13 @@
6767 this.Viewer = SpriteDrawer.Load( imageTypeName , chipId );
6868 this.Owner = owner;
6969 this.LogicParameter = new ActionParameter();
70- this.Bounds = new Bounds( this , new Box( ChipImage.SizeSide / -2.0 , ChipImage.SizeSide / -2.0 , ChipImage.SizeSide / +2.0 , +ChipImage.SizeSide / +2.0 ) );
70+ this.Bounds = new Bounds( this , new Box( ChipImage.SizeSide / -2.0f , ChipImage.SizeSide / -2.0f , ChipImage.SizeSide / +2.0f , +ChipImage.SizeSide / +2.0f ) );
7171
7272 this.Type = type;
7373 this.ChipId = chipId;
7474 this.HitPoint = 1;
75- WalkingAcceleration = 0.5;
76- RunningAcceleration = 0.5;
75+ WalkingAcceleration = 0.5f;
76+ RunningAcceleration = 0.5f;
7777 WalkingMaxVelocity = 5;
7878 RunningMaxVelocity = 10;
7979 JumpingMaxVelocity = 4;
@@ -222,13 +222,13 @@
222222 set;
223223 }
224224
225- private double walkingMaxVelocity = 0;
226- private double runningMaxVelocity = 0;
225+ private float walkingMaxVelocity = 0;
226+ private float runningMaxVelocity = 0;
227227
228228 /// <summary>
229229 /// 静止時の加速度を設定または、取得します。
230230 /// </summary>
231- public double RestingAcceleration {
231+ public float RestingAcceleration {
232232 get;
233233 set;
234234 }
@@ -235,7 +235,7 @@
235235 /// <summary>
236236 /// 歩行時の加速度を設定または、取得します。
237237 /// </summary>
238- public double WalkingAcceleration {
238+ public float WalkingAcceleration {
239239 get;
240240 set;
241241 }
@@ -242,7 +242,7 @@
242242 /// <summary>
243243 /// 走行時の加速度を設定または、取得します。
244244 /// </summary>
245- public double RunningAcceleration {
245+ public float RunningAcceleration {
246246 get;
247247 set;
248248 }
@@ -249,7 +249,7 @@
249249 /// <summary>
250250 /// 静止時の最高速度を設定または、取得します。
251251 /// </summary>
252- public double RestingMaxVelocity {
252+ public float RestingMaxVelocity {
253253 get;
254254 set;
255255 }
@@ -257,7 +257,7 @@
257257 /// 横(X)方向の最高速度を設定または、取得します。
258258 /// 1チップを超える速度は、指定できません。
259259 /// </summary>
260- public double WalkingMaxVelocity {
260+ public float WalkingMaxVelocity {
261261 get {
262262 return walkingMaxVelocity;
263263 }
@@ -272,7 +272,7 @@
272272 /// 加速時の横(X)方向の最高速度を設定または、取得します。
273273 /// 1チップを超える速度は、指定できません。
274274 /// </summary>
275- public double RunningMaxVelocity {
275+ public float RunningMaxVelocity {
276276 get {
277277 return runningMaxVelocity;
278278 }
@@ -286,7 +286,7 @@
286286 /// <summary>
287287 /// 降下重力を設定または、取得します。
288288 /// </summary>
289- public double JumpingAcceleration {
289+ public float JumpingAcceleration {
290290 get;
291291 set;
292292 }
@@ -293,7 +293,7 @@
293293 /// <summary>
294294 /// スプライトのジャンプ力を取得または、設定します。
295295 /// </summary>
296- public double JumpingMaxVelocity {
296+ public float JumpingMaxVelocity {
297297 get;
298298 set;
299299 }
@@ -460,8 +460,8 @@
460460 #region 移動先を計算する
461461 this.ResetPreviousLocation();
462462 if( CanAdvance ) {
463- double accelerationX = 0;
464- double maxVelocityX = 0;
463+ float accelerationX = 0;
464+ float maxVelocityX = 0;
465465 switch( this.AdvancingType ) {
466466 case AdvancingType.Resting:
467467 if( this.VelocityX != 0 ) {
@@ -483,8 +483,8 @@
483483 }
484484 // 真下のチップの摩擦を取得して影響を計算する。
485485 // ジャンプ力の増加を打ち切る
486- double accelerationY = 0;
487- double maxVelocityY = 0;
486+ float accelerationY = 0;
487+ float maxVelocityY = 0;
488488 if( this.IsFloating ) {
489489 if( jumpingTime > 0 ) {
490490 --jumpingTime;
@@ -643,7 +643,7 @@
643643 /// <summary>
644644 /// X軸の座標を取得または、設定します。
645645 /// </summary>
646- public double X {
646+ public float X {
647647 get {
648648 return this.location.X;
649649 }
@@ -665,7 +665,7 @@
665665 /// <summary>
666666 /// Y軸の座標を取得または、設定します。
667667 /// </summary>
668- public double Y {
668+ public float Y {
669669 get {
670670 return this.location.Y;
671671 }
@@ -688,7 +688,7 @@
688688 /// <summary>
689689 /// X軸方向の速度を設定または、取得します。
690690 /// </summary>
691- public double VelocityX {
691+ public float VelocityX {
692692 get;
693693 set;
694694 }
@@ -695,7 +695,7 @@
695695 /// <summary>
696696 /// Y軸方向の速度を設定または、取得します。
697697 /// </summary>
698- public double VelocityY {
698+ public float VelocityY {
699699 get;
700700 set;
701701 }
@@ -703,7 +703,7 @@
703703 /// <summary>
704704 /// スプライトの前回のX座標を設定または、取得します。
705705 /// </summary>
706- public double PreviousX {
706+ public float PreviousX {
707707 get {
708708 return this.previousLocation.X;
709709 }
@@ -711,7 +711,7 @@
711711 /// <summary>
712712 /// スプライトの前回のY座標を取得または、設定します。
713713 /// </summary>
714- public double PreviousY {
714+ public float PreviousY {
715715 get {
716716 return this.previousLocation.Y;
717717 }
@@ -720,23 +720,23 @@
720720 /// <summary>
721721 /// チップ座標で表されるX座標を設定または、取得します。
722722 /// </summary>
723- public double ChipX {
723+ public float ChipX {
724724 get {
725- return Math.Floor( this.X / ChipImage.SizeSide );
725+ return MathF.Floor( this.X / ChipImage.SizeSide );
726726 }
727727 set {
728- this.X = ( value + 0.5 ) * ChipImage.SizeSide;
728+ this.X = ( value + 0.5f ) * ChipImage.SizeSide;
729729 }
730730 }
731731 /// <summary>
732732 /// チップ座標で表されるY座標を設定または、取得します。
733733 /// </summary>
734- public double ChipY {
734+ public float ChipY {
735735 get {
736- return Math.Floor( this.Y / ChipImage.SizeSide );
736+ return MathF.Floor( this.Y / ChipImage.SizeSide );
737737 }
738738 set {
739- this.Y = ( value + 0.5 ) * ChipImage.SizeSide;
739+ this.Y = ( value + 0.5f ) * ChipImage.SizeSide;
740740 }
741741 }
742742
@@ -780,9 +780,9 @@
780780 /// <param name="row">中心となるX軸の座標</param>
781781 /// <param name="column">中心となるY軸の座標</param>
782782 /// <param name="rightRotation">右回りに回転を行うようにします。</param>
783- public static void Rotate( Sprite target , double x , double y , bool rightRotation ) {
784- target.X = x + ( target.LogicParameter.Radius * Math.Cos( Math.PI / 180 * target.LogicParameter.Angle ) );
785- target.Y = y + ( target.LogicParameter.Radius * Math.Sin( Math.PI / 180 * target.LogicParameter.Angle ) );
783+ public static void Rotate( Sprite target , float x , float y , bool rightRotation ) {
784+ target.X = x + ( target.LogicParameter.Radius * MathF.Cos( MathF.PI / 180 * target.LogicParameter.Angle ) );
785+ target.Y = y + ( target.LogicParameter.Radius * MathF.Sin( MathF.PI / 180 * target.LogicParameter.Angle ) );
786786
787787 if( rightRotation ) {
788788 target.LogicParameter.Angle += target.LogicParameter.Speed;
@@ -800,7 +800,7 @@
800800 /// <param name="target">対象のスプライト</param>
801801 /// <param name="row">中心のX座標</param>
802802 /// <param name="column">中心のY座標</param>
803- public static void RoundTrip( Sprite target , double x , double y ) {
803+ public static void RoundTrip( Sprite target , float x , float y ) {
804804 // 移動方向を切り替える
805805 if( target.LogicParameter.Radius > target.LogicParameter.LimitDistance )
806806 target.LogicParameter.Universal["GivenDirection"] = false;
@@ -813,8 +813,8 @@
813813 else
814814 target.LogicParameter.Radius -= target.LogicParameter.Speed;
815815
816- target.X = x + ( target.LogicParameter.Radius * Math.Cos( Math.PI / 180 * target.LogicParameter.Angle ) );
817- target.Y = y + ( target.LogicParameter.Radius * Math.Sin( Math.PI / 180 * target.LogicParameter.Angle ) );
816+ target.X = x + ( target.LogicParameter.Radius * MathF.Cos( MathF.PI / 180 * target.LogicParameter.Angle ) );
817+ target.Y = y + ( target.LogicParameter.Radius * MathF.Sin( MathF.PI / 180 * target.LogicParameter.Angle ) );
818818 }
819819 /// <summary>
820820 /// キャラクタオブジェクトをVerlet積分法に基づいて移動する。
@@ -824,7 +824,7 @@
824824 /// <param name="accelerationY">Y軸方向の加速度</param>
825825 /// <param name="maxVelocityX">X軸方向の最高速度</param>
826826 /// <param name="maxVelocityY">Y軸方向の最高速度</param>
827- public static void Advance( Sprite target , double accelerationX , double accelerationY , double maxVelocityX , double maxVelocityY ) {
827+ public static void Advance( Sprite target , float accelerationX , float accelerationY , float maxVelocityX , float maxVelocityY ) {
828828 target.VelocityX =
829829 Math.Min(
830830 Math.Max( target.VelocityX + accelerationX , -maxVelocityX ) ,
@@ -845,15 +845,15 @@
845845 /// <param name="source">targetに衝突するスプライト</param>
846846 /// <param name="target">対象のスプライト</param>
847847 /// <param name="bound">反動で移動する距離</param>
848- public static void Rebound( Sprite source , Sprite target , double bound ) {
848+ public static void Rebound( Sprite source , Sprite target , float bound ) {
849849 if( source.Bounds.IsHitting( target.Bounds ) == false )
850850 return;
851- double angle = Sprite.GetAngle( source.X , source.Y , target.X , target.Y );
851+ float angle = Sprite.GetAngle( source.X , source.Y , target.X , target.Y );
852852 if( angle > 0 )
853853 angle = -angle;
854854 else
855855 angle = Math.Abs( angle );
856- source.Location = new Vector( target.X + ( bound * Math.Cos( Math.PI / 180 * angle ) ) , target.Y + ( bound * Math.Sin( Math.PI / 180 * angle ) ) );
856+ source.Location = new Vector( target.X + ( bound * MathF.Cos( MathF.PI / 180 * angle ) ) , target.Y + ( bound * MathF.Sin( MathF.PI / 180 * angle ) ) );
857857 }
858858 /// <summary>
859859 /// スプライトとの衝突を判定してリバウンドを行わずに停止します。
@@ -862,11 +862,11 @@
862862 /// <param name="source">targetに衝突するスプライト</param>
863863 /// <param name="target">対象のスプライト</param>
864864 public static void Stop( Sprite source , Sprite target ) {
865- double x = source.X;
866- double y = source.Y;
865+ float x = source.X;
866+ float y = source.Y;
867867 if( source.Bounds.IsHitting( target.Bounds , AxisType.Y ) ) {
868- double top = Math.Abs( Math.Abs( source.Bounds.Top ) - Math.Abs( target.Bounds.Bottom ) );
869- double bottom = Math.Abs( Math.Abs( source.Bounds.Bottom ) - Math.Abs( target.Bounds.Top ) );
868+ float top = Math.Abs( Math.Abs( source.Bounds.Top ) - Math.Abs( target.Bounds.Bottom ) );
869+ float bottom = Math.Abs( Math.Abs( source.Bounds.Bottom ) - Math.Abs( target.Bounds.Top ) );
870870 if( top < bottom ) {
871871 if( target.IsJumping ) {
872872 y = target.Bounds.Bottom + ChipImage.SizeSide / 2;
@@ -878,8 +878,8 @@
878878 }
879879
880880 if( source.Bounds.IsHitting( target.Bounds , AxisType.X ) ) {
881- double left = Math.Abs( Math.Abs( source.Bounds.Left ) - Math.Abs( target.Bounds.Right ) );
882- double right = Math.Abs( Math.Abs( source.Bounds.Right ) - Math.Abs( target.Bounds.Left ) );
881+ float left = Math.Abs( Math.Abs( source.Bounds.Left ) - Math.Abs( target.Bounds.Right ) );
882+ float right = Math.Abs( Math.Abs( source.Bounds.Right ) - Math.Abs( target.Bounds.Left ) );
883883 if( left > right )
884884 x = target.Bounds.Left - target.Bounds.Width;
885885 else
@@ -894,8 +894,8 @@
894894 /// <param name="target">スプライト2</param>
895895 /// <param name="dir">吸着する方向</param>
896896 public static void Physisorb( Sprite source , Sprite target , DirectionFlags dir ) {
897- double x = source.X;
898- double y = source.Y;
897+ float x = source.X;
898+ float y = source.Y;
899899
900900 DirectionFlags hittingDir = source.NormalizeLocation( target , dir );
901901 if( ( hittingDir & DirectionFlags.Left ) == 0 ) {
@@ -919,11 +919,11 @@
919919 /// <returns>最も衝突している方向</returns>
920920 public static DirectionFlags GetHittingDirection( Sprite source , Sprite target ) {
921921 DirectionFlags dir = DirectionFlags.None;
922- double max = double.MinValue;
923- double top = Math.Abs( source.Bounds.GetHittingDistance( DirectionType.Top , target.Bounds ) );
924- double bottom = Math.Abs( source.Bounds.GetHittingDistance( DirectionType.Bottom , target.Bounds ) );
925- double left = Math.Abs( source.Bounds.GetHittingDistance( DirectionType.Left , target.Bounds ) );
926- double right = Math.Abs( source.Bounds.GetHittingDistance( DirectionType.Right , target.Bounds ) );
922+ float max = float.MinValue;
923+ float top = Math.Abs( source.Bounds.GetHittingDistance( DirectionType.Top , target.Bounds ) );
924+ float bottom = Math.Abs( source.Bounds.GetHittingDistance( DirectionType.Bottom , target.Bounds ) );
925+ float left = Math.Abs( source.Bounds.GetHittingDistance( DirectionType.Left , target.Bounds ) );
926+ float right = Math.Abs( source.Bounds.GetHittingDistance( DirectionType.Right , target.Bounds ) );
927927 if( max < top && top != 0 ) {
928928 max = top;
929929 dir = DirectionFlags.Top;
@@ -951,8 +951,8 @@
951951
952952 /// <param name="target">対象のキャラクタ</param>
953953 /// <returns>対象キャラクタとの距離</returns>
954- public static double GetDistance( Sprite source , Sprite target ) {
955- return Math.Sqrt( Math.Pow( source.X - target.X , 2 ) + Math.Pow( source.Y - target.Y , 2 ) );
954+ public static float GetDistance( Sprite source , Sprite target ) {
955+ return MathF.Sqrt( MathF.Pow( source.X - target.X , 2 ) + MathF.Pow( source.Y - target.Y , 2 ) );
956956 }
957957 /// <summary>
958958 /// 二点間の距離を取得します。
@@ -962,8 +962,8 @@
962962 /// <param name="x2">終点(X)</param>
963963 /// <param name="y2">終点(Y)</param>
964964 /// <returns>距離</returns>
965- public static double GetDistance( double x1 , double y1 , double x2 , double y2 ) {
966- return Math.Sqrt( Math.Pow( x2 - x1 , 2 ) + Math.Pow( y2 - y2 , 2 ) );
965+ public static float GetDistance( float x1 , float y1 , float x2 , float y2 ) {
966+ return MathF.Sqrt( MathF.Pow( x2 - x1 , 2 ) + MathF.Pow( y2 - y2 , 2 ) );
967967 }
968968 /// <summary>
969969 /// 始点座標からの角度を取得します。
@@ -973,8 +973,8 @@
973973 /// <param name="x2">終点(X)</param>
974974 /// <param name="y2">終点(Y)</param>
975975 /// <returns>角度</returns>
976- public static double GetAngle( double x1 , double y1 , double x2 , double y2 ) {
977- return Math.Atan2( y2 - y1 , x2 - x1 ) / ( Math.PI / 180 );
976+ public static float GetAngle( float x1 , float y1 , float x2 , float y2 ) {
977+ return MathF.Atan2( y2 - y1 , x2 - x1 ) / ( MathF.PI / 180 );
978978 }
979979 #endregion
980980 }
--- trunk/Nlgp1/Nlgp1/Program.cs (revision 628)
+++ trunk/Nlgp1/Nlgp1/Program.cs (revision 629)
@@ -55,11 +55,11 @@
5555
5656 DX.SetDrawScreen( DX.DX_SCREEN_BACK );
5757 int baseTime = Environment.TickCount;
58- double frameCount = 0;
58+ float frameCount = 0;
5959 while( DX.ProcessMessage() ) {
60- double nowFrameCount;
60+ float nowFrameCount;
6161 while( true ) {
62- nowFrameCount = ( Environment.TickCount - baseTime ) * ( 60.0 / 1000.0 );
62+ nowFrameCount = ( Environment.TickCount - baseTime ) * ( 60.0f / 1000.0f );
6363 if( nowFrameCount < frameCount ) {
6464 Thread.Sleep(1);
6565 }
@@ -67,7 +67,7 @@
6767 break;
6868 }
6969 }
70- frameCount = Math.Floor( nowFrameCount + 1 );
70+ frameCount = MathF.Floor( nowFrameCount + 1.0f );
7171
7272 rate.Update();
7373
--- trunk/Nlgp1/Nlgp1/Utilities/MathF.cs (nonexistent)
+++ trunk/Nlgp1/Nlgp1/Utilities/MathF.cs (revision 629)
@@ -0,0 +1,57 @@
1+using System;
2+
3+namespace Nlgp1.Utilities {
4+
5+ public static class MathF {
6+
7+ public const float PI = ( float )( Math.PI );
8+
9+ public static float Acos( float a ) {
10+ return ( float )( Math.Acos( a ) );
11+ }
12+
13+ public static float Asin( float a ) {
14+ return ( float )( Math.Asin( a ) );
15+ }
16+
17+ public static float Atan( float a ) {
18+ return ( float )( Math.Atan( a ) );
19+ }
20+
21+ public static float Atan2( float y , float x ) {
22+ return ( float )( Math.Atan2( y , x ) );
23+ }
24+
25+ public static float Ceiling( float a ) {
26+ return ( float )( Math.Ceiling( a ) );
27+ }
28+
29+ public static float Cos( float a ) {
30+ return ( float )( Math.Cos( a ) );
31+ }
32+
33+ public static float Floor( float a ) {
34+ return ( float )( Math.Floor( a ) );
35+ }
36+
37+ public static float Pow( float x , float y ) {
38+ return ( float )( Math.Pow( x , y ) );
39+ }
40+
41+ public static float Round( float a ) {
42+ return ( float )( Math.Round( a ) );
43+ }
44+
45+ public static float Sin( float a ) {
46+ return ( float )( Math.Sin( a ) );
47+ }
48+
49+ public static float Sqrt( float a ) {
50+ return ( float )( Math.Sqrt( a ) );
51+ }
52+
53+ public static float Tan( float a ) {
54+ return ( float )( Math.Tan( a ) );
55+ }
56+ }
57+}
--- trunk/Nlgp1/Nlgp1/Utilities/Vector.cs (revision 628)
+++ trunk/Nlgp1/Nlgp1/Utilities/Vector.cs (revision 629)
@@ -5,10 +5,10 @@
55
66 public struct Vector {
77
8- public double X;
9- public double Y;
8+ public float X;
9+ public float Y;
1010
11- public Vector( double x , double y ) {
11+ public Vector( float x , float y ) {
1212 this.X = x;
1313 this.Y = y;
1414 }
@@ -29,15 +29,15 @@
2929 return new Vector( vector1.X - vector2.X , vector1.Y - vector2.Y );
3030 }
3131
32- public static Vector operator *( Vector vector1 , double scalar2 ) {
32+ public static Vector operator *( Vector vector1 , float scalar2 ) {
3333 return new Vector( vector1.X * scalar2 , vector1.Y * scalar2 );
3434 }
3535
36- public static Vector operator *( double scalar1 , Vector vector2 ) {
36+ public static Vector operator *( float scalar1 , Vector vector2 ) {
3737 return new Vector( scalar1 * vector2.X , scalar1 * vector2.Y );
3838 }
3939
40- public static Vector operator /( Vector vector1 , double scalar2 ) {
40+ public static Vector operator /( Vector vector1 , float scalar2 ) {
4141 return new Vector( vector1.X / scalar2 , vector1.Y / scalar2 );
4242 }
4343
--- trunk/Nlgp1/Nlgp1/Utilities/Box.cs (revision 628)
+++ trunk/Nlgp1/Nlgp1/Utilities/Box.cs (revision 629)
@@ -8,7 +8,7 @@
88 public Vector Minimum;
99 public Vector Maximum;
1010
11- public double Left {
11+ public float Left {
1212 get {
1313 return this.Minimum.X;
1414 }
@@ -17,7 +17,7 @@
1717 }
1818 }
1919
20- public double Top {
20+ public float Top {
2121 get {
2222 return this.Minimum.Y;
2323 }
@@ -26,7 +26,7 @@
2626 }
2727 }
2828
29- public double Right {
29+ public float Right {
3030 get {
3131 return this.Maximum.X;
3232 }
@@ -35,7 +35,7 @@
3535 }
3636 }
3737
38- public double Bottom {
38+ public float Bottom {
3939 get {
4040 return this.Maximum.Y;
4141 }
@@ -44,13 +44,13 @@
4444 }
4545 }
4646
47- public double Width {
47+ public float Width {
4848 get {
4949 return this.Maximum.X - this.Minimum.X;
5050 }
5151 }
5252
53- public double Height {
53+ public float Height {
5454 get {
5555 return this.Maximum.Y - this.Minimum.Y;
5656 }
@@ -67,7 +67,7 @@
6767 this.Maximum = maximum;
6868 }
6969
70- public Box( double left , double top , double right, double bottom ) {
70+ public Box( float left , float top , float right, float bottom ) {
7171 this.Minimum = new Vector( left , top );
7272 this.Maximum = new Vector( right , bottom );
7373 }
Show on old repository browser