Skip to content

Commit

Permalink
lots of minor things
Browse files Browse the repository at this point in the history
  • Loading branch information
RealRTTV committed Mar 19, 2024
1 parent c271ff8 commit 0e5c54b
Show file tree
Hide file tree
Showing 19 changed files with 435 additions and 221 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "nbtworkbench"
version = "1.2.2"
version = "1.2.3"
edition = "2021"
description = "A modern NBT Editor written in Rust designed for performance and efficiency."
license-file = "LICENSE"
repository = "https://github.com/RealRTTV/nbtworkbench"
keywords = ["nbt", "window", "unsafe", "editor", "tree"]
categories = ["graphics", "rendering", "text-editors", "parser-implementations"]

[lib]
[target.'cfg(target_arch = "wasm32")'.lib]
crate-type = ["cdylib", "rlib"]
path = "src/main.rs"

Expand Down
19 changes: 8 additions & 11 deletions src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,10 @@ pub const OPEN_ARRAY_IN_HEX_UV: Vec2u = Vec2u::new(35, 131);
pub const OPEN_IN_TXT: Vec2u = Vec2u::new(51, 131);
pub const SORT_COMPOUND_BY_NAME: Vec2u = Vec2u::new(67, 131);
pub const SORT_COMPOUND_BY_TYPE: Vec2u = Vec2u::new(83, 131);
pub const SORT_COMPOUND_BY_NOTHING: Vec2u = Vec2u::new(0, 160);
pub const SORT_COMPOUND_BY_NOTHING: Vec2u = Vec2u::new(3, 163);
pub const FREEHAND_MODE_UV: Vec2u = Vec2u::new(0, 144);
pub const ENABLED_FREEHAND_MODE_UV: Vec2u = Vec2u::new(16, 144);
pub const STEAL_ANIMATION_OVERLAY_UV: Vec2u = Vec2u::new(64, 144);
pub const STAMP_BACKDROP_UV: Vec2u = Vec2u::new(16, 160);
pub const MAGNIFYING_GLASS_UV: Vec2u = Vec2u::new(96, 48);

pub const BYTE_UV: Vec2u = Vec2u::new(0, 0);
pub const SHORT_UV: Vec2u = Vec2u::new(16, 0);
Expand Down Expand Up @@ -139,6 +137,12 @@ pub const ALERT_UV: Vec2u = Vec2u::new(112, 144);
pub const BACKDROP_UV: Vec2u = Vec2u::new(32, 160);
pub const ADD_SEARCH_BOOKMARKS: Vec2u = Vec2u::new(48, 160);
pub const REMOVE_SEARCH_BOOKMARKS: Vec2u = Vec2u::new(64, 160);
pub const SEARCH_KEYS: Vec2u = Vec2u::new(80, 160);
pub const SEARCH_VALUES: Vec2u = Vec2u::new(80, 176);
pub const SEARCH_KEYS_AND_VALUES: Vec2u = Vec2u::new(80, 192);
pub const STRING_SEARCH_MODE: Vec2u = Vec2u::new(96, 160);
pub const REGEX_SEARCH_MODE: Vec2u = Vec2u::new(96, 176);
pub const SNBT_SEARCH_MODE: Vec2u = Vec2u::new(96, 192);

pub const BASE_Z: u8 = 5;
pub const JUST_OVERLAPPING_BASE_Z: u8 = BASE_Z + 1;
Expand All @@ -160,10 +164,8 @@ pub const TOOLTIP_Z: u8 = 250;

#[allow(clippy::cast_ptr_alignment)]
pub fn icon() -> Vec<u8> {
#[cfg(all(debug_assertions, not(target_arch = "wasm32")))]
let start = unsafe { core::arch::x86_64::_rdtsc() };
// error!("Hello, world!");
let original = match (since_epoch().as_micros() & 7) as u8 {
let original = match (since_epoch().as_millis() & 7) as u8 {
// it's a good random only because its used once
0 => OTHERSIDE_MUSIC_DISC_ICON,
1 => PIGSTEP_MUSIC_DISC_ICON,
Expand Down Expand Up @@ -209,10 +211,5 @@ pub fn icon() -> Vec<u8> {
}
}
let mut scaled = ManuallyDrop::new(core::hint::black_box(scaled));
#[cfg(all(debug_assertions, not(target_arch = "wasm32")))]
crate::log!(
"took {} cycles",
unsafe { core::arch::x86_64::_rdtsc() } - start
);
unsafe { Vec::from_raw_parts(scaled.as_mut_ptr().cast::<u8>(), 16384, 16384) }
}
Binary file modified src/assets/atlas.hex
Binary file not shown.
Binary file modified src/assets/build/atlas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0e5c54b

Please sign in to comment.