Skip to content

Commit

Permalink
feat: interactive GUI for pixel_match (#33)
Browse files Browse the repository at this point in the history
* show recovered image

* show cell border

* movable cell border

* multithreading

* edge

* refactor

* recalculate

* wip

* buggy

* fixed

* algo

* blacklist works on shaker

* prepare for confirmed pairs

* refactor part.1

* split

* VecOnGrid<Option<_>> -> VecOnGrid<_>

* wip

* now confirmed_pairs works

* draggable to x and y axis

* combine

* ugly but better

* connected square on drag

* wip

* fix dragging bug

* refactor shaker

* select root at begin

* fix draggable dir

* remove temp code

* remove unused gitignore

* update ci to install sdl2

* remote unneeded features of sdl2
  • Loading branch information
kawaemon authored Oct 7, 2021
1 parent 6f857ca commit 8a1646e
Show file tree
Hide file tree
Showing 12 changed files with 1,355 additions and 80 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Setup SDL2
run: |
cargo install cargo-vcpkg
cargo vcpkg -v build
- name: Build
run: cargo build --release --verbose
- name: Run tests
Expand All @@ -31,6 +35,10 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Setup SDL2
run: |
cargo install cargo-vcpkg
cargo vcpkg -v build
- run: rustup component add clippy
- uses: actions-rs/clippy-check@v1
with:
Expand Down
64 changes: 51 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ default-run = "procon2021_comp"
anyhow = "1.0.40"
easy-parallel = "3.1.0"
image = "0.23.14"
bitflags = "1.3.2"

reqwest = { version = "0.11.4", features = ["blocking"], optional = true }
dotenv = { version = "0.15.0", optional = true }
Expand All @@ -28,3 +29,17 @@ rand = "0.8.4"
[profile.release]
codegen-units = 1
lto = "fat"
debug = true

[dependencies.sdl2]
version = "0.34"
default-features = false
features = ["ttf", "static-link", "use-vcpkg"]

[package.metadata.vcpkg]
dependencies = ["sdl2", "sdl2-ttf"]
git = "https://github.com/microsoft/vcpkg"
rev = "261c458af6e3eed5d099144aff95d2b5035f656b"

[package.metadata.vcpkg.target]
x86_64-pc-windows-msvc = { triplet = "x64-windows-static-md" }
Binary file added mplus-1m-medium.ttf
Binary file not shown.
8 changes: 4 additions & 4 deletions src/basis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub(crate) struct Operation {
}

/// `Rot` はある断片画像を原画像の状態から時計回りに回転させた角度を表す.
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum Rot {
R0,
R90,
Expand All @@ -117,7 +117,7 @@ pub(crate) enum Rot {

impl Rot {
#[inline]
fn as_num(self) -> u8 {
pub(crate) fn as_num(self) -> u8 {
match self {
Rot::R0 => 0,
Rot::R90 => 1,
Expand All @@ -127,7 +127,7 @@ impl Rot {
}

#[inline]
fn from_num(rot: u8) -> Self {
pub(crate) fn from_num(rot: u8) -> Self {
assert!(rot <= 3, "rot must be lower than 4");
match rot {
0 => Rot::R0,
Expand All @@ -147,7 +147,7 @@ impl AddAssign for Rot {
}

/// `Dir` はある断片画像において辺が位置する向きを表す.
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum Dir {
North,
East,
Expand Down
Loading

0 comments on commit 8a1646e

Please sign in to comment.