Skip to content

Commit

Permalink
Renamed update to query.
Browse files Browse the repository at this point in the history
  • Loading branch information
genaray committed Jan 12, 2023
1 parent 0fabc37 commit 2a3d6a1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Arch.System.Sample/Systems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ public partial class MovementSystem : BaseSystem<World, GameTime>
private readonly Rectangle _viewport;
public MovementSystem(World world, Rectangle viewport) : base(world) { _viewport = viewport;}

[Update]
[Query]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Move([Data] GameTime time, ref Position pos, ref Velocity vel)
{
pos.Vector2 += time.ElapsedGameTime.Milliseconds * vel.Vector2;
}

[Update]
[Query]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Bounce(ref Position pos, ref Velocity vel)
{
Expand All @@ -48,7 +48,7 @@ public partial class ColorSystem : BaseSystem<World, GameTime>
{
public ColorSystem(World world) : base(world) {}

[Update]
[Query]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ChangeColor([Data] GameTime time, ref Sprite sprite)
{
Expand All @@ -72,7 +72,7 @@ public override void BeforeUpdate(in GameTime t)
_batch.Begin();
}

[Update]
[Query]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Draw(ref Position position, ref Sprite sprite)
{
Expand Down Expand Up @@ -100,7 +100,7 @@ public override void Update(in GameTime t)
PrintEntitiesWithoutVelocityQuery(World); // Call source generated query, which calls the PrintEntitiesWithoutVelocity method
}

[Update]
[Query]
[All<Position, Sprite>, None<Velocity>]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PrintEntitiesWithoutVelocity(in Entity entity)
Expand Down
2 changes: 1 addition & 1 deletion Arch.System.SourceGenerator/SourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace Arch.System.SourceGenerator
// Do a simple filter for methods marked with update
IncrementalValuesProvider<MethodDeclarationSyntax> methodDeclarations = context.SyntaxProvider.CreateSyntaxProvider(
static (s, _) => s is MethodDeclarationSyntax { AttributeLists.Count: > 0 },
static (ctx, _) => GetMethodSymbolIfAttributeof(ctx, "Arch.System.SourceGenerator.UpdateAttribute")
static (ctx, _) => GetMethodSymbolIfAttributeof(ctx, "Arch.System.SourceGenerator.QueryAttribute")
).Where(static m => m is not null)!; // filter out attributed methods that we don't care about

// Combine the selected enums with the `Compilation`
Expand Down
2 changes: 1 addition & 1 deletion Arch.System/Attributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// Marks a method to generate a high performance query for it.
/// </summary>
[global::System.AttributeUsage(global::System.AttributeTargets.Method)]
public class UpdateAttribute : global::System.Attribute
public class QueryAttribute : global::System.Attribute
{
}

Expand Down

0 comments on commit 2a3d6a1

Please sign in to comment.