• R/O
  • SSH
  • HTTPS

nlgp1: Commit


Commit MetaInfo

Revision733 (tree)
Zeit2011-02-21 15:52:12
Autorbiikame

Log Message

Box2DX.Commonを参照するよう修正

Ändern Zusammenfassung

Diff

--- trunk/Nlgp1/Nlgp1/Characters/Character.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1/Characters/Character.cs (revision 733)
@@ -1,4 +1,5 @@
11 using System;
2+using Box2DX.Common;
23 using Nlgp1.Attacks;
34 using Nlgp1.Attacks.Guns;
45 using Nlgp1.Common;
@@ -10,7 +11,7 @@
1011 /// キャラクタクラス
1112 /// </summary>
1213 public class Character : Sprite {
13- public Character( int typeID , SpriteType spriteType , Size characterSize , LocationF location )
14+ public Character( int typeID , SpriteType spriteType , Size characterSize , Vec2 location )
1415 : base( LayerType.Character , typeID , spriteType , "CharacterImages" , characterSize , string.Format( "Character-{0}" , typeID ) , location )
1516 {
1617 }
--- trunk/Nlgp1/Nlgp1/Characters/SpriteFactory.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1/Characters/SpriteFactory.cs (revision 733)
@@ -1,16 +1,17 @@
11 using System;
2+using Box2DX.Common;
23 using Nlgp1.Attacks;
34 using Nlgp1.Attacks.Guns;
5+using Nlgp1.Common;
6+using Nlgp1.Common.Drawing;
47 using Nlgp1.Parameters;
58 using Nlgp1.Players;
69 using Nlgp1.Sprites;
710 using Nlgp1.Utilities;
8-using Nlgp1.Common;
9-using Nlgp1.Common.Drawing;
1011
1112 namespace Nlgp1.Characters {
1213 public static class SpriteFactory {
13- private static Sprite create( int typeID , LocationF location , Size characterSize ){
14+ private static Sprite create( int typeID , Vec2 location , Size characterSize ){
1415 var newSprite = new Character( typeID , SpriteType.Monster , characterSize , location );
1516 newSprite.Bounds.BlankLeft = 2;
1617 newSprite.Bounds.BlankRight = 2;
@@ -25,7 +26,7 @@
2526 /// <param name="location">初期位置</param>
2627 /// <param name="characterSize">スプライトのサイズ</param>
2728 /// <returns>生成されたキャラクタオブジェクト</returns>
28- public static Sprite CreateSprite( int typeID , LocationF location , Size characterSize ) {
29+ public static Sprite CreateSprite( int typeID , Vec2 location , Size characterSize ) {
2930 Sprite newSprite = create( typeID , location , characterSize );
3031 switch( typeID ) {
3132 case 2:
--- trunk/Nlgp1/Nlgp1/Players/PlayerStatus.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1/Players/PlayerStatus.cs (revision 733)
@@ -1,15 +1,15 @@
11 using System;
22 using System.Linq;
3+using Box2DX.Common;
34 using Nlgp1.Attacks;
45 using Nlgp1.Attacks.Guns;
56 using Nlgp1.Characters;
7+using Nlgp1.Common;
68 using Nlgp1.DxLib;
79 using Nlgp1.Parameters;
810 using Nlgp1.Sprites;
911 using Nlgp1.Stages;
1012 using Nlgp1.Utilities;
11-using Nlgp1.Common;
12-using Nlgp1.Common.Drawing;
1313
1414 // [重要]このコードは、暫定版であり実験用コードを含みます。将来的に設計・実装が変更されます。
1515 // これらのコードを生放送等で配信することは、構いませんが実装者の許可無く無断で
@@ -55,7 +55,7 @@
5555 /// 自分自身のキャラクタを初期化します。
5656 /// </summary>
5757 /// <param name="location">初期位置</param>
58- public static Sprite LoadPlayer( LocationF location ) {
58+ public static Sprite LoadPlayer( Vec2 location ) {
5959 TimerInitialize();
6060
6161 if( Player != null )
--- trunk/Nlgp1/Nlgp1/Stages/GameMap.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1/Stages/GameMap.cs (revision 733)
@@ -2,6 +2,7 @@
22 using System.Collections.Generic;
33 using System.IO;
44 using System.Linq;
5+using Box2DX.Common;
56 using Nlgp1.Characters;
67 using Nlgp1.Common;
78 using Nlgp1.Common.Drawing;
@@ -30,12 +31,12 @@
3031 GameMap.sheetSize = new Size();
3132 foreach( LayerType layerType in Enum.GetValues( typeof( LayerType ) ) ) {
3233 Cell[,] sheet = mapData.GetSheet( layerType );
33- GameMap.sheetSize.Width = Math.Max( GameMap.sheetSize.Width , sheet.GetLength( 0 ) );
34- GameMap.sheetSize.Height = Math.Max( GameMap.sheetSize.Height , sheet.GetLength( 1 ) );
34+ GameMap.sheetSize.Width = System.Math.Max( GameMap.sheetSize.Width , sheet.GetLength( 0 ) );
35+ GameMap.sheetSize.Height = System.Math.Max( GameMap.sheetSize.Height , sheet.GetLength( 1 ) );
3536 for( int x = 0 ; x < sheet.GetLength( 0 ) ; x++ ) {
3637 for( int y = 0 ; y < sheet.GetLength( 1 ) ; y++ ) {
3738 Cell cell = sheet[ x , y ];
38- LocationF location = new LocationF( x , y ) * MapData.CellSize;
39+ Vec2 location = new Vec2( x , y ) * MapData.CellSize;
3940 if( cell.CellTypeID >= 1 ) {
4041 Sprite sprite;
4142 if( layerType == LayerType.Character ) {
@@ -58,7 +59,7 @@
5859 }
5960 }
6061 }
61- GameMap.stageSize = new SizeF( sheetSize.Width * MapData.CellSize , sheetSize.Height * MapData.CellSize );
62+ GameMap.stageSize = new Vec2( sheetSize.Width * MapData.CellSize , sheetSize.Height * MapData.CellSize );
6263 }
6364
6465 public static void UnloadStage() {
@@ -112,7 +113,7 @@
112113
113114 private static Size sheetSize;
114115
115- private static SizeF stageSize;
116+ private static Vec2 stageSize;
116117
117118 /// <summary>
118119 /// 座標を指定してそこにあるスプライト群を取得します。
@@ -119,7 +120,7 @@
119120 /// </summary>
120121 /// <param name="location">座標</param>
121122 /// <returns>指定した座標に存在するスプライト</returns>
122- public static IEnumerable< Sprite > GetSprites( LocationF location ) {
123+ public static IEnumerable< Sprite > GetSprites( Vec2 location ) {
123124 return Sprite.SpriteCollection().Cast< Sprite >().Where( ( sprite ) => {
124125 return sprite.Bounds.HitTest( location );
125126 } );
@@ -130,8 +131,8 @@
130131 /// </summary>
131132 /// <param name="location">座標</param>
132133 /// <returns>ステージ範囲内かどうか</returns>
133- public static bool IsStageArea( LocationF location ) {
134- return ( 0 <= location.X && location.X <= GameMap.stageSize.Width ) && ( 0 <= location.Y && location.Y <= GameMap.stageSize.Height );
134+ public static bool IsStageArea( Vec2 location ) {
135+ return ( 0 <= location.X && location.X <= GameMap.stageSize.X ) && ( 0 <= location.Y && location.Y <= GameMap.stageSize.Y );
135136 }
136137
137138 /// <summary>
@@ -138,7 +139,7 @@
138139 /// スプライトを削除します。
139140 /// </summary>
140141 /// <param name="location">座標</param>
141- public static void RemoveSprite( LocationF location ) {
142+ public static void RemoveSprite( Vec2 location ) {
142143 foreach( Sprite sprite in GameMap.GetSprites( location ) ) {
143144 sprite.Dispose();
144145 }
--- trunk/Nlgp1/Nlgp1/Sprites/SpriteAction.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1/Sprites/SpriteAction.cs (revision 733)
@@ -17,8 +17,8 @@
1717 /// <param name="y">中心となるY軸の座標</param>
1818 /// <param name="rightRotation">右回りに回転を行うようにします。</param>
1919 public static void Rotation( Sprite target , float x , float y , bool rightRotation ) {
20- target.X = x + ( target.LogicParameter.Radius * MathF.Cos( MathF.PI / 180 * target.LogicParameter.Angle ) );
21- target.Y = y + ( target.LogicParameter.Radius * MathF.Sin( MathF.PI / 180 * target.LogicParameter.Angle ) );
20+ target.X = x + ( target.LogicParameter.Radius * MathEx.Cos( MathEx.PI / 180 * target.LogicParameter.Angle ) );
21+ target.Y = y + ( target.LogicParameter.Radius * MathEx.Sin( MathEx.PI / 180 * target.LogicParameter.Angle ) );
2222
2323 if( rightRotation ) {
2424 target.LogicParameter.Angle += target.LogicParameter.Speed;
@@ -49,8 +49,8 @@
4949 else
5050 target.LogicParameter.Radius -= target.LogicParameter.Speed;
5151
52- target.X = x + ( target.LogicParameter.Radius * MathF.Cos( MathF.PI / 180 * target.LogicParameter.Angle ) );
53- target.Y = y + ( target.LogicParameter.Radius * MathF.Sin( MathF.PI / 180 * target.LogicParameter.Angle ) );
52+ target.X = x + ( target.LogicParameter.Radius * MathEx.Cos( MathEx.PI / 180 * target.LogicParameter.Angle ) );
53+ target.Y = y + ( target.LogicParameter.Radius * MathEx.Sin( MathEx.PI / 180 * target.LogicParameter.Angle ) );
5454 }
5555 /// <summary>
5656 /// キャラクタオブジェクトをVerlet積分法に基づいて移動する。
@@ -109,7 +109,7 @@
109109 angle = -angle;
110110 else
111111 angle = Math.Abs( angle );
112- source.TryMove( target.X + ( bound * MathF.Cos( MathF.PI / 180 * angle ) ) , target.Y + ( bound * MathF.Sin( MathF.PI / 180 * angle ) ) );
112+ source.TryMove( target.X + ( bound * MathEx.Cos( MathEx.PI / 180 * angle ) ) , target.Y + ( bound * MathEx.Sin( MathEx.PI / 180 * angle ) ) );
113113 }
114114 /// <summary>
115115 /// スプライトとの衝突を判定してリバウンドを行わずに停止します。
--- trunk/Nlgp1/Nlgp1/Sprites/Sprite.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1/Sprites/Sprite.cs (revision 733)
@@ -1,6 +1,7 @@
11 using System;
22 using System.Collections.Generic;
33 using System.Linq;
4+using Box2DX.Common;
45 using Nlgp1.Attacks;
56 using Nlgp1.Common;
67 using Nlgp1.Common.Drawing;
@@ -42,8 +43,8 @@
4243
4344 private int startTick = 0;
4445 private float jumpBoost = 0;
45- private LocationF verticalPos = new LocationF();
46- private LocationF horizontalPos = new LocationF();
46+ private Vec2 verticalPos = new Vec2();
47+ private Vec2 horizontalPos = new Vec2();
4748 private Dictionary<AttackType,IAttack> attackSlot = new Dictionary<AttackType , IAttack>();
4849
4950 /// <summary>
@@ -56,7 +57,7 @@
5657 /// <param name="chipSize">スプライトのサイズ(最小=32x32)</param>
5758 /// <param name="debugID">デバッグ用 識別子 (通常使わない)</param>
5859 /// <param name="location">初期位置</param>
59- public Sprite( LayerType layerType , int typeID , SpriteType spriteType , string imageTypeName , Size chipSize , string debugID , LocationF location ) {
60+ public Sprite( LayerType layerType , int typeID , SpriteType spriteType , string imageTypeName , Size chipSize , string debugID , Vec2 location ) {
6061 lock( objectList )
6162 objectList.Add( this );
6263
@@ -63,7 +64,7 @@
6364 this.Motion = SpriteMotion.Get( layerType , imageTypeName , typeID , chipSize );
6465 this.Speed = new Speed();
6566 this.LogicParameter = new ActionParameter();
66- this.Bounds = new Parameters.Bounds( this , new LocationF() , chipSize );
67+ this.Bounds = new Parameters.Bounds( this , new Vec2() , new Vec2( chipSize.Width , chipSize.Height ) );
6768
6869 this.SpriteType = spriteType;
6970 this.TypeID = typeID;
@@ -196,7 +197,7 @@
196197 /// <summary>
197198 /// スプライトが上または、下方向に衝突したセル座標を取得します。
198199 /// </summary>
199- public LocationF VerticalPos {
200+ public Vec2 VerticalPos {
200201 get {
201202 return verticalPos;
202203 }
@@ -204,7 +205,7 @@
204205 /// <summary>
205206 /// スプライトが左または、右方向に衝突したセル座標を取得します。
206207 /// </summary>
207- public LocationF HorizontalPos {
208+ public Vec2 HorizontalPos {
208209 get {
209210 return horizontalPos;
210211 }
@@ -354,7 +355,7 @@
354355 /// <param name="direction">方向の組み合わせ</param>
355356 /// <returns>スプライト群</returns>
356357 public IEnumerable< Sprite > GetImmediateSprites( DirectionFlags direction ) {
357- LocationF location = Location;
358+ Vec2 location = Location;
358359 bool isLeft = ( direction & DirectionFlags.Left ) != 0;
359360 bool isRight = ( direction & DirectionFlags.Right ) != 0;
360361 bool isTop = ( direction & DirectionFlags.Top ) != 0;
@@ -383,7 +384,7 @@
383384 return true;
384385 }
385386 else {
386- LocationF location = Location;
387+ Vec2 location = Location;
387388 bool isLeft = ( direction & DirectionFlags.Left ) != 0;
388389 bool isRight = ( direction & DirectionFlags.Right ) != 0;
389390 bool isTop = ( direction & DirectionFlags.Top ) != 0;
@@ -408,7 +409,7 @@
408409 /// </summary>
409410 /// <param name="location">座標</param>
410411 /// <returns>ブロック属性のスプライトであるかどうか</returns>
411- public bool ImmediateSpritesAreBlock( LocationF location ) {
412+ public bool ImmediateSpritesAreBlock( Vec2 location ) {
412413 return GameMap.GetSprites( location ).Any( ( sprite ) => sprite.IsBlock ) && GameMap.IsStageArea( location );
413414 }
414415 /// <summary>
@@ -491,7 +492,7 @@
491492 }
492493 return DirectionFlags.None;
493494 }
494- private LocationF dummy = new LocationF();
495+ private Vec2 dummy = new Vec2();
495496 /// <summary>
496497 /// 指定した方向に移動しようとした場合に衝突するかどうか判定します。
497498 /// </summary>
@@ -508,7 +509,7 @@
508509 /// <param name="hitPos">衝突した座標を受け取ります。</param>
509510 /// <param name="isRecovery">衝突時に位置を補正するかどうか</param>
510511 /// <returns>衝突するかどうか</returns>
511- public bool MoveTest( DirectionType dir , ref LocationF hitPos , bool isRecovery , int blank , bool isNotSprite ) {
512+ public bool MoveTest( DirectionType dir , ref Vec2 hitPos , bool isRecovery , int blank , bool isNotSprite ) {
512513 Sprite hitSprite = null;
513514 switch( dir ) {
514515 case DirectionType.Top:
@@ -566,7 +567,7 @@
566567 if( this.IsBlockSprite( hitPos ) || hitSprite != null ) {
567568 if( isRecovery ) {
568569 if( hitSprite != null ){
569- float toX = hitSprite.Bounds.Left - ( Math.Abs( X - PrevX ) );
570+ float toX = hitSprite.Bounds.Left - ( System.Math.Abs( X - PrevX ) );
570571 float toY = Y;
571572 if( hitSprite.TryMove( toX , toY ) == DirectionFlags.None ){
572573 hitSprite.ResetPrev();
@@ -589,7 +590,7 @@
589590 hitPos.Y = ( Bounds.Bottom - i );
590591 if( this.IsBlockSprite( hitPos ) || hitSprite != null ) {
591592 if( isRecovery ) {
592- if( hitSprite != null && hitSprite.TryMove( hitSprite.Bounds.Left + ( Math.Abs( X - PrevX ) ) , hitSprite.Y ) == DirectionFlags.None ) {
593+ if( hitSprite != null && hitSprite.TryMove( hitSprite.Bounds.Left + ( System.Math.Abs( X - PrevX ) ) , hitSprite.Y ) == DirectionFlags.None ) {
593594 hitSprite.ResetPrev();
594595 } else {
595596 X = ( hitPos.X ) - Bounds.Width;
@@ -610,7 +611,7 @@
610611 /// </summary>
611612 /// <param name="x">座標</param>
612613 /// <returns>ブロック属性かまたは、ステージ範囲外かどうか</returns>
613- public bool IsBlockSprite( LocationF location ) {
614+ public bool IsBlockSprite( Vec2 location ) {
614615 return GameMap.GetSprites( location ).Any( ( sprite ) => {
615616 return sprite != this && sprite.IsBlock;
616617 } );
@@ -784,7 +785,7 @@
784785 return;
785786 Motion.GetChip( this ).Draw( location );
786787 }
787- LocationF IDraw.DrawPoint {
788+ Vec2 IDraw.DrawPoint {
788789 get {
789790 return Location;
790791 }
@@ -822,8 +823,8 @@
822823 #endregion
823824
824825 #region IBounds メンバー
825- private LocationF location = new LocationF();
826- private LocationF prevLocation = new LocationF();
826+ private Vec2 location = new Vec2();
827+ private Vec2 prevLocation = new Vec2();
827828 private DirectionFlags dirH = DirectionFlags.None;
828829 private DirectionFlags dirV = DirectionFlags.None;
829830
@@ -830,7 +831,7 @@
830831 /// <summary>
831832 /// 現在の座標を取得します。
832833 /// </summary>
833- public LocationF Location {
834+ public Vec2 Location {
834835 get {
835836 return location;
836837 }
@@ -838,7 +839,7 @@
838839 /// <summary>
839840 /// 前回の座標を取得します。
840841 /// </summary>
841- public LocationF PrevLocation {
842+ public Vec2 PrevLocation {
842843 get {
843844 return prevLocation;
844845 }
--- trunk/Nlgp1/Nlgp1/Attacks/Shot.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1/Attacks/Shot.cs (revision 733)
@@ -1,9 +1,10 @@
11 using System;
22 using System.Collections.Generic;
3+using Box2DX.Common;
34 using Nlgp1.Attacks.Guns;
4-using Nlgp1.Sprites;
55 using Nlgp1.Common;
66 using Nlgp1.Common.Drawing;
7+using Nlgp1.Sprites;
78
89 namespace Nlgp1.Attacks {
910 /// <summary>
@@ -29,7 +30,7 @@
2930 this.CanMoveingAttack = false;
3031
3132 this.Attacking += new EventHandler( ( sender , e ) => {
32- T gun = Utility.Construct< T >( this.GunTypeID , this , gunSize , null , new LocationF() );
33+ T gun = Utility.Construct< T >( this.GunTypeID , this , gunSize , null , new Vec2() );
3334
3435 if( InitializeEvent != null )
3536 InitializeEvent( this , new SpriteActionEventArgs<T>( gun ) );
--- trunk/Nlgp1/Nlgp1/Attacks/Guns/Gun.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1/Attacks/Guns/Gun.cs (revision 733)
@@ -1,4 +1,5 @@
11 using System;
2+using Box2DX.Common;
23 using Nlgp1.Common;
34 using Nlgp1.Common.Drawing;
45 using Nlgp1.Parameters;
@@ -20,7 +21,7 @@
2021 }
2122
2223 #region IGun メンバー
23- Gun( int typeID , IAttack source , Size gunSize , string debugID , LocationF location )
24+ Gun( int typeID , IAttack source , Size gunSize , string debugID , Vec2 location )
2425 : base( LayerType.Character , typeID , source.Owner.SpriteType , "GunImages" , gunSize , debugID , location )
2526 {
2627 this.Owner = source;
--- trunk/Nlgp1/Nlgp1/Views/StageView.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1/Views/StageView.cs (revision 733)
@@ -1,11 +1,12 @@
11 using System;
22 using System.Collections.Generic;
3+using Box2DX.Common;
34 using Nlgp1.Attacks;
45 using Nlgp1.Characters;
6+using Nlgp1.Common;
7+using Nlgp1.Common.Drawing;
58 using Nlgp1.Stages;
69 using Nlgp1.Utilities;
7-using Nlgp1.Common;
8-using Nlgp1.Common.Drawing;
910
1011 // [重要]このコードは、暫定版であり実験用コードを含みます。将来的に設計・実装が変更されます。
1112 // これらのコードを生放送等で配信することは、構いませんが実装者の許可無く無断で
@@ -68,7 +69,7 @@
6869 #region オブジェクトの描画
6970 foreach( var m in drawObjects )
7071 if( IsVisibleSprite( m.DrawPoint.X , m.DrawPoint.Y , 0 ) )
71- m.Draw( ( new LocationF( m.DrawPoint.X - scrollX - 1 , m.DrawPoint.Y - scrollY - 1 ) ).Round() );
72+ m.Draw( new Location( MathEx.Round( m.DrawPoint.X - scrollX - 1 ) , MathEx.Round( m.DrawPoint.Y - scrollY - 1 ) ) );
7273 #endregion
7374 }
7475
--- trunk/Nlgp1/Nlgp1/Parameters/Bounds.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1/Parameters/Bounds.cs (revision 733)
@@ -2,12 +2,12 @@
22 using Nlgp1.Sprites;
33 using Nlgp1.Utilities;
44 using Nlgp1.Common;
5-using Nlgp1.Common.Drawing;
5+using Box2DX.Common;
66
77 namespace Nlgp1.Parameters {
88 public class Bounds : IBounds {
99
10- public Bounds( Sprite sprite , LocationF location , SizeF size ) {
10+ public Bounds( Sprite sprite , Vec2 location , Vec2 size ) {
1111 this.sprite = sprite;
1212 this.location = location;
1313 this.size = size;
@@ -21,14 +21,14 @@
2121
2222 private Sprite sprite;
2323
24- private LocationF location = new LocationF();
25- private SizeF size = new SizeF();
24+ private Vec2 location = new Vec2();
25+ private Vec2 size = new Vec2();
2626 /// <summary>
2727 /// サイズを取得します。
2828 /// </summary>
29- public SizeF Size {
29+ public Vec2 Size {
3030 get {
31- return new SizeF( this.Width , this.Height );
31+ return new Vec2( this.Width , this.Height );
3232 }
3333 }
3434 /// <summary>
@@ -36,7 +36,7 @@
3636 /// </summary>
3737 public float Width {
3838 get {
39- return this.size.Width - ( this.BlankLeft + this.BlankRight );
39+ return this.size.X - ( this.BlankLeft + this.BlankRight );
4040 }
4141 }
4242 /// <summary>
@@ -44,7 +44,7 @@
4444 /// </summary>
4545 public float Height {
4646 get {
47- return this.size.Height - ( this.BlankTop + this.BlankBottom );
47+ return this.size.Y - ( this.BlankTop + this.BlankBottom );
4848 }
4949 }
5050
@@ -101,7 +101,7 @@
101101 /// </summary>
102102 public float Right {
103103 get {
104- return this.sprite.X + this.location.X + this.size.Width - this.BlankRight;
104+ return this.sprite.X + this.location.X + this.size.X - this.BlankRight;
105105 }
106106 }
107107 /// <summary>
@@ -109,7 +109,7 @@
109109 /// </summary>
110110 public float Bottom {
111111 get {
112- return this.sprite.Y + this.location.Y + this.size.Height - this.BlankBottom;
112+ return this.sprite.Y + this.location.Y + this.size.Y - this.BlankBottom;
113113 }
114114 }
115115 #endregion
@@ -166,7 +166,7 @@
166166 return 0;
167167 }
168168
169- public bool HitTest( LocationF location ) {
169+ public bool HitTest( Vec2 location ) {
170170 float left = this.Left + this.BlankLeft;
171171 float top = this.Top + this.BlankTop;
172172 float right = this.Right - this.BlankRight;
--- trunk/Nlgp1/Nlgp1/IDraw.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1/IDraw.cs (revision 733)
@@ -2,6 +2,7 @@
22 using System.Collections.Generic;
33 using System.Linq;
44 using System.Text;
5+using Box2DX.Common;
56 using Nlgp1.Common;
67 using Nlgp1.Common.Drawing;
78 using Nlgp1.Parameters;
@@ -20,7 +21,7 @@
2021 /// <summary>
2122 /// オブジェクトの位置を取得します。
2223 /// </summary>
23- LocationF DrawPoint {
24+ Vec2 DrawPoint {
2425 get;
2526 }
2627 /// <summary>
--- trunk/Nlgp1/Nlgp1/Utilities/MathEx.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1/Utilities/MathEx.cs (revision 733)
@@ -16,6 +16,40 @@
1616 /// </summary>
1717 public static class MathEx {
1818
19+ public const float PI = ( float )( Math.PI );
20+
21+ public static float Atan2( float x , float y ) {
22+ return ( float )( Math.Atan2( x , y ) );
23+ }
24+
25+ public static int Ceiling( float f ) {
26+ return ( int )( Math.Ceiling( f ) );
27+ }
28+
29+ public static float Cos( float f ) {
30+ return ( float )( Math.Cos( f ) );
31+ }
32+
33+ public static int Floor( float f ) {
34+ return ( int )( Math.Floor( f ) );
35+ }
36+
37+ public static float Pow2( float f ) {
38+ return f * f;
39+ }
40+
41+ public static int Round( float f ) {
42+ return ( int )( Math.Round( f ) );
43+ }
44+
45+ public static float Sin( float f ) {
46+ return ( float )( Math.Sin( f ) );
47+ }
48+
49+ public static float Sqrt( float f ) {
50+ return ( float )( Math.Sqrt( f ) );
51+ }
52+
1953 /// <summary>
2054 /// キャラクタ間の距離を取得します。
2155 /// </summary>
@@ -23,7 +57,7 @@
2357 /// <param name="toChar">対象のキャラクタ</param>
2458 /// <returns>対象キャラクタとの距離</returns>
2559 public static float Distance( Sprite source , Sprite toChar ) {
26- return MathF.Sqrt( MathF.Pow2( source.X - toChar.X ) + MathF.Pow2( source.Y - toChar.Y ) );
60+ return MathEx.Sqrt( MathEx.Pow2( source.X - toChar.X ) + MathEx.Pow2( source.Y - toChar.Y ) );
2761 }
2862 /// <summary>
2963 /// 二点間の距離を取得します。
@@ -34,7 +68,7 @@
3468 /// <param name="y2">終点(Y)</param>
3569 /// <returns>距離</returns>
3670 public static float Distance( float x1 , float y1 , float x2 , float y2 ) {
37- return MathF.Sqrt( MathF.Pow2( x2 - x1 ) + MathF.Pow2( y2 - y2 ) );
71+ return MathEx.Sqrt( MathEx.Pow2( x2 - x1 ) + MathEx.Pow2( y2 - y2 ) );
3872 }
3973 /// <summary>
4074 /// 始点座標からの角度を取得します。
@@ -45,7 +79,7 @@
4579 /// <param name="y2">終点(Y)</param>
4680 /// <returns>角度</returns>
4781 public static float Angle( float x1 , float y1 , float x2 , float y2 ) {
48- return MathF.Atan2( y2 - y1 , x2 - x1 ) / ( MathF.PI / 180 );
82+ return MathEx.Atan2( y2 - y1 , x2 - x1 ) / ( MathEx.PI / 180 );
4983 }
5084 }
5185 }
--- trunk/Nlgp1/Nlgp1.Common/Drawing/RectangleF.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1.Common/Drawing/RectangleF.cs (nonexistent)
@@ -1,82 +0,0 @@
1-using System;
2-
3-namespace Nlgp1.Common.Drawing {
4-
5- public struct RectangleF {
6-
7- public RectangleF( float x , float y , float width , float height )
8- : this( new LocationF( x , y ) , new SizeF( width , height ) ) {}
9-
10- public RectangleF( LocationF location , SizeF size ) {
11- this.Location = location;
12- this.Size = size;
13- }
14-
15- public override string ToString() {
16- return string.Format( "X = {0}, Y = {1}, Width = {2}, Height = {3}" , this.X , this.Y , this.Width , this.Height );
17- }
18-
19- public float Left {
20- get {
21- return this.Left;
22- }
23- }
24-
25- public float Top {
26- get {
27- return this.Top;
28- }
29- }
30-
31- public float Right {
32- get {
33- return this.Right;
34- }
35- }
36-
37- public float Bottom {
38- get {
39- return this.Bottom;
40- }
41- }
42-
43- public float X {
44- get {
45- return this.Location.X;
46- }
47- set {
48- this.Location.Y = value;
49- }
50- }
51-
52- public float Y {
53- get {
54- return this.Location.Y;
55- }
56- set {
57- this.Location.Y = value;
58- }
59- }
60-
61- public float Width {
62- get {
63- return this.Size.Width;
64- }
65- set {
66- this.Size.Width = value;
67- }
68- }
69-
70- public float Height {
71- get {
72- return this.Size.Height;
73- }
74- set {
75- this.Size.Height = value;
76- }
77- }
78-
79- public LocationF Location;
80- public SizeF Size;
81- }
82-}
--- trunk/Nlgp1/Nlgp1.Common/Drawing/SizeF.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1.Common/Drawing/SizeF.cs (nonexistent)
@@ -1,47 +0,0 @@
1-using System;
2-
3-namespace Nlgp1.Common.Drawing {
4-
5- public struct SizeF {
6-
7- public SizeF( float width , float height ) {
8- this.Width = width;
9- this.Height = height;
10- }
11-
12- public override string ToString() {
13- return string.Format( "Width = {0}, Height = {1}", this.Width , this.Height );
14- }
15-
16- public static SizeF operator +( SizeF size ) {
17- return new SizeF( +size.Width , +size.Height );
18- }
19-
20- public static SizeF operator -( SizeF size ) {
21- return new SizeF( -size.Width , -size.Height );
22- }
23-
24- public static SizeF operator +( SizeF location1 , SizeF location2 ) {
25- return new SizeF( location1.Width + location2.Width , location1.Height + location2.Height );
26- }
27-
28- public static SizeF operator -( SizeF location1 , SizeF location2 ) {
29- return new SizeF( location1.Width - location2.Width , location1.Height - location2.Height );
30- }
31-
32- public static SizeF operator *( SizeF size , float scaling ) {
33- return new SizeF( size.Width * scaling , size.Height * scaling );
34- }
35-
36- public static SizeF operator *( float scaling , SizeF size ) {
37- return new SizeF( scaling * size.Width , scaling * size.Height );
38- }
39-
40- public static SizeF operator /( SizeF size , float scaling ) {
41- return new SizeF( size.Width / scaling , size.Height / scaling );
42- }
43-
44- public float Width;
45- public float Height;
46- }
47-}
--- trunk/Nlgp1/Nlgp1.Common/Drawing/MathF.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1.Common/Drawing/MathF.cs (nonexistent)
@@ -1,41 +0,0 @@
1-using System;
2-
3-namespace Nlgp1.Common.Drawing {
4-
5- public static class MathF {
6-
7- public const float PI = ( float )( Math.PI );
8-
9- public static float Atan2( float x , float y ) {
10- return ( float )( Math.Atan2( x , y ) );
11- }
12-
13- public static int Ceiling( this float f ) {
14- return ( int )( Math.Ceiling( f ) );
15- }
16-
17- public static float Cos( float f ) {
18- return ( float )( Math.Cos( f ) );
19- }
20-
21- public static int Floor( this float f ) {
22- return ( int )( Math.Floor( f ) );
23- }
24-
25- public static float Pow2( float f ) {
26- return f * f;
27- }
28-
29- public static int Round( this float f ) {
30- return ( int )( Math.Round( f ) );
31- }
32-
33- public static float Sin( float f ) {
34- return ( float )( Math.Sin( f ) );
35- }
36-
37- public static float Sqrt( float f ) {
38- return ( float )( Math.Sqrt( f ) );
39- }
40- }
41-}
--- trunk/Nlgp1/Nlgp1.Common/Drawing/LocationF.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1.Common/Drawing/LocationF.cs (nonexistent)
@@ -1,51 +0,0 @@
1-using System;
2-
3-namespace Nlgp1.Common.Drawing {
4-
5- public struct LocationF {
6-
7- public LocationF( float x , float y ) {
8- this.X = x;
9- this.Y = y;
10- }
11-
12- public override string ToString() {
13- return string.Format( "X = {0}, Y = {1}" , this.X , this.Y );
14- }
15-
16- public Location Round() {
17- return new Location( this.X.Round() , this.Y.Round() );
18- }
19-
20- public static LocationF operator +( LocationF location ) {
21- return new LocationF( +location.X , +location.Y );
22- }
23-
24- public static LocationF operator -( LocationF location ) {
25- return new LocationF( -location.X , -location.Y );
26- }
27-
28- public static LocationF operator +( LocationF location1 , LocationF location2 ) {
29- return new LocationF( location1.X + location2.X , location1.Y + location2.Y );
30- }
31-
32- public static LocationF operator -( LocationF location1 , LocationF location2 ) {
33- return new LocationF( location1.X - location2.X , location1.Y - location2.Y );
34- }
35-
36- public static LocationF operator *( LocationF location , float scaling ) {
37- return new LocationF( location.X * scaling , location.Y * scaling );
38- }
39-
40- public static LocationF operator *( float scaling , LocationF location ) {
41- return new LocationF( scaling * location.X , scaling * location.Y );
42- }
43-
44- public static LocationF operator /( LocationF location , float scaling ) {
45- return new LocationF( location.X / scaling , location.Y / scaling );
46- }
47-
48- public float X;
49- public float Y;
50- }
51-}
--- trunk/Nlgp1/Nlgp1.Common/Drawing/Size.cs (revision 732)
+++ trunk/Nlgp1/Nlgp1.Common/Drawing/Size.cs (revision 733)
@@ -13,10 +13,6 @@
1313 return string.Format( "Width = {0}, Height = {1}", this.Width , this.Height );
1414 }
1515
16- public static implicit operator SizeF( Size size ) {
17- return new SizeF( size.Width , size.Height );
18- }
19-
2016 public static Size operator +( Size size ) {
2117 return new Size( +size.Width , +size.Height );
2218 }
Show on old repository browser