Skip to content

Commit

Permalink
Editor: Unify module pointers, assets: update pixi assets
Browse files Browse the repository at this point in the history
  • Loading branch information
foxnne committed Jan 17, 2025
1 parent 8ed7fa6 commit 17e6c29
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion assets/pixi.atlas
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"sprites":[{"name":"pencil_0_default","source":[69,0,22,22],"origin":[0,22]},{"name":"eraser_0_default","source":[91,0,22,22],"origin":[0,22]},{"name":"bucket_0_default","source":[165,0,15,18],"origin":[0,13]},{"name":"dropper_0_default","source":[113,0,21,21],"origin":[0,21]},{"name":"selection_0_default","source":[23,0,23,23],"origin":[0,23]},{"name":"selection_add_0_default","source":[0,0,23,23],"origin":[0,23]},{"name":"selection_rem_0_default","source":[46,0,23,23],"origin":[0,23]},{"name":"fox_0_default","source":[134,0,31,18],"origin":[5,20]},{"name":"logo_0_default","source":[180,0,3,5],"origin":[-10,13]}],"animations":[{"name":"pencil_default","start":0,"length":1,"fps":1},{"name":"eraser_default","start":1,"length":1,"fps":1},{"name":"bucket_default","start":2,"length":1,"fps":1},{"name":"dropper_default","start":3,"length":1,"fps":1},{"name":"selection_default","start":4,"length":1,"fps":1},{"name":"selection_add_default","start":5,"length":1,"fps":1},{"name":"selection_rem_default","start":6,"length":1,"fps":1},{"name":"fox_default","start":7,"length":1,"fps":1},{"name":"logo_default","start":8,"length":1,"fps":1}]}
{"sprites":[{"name":"pencil_0_default","source":[69,0,22,22],"origin":[0,22]},{"name":"eraser_0_default","source":[91,0,22,22],"origin":[0,22]},{"name":"bucket_0_default","source":[161,0,15,18],"origin":[0,13]},{"name":"dropper_0_default","source":[113,0,21,21],"origin":[0,21]},{"name":"selection_0_default","source":[23,0,23,23],"origin":[0,23]},{"name":"selection_add_0_default","source":[0,0,23,23],"origin":[0,23]},{"name":"selection_rem_0_default","source":[46,0,23,23],"origin":[0,23]},{"name":"fox_0_default","source":[134,0,27,18],"origin":[3,20]},{"name":"logo_0_default","source":[176,0,3,5],"origin":[-10,13]}],"animations":[{"name":"pencil_default","start":0,"length":1,"fps":1},{"name":"eraser_default","start":1,"length":1,"fps":1},{"name":"bucket_default","start":2,"length":1,"fps":1},{"name":"dropper_default","start":3,"length":1,"fps":1},{"name":"selection_default","start":4,"length":1,"fps":1},{"name":"selection_add_default","start":5,"length":1,"fps":1},{"name":"selection_rem_default","start":6,"length":1,"fps":1},{"name":"fox_default","start":7,"length":1,"fps":1},{"name":"logo_default","start":8,"length":1,"fps":1}]}
Binary file modified assets/pixi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 17 additions & 12 deletions src/editor/Editor.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub const Settings = @import("Settings.zig");
pub const Colors = @import("Colors.zig");
pub const Recents = @import("Recents.zig");
pub const Tools = @import("Tools.zig");
pub const Theme = @import("Theme.zig");

const zip = @import("zip");
const zstbi = @import("zstbi");
Expand All @@ -18,10 +19,11 @@ const zmath = @import("zmath");

pub const Editor = @This();

pub const Sidebar = @import("Sidebar.zig");
// Modules
pub const Explorer = @import("explorer/Explorer.zig");
pub const Artboard = @import("artboard/Artboard.zig");
pub const Popups = @import("popups/Popups.zig");
pub const Artboard = @import("artboard/Artboard.zig");
pub const Sidebar = @import("Sidebar.zig");

pub const mach_module = .editor;
pub const mach_systems = .{
Expand All @@ -33,18 +35,18 @@ pub const mach_systems = .{
.deinit,
};

pub const Theme = @import("Theme.zig");

theme: Theme,
settings: Settings,
hotkeys: Pixi.input.Hotkeys,
recents: Recents,

// Module pointers
popups: *Popups,
explorer: *Explorer,
popups: *Popups,
artboard: *Artboard,
sidebar: *Sidebar,

settings: Settings = undefined,
hotkeys: Pixi.input.Hotkeys = undefined,
project_folder: ?[:0]const u8 = null,
recents: Recents = undefined,

previous_atlas_export: ?[:0]const u8 = null,
open_files: std.ArrayList(Pixi.storage.Internal.PixiFile) = undefined,
Expand All @@ -68,6 +70,8 @@ pub fn init(
editor: *Editor,
_popups: *Popups,
_explorer: *Explorer,
_artboard: *Artboard,
_sidebar: *Sidebar,
sidebar_mod: mach.Mod(Sidebar),
explorer_mod: mach.Mod(Explorer),
artboard_mod: mach.Mod(Artboard),
Expand All @@ -77,6 +81,11 @@ pub fn init(
.theme = undefined,
.popups = _popups,
.explorer = _explorer,
.artboard = _artboard,
.sidebar = _sidebar,
.settings = try Settings.init(app.arena_allocator.allocator()),
.hotkeys = try Pixi.input.Hotkeys.initDefault(app.allocator),
.recents = try Recents.init(app.allocator),
};

editor.open_files = std.ArrayList(Pixi.storage.Internal.PixiFile).init(app.allocator);
Expand All @@ -88,10 +97,6 @@ pub fn init(
explorer_mod.call(.init);
artboard_mod.call(.init);
popups_mod.call(.init);

editor.settings = try Settings.init(app.arena_allocator.allocator());
editor.hotkeys = try Pixi.input.Hotkeys.initDefault(app.allocator);
editor.recents = try Recents.init(app.allocator);
}

pub fn lateInit(core: *Core, app: *Pixi, editor: *Editor) !void {
Expand Down

0 comments on commit 17e6c29

Please sign in to comment.