Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/foxnne/pixi
Browse files Browse the repository at this point in the history
  • Loading branch information
foxnne committed Nov 9, 2024
2 parents ae30302 + 131f2b8 commit 768e793
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 12 deletions.
103 changes: 103 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: build
on:
push:
paths-ignore:
- "doc/**"
- "README.md"
- "**.md"
- "LICENSE**"
pull_request:
paths-ignore:
- "doc/**"
- "README.md"
- "**.md"
- "LICENSE**"
jobs:
x86_64-linux:
runs-on: ubuntu-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
env:
DISPLAY: ':99.0'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v1
with:
version: 2024.5.0-mach
mirror: 'https://pkg.machengine.org/zig'
- name: Get GTK3
run: sudo apt install libgtk-3-dev
- name: Launch xvfb
run: Xvfb :99 -screen 0 1680x720x24 > /dev/null 2>&1 &
- name: Build
run: zig build
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: x86_64-linux
path: zig-out/bin
- name: x86_64-linux -> x86_64-windows
run: zig build -Dtarget=x86_64-windows-gnu
x86_64-windows:
runs-on: windows-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v1
with:
version: 2024.5.0-mach
mirror: 'https://pkg.machengine.org/zig'
- name: Build
run: zig build
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: x86_64-windows
path: zig-out/bin
arm64-macos:
runs-on: macos-14
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v1
with:
version: 2024.5.0-mach
mirror: 'https://pkg.machengine.org/zig'
- name: build
run: zig build -Duse_sysgpu=true
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: arm64-macos
path: zig-out/bin
x86_64-macos:
runs-on: macos-12
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v1
with:
version: 2024.5.0-mach
mirror: 'https://pkg.machengine.org/zig'
- name: Build
run: zig build -Duse_sysgpu=true
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: x86_64-macos
path: zig-out/bin
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,23],"origin":[0,22]},{"name":"eraser_0_default","source":[91,0,22,23],"origin":[0,22]},{"name":"bucket_0_default","source":[165,0,15,19],"origin":[0,13]},{"name":"dropper_0_default","source":[113,0,21,22],"origin":[0,21]},{"name":"selection_0_default","source":[23,0,23,24],"origin":[1,22]},{"name":"selection_add_0_default","source":[0,0,23,24],"origin":[1,22]},{"name":"selection_rem_0_default","source":[46,0,23,24],"origin":[1,22]},{"name":"fox_0_default","source":[134,0,31,19],"origin":[5,20]},{"name":"logo_0_default","source":[180,0,3,6],"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":[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}]}
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.
Binary file modified assets/src/cursors.pixi
Binary file not shown.
16 changes: 8 additions & 8 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const builtin = @import("builtin");

const mach = @import("mach");
const mach_gpu_dawn = @import("mach_gpu_dawn");
const xcode_frameworks = @import("xcode_frameworks");

const nfd = @import("src/deps/nfd-zig/build.zig");
const zip = @import("src/deps/zip/build.zig");
Expand Down Expand Up @@ -91,13 +90,14 @@ pub fn build(b: *std.Build) !void {

const nfd_lib = nfd.makeLib(b, target, optimize);
app.compile.root_module.addImport("nfd", nfd_lib);
// if (nfd_lib.target_info.target.os.tag == .macos) {
// // MacOS: this must be defined for macOS 13.3 and older.
// // Critically, this MUST NOT be included as a -D__kernel_ptr_semantics flag. If it is,
// // then this macro will not be defined even if `defineCMacro` was also called!
// nfd_lib.defineCMacro("__kernel_ptr_semantics", "");
// xcode_frameworks.addPaths(nfd_lib);
// }
if (target.result.isDarwin()) {
// // MacOS: this must be defined for macOS 13.3 and older.
// // Critically, this MUST NOT be included as a -D__kernel_ptr_semantics flag. If it is,
// // then this macro will not be defined even if `defineCMacro` was also called!
nfd_lib.addCMacro("__kernel_ptr_semantics", "");
// xcode_frameworks.addPaths(nfd_lib);
mach.addPaths(nfd_lib);
}
app.compile.linkLibrary(zig_imgui_dep.artifact("imgui"));
app.compile.linkLibrary(zstbi.artifact("zstbi"));
zip.link(app.compile);
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<h3 align=center></h3>
</p>

![buildworkflow](https://github.com/foxnne/pixi/actions/workflows/build.yml/badge.svg)

#
**Pixi** is an cross-platform open-source pixel art editor and animation editor written in [Zig](https://github.com/ziglang/zig).

Expand Down
6 changes: 3 additions & 3 deletions src/editor/explorer/sprites.zig
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ pub fn draw() void {
defer imgui.unindent();

if (imgui.beginChild("Sprite", .{
.x = imgui.getWindowWidth(),
.y = pixi.state.settings.sprite_edit_height * pixi.content_scale[1],
.x = -1.0,
.y = pixi.state.settings.sprite_edit_height,
}, imgui.ChildFlags_None, imgui.WindowFlags_ChildWindow)) {
defer imgui.endChild();

Expand Down Expand Up @@ -96,7 +96,7 @@ pub fn draw() void {
if (imgui.collapsingHeader(pixi.fa.atlas ++ " Sprites", imgui.TreeNodeFlags_DefaultOpen)) {
imgui.pushStyleVarImVec2(imgui.StyleVar_FramePadding, .{ .x = 2.0 * pixi.content_scale[0], .y = 5.0 * pixi.content_scale[1] });
defer imgui.popStyleVar();
if (imgui.beginChild("Sprites", .{ .x = imgui.getWindowWidth() - pixi.state.settings.explorer_grip * pixi.content_scale[0], .y = 0.0 }, imgui.ChildFlags_None, imgui.WindowFlags_ChildWindow)) {
if (imgui.beginChild("Sprites", .{ .x = 0.0, .y = 0.0 }, imgui.ChildFlags_None, imgui.WindowFlags_ChildWindow)) {
defer imgui.endChild();

for (file.sprites.items) |sprite| {
Expand Down

0 comments on commit 768e793

Please sign in to comment.