/// <summary> /// 通常の描画に加えてテクスチャを描画する。 /// </summary> /// <param name="upperLeftPos">テクスチャの左上の描画位置</param> /// <param name="upperRightPos">テクスチャの右上の描画位置</param> /// <param name="lowerRightPos">テクスチャの右下の描画位置</param> /// <param name="lowerLeftPos">テクスチャの左下の描画位置</param> /// <param name="upperLeftCol">テクスチャの左上の頂点色</param> /// <param name="upperRightCol">テクスチャの右上の頂点色</param> /// <param name="lowerRightCol">テクスチャの右下の頂点色</param> /// <param name="lowerLeftCol">テクスチャの左下の頂点色</param> /// <param name="upperLeftUV">テクスチャの左上のUV値</param> /// <param name="upperRightUV">テクスチャの右上のUV値</param> /// <param name="lowerRightUV">テクスチャの右下のUV値</param> /// <param name="lowerLeftUV">テクスチャの左下のUV値</param> /// <param name="texture">描画するテクスチャ</param> /// <param name="alphaBlend">アルファブレンドの種類</param> /// <param name="priority">描画の優先順位(大きいほど前面に描画される)</param> /// <remarks>OnDrawAdditionallyの中以外では実行してはいけない。</remarks> public void DrawSpriteAdditionally(Vector2DF upperLeftPos, Vector2DF upperRightPos, Vector2DF lowerRightPos, Vector2DF lowerLeftPos, Color upperLeftCol, Color upperRightCol, Color lowerRightCol, Color lowerLeftCol, Vector2DF upperLeftUV, Vector2DF upperRightUV, Vector2DF lowerRightUV, Vector2DF lowerLeftUV, Texture2D texture, AlphaBlendMode alphaBlend, int priority) { coreLayer2D.DrawSpriteAdditionally(upperLeftPos, upperRightPos, lowerRightPos, lowerLeftPos, upperLeftCol, upperRightCol, lowerRightCol, lowerLeftCol, upperLeftUV, upperRightUV, lowerRightUV, lowerLeftUV, IG.GetTexture2D(texture), (swig.AlphaBlendMode)alphaBlend, priority); }
/// <summary> /// 通常の描画に加えて専用のシェーダーを用いて2Dスプライトを描画する。 /// </summary> /// <param name="upperLeftPos">テクスチャの左上の描画位置</param> /// <param name="upperRightPos">テクスチャの右上の描画位置</param> /// <param name="lowerRightPos">テクスチャの右下の描画位置</param> /// <param name="lowerLeftPos">テクスチャの左下の描画位置</param> /// <param name="upperLeftCol">テクスチャの左上の頂点色</param> /// <param name="upperRightCol">テクスチャの右上の頂点色</param> /// <param name="lowerRightCol">テクスチャの右下の頂点色</param> /// <param name="lowerLeftCol">テクスチャの左下の頂点色</param> /// <param name="upperLeftUV">テクスチャの左上のUV値</param> /// <param name="upperRightUV">テクスチャの右上のUV値</param> /// <param name="lowerRightUV">テクスチャの右下のUV値</param> /// <param name="lowerLeftUV">テクスチャの左下のUV値</param> /// <param name="material">表示に使用するマテリアル</param> /// <param name="alphaBlend">アルファブレンドの種類</param> /// <param name="priority">描画の優先順位(大きいほど前面に描画される)</param> /// <remarks> /// 専用のシェーダーを用いてスプライトを描画する。 /// OnDrawAdditionallyの中以外では実行してはいけない。 /// </remarks> public void DrawSpriteWithMaterialAdditionally(Vector2DF upperLeftPos, Vector2DF upperRightPos, Vector2DF lowerRightPos, Vector2DF lowerLeftPos, Color upperLeftCol, Color upperRightCol, Color lowerRightCol, Color lowerLeftCol, Vector2DF upperLeftUV, Vector2DF upperRightUV, Vector2DF lowerRightUV, Vector2DF lowerLeftUV, Material2D material, AlphaBlendMode alphaBlend, int priority) { coreLayer2D.DrawSpriteWithMaterialAdditionally(upperLeftPos, upperRightPos, lowerRightPos, lowerLeftPos, upperLeftCol, upperRightCol, lowerRightCol, lowerLeftCol, upperLeftUV, upperRightUV, lowerRightUV, lowerLeftUV, IG.GetMaterial2D(material), (swig.AlphaBlendMode)alphaBlend, priority); }
/// <summary> /// 通常の描画に加えて専用のシェーダーを用いて2Dスプライトを描画する。 /// </summary> /// <param name="upperLeftPos">テクスチャの左上の描画位置</param> /// <param name="upperRightPos">テクスチャの右上の描画位置</param> /// <param name="lowerRightPos">テクスチャの右下の描画位置</param> /// <param name="lowerLeftPos">テクスチャの左下の描画位置</param> /// <param name="upperLeftCol">テクスチャの左上の頂点色</param> /// <param name="upperRightCol">テクスチャの右上の頂点色</param> /// <param name="lowerRightCol">テクスチャの右下の頂点色</param> /// <param name="lowerLeftCol">テクスチャの左下の頂点色</param> /// <param name="upperLeftUV">テクスチャの左上のUV値</param> /// <param name="upperRightUV">テクスチャの右上のUV値</param> /// <param name="lowerRightUV">テクスチャの右下のUV値</param> /// <param name="lowerLeftUV">テクスチャの左下のUV値</param> /// <param name="material">表示に使用するマテリアル</param> /// <param name="alphaBlend">アルファブレンドの種類</param> /// <param name="priority">描画の優先順位(大きいほど前面に描画される)</param> /// <remarks> /// 専用のシェーダーを用いてスプライトを描画する。 /// OnDrawAdditionallyの中以外では実行してはいけない。 /// </remarks> public void DrawSpriteWithMaterialAdditionally(Vector2DF upperLeftPos, Vector2DF upperRightPos, Vector2DF lowerRightPos, Vector2DF lowerLeftPos, Color upperLeftCol, Color upperRightCol, Color lowerRightCol, Color lowerLeftCol, Vector2DF upperLeftUV, Vector2DF upperRightUV, Vector2DF lowerRightUV, Vector2DF lowerLeftUV, Material2D material, AlphaBlendMode alphaBlend, int priority) { Layer.DrawSpriteWithMaterialAdditionally(upperLeftPos, upperRightPos, lowerRightPos, lowerLeftPos, upperLeftCol, upperRightCol, lowerRightCol, lowerLeftCol, upperLeftUV, upperRightUV, lowerRightUV, lowerLeftUV, material, alphaBlend, priority); }
/// <summary> /// 2点間の距離を取得する。 /// </summary> /// <param name="v1">v1ベクトル</param> /// <param name="v2">v2ベクトル</param> /// <returns>距離</returns> public static float Distance(Vector2DF v1, Vector2DF v2) { float dx = v1.X - v2.X; float dy = v1.Y - v2.Y; return((float)Math.Sqrt(dx * dx + dy * dy)); }
public FCurveKeyframe(InterpolationType interpolationType = asd.InterpolationType.Linear) { LeftHandle = new Vector2DF(); RightHandle = new Vector2DF(); KeyValue = new Vector2DF(); Interpolation = interpolationType; }
/// <summary> /// 通常の描画に加えてテクスチャを描画する。 /// </summary> /// <param name="upperLeftPos">テクスチャの左上の描画位置</param> /// <param name="upperRightPos">テクスチャの右上の描画位置</param> /// <param name="lowerRightPos">テクスチャの右下の描画位置</param> /// <param name="lowerLeftPos">テクスチャの左下の描画位置</param> /// <param name="upperLeftCol">テクスチャの左上の頂点色</param> /// <param name="upperRightCol">テクスチャの右上の頂点色</param> /// <param name="lowerRightCol">テクスチャの右下の頂点色</param> /// <param name="lowerLeftCol">テクスチャの左下の頂点色</param> /// <param name="upperLeftUV">テクスチャの左上のUV値</param> /// <param name="upperRightUV">テクスチャの右上のUV値</param> /// <param name="lowerRightUV">テクスチャの右下のUV値</param> /// <param name="lowerLeftUV">テクスチャの左下のUV値</param> /// <param name="texture">描画するテクスチャ</param> /// <param name="alphaBlend">アルファブレンドの種類</param> /// <param name="priority">描画の優先順位(大きいほど前面に描画される)</param> /// <remarks>OnDrawAdditionallyの中以外では実行してはいけない。</remarks> protected void DrawSpriteAdditionally(Vector2DF upperLeftPos, Vector2DF upperRightPos, Vector2DF lowerRightPos, Vector2DF lowerLeftPos, Color upperLeftCol, Color upperRightCol, Color lowerRightCol, Color lowerLeftCol, Vector2DF upperLeftUV, Vector2DF upperRightUV, Vector2DF lowerRightUV, Vector2DF lowerLeftUV, Texture2D texture, AlphaBlendMode alphaBlend, int priority) { Layer.DrawSpriteAdditionally(upperLeftPos, upperRightPos, lowerRightPos, lowerLeftPos, upperLeftCol, upperRightCol, lowerRightCol, lowerLeftCol, upperLeftUV, upperRightUV, lowerRightUV, lowerLeftUV, texture, alphaBlend, priority); }
public void StartAnimation(Vector2DF goal) { LayoutedPosition = goal; Cancellation?.Dispose(); Cancellation = owner.GetNewItemPosition(Object, goal) .Where(p => Object.IsAlive) .Subscribe(p => Object.Position = p); }
public void DrawRotatedRectangleAdditionally(RectF drawingArea, Color color, Vector2DF rotationCenter, float angle, RectF uv, Texture2D texture, AlphaBlendMode alphaBlend, int priority) { if (coreLayer2D == null) { return; } coreLayer2D.DrawRotatedRectangleAdditionally(drawingArea, color, rotationCenter, angle, uv, (texture == null) ? null : texture.SwigObject, (swig.AlphaBlendMode)alphaBlend, priority); }
public void DrawTriangleAdditionally(Vector2DF position1, Vector2DF position2, Vector2DF position3, Color color, Vector2DF uv1, Vector2DF uv2, Vector2DF uv3, Texture2D texture, AlphaBlendMode alphaBlend, int priority) { if (coreLayer2D == null) { return; } coreLayer2D.DrawTriangleAdditionally(position1, position2, position3, color, uv1, uv2, uv3, (texture == null) ? null : texture.SwigObject, (swig.AlphaBlendMode)alphaBlend, priority); }
/// <summary> /// 通常の描画に加えてテクスチャを描画する。 /// </summary> /// <param name="upperLeftPos">テクスチャの左上の描画位置</param> /// <param name="upperRightPos">テクスチャの右上の描画位置</param> /// <param name="lowerRightPos">テクスチャの右下の描画位置</param> /// <param name="lowerLeftPos">テクスチャの左下の描画位置</param> /// <param name="upperLeftCol">テクスチャの左上の頂点色</param> /// <param name="upperRightCol">テクスチャの右上の頂点色</param> /// <param name="lowerRightCol">テクスチャの右下の頂点色</param> /// <param name="lowerLeftCol">テクスチャの左下の頂点色</param> /// <param name="upperLeftUV">テクスチャの左上のUV値</param> /// <param name="upperRightUV">テクスチャの右上のUV値</param> /// <param name="lowerRightUV">テクスチャの右下のUV値</param> /// <param name="lowerLeftUV">テクスチャの左下のUV値</param> /// <param name="texture">描画するテクスチャ</param> /// <param name="alphaBlend">アルファブレンドの種類</param> /// <param name="depthWrite">深度を比較するか?</param> /// <param name="depthTest">深度を書き込むか?</param> /// <remarks>OnDrawAdditionallyの中以外では実行してはいけない。</remarks> public void DrawSpriteAdditionally(Vector3DF upperLeftPos, Vector3DF upperRightPos, Vector3DF lowerRightPos, Vector3DF lowerLeftPos, Color upperLeftCol, Color upperRightCol, Color lowerRightCol, Color lowerLeftCol, Vector2DF upperLeftUV, Vector2DF upperRightUV, Vector2DF lowerRightUV, Vector2DF lowerLeftUV, Texture2D texture, AlphaBlendMode alphaBlend, bool depthWrite, bool depthTest) { coreLayer3D.DrawSpriteAdditionally( upperLeftPos, upperRightPos, lowerRightPos, lowerLeftPos, upperLeftCol, upperRightCol, lowerRightCol, lowerLeftCol, upperLeftUV, upperRightUV, lowerRightUV, lowerLeftUV, IG.GetTexture2D(texture), (swig.AlphaBlendMode)alphaBlend, depthWrite, depthTest); }
public void DrawLineAdditionally(Vector2DF point1, Vector2DF point2, float thickness, Color color, AlphaBlendMode alphaBlend, int priority) { if (coreLayer2D == null) { return; } coreLayer2D.DrawLineAdditionally(point1, point2, thickness, color, (swig.AlphaBlendMode)alphaBlend, priority); }
/// <summary> /// スカラーで除算する。 /// </summary> /// <param name="v1">値1</param> /// <param name="v2">値2</param> /// <returns>v1/v2</returns> public static Vector2DF DivideByScalar(Vector2DF v1, float v2) { var ret = new Vector2DF(); ret.X = v1.X / v2; ret.Y = v1.Y / v2; return(ret); }
/// <summary> /// 除算する。 /// </summary> /// <param name="v1">値1</param> /// <param name="v2">値2</param> /// <returns>v1/v2</returns> public static Vector2DF Divide(Vector2DF v1, Vector2DF v2) { var ret = new Vector2DF(); ret.X = v1.X / v2.X; ret.Y = v1.Y / v2.Y; return(ret); }
/// <summary> /// 通常の描画に加えてテクスチャを描画する。 /// </summary> /// <param name="upperLeftPos">テクスチャの左上の描画位置</param> /// <param name="upperRightPos">テクスチャの右上の描画位置</param> /// <param name="lowerRightPos">テクスチャの右下の描画位置</param> /// <param name="lowerLeftPos">テクスチャの左下の描画位置</param> /// <param name="upperLeftCol">テクスチャの左上の頂点色</param> /// <param name="upperRightCol">テクスチャの右上の頂点色</param> /// <param name="lowerRightCol">テクスチャの右下の頂点色</param> /// <param name="lowerLeftCol">テクスチャの左下の頂点色</param> /// <param name="upperLeftUV">テクスチャの左上のUV値</param> /// <param name="upperRightUV">テクスチャの右上のUV値</param> /// <param name="lowerRightUV">テクスチャの右下のUV値</param> /// <param name="lowerLeftUV">テクスチャの左下のUV値</param> /// <param name="texture">描画するテクスチャ</param> /// <param name="alphaBlend">アルファブレンドの種類</param> /// <param name="depthTest">深度を書き込むか?</param> /// <param name="depthWrite">深度を比較するか?</param> /// <remarks>OnDrawAdditionallyの中以外では実行してはいけない。</remarks> public void DrawSpriteAdditionally(Vector3DF upperLeftPos, Vector3DF upperRightPos, Vector3DF lowerRightPos, Vector3DF lowerLeftPos, Color upperLeftCol, Color upperRightCol, Color lowerRightCol, Color lowerLeftCol, Vector2DF upperLeftUV, Vector2DF upperRightUV, Vector2DF lowerRightUV, Vector2DF lowerLeftUV, Texture2D texture, AlphaBlendMode alphaBlend, bool depthWrite, bool depthTest) { Layer.DrawSpriteAdditionally( upperLeftPos, upperRightPos, lowerRightPos, lowerLeftPos, upperLeftCol, upperRightCol, lowerRightCol, lowerLeftCol, upperLeftUV, upperRightUV, lowerRightUV, lowerLeftUV, texture, alphaBlend, depthWrite, depthTest); }
public void DrawArcAdditionally(Vector2DF center, float outerDiameter, float innerDiameter, Color color, int vertNum, int startingVerticalAngle, int endingVerticalAngle, float angle, Texture2D texture, AlphaBlendMode alphaBlend, int priority) { if (coreLayer2D == null) { return; } coreLayer2D.DrawArcAdditionally(center, outerDiameter, innerDiameter, color, vertNum, startingVerticalAngle, endingVerticalAngle, angle, (texture == null) ? null : texture.SwigObject, (swig.AlphaBlendMode)alphaBlend, priority); }
/// <summary> /// 通常の描画に加えて文字列を描画する。 /// </summary> /// <param name="pos">描画位置</param> /// <param name="color">頂点色</param> /// <param name="font">フォント</param> /// <param name="text">文字列</param> /// <param name="writingDirection">行方向</param> /// <param name="alphaBlend">アルファブレンドの種類</param> /// <param name="priority">描画の優先順位(大きいほど前面に描画される)</param> /// <remarks> /// OnDrawAdditionallyの中以外では実行してはいけない。 /// </remarks> public void DrawTextAdditionally(Vector2DF pos, Color color, Font font, string text, WritingDirection writingDirection, AlphaBlendMode alphaBlend, int priority) { if (coreLayer2D == null) { return; } coreLayer2D.DrawTextAdditionally(pos, color, IG.GetFont(font), text, (swig.WritingDirection)writingDirection, (swig.AlphaBlendMode)alphaBlend, priority); }
/// <summary> /// 減算する。 /// </summary> /// <param name="v1"></param> /// <param name="v2"></param> /// <returns></returns> public static Vector2DF Subtract(Vector2DF v1, Vector2DF v2) { Vector2DF o = new Vector2DF(); o.X = v1.X - v2.X; o.Y = v1.Y - v2.Y; return(o); }
/// <summary> /// 加算する。 /// </summary> /// <param name="v1"></param> /// <param name="v2"></param> /// <returns></returns> public static Vector2DF Add(Vector2DF v1, Vector2DF v2) { Vector2DF o = new Vector2DF(); o.X = v1.X + v2.X; o.Y = v1.Y + v2.Y; return(o); }
/// <summary> /// 次のシーンを3角形に貼り付けて描画する。 /// </summary> /// <param name="pos1">座標1(0~1)</param> /// <param name="pos2">座標2(0~1)</param> /// <param name="pos3">座標3(0~1)</param> /// <param name="col1">頂点カラー1</param> /// <param name="col2">頂点カラー2</param> /// <param name="col3">頂点カラー3</param> /// <param name="uv1">UV1(0~1)</param> /// <param name="uv2">UV2(0~1)</param> /// <param name="uv3">UV3(0~1)</param> /// <remarks>ChangeSceneを実行するまでは無効である。</remarks> public void DrawTriangleWithNextScene( Vector2DF pos1, Vector2DF pos2, Vector2DF pos3, Color col1, Color col2, Color col3, Vector2DF uv1, Vector2DF uv2, Vector2DF uv3) { coreInstance.DrawTriangleWithNextScene( pos1, pos2, pos3, col1, col2, col3, uv1, uv2, uv3); }
/// <summary> /// 次のシーンを4角形に貼り付けて描画する。 /// </summary> /// <param name="upperLeftPos">左上の描画位置(0~1)</param> /// <param name="upperRightPos">右上の描画位置(0~1)</param> /// <param name="lowerRightPos">右下の描画位置(0~1)</param> /// <param name="lowerLeftPos">左下の描画位置(0~1)</param> /// <param name="upperLeftCol">左上の頂点色</param> /// <param name="upperRightCol">右上の頂点色</param> /// <param name="lowerRightCol">右下の頂点色</param> /// <param name="lowerLeftCol">左下の頂点色</param> /// <param name="upperLeftUV">左上のUV値(0~1)</param> /// <param name="upperRightUV">右上のUV値(0~1)</param> /// <param name="lowerRightUV">右下のUV値(0~1)</param> /// <param name="lowerLeftUV">左下のUV値(0~1)</param> /// <remarks>ChangeSceneを実行するまでは無効である。</remarks> public void DrawRectangleWithNextScene( Vector2DF upperLeftPos, Vector2DF upperRightPos, Vector2DF lowerRightPos, Vector2DF lowerLeftPos, Color upperLeftCol, Color upperRightCol, Color lowerRightCol, Color lowerLeftCol, Vector2DF upperLeftUV, Vector2DF upperRightUV, Vector2DF lowerRightUV, Vector2DF lowerLeftUV) { coreInstance.DrawRectangleWithNextScene( upperLeftPos, upperRightPos, lowerRightPos, lowerLeftPos, upperLeftCol, upperRightCol, lowerRightCol, lowerLeftCol, upperLeftUV, upperRightUV, lowerRightUV, lowerLeftUV); }
/// <summary> /// 前のシーンを3角形に貼り付けて描画する。 /// </summary> /// <param name="pos1">座標1(0~1)</param> /// <param name="pos2">座標2(0~1)</param> /// <param name="pos3">座標3(0~1)</param> /// <param name="col1">頂点カラー1</param> /// <param name="col2">頂点カラー2</param> /// <param name="col3">頂点カラー3</param> /// <param name="uv1">UV1(0~1)</param> /// <param name="uv2">UV2(0~1)</param> /// <param name="uv3">UV3(0~1)</param> /// <remarks>ChangeSceneを実行すると前のシーンの描画は停止し、静止画として扱われる。</remarks> public void DrawTriangleWithPreviousScene( Vector2DF pos1, Vector2DF pos2, Vector2DF pos3, Color col1, Color col2, Color col3, Vector2DF uv1, Vector2DF uv2, Vector2DF uv3) { SwigObject.DrawTriangleWithPreviousScene( pos1, pos2, pos3, col1, col2, col3, uv1, uv2, uv3); }
/// <summary> /// 前のシーンを4角形に貼り付けて描画する。 /// </summary> /// <param name="upperLeftPos">左上の描画位置(0~1)</param> /// <param name="upperRightPos">右上の描画位置(0~1)</param> /// <param name="lowerRightPos">右下の描画位置(0~1)</param> /// <param name="lowerLeftPos">左下の描画位置(0~1)</param> /// <param name="upperLeftCol">左上の頂点色</param> /// <param name="upperRightCol">右上の頂点色</param> /// <param name="lowerRightCol">右下の頂点色</param> /// <param name="lowerLeftCol">左下の頂点色</param> /// <param name="upperLeftUV">左上のUV値(0~1)</param> /// <param name="upperRightUV">右上のUV値(0~1)</param> /// <param name="lowerRightUV">右下のUV値(0~1)</param> /// <param name="lowerLeftUV">左下のUV値(0~1)</param> /// <remarks>ChangeSceneを実行すると前のシーンの描画は停止し、静止画として扱われる。</remarks> public void DrawRectangleWithPreviousScene( Vector2DF upperLeftPos, Vector2DF upperRightPos, Vector2DF lowerRightPos, Vector2DF lowerLeftPos, Color upperLeftCol, Color upperRightCol, Color lowerRightCol, Color lowerLeftCol, Vector2DF upperLeftUV, Vector2DF upperRightUV, Vector2DF lowerRightUV, Vector2DF lowerLeftUV) { SwigObject.DrawRectangleWithPreviousScene( upperLeftPos, upperRightPos, lowerRightPos, lowerLeftPos, upperLeftCol, upperRightCol, lowerRightCol, lowerLeftCol, upperLeftUV, upperRightUV, lowerRightUV, lowerLeftUV); }
private Vector2DF GetPosition(int index) { var x = index % LineCapacity; var y = index / LineCapacity; var offset = new Vector2DF(x, y); if (Orientation == Orientation.Vertical) { offset = offset.ExchangeXY(); } return offset * ItemSpan; }
//コンストラクタ protected Enemy(asd.Vector2DF pos, asd.Vector2DF movevector, Player player) : base() { Position = pos; Texture = asd.Engine.Graphics.CreateTexture2D("Resources/Enemy.png"); CenterPosition = new asd.Vector2DF(Texture.Size.X / 2.0f, Texture.Size.Y / 2.0f); count = 0; this.player = player; }
public bool IsOnMouse(asd.Vector2DF pos) { bool ret = false; foreach (var m in _maps) { if (m.IsOnMouse(pos)) { ret = true; } } return(ret); }
private void AddObject(Vector2DF position, EasingStart start, EasingEnd end) { var heart = Engine.Graphics.CreateTexture2D("Heart.png"); var obj = new ReactiveTextureObject2D() { Texture = heart, Position = position, }; obj.SetCenterPosition(CenterPosition.CenterCenter); Engine.AddObject2D(obj); obj.OnUpdateEvent.DoEasingY(obj, position.Y + 400, start, end, 120) .Subscribe(); }
public Enemy(Vector2DF pos, NormalPlayer player) { Position = pos; this.player = player; Texture = asd.Engine.Graphics.CreateTexture2D("Resources/Player2.png"); CenterPosition = new asd.Vector2DF(Texture.Size.X / 2.0f, Texture.Size.Y / 2.0f); Radius = Texture.Size.X / 2.0f; //破壊時の効果音を読み込む deathSound = asd.Engine.Sound.CreateSoundSource("Resources/Explode.wav", true); enemycount++; }
protected override void OnStart() { center = new Vector2DF(320, 240); obj = new TextureObject2D() { Texture = Engine.Graphics.CreateTexture2D("Heart.png"), Position = center, }; Engine.AddObject2D(obj); var obj2 = new TextureObject2D() { Texture = Engine.Graphics.CreateTexture2D("Heart.png"), Position = center, DrawingPriority = -1, }; Engine.AddObject2D(obj2); }
public PlayerOrigin(Keys right, Keys left, Keys up, Keys down, Keys attack) { Texture = asd.Engine.Graphics.CreateTexture2D("Resources/NormalPlayer.png"); CenterPosition = new asd.Vector2DF(Texture.Size.X / 2.0f, Texture.Size.Y / 2.0f); //中心に判定を設定 Radius = Texture.Size.X / 3.0f; //ショットの効果音を読み込む ShotSound = asd.Engine.Sound.CreateSoundSource("Resources/Shot.wav", true); //ボム発動の効果音を読み込む BombSound = asd.Engine.Sound.CreateSoundSource("Resources/Bomb.wav", true); this.right = right; this.left = left; this.up = up; this.down = down; this.attack = attack; }
/// <summary> /// 行列でベクトルを変形させる。 /// </summary> /// <param name="in_">変形前ベクトル</param> /// <returns>変形後ベクトル</returns> public Vector2DF Transform2D(Vector2DF in_) { float* values = stackalloc float[4]; fixed(float* v = Values) { for (int i = 0; i < 3; i++) { values[i] = 0; values[i] += in_.X * v[i*3+0]; values[i] += in_.Y * v[i*3+1]; values[i] += 1.0f * v[i*3+2]; } } Vector2DF o = new Vector2DF(); o.X = values[0]; o.Y = values[1]; return o; }
protected override void OnUpdate() { //敵との当たり判定(STG準拠) foreach (var obj in Layer.Objects) { CollideWith(obj as CollidableObject); } //マップ遷移 if (Stage.stagelist[GameScene.stage_now][(int)Position.Y / 32, (int)Position.X / 32] == Stage.n) { Wall.wall_dispose = true; } asd.Vector2DF position = Position; position.X = asd.MathHelper.Clamp(position.X, asd.Engine.WindowSize.X - Texture.Size.X / 2.0f, Texture.Size.X / 2.0f); position.Y = asd.MathHelper.Clamp(position.Y, asd.Engine.WindowSize.Y - Texture.Size.Y / 2.0f, Texture.Size.Y / 2.0f); Position = position; Count++; }
public void DrawArcAdditionally(Vector2DF center, float outerDiameter, float innerDiameter, Color color, int vertNum, int startingVerticalAngle, int endingVerticalAngle, float angle, Texture2D texture, AlphaBlendMode alphaBlend, int priority) { coreLayer2D.DrawArcAdditionally(center, outerDiameter, innerDiameter, color, vertNum, startingVerticalAngle, endingVerticalAngle, angle, IG.GetTexture2D(texture), (swig.AlphaBlendMode)alphaBlend, priority); }
/// <summary> /// 2点間の距離を取得する。 /// </summary> /// <param name="v1">v1ベクトル</param> /// <param name="v2">v2ベクトル</param> /// <returns>距離</returns> public static float Distance(Vector2DF v1, Vector2DF v2) { float dx = v1.X - v2.X; float dy = v1.Y - v2.Y; return (float)Math.Sqrt(dx * dx + dy * dy); }
protected void DrawLineAdditionally(Vector2DF point1, Vector2DF point2, Color color, float thickness, AlphaBlendMode alphaBlend, int priority) { Layer.DrawLineAdditionally(point1, point2, thickness, color, alphaBlend, priority); }
protected override void OnStart() { Texture = Engine.Graphics.CreateTexture2D( CloudTexturePath ); CenterPosition = new Vector2DF( Texture.Size.X / 2, Texture.Size.Y / 2 ); }
public void DrawTriangleAdditionally(Vector2DF position1, Vector2DF position2, Vector2DF position3, Color color, Vector2DF uv1, Vector2DF uv2, Vector2DF uv3, Texture2D texture, AlphaBlendMode alphaBlend, int priority) { if (coreLayer2D == null) return; coreLayer2D.DrawTriangleAdditionally(position1, position2, position3, color, uv1, uv2, uv3, (texture == null) ? null : texture.SwigObject, (swig.AlphaBlendMode)alphaBlend, priority); }
public ItemInfo(LinearPanel owner, Object2D obj) { this.owner = owner; Object = obj; LayoutedPosition = obj.Position; }
protected void DrawCircleAdditionally(Vector2DF center, float outerDiameter, float innerDiameter, Color color, int vertNum, float angle, Texture2D texture, AlphaBlendMode alphaBlend, int priority) { Layer.DrawCircleAdditionally(center, outerDiameter, innerDiameter, color, vertNum, angle, texture, alphaBlend, priority); }
protected void DrawRotatedRectangleAdditionally(RectF drawingArea, Color color, Vector2DF rotationCenter, float angle, RectF uv, Texture2D texture, AlphaBlendMode alphaBlend, int priority) { Layer.DrawRotatedRectangleAdditionally(drawingArea, color, rotationCenter, angle, uv, texture, alphaBlend, priority); }
/// <summary> /// 通常の描画に加えて文字列を描画する。 /// </summary> /// <param name="pos">描画位置</param> /// <param name="color">頂点色</param> /// <param name="font">フォント</param> /// <param name="text">文字列</param> /// <param name="writingDirection">行方向</param> /// <param name="alphaBlend">アルファブレンドの種類</param> /// <param name="priority">描画の優先順位(大きいほど前面に描画される)</param> /// <remarks> /// OnDrawAdditionallyの中以外では実行してはいけない。 /// </remarks> protected void DrawTextAdditionally(Vector2DF pos, Color color, Font font, string text, WritingDirection writingDirection, AlphaBlendMode alphaBlend, int priority) { Layer.DrawTextAdditionally(pos, color, font, text, writingDirection, alphaBlend, priority); }
protected void DrawTriangleAdditionally(Vector2DF position1, Vector2DF position2, Vector2DF position3, Color color, Vector2DF uv1, Vector2DF uv2, Vector2DF uv3, Texture2D texture, AlphaBlendMode alphaBlend, int priority) { Layer.DrawTriangleAdditionally(position1, position2, position3, color, uv1, uv2, uv3, texture, alphaBlend, priority); }
/// <summary> /// 内積を取得する。 /// </summary> /// <param name="v1">v1ベクトル</param> /// <param name="v2">v2ベクトル</param> /// <returns>内積v1・v2</returns> public static float Dot(Vector2DF v1, Vector2DF v2) { return v1.X * v2.X + v1.Y * v2.Y; }
/// <summary> /// 多角形を構成する頂点を追加する。 /// </summary> /// <param name="vertex">新規に追加する頂点の座標</param> public void AddVertex(Vector2DF vertex) { corePolygon.AddVertex(vertex); }
public void SetVector2DF(string name, Vector2DF value) { SwigObject.SetVector2DF(name, value); }
int IsAbleToGo3(asd.Vector2DF pos) { return(Stage.stagelist[GameScene.stage_now][(int)(pos.Y / 32), (int)(pos.X / 32)]); }
private RectF AddPosition(RectF source, Vector2DF d) { return new RectF(source.X + d.X, source.Y + d.Y, source.Width, source.Height); }
protected void DrawArcAdditionally(Vector2DF center, float outerDiameter, float innerDiameter, Color color, int vertNum, int startingVerticalAngle, int endingVerticalAngle, float angle, Texture2D texture, AlphaBlendMode alphaBlend, int priority) { Layer.DrawArcAdditionally(center, outerDiameter, innerDiameter, color, vertNum, startingVerticalAngle, endingVerticalAngle, angle, texture, alphaBlend, priority); }
/// <summary> /// カメラで映す範囲を強制的に変更します。 /// </summary> /// <param name="initialCameraSrc">カメラが映す範囲。</param> /// <param name="initialSeeingArea">注目する範囲。</param> public void SetScrollPosition(RectI initialCameraSrc, RectF initialSeeingArea) { actualCameraPosition_ = initialCameraSrc.Position.To2DF(); camera_.Src = initialCameraSrc; ReviseCamera(initialSeeingArea); }
public MyObject( float x, float y ) { Position = new Vector2DF( x, y ); }
/// <summary> /// 指定したインデックスの頂点のUVを設定する。 /// </summary> /// <param name="uv">インデックスで指定した頂点に設定するUV</param> /// <param name="index">UVを設定する頂点のインデックス(0 <= index < 3)</param> public void SetUVByIndex(Vector2DF uv, int index) { coreTriangle.SetUVByIndex(uv, index); }
private void ReviseCamera(RectF rect) { var offset = new Vector2DF(); var innerBindingRect = new RectF( actualCameraPosition_.X + BindingAreaRange.X, actualCameraPosition_.Y + BindingAreaRange.Y, BindingAreaRange.Width, BindingAreaRange.Height); offset += GetJut(rect, innerBindingRect); var outerBindingRect = new RectF( BoundaryStartingPosition.X, BoundaryStartingPosition.Y, BoundaryEndingPosition.X - BoundaryStartingPosition.X, BoundaryEndingPosition.Y - BoundaryStartingPosition.Y); offset -= GetJut(camera_.Src.ToF().WithPosition(actualCameraPosition_ + offset), outerBindingRect); if (offset != new Vector2DF(0, 0)) { actualCameraPosition_ = actualCameraPosition_ + offset; scrollDisposable_?.Dispose(); scrollDisposable_ = getCameraMoving_(actualCameraPosition_) .Subscribe(r => camera_.Src = r.ToI()); } }
/// <summary> /// 外積を取得する。 /// </summary> /// <param name="v1">v1ベクトル</param> /// <param name="v2">v2ベクトル</param> /// <returns>外積v1×v2</returns> public static float Cross(Vector2DF v1, Vector2DF v2) { return v1.X * v2.Y - v1.Y * v2.X; }
/// <summary> /// 指定したインデックスの頂点の座標を設定する。 /// </summary> /// <param name="point">インデックスで指定した頂点に設定する座標</param> /// <param name="index">座標を設定する頂点のインデックス(0 <= index < 3)</param> public void SetPointByIndex(Vector2DF point, int index) { coreTriangle.SetPointByIndex(point, index); }
private Vector2DF GetJut(RectF rect, RectF bound) { var result = new Vector2DF(); if (rect.X + rect.Width > bound.X + bound.Width) { result.X = rect.X + rect.Width - (bound.X + bound.Width); } if (rect.X - result.X < bound.X) { result.X += rect.X - result.X - bound.X; } if (rect.Y + rect.Height > bound.Y + bound.Height) { result.Y = rect.Y + rect.Height - (bound.Y + bound.Height); } if (rect.Y - result.Y < bound.Y) { result.Y += rect.Y - result.Y - bound.Y; } return result; }