module: rename query -> queryDeprecated

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-05-06 14:17:20 -07:00 committed by Stephen Gutekanst
parent 26b2351d4b
commit 2e8926d6fa
16 changed files with 33 additions and 33 deletions

View file

@ -134,7 +134,7 @@ fn audioTick(audio: *Mod) !void {
@memset(mixing_buffer.items, 0);
var did_state_change = false;
var archetypes_iter = audio.entities.query(.{ .all = &.{
var archetypes_iter = audio.entities.queryDeprecated(.{ .all = &.{
.{ .mach_audio = &.{ .samples, .channels, .playing, .index } },
} });
while (archetypes_iter.next()) |archetype| {

View file

@ -132,7 +132,7 @@ fn init(core: *Mod) !void {
}
fn update(core: *Mod) !void {
var archetypes_iter = core.entities.query(.{ .all = &.{
var archetypes_iter = core.entities.queryDeprecated(.{ .all = &.{
.{ .mach_core = &.{
.title,
} },
@ -173,7 +173,7 @@ fn deinit(core: *Mod) void {
core.state().queue.release();
mach.core.deinit();
var archetypes_iter = core.entities.query(.{ .all = &.{
var archetypes_iter = core.entities.queryDeprecated(.{ .all = &.{
.{ .mach_core = &.{
.title,
} },

View file

@ -43,7 +43,7 @@ pub const events = .{
};
fn update(core: *mach.Core.Mod, sprite: *Mod, sprite_pipeline: *gfx.SpritePipeline.Mod) !void {
var archetypes_iter = sprite_pipeline.entities.query(.{ .all = &.{
var archetypes_iter = sprite_pipeline.entities.queryDeprecated(.{ .all = &.{
.{ .mach_gfx_sprite_pipeline = &.{
.built,
} },
@ -69,7 +69,7 @@ fn updatePipeline(
const encoder = device.createCommandEncoder(&.{ .label = label });
defer encoder.release();
var archetypes_iter = sprite.entities.query(.{ .all = &.{
var archetypes_iter = sprite.entities.queryDeprecated(.{ .all = &.{
.{ .mach_gfx_sprite = &.{
.uv_transform,
.transform,

View file

@ -124,7 +124,7 @@ fn init(sprite_pipeline: *Mod) void {
}
fn deinit(sprite_pipeline: *Mod) void {
var archetypes_iter = sprite_pipeline.entities.query(.{ .all = &.{
var archetypes_iter = sprite_pipeline.entities.queryDeprecated(.{ .all = &.{
.{ .mach_gfx_sprite_pipeline = &.{
.built,
} },
@ -138,7 +138,7 @@ fn update(core: *mach.Core.Mod, sprite_pipeline: *Mod) !void {
// Destroy all sprite render pipelines. We will rebuild them all.
deinit(sprite_pipeline);
var archetypes_iter = sprite_pipeline.entities.query(.{ .all = &.{
var archetypes_iter = sprite_pipeline.entities.queryDeprecated(.{ .all = &.{
.{ .mach_gfx_sprite_pipeline = &.{
.texture,
} },
@ -324,7 +324,7 @@ fn preRender(sprite_pipeline: *Mod, core: *mach.Core.Mod) void {
const encoder = core.state().device.createCommandEncoder(&.{ .label = label });
defer encoder.release();
var archetypes_iter = sprite_pipeline.entities.query(.{ .all = &.{
var archetypes_iter = sprite_pipeline.entities.queryDeprecated(.{ .all = &.{
.{ .mach_gfx_sprite_pipeline = &.{
.built,
} },
@ -367,7 +367,7 @@ fn render(sprite_pipeline: *Mod) !void {
sprite_pipeline.state().render_pass = null;
// TODO(sprite): need a way to specify order of rendering with multiple pipelines
var archetypes_iter = sprite_pipeline.entities.query(.{ .all = &.{
var archetypes_iter = sprite_pipeline.entities.queryDeprecated(.{ .all = &.{
.{ .mach_gfx_sprite_pipeline = &.{
.built,
} },

View file

@ -59,7 +59,7 @@ const BuiltText = struct {
};
fn update(core: *mach.Core.Mod, text: *Mod, text_pipeline: *gfx.TextPipeline.Mod) !void {
var archetypes_iter = text_pipeline.entities.query(.{ .all = &.{
var archetypes_iter = text_pipeline.entities.queryDeprecated(.{ .all = &.{
.{ .mach_gfx_text_pipeline = &.{
.built,
} },
@ -97,7 +97,7 @@ fn updatePipeline(
var texture_update = false;
var num_texts: u32 = 0;
var removes = try std.ArrayListUnmanaged(mach.EntityID).initCapacity(allocator, 8);
var archetypes_iter = text.entities.query(.{ .all = &.{
var archetypes_iter = text.entities.queryDeprecated(.{ .all = &.{
.{ .mach_gfx_text = &.{
.transform,
.text,

View file

@ -145,7 +145,7 @@ pub const BuiltPipeline = struct {
};
fn deinit(text_pipeline: *Mod) void {
var archetypes_iter = text_pipeline.entities.query(.{ .all = &.{
var archetypes_iter = text_pipeline.entities.queryDeprecated(.{ .all = &.{
.{ .mach_gfx_text_pipeline = &.{
.built,
} },
@ -163,7 +163,7 @@ fn update(core: *mach.Core.Mod, text_pipeline: *Mod) !void {
// Destroy all text render pipelines. We will rebuild them all.
deinit(text_pipeline);
var archetypes_iter = text_pipeline.entities.query(.{ .all = &.{
var archetypes_iter = text_pipeline.entities.queryDeprecated(.{ .all = &.{
.{ .mach_gfx_text_pipeline = &.{
.is_pipeline,
} },
@ -353,7 +353,7 @@ fn preRender(text_pipeline: *Mod, core: *mach.Core.Mod) void {
const encoder = core.state().device.createCommandEncoder(&.{ .label = label });
defer encoder.release();
var archetypes_iter = text_pipeline.entities.query(.{ .all = &.{
var archetypes_iter = text_pipeline.entities.queryDeprecated(.{ .all = &.{
.{ .mach_gfx_text_pipeline = &.{
.built,
} },
@ -396,7 +396,7 @@ fn render(text_pipeline: *Mod) !void {
text_pipeline.state().render_pass = null;
// TODO(text): need a way to specify order of rendering with multiple pipelines
var archetypes_iter = text_pipeline.entities.query(.{ .all = &.{
var archetypes_iter = text_pipeline.entities.queryDeprecated(.{ .all = &.{
.{ .mach_gfx_text_pipeline = &.{
.built,
} },

View file

@ -114,7 +114,7 @@ pub fn Entities(comptime modules: anytype) type {
};
/// A complex query for entities matching a given criteria
pub const Query = query_mod.Query(modules);
pub const QueryDeprecated = query_mod.QueryDeprecated(modules);
pub const QueryTag = query_mod.QueryTag;
pub fn init(allocator: Allocator) !Self {
@ -628,9 +628,9 @@ pub fn Entities(comptime modules: anytype) type {
}
// Queries for archetypes matching the given query.
pub fn query(
pub fn queryDeprecated(
entities: *Self,
q: Query,
q: QueryDeprecated,
) ArchetypeIterator(modules) {
return ArchetypeIterator(modules).init(entities, q);
}
@ -721,12 +721,12 @@ pub fn ArchetypeIterator(comptime modules: anytype) type {
const EntitiesT = Entities(modules);
return struct {
entities: *EntitiesT,
query: EntitiesT.Query,
query: EntitiesT.QueryDeprecated,
index: usize,
const Self = @This();
pub fn init(entities: *EntitiesT, query: EntitiesT.Query) Self {
pub fn init(entities: *EntitiesT, query: EntitiesT.QueryDeprecated) Self {
return Self{
.entities = entities,
.query = query,
@ -921,7 +921,7 @@ test "example" {
//-------------------------------------------------------------------------
// Query for archetypes that have all of the given components
var iter = world.query(.{ .all = &.{
var iter = world.queryDeprecated(.{ .all = &.{
.{ .game = &.{.rotation} },
} });
while (iter.next()) |archetype| {

View file

@ -96,7 +96,7 @@ test "entities DB" {
//-------------------------------------------------------------------------
// Querying
var iter = world.entities.query(.{ .all = &.{
var iter = world.entities.queryDeprecated(.{ .all = &.{
.{ .physics = &.{.id} },
} });

View file

@ -10,7 +10,7 @@ pub const QueryTag = enum {
};
/// A complex query for entities matching a given criteria
pub fn Query(comptime modules: anytype) type {
pub fn QueryDeprecated(comptime modules: anytype) type {
const component_types_by_name = ComponentTypesByName(modules){};
return union(QueryTag) {
// TODO: cleanup comptime
@ -102,7 +102,7 @@ test "query" {
},
});
const Q = Query(modules);
const Q = QueryDeprecated(modules);
// Namespace type lets us select a single namespace.
try testing.expectEqual(@as(Q.Namespace, .game), .game);