Skip to content

Commit

Permalink
GameCanvas 6.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
seibe authored Apr 10, 2021
2 parents e96af36 + ec0490c commit fe4cb04
Show file tree
Hide file tree
Showing 29 changed files with 1,947 additions and 125 deletions.
4 changes: 4 additions & 0 deletions Packages/GameCanvas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# CHANGE LOG
## 6.1.0
### 機能追加
- [#61](https://github.com/sfc-sdp/GameCanvas-Unity/issues/61), [#208](https://github.com/sfc-sdp/GameCanvas-Unity/pull/208) 角丸長方形の描画関数を追加

## 6.0.0
### 機能追加
- [#188](https://github.com/sfc-sdp/GameCanvas-Unity/issues/188) null許容参照型に対応
Expand Down
318 changes: 231 additions & 87 deletions Packages/GameCanvas/Runtime/Scripts/Engine/GcGraphicsEngine.cs

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Packages/GameCanvas/Runtime/Scripts/GcActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// </remarks>
/*------------------------------------------------------------*/
#nullable enable

namespace GameCanvas
{
/// <summary>
Expand Down
81 changes: 80 additions & 1 deletion Packages/GameCanvas/Runtime/Scripts/GcProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/*------------------------------------------------------------*/
#nullable enable
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
Expand Down Expand Up @@ -233,6 +232,15 @@ public CoordianteScope CoordinateScope
get => m_Context.Graphics.CoordinateScope;
}

/// <inheritdoc/>
public float CornerRadius
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => m_Context.Graphics.CornerRadius;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set { m_Context.Graphics.CornerRadius = value; }
}

/// <inheritdoc/>
public float2x3 CurrentCoordinate
{
Expand Down Expand Up @@ -694,6 +702,7 @@ public float TimeSinceStartup
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => m_Context.Time.TimeSinceStartup;
}

/// <inheritdoc/>
public bool VSyncEnabled
{
Expand Down Expand Up @@ -1060,6 +1069,41 @@ public void DrawRect(in float2 position, in float2 size, float degree = 0f)
public void DrawRect(in GcRect rect)
=> m_Context.Graphics.DrawRect(rect);

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawRoundedRect()
=> m_Context.Graphics.DrawRoundedRect();

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawRoundedRect(in float x, in float y, in float width, in float height, float degree = 0f)
=> m_Context.Graphics.DrawRoundedRect(new GcRect(x, y, width, height, math.radians(degree)));

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawRoundedRect(in float x, in float y, in float width, in float height, float cornerRadius, float degree = 0f)
=> m_Context.Graphics.DrawRoundedRect(new GcRect(x, y, width, height, math.radians(degree)), cornerRadius);

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawRoundedRect(in float2 position, in float2 size, float degree = 0f)
=> m_Context.Graphics.DrawRoundedRect(new GcRect(position, size, math.radians(degree)));

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawRoundedRect(in float2 position, in float2 size, float cornerRadius, float degree = 0f)
=> m_Context.Graphics.DrawRoundedRect(new GcRect(position, size, math.radians(degree)), cornerRadius);

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawRoundedRect(in GcRect rect)
=> m_Context.Graphics.DrawRoundedRect(rect);

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawRoundedRect(in GcRect rect, float cornerRect)
=> m_Context.Graphics.DrawRoundedRect(rect, cornerRect);

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawString(in string str)
Expand Down Expand Up @@ -1154,6 +1198,41 @@ public void FillRect(in float2 position, in float2 size, float degree = 0f)
public void FillRect(in GcRect rect)
=> m_Context.Graphics.FillRect(rect);

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FillRoundedRect()
=> m_Context.Graphics.FillRoundedRect();

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FillRoundedRect(in float x, in float y, in float width, in float height, float degree = 0f)
=> m_Context.Graphics.FillRoundedRect(new GcRect(x, y, width, height, math.radians(degree)));

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FillRoundedRect(in float x, in float y, in float width, in float height, float cornerRadius, float degree = 0f)
=> m_Context.Graphics.FillRoundedRect(new GcRect(x, y, width, height, math.radians(degree)), cornerRadius);

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FillRoundedRect(in float2 position, in float2 size, float degree = 0f)
=> m_Context.Graphics.FillRoundedRect(new GcRect(position, size, math.radians(degree)));

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FillRoundedRect(in float2 position, in float2 size, float cornerRadius, float degree = 0f)
=> m_Context.Graphics.FillRoundedRect(new GcRect(position, size, math.radians(degree)), cornerRadius);

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FillRoundedRect(in GcRect rect)
=> m_Context.Graphics.FillRoundedRect(rect);

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FillRoundedRect(in GcRect rect, float cornerRadius)
=> m_Context.Graphics.FillRoundedRect(rect, cornerRadius);

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FocusCameraImage(in GcCameraDevice camera, in float2? uv)
Expand Down
1 change: 0 additions & 1 deletion Packages/GameCanvas/Runtime/Scripts/Interface/IActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// </remarks>
/*------------------------------------------------------------*/
#nullable enable

namespace GameCanvas
{
public interface IActor
Expand Down
1 change: 0 additions & 1 deletion Packages/GameCanvas/Runtime/Scripts/Interface/IEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// </remarks>
/*------------------------------------------------------------*/
#nullable enable

namespace GameCanvas
{
public interface IEngine : System.IDisposable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// </remarks>
/*------------------------------------------------------------*/
#nullable enable

namespace GameCanvas
{
public interface IGameCanvas
Expand Down
117 changes: 117 additions & 0 deletions Packages/GameCanvas/Runtime/Scripts/Interface/IGraphics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public interface IGraphics
/// </summary>
CoordianteScope CoordinateScope { get; }

/// <summary>
/// 角丸の半径
/// </summary>
float CornerRadius { get; set; }

/// <summary>
/// 現在の座標系(変換行列)
/// </summary>
Expand Down Expand Up @@ -226,6 +231,24 @@ public interface IGraphics
/// <param name="rect">矩形</param>
void DrawRect(in GcRect rect);

/// <summary>
/// 角丸矩形を線で描画します
/// </summary>
void DrawRoundedRect();

/// <summary>
/// 角丸矩形を線で描画します
/// </summary>
/// <param name="rect">二等辺三角形が収まる矩形</param>
void DrawRoundedRect(in GcRect rect);

/// <summary>
/// 角丸矩形を線で描画します
/// </summary>
/// <param name="rect">二等辺三角形が収まる矩形</param>
/// <param name="cornerRadius">角丸の半径</param>
void DrawRoundedRect(in GcRect rect, float cornerRadius);

/// <summary>
/// 文字列を描画します
/// </summary>
Expand Down Expand Up @@ -297,6 +320,24 @@ public interface IGraphics
/// <param name="rect">矩形</param>
void FillRect(in GcRect rect);

/// <summary>
/// 角丸矩形を塗りで描画します
/// </summary>
void FillRoundedRect();

/// <summary>
/// 角丸矩形を塗りで描画します
/// </summary>
/// <param name="rect">二等辺三角形が収まる矩形</param>
void FillRoundedRect(in GcRect rect);

/// <summary>
/// 角丸矩形を塗りで描画します
/// </summary>
/// <param name="rect">二等辺三角形が収まる矩形</param>
/// <param name="cornerRadius">角丸の半径</param>
void FillRoundedRect(in GcRect rect, float cornerRadius);

/// <summary>
/// スタックから座標系(変換行列)を取り出し <see cref="CurrentCoordinate"/> に上書きします
/// </summary>
Expand Down Expand Up @@ -553,6 +594,44 @@ public interface IGraphicsEx : IGraphics
[EditorBrowsable(EditorBrowsableState.Never)]
void DrawRightString(in string str, in float x, in float y, float degree = 0f);

/// <summary>
/// 角丸矩形を線で描画します
/// </summary>
/// <param name="x">X座標</param>
/// <param name="y">Y座標</param>
/// <param name="width">横幅</param>
/// <param name="height">縦幅</param>
/// <param name="degree">回転(度数法)</param>
void DrawRoundedRect(in float x, in float y, in float width, in float height, float degree = 0f);

/// <summary>
/// 角丸矩形を線で描画します
/// </summary>
/// <param name="x">X座標</param>
/// <param name="y">Y座標</param>
/// <param name="width">横幅</param>
/// <param name="height">縦幅</param>
/// <param name="cornerRadius">角丸の半径</param>
/// <param name="degree">回転(度数法)</param>
void DrawRoundedRect(in float x, in float y, in float width, in float height, float cornerRadius, float degree = 0f);

/// <summary>
/// 角丸矩形を線で描画します
/// </summary>
/// <param name="position">位置</param>
/// <param name="size">大きさ</param>
/// <param name="degree">回転(度数法)</param>
void DrawRoundedRect(in float2 position, in float2 size, float degree = 0f);

/// <summary>
/// 角丸矩形を線で描画します
/// </summary>
/// <param name="position">位置</param>
/// <param name="size">大きさ</param>
/// <param name="cornerRadius">角丸の半径</param>
/// <param name="degree">回転(度数法)</param>
void DrawRoundedRect(in float2 position, in float2 size, float cornerRadius, float degree = 0f);

/// <summary>
/// 文字列を描画します
/// </summary>
Expand Down Expand Up @@ -621,6 +700,44 @@ public interface IGraphicsEx : IGraphics
/// <param name="degree">回転(度数法)</param>
void FillRect(in float2 position, in float2 size, float degree = 0f);

/// <summary>
/// 角丸矩形を塗りで描画します
/// </summary>
/// <param name="x">X座標</param>
/// <param name="y">Y座標</param>
/// <param name="width">横幅</param>
/// <param name="height">縦幅</param>
/// <param name="degree">回転(度数法)</param>
void FillRoundedRect(in float x, in float y, in float width, in float height, float degree = 0f);

/// <summary>
/// 角丸矩形を塗りで描画します
/// </summary>
/// <param name="x">X座標</param>
/// <param name="y">Y座標</param>
/// <param name="width">横幅</param>
/// <param name="height">縦幅</param>
/// <param name="cornerRadius">角丸の半径</param>
/// <param name="degree">回転(度数法)</param>
void FillRoundedRect(in float x, in float y, in float width, in float height, float cornerRadius, float degree = 0f);

/// <summary>
/// 角丸矩形を塗りで描画します
/// </summary>
/// <param name="position">位置</param>
/// <param name="size">大きさ</param>
/// <param name="degree">回転(度数法)</param>
void FillRoundedRect(in float2 position, in float2 size, float degree = 0f);

/// <summary>
/// 角丸矩形を塗りで描画します
/// </summary>
/// <param name="position">位置</param>
/// <param name="size">大きさ</param>
/// <param name="cornerRadius">角丸の半径</param>
/// <param name="degree">回転(度数法)</param>
void FillRoundedRect(in float2 position, in float2 size, float cornerRadius, float degree = 0f);

/// <summary>
/// 画像の縦幅を取得します
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public interface IInputAcceleration
/// <returns>1つ以上の加速度イベントがあったかどうか</returns>
bool TryGetAccelerationEventAll(out System.ReadOnlySpan<GcAccelerationEvent> events);

[System.Obsolete("Use to `TryGetAccelerationEvent` instead.")]
[System.Obsolete("Use to `TryGetAccelerationEventAll` instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
bool TryGetAccelerationEvents(out NativeArray<GcAccelerationEvent>.ReadOnly array, out int count);
}
Expand All @@ -75,33 +75,33 @@ public interface IInputAccelerationEx : IInputAcceleration
/// <summary>
/// 最後に検出した加速度イベントの X方向の加速度
/// </summary>
[System.Obsolete("Use to `LastAcceleration` instead.")]
[System.Obsolete("Use to `LastAcceleration` instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
float AccelerationLastX { get; }

/// <summary>
/// 最後に検出した加速度イベントの Y方向の加速度
/// </summary>
[System.Obsolete("Use to `LastAcceleration` instead.")]
[System.Obsolete("Use to `LastAcceleration` instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
float AccelerationLastY { get; }

/// <summary>
/// 最後に検出した加速度イベントの Z方向の加速度
/// </summary>
[System.Obsolete("Use to `LastAcceleration` instead.")]
[System.Obsolete("Use to `LastAcceleration` instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
float AccelerationLastZ { get; }

[System.Obsolete("Use to `TryGetAccelerationEvent` instead.")]
[System.Obsolete("Use to `TryGetAccelerationEvent` instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
float GetAccelerationX(in int i, bool normalize = false);

[System.Obsolete("Use to `TryGetAccelerationEvent` instead.")]
[System.Obsolete("Use to `TryGetAccelerationEvent` instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
float GetAccelerationY(in int i, bool normalize = false);

[System.Obsolete("Use to `TryGetAccelerationEvent` instead.")]
[System.Obsolete("Use to `TryGetAccelerationEvent` instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
float GetAccelerationZ(in int i, bool normalize = false);
}
Expand Down
4 changes: 2 additions & 2 deletions Packages/GameCanvas/Runtime/Scripts/Interface/IPhysics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public interface IPhysicsEx : IPhysics
/// <param name="y2">円2の中心Y座標</param>
/// <param name="r2">円2の半径</param>
/// <returns>接触しているかどうか</returns>
[System.Obsolete("Use to `HitTest` instead.")]
[System.Obsolete("Use to `HitTest` instead.")]
bool CheckHitCircle(in float x1, in float y1, in float r1, in float x2, in float y2, in float r2);

/// <summary>
Expand All @@ -82,7 +82,7 @@ public interface IPhysicsEx : IPhysics
/// <param name="w2">矩形2の横幅</param>
/// <param name="h2">矩形2の縦幅</param>
/// <returns>接触しているかどうか</returns>
[System.Obsolete("Use to `HitTest` instead.")]
[System.Obsolete("Use to `HitTest` instead.")]
bool CheckHitRect(in float x1, in float y1, in float w1, in float h1, in float x2, in float y2, in float w2, in float h2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// </remarks>
/*------------------------------------------------------------*/
#nullable enable

namespace GameCanvas
{
public interface IPrimitive<T> : System.IEquatable<T>
Expand Down
1 change: 0 additions & 1 deletion Packages/GameCanvas/Runtime/Scripts/Interface/IScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// </remarks>
/*------------------------------------------------------------*/
#nullable enable

namespace GameCanvas
{
public interface IScene
Expand Down
Loading

0 comments on commit fe4cb04

Please sign in to comment.