move /api under /lib
This commit is contained in:
parent
1cca8c5806
commit
9cfc675194
12
cli/main.zig
12
cli/main.zig
@ -3,8 +3,8 @@ const std = @import("std");
|
|||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const Allocator = std.mem.Allocator;
|
const Allocator = std.mem.Allocator;
|
||||||
|
|
||||||
const Artificer = @import("artificer");
|
const Lib = @import("lib");
|
||||||
const Api = @import("artifacts-api");
|
const Api = Lib.Api;
|
||||||
|
|
||||||
const simulated = true;
|
const simulated = true;
|
||||||
|
|
||||||
@ -60,8 +60,8 @@ pub fn main() !void {
|
|||||||
|
|
||||||
const character_id = (try server.getCharacter("Blondie")).?;
|
const character_id = (try server.getCharacter("Blondie")).?;
|
||||||
|
|
||||||
var system_clock = Artificer.SystemClock{};
|
var system_clock = Lib.SystemClock{};
|
||||||
var sim_server = Artificer.SimServer.init(0, &store);
|
var sim_server = Lib.SimServer.init(0, &store);
|
||||||
|
|
||||||
if (simulated) {
|
if (simulated) {
|
||||||
const character = store.characters.get(character_id).?;
|
const character = store.characters.get(character_id).?;
|
||||||
@ -69,9 +69,9 @@ pub fn main() !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var artificer = if (simulated)
|
var artificer = if (simulated)
|
||||||
try Artificer.ArtificerSim.init(allocator, &store, &sim_server.clock, &sim_server, character_id)
|
try Lib.ArtificerSim.init(allocator, &store, &sim_server.clock, &sim_server, character_id)
|
||||||
else
|
else
|
||||||
try Artificer.ArtificerApi.init(allocator, &store, &system_clock, &server, character_id);
|
try Lib.ArtificerApi.init(allocator, &store, &system_clock, &server, character_id);
|
||||||
|
|
||||||
defer artificer.deinit(allocator);
|
defer artificer.deinit(allocator);
|
||||||
|
|
||||||
|
18
gui/app.zig
18
gui/app.zig
@ -1,7 +1,6 @@
|
|||||||
// zig fmt: off
|
// zig fmt: off
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Api = @import("artifacts-api");
|
const Lib = @import("lib");
|
||||||
const Artificer = @import("artificer");
|
|
||||||
const UI = @import("./ui.zig");
|
const UI = @import("./ui.zig");
|
||||||
const RectUtils = @import("./rect-utils.zig");
|
const RectUtils = @import("./rect-utils.zig");
|
||||||
const rl = @import("raylib");
|
const rl = @import("raylib");
|
||||||
@ -13,6 +12,7 @@ const rlgl_h = @cImport({
|
|||||||
|
|
||||||
const assert = std.debug.assert;
|
const assert = std.debug.assert;
|
||||||
const log = std.log.scoped(.app);
|
const log = std.log.scoped(.app);
|
||||||
|
const Api = Lib.Api;
|
||||||
|
|
||||||
const App = @This();
|
const App = @This();
|
||||||
|
|
||||||
@ -39,11 +39,11 @@ blur_shader: rl.Shader,
|
|||||||
|
|
||||||
simulation: bool = false,
|
simulation: bool = false,
|
||||||
|
|
||||||
system_clock: Artificer.SystemClock,
|
system_clock: Lib.SystemClock,
|
||||||
started_at: i128,
|
started_at: i128,
|
||||||
artificer: Artificer.ArtificerApi,
|
artificer: Lib.ArtificerApi,
|
||||||
sim_artificer: Artificer.ArtificerSim,
|
sim_artificer: Lib.ArtificerSim,
|
||||||
sim_server: Artificer.SimServer,
|
sim_server: Lib.SimServer,
|
||||||
sim_started_at: i128,
|
sim_started_at: i128,
|
||||||
last_sim_timestamp: i128 = 0,
|
last_sim_timestamp: i128 = 0,
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ pub fn init(allocator: std.mem.Allocator, store: *Api.Store, server: *Api.Server
|
|||||||
|
|
||||||
const character_id = store.characters.getId("Blondie").?;
|
const character_id = store.characters.getId("Blondie").?;
|
||||||
|
|
||||||
const sim_server = Artificer.SimServer.init(0, store);
|
const sim_server = Lib.SimServer.init(0, store);
|
||||||
|
|
||||||
var app = try allocator.create(App);
|
var app = try allocator.create(App);
|
||||||
errdefer allocator.destroy(app);
|
errdefer allocator.destroy(app);
|
||||||
@ -177,10 +177,10 @@ pub fn init(allocator: std.mem.Allocator, store: *Api.Store, server: *Api.Server
|
|||||||
};
|
};
|
||||||
app.started_at = app.system_clock.nanoTimestamp();
|
app.started_at = app.system_clock.nanoTimestamp();
|
||||||
|
|
||||||
app.sim_artificer = try Artificer.ArtificerSim.init(allocator, store, &app.sim_server.clock, &app.sim_server, character_id);
|
app.sim_artificer = try Lib.ArtificerSim.init(allocator, store, &app.sim_server.clock, &app.sim_server, character_id);
|
||||||
errdefer app.sim_artificer.deinit(allocator);
|
errdefer app.sim_artificer.deinit(allocator);
|
||||||
|
|
||||||
app.artificer = try Artificer.ArtificerApi.init(allocator, store, &app.system_clock, server, character_id);
|
app.artificer = try Lib.ArtificerApi.init(allocator, store, &app.system_clock, server, character_id);
|
||||||
errdefer app.artificer.deinit(allocator);
|
errdefer app.artificer.deinit(allocator);
|
||||||
|
|
||||||
app.artificer_thread = try std.Thread.spawn(.{ .allocator = allocator }, artificer_thread_cb, .{ app });
|
app.artificer_thread = try std.Thread.spawn(.{ .allocator = allocator }, artificer_thread_cb, .{ app });
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// zig fmt: off
|
// zig fmt: off
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Api = @import("artifacts-api");
|
const Lib = @import("lib");
|
||||||
const rl = @import("raylib");
|
const rl = @import("raylib");
|
||||||
const raylib_h = @cImport({
|
const raylib_h = @cImport({
|
||||||
@cInclude("stdio.h");
|
@cInclude("stdio.h");
|
||||||
@ -8,6 +8,8 @@ const raylib_h = @cImport({
|
|||||||
});
|
});
|
||||||
const App = @import("./app.zig");
|
const App = @import("./app.zig");
|
||||||
|
|
||||||
|
const Api = Lib.Api;
|
||||||
|
|
||||||
pub const std_options = .{
|
pub const std_options = .{
|
||||||
.log_scope_levels = &[_]std.log.ScopeLevel{
|
.log_scope_levels = &[_]std.log.ScopeLevel{
|
||||||
.{ .scope = .api, .level = .warn },
|
.{ .scope = .api, .level = .warn },
|
||||||
|
@ -10,7 +10,7 @@ pub const images_uri = std.Uri.parse(images_url) catch @compileError("Images ser
|
|||||||
pub const api_url = "https://api.artifactsmmo.com";
|
pub const api_url = "https://api.artifactsmmo.com";
|
||||||
pub const docs_url = api_url ++ "/openapi.json";
|
pub const docs_url = api_url ++ "/openapi.json";
|
||||||
|
|
||||||
pub const parseDateTime = @import("./date_time/parse.zig").parseDateTime;
|
pub const parseDateTime = @import("../date_time/parse.zig").parseDateTime;
|
||||||
|
|
||||||
pub const Server = @import("server.zig");
|
pub const Server = @import("server.zig");
|
||||||
pub const RateLimit = @import("./ratelimit.zig");
|
pub const RateLimit = @import("./ratelimit.zig");
|
@ -2,7 +2,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Store = @import("../store.zig");
|
const Store = @import("../store.zig");
|
||||||
const EnumStringUtils = @import("../enum_string_utils.zig").EnumStringUtils;
|
const EnumStringUtils = @import("../enum_string_utils.zig").EnumStringUtils;
|
||||||
const parseDateTime = @import("../date_time/parse.zig").parseDateTime;
|
const parseDateTime = @import("../../date_time/parse.zig").parseDateTime;
|
||||||
const json_utils = @import("../json_utils.zig");
|
const json_utils = @import("../json_utils.zig");
|
||||||
pub const Equipment = @import("./equipment.zig");
|
pub const Equipment = @import("./equipment.zig");
|
||||||
const Task = @import("./task.zig");
|
const Task = @import("./task.zig");
|
@ -2,7 +2,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Store = @import("../store.zig");
|
const Store = @import("../store.zig");
|
||||||
const json_utils = @import("../json_utils.zig");
|
const json_utils = @import("../json_utils.zig");
|
||||||
const parseDateTime = @import("../date_time/parse.zig").parseDateTime;
|
const parseDateTime = @import("../../date_time/parse.zig").parseDateTime;
|
||||||
const EnumStringUtils = @import("../enum_string_utils.zig").EnumStringUtils;
|
const EnumStringUtils = @import("../enum_string_utils.zig").EnumStringUtils;
|
||||||
|
|
||||||
const Cooldown = @This();
|
const Cooldown = @This();
|
@ -2,7 +2,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Character = @import("./character.zig");
|
const Character = @import("./character.zig");
|
||||||
const json_utils = @import("../json_utils.zig");
|
const json_utils = @import("../json_utils.zig");
|
||||||
const parseDateTime = @import("../date_time/parse.zig").parseDateTime;
|
const parseDateTime = @import("../../date_time/parse.zig").parseDateTime;
|
||||||
const Store = @import("../store.zig");
|
const Store = @import("../store.zig");
|
||||||
const Item = @import("./item.zig");
|
const Item = @import("./item.zig");
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Store = @import("../store.zig");
|
const Store = @import("../store.zig");
|
||||||
const json_utils = @import("../json_utils.zig");
|
const json_utils = @import("../json_utils.zig");
|
||||||
const parseDateTime = @import("../date_time/parse.zig").parseDateTime;
|
const parseDateTime = @import("../../date_time/parse.zig").parseDateTime;
|
||||||
const json = std.json;
|
const json = std.json;
|
||||||
const Allocator = std.mem.Allocator;
|
const Allocator = std.mem.Allocator;
|
||||||
|
|
@ -2,9 +2,9 @@
|
|||||||
const Root = @import("root.zig");
|
const Root = @import("root.zig");
|
||||||
const Store = @import("./store.zig");
|
const Store = @import("./store.zig");
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const json_utils = @import("json_utils.zig");
|
const json_utils = @import("./json_utils.zig");
|
||||||
const errors = @import("./errors.zig");
|
const errors = @import("./errors.zig");
|
||||||
const stb_image = @import("./stb_image/root.zig");
|
const stb_image = @import("../stb_image/root.zig");
|
||||||
const RateLimit = @import("./ratelimit.zig");
|
const RateLimit = @import("./ratelimit.zig");
|
||||||
|
|
||||||
const FetchError = errors.FetchError;
|
const FetchError = errors.FetchError;
|
@ -1,6 +1,6 @@
|
|||||||
// zig fmt: off
|
// zig fmt: off
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Api = @import("artifacts-api");
|
const Api = @import("./api/root.zig");
|
||||||
const Allocator = std.mem.Allocator;
|
const Allocator = std.mem.Allocator;
|
||||||
|
|
||||||
const GatherGoal = @import("gather_goal.zig");
|
const GatherGoal = @import("gather_goal.zig");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// zig fmt: off
|
// zig fmt: off
|
||||||
const Api = @import("artifacts-api");
|
const Api = @import("./api/root.zig");
|
||||||
|
|
||||||
const Artificer = @import("./artificer.zig");
|
const Artificer = @import("./artificer.zig");
|
||||||
const Context = Artificer.GoalContext;
|
const Context = Artificer.GoalContext;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// zig fmt: off
|
// zig fmt: off
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Api = @import("artifacts-api");
|
const Api = @import("./api/root.zig");
|
||||||
|
|
||||||
const Artificer = @import("./artificer.zig");
|
const Artificer = @import("./artificer.zig");
|
||||||
const Context = Artificer.GoalContext;
|
const Context = Artificer.GoalContext;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// zig fmt: off
|
// zig fmt: off
|
||||||
const Api = @import("artifacts-api");
|
const Api = @import("./api/root.zig");
|
||||||
|
|
||||||
const Artificer = @import("./artificer.zig");
|
const Artificer = @import("./artificer.zig");
|
||||||
const Context = Artificer.GoalContext;
|
const Context = Artificer.GoalContext;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// zig fmt: off
|
// zig fmt: off
|
||||||
const Api = @import("artifacts-api");
|
pub const Api = @import("./api/root.zig");
|
||||||
|
|
||||||
pub const ArtificerType = @import("./artificer.zig").ArtificerType;
|
pub const ArtificerType = @import("./artificer.zig").ArtificerType;
|
||||||
pub const SimServer = @import("./sim_server.zig");
|
pub const SimServer = @import("./sim_server.zig");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// zig fmt: off
|
// zig fmt: off
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Api = @import("artifacts-api");
|
const Api = @import("./api/root.zig");
|
||||||
const SimClock = @import("./sim_clock.zig");
|
const SimClock = @import("./sim_clock.zig");
|
||||||
const Server = @This();
|
const Server = @This();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user