Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b6098d331 | ||
|
|
69d70e4712 | ||
|
|
32fd954952 | ||
|
|
40ea4445cd | ||
|
|
3ca5f984de | ||
|
|
6dbf6c0e3c | ||
|
|
6a05d86801 | ||
|
|
068dfce7ca | ||
|
|
28a9089443 | ||
|
|
e42776a2c8 |
No files matched your search
@@ -1,11 +1,64 @@
|
||||
# Contributing to Rusty Path Of Building
|
||||
|
||||
## Reporting bugs
|
||||
|
||||
- Ensure the bug was not already reported by searching through existing [issues](https://github.com/meehl/rusty-path-of-building/issues).
|
||||
- If the bug can also be reproduced with the official runtime (e.g. by running through wine), please open an issue in the [PoB1](https://github.com/PathOfBuildingCommunity/PathOfBuilding) or [PoB2](https://github.com/PathOfBuildingCommunity/PathOfBuilding-PoE2) repo instead. If you're unsure, feel free to just open it here.
|
||||
- If possible, use the bug report template to create the issue and provide as much information as possible.
|
||||
|
||||
## Contributing code
|
||||
|
||||
- Get familiar with the code base before you start. I'll try to add more documentation providing a high-level overview of the architecture in the future. Until then, feel free to reach out through [Discussions](https://github.com/meehl/rusty-path-of-building/discussions) if you have any questions.
|
||||
- If you intend to work on the API functions, also check out the [SimpleGraphic](https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic) code base. A great place to ask questions about it is the PoB dev discord server. [Here](https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic) is more info on how to join.
|
||||
- Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
|
||||
|
||||
## macOS Development Setup
|
||||
|
||||
### 1. Install Lua runtime dependencies
|
||||
|
||||
The application requires several Lua C libraries at runtime. Install them using LuaRocks with the LuaJIT backend:
|
||||
|
||||
```bash
|
||||
brew install luajit luarocks
|
||||
|
||||
luarocks --lua-version 5.1 install luasocket
|
||||
luarocks --lua-version 5.1 install luautf8
|
||||
luarocks --lua-version 5.1 install lua-curl
|
||||
```
|
||||
|
||||
Build and install `lzip` from the bundled source (requires zlib, which is pre-installed on macOS):
|
||||
|
||||
```bash
|
||||
cd lua/libs/lzip && make LUA_IMPL=luajit install
|
||||
```
|
||||
|
||||
### 2. Configure LUA_CPATH
|
||||
|
||||
Add the following to your shell profile (`~/.zshrc` or `~/.bash_profile`) so the runtime can locate the installed libraries:
|
||||
|
||||
```bash
|
||||
eval $(luarocks --lua-version 5.1 path)
|
||||
```
|
||||
|
||||
Then reload your shell or run `source ~/.bash_profile`.
|
||||
|
||||
### 3. Startup
|
||||
|
||||
```bash
|
||||
cargo run <poe1|poe2>
|
||||
```
|
||||
|
||||
Path of Building files are automatically downloaded to the following directories on first startup:
|
||||
|
||||
- poe1: `~/Library/Application Support/RustyPathOfBuilding1`
|
||||
- poe2: `~/Library/Application Support/RustyPathOfBuilding2`
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
**Build fails with `library 'luajit-5.1' not found`**
|
||||
|
||||
This usually means the build cache points to an old LuaJIT version after a Homebrew upgrade. Run:
|
||||
|
||||
```bash
|
||||
cargo clean && cargo run <poe1|poe2>
|
||||
```
|
||||
@@ -1 +1,3 @@
|
||||
/target/
|
||||
*.so
|
||||
*.so.dSYM
|
||||
+24
-1
@@ -2,6 +2,27 @@
|
||||
|
||||
## [Unreleased] - ReleaseDate
|
||||
|
||||
## [0.2.18] - 2026-05-29
|
||||
|
||||
### Changed
|
||||
|
||||
- Raise `max_texture_array_layers` GPU requirement to support new gem tooltips
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix doubleclick handling
|
||||
|
||||
## [0.2.17] - 2026-05-24
|
||||
|
||||
### Changed
|
||||
|
||||
- Improve macOS compatibility
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix broken selection and display of colored text
|
||||
- Fix black screen during installation on nixOS
|
||||
|
||||
## [0.2.16] - 2026-03-23
|
||||
|
||||
### Fixed
|
||||
@@ -188,8 +209,10 @@
|
||||
- First release
|
||||
|
||||
<!-- next-url -->
|
||||
[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.16...HEAD
|
||||
[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.18...HEAD
|
||||
|
||||
[0.2.18]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.17...v0.2.18
|
||||
[0.2.17]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.16...v0.2.17
|
||||
[0.2.16]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.15...v0.2.16
|
||||
[0.2.15]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.14...v0.2.15
|
||||
[0.2.14]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.13...v0.2.14
|
||||
|
||||
Generated
+66
-2
@@ -372,6 +372,12 @@ dependencies = [
|
||||
"core2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
|
||||
|
||||
[[package]]
|
||||
name = "block2"
|
||||
version = "0.5.1"
|
||||
@@ -648,7 +654,7 @@ checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"core-foundation 0.9.4",
|
||||
"core-graphics-types",
|
||||
"core-graphics-types 0.1.3",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
]
|
||||
@@ -664,6 +670,17 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics-types"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
"core-foundation 0.10.1",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core2"
|
||||
version = "0.4.0"
|
||||
@@ -1792,6 +1809,15 @@ version = "0.11.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "373f5eceeeab7925e0c1098212f2fbc4d416adec9d35051a6ab251e824c1854a"
|
||||
|
||||
[[package]]
|
||||
name = "malloc_buf"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "maybe-rayon"
|
||||
version = "0.1.1"
|
||||
@@ -1817,6 +1843,21 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "metal"
|
||||
version = "0.32.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00c15a6f673ff72ddcc22394663290f870fb224c1bfce55734a75c414150e605"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
"block",
|
||||
"core-graphics-types 0.2.0",
|
||||
"foreign-types",
|
||||
"log",
|
||||
"objc",
|
||||
"paste",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mime"
|
||||
version = "0.3.17"
|
||||
@@ -2039,6 +2080,15 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
|
||||
dependencies = [
|
||||
"malloc_buf",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc-sys"
|
||||
version = "0.3.5"
|
||||
@@ -3099,7 +3149,7 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
||||
|
||||
[[package]]
|
||||
name = "rusty-path-of-building"
|
||||
version = "0.2.16"
|
||||
version = "0.2.18"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"anyhow",
|
||||
@@ -4084,11 +4134,21 @@ dependencies = [
|
||||
"rustc-hash 1.1.0",
|
||||
"smallvec",
|
||||
"thiserror 2.0.18",
|
||||
"wgpu-core-deps-apple",
|
||||
"wgpu-core-deps-windows-linux-android",
|
||||
"wgpu-hal",
|
||||
"wgpu-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-core-deps-apple"
|
||||
version = "27.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0772ae958e9be0c729561d5e3fd9a19679bcdfb945b8b1a1969d9bfe8056d233"
|
||||
dependencies = [
|
||||
"wgpu-hal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-core-deps-windows-linux-android"
|
||||
version = "27.0.0"
|
||||
@@ -4108,16 +4168,20 @@ dependencies = [
|
||||
"arrayvec",
|
||||
"ash",
|
||||
"bitflags 2.11.0",
|
||||
"block",
|
||||
"bytemuck",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
"core-graphics-types 0.2.0",
|
||||
"gpu-alloc",
|
||||
"gpu-descriptor",
|
||||
"hashbrown 0.16.1",
|
||||
"libc",
|
||||
"libloading",
|
||||
"log",
|
||||
"metal",
|
||||
"naga",
|
||||
"objc",
|
||||
"ordered-float",
|
||||
"parking_lot",
|
||||
"portable-atomic",
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@ authors = ["meehl"]
|
||||
description = "Cross-platform runtime for Path of Building"
|
||||
repository = "https://github.com/meehl/rusty-path-of-building"
|
||||
license = "MIT"
|
||||
version = "0.2.16"
|
||||
version = "0.2.18"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
@@ -37,11 +37,11 @@ regex = "1.11.2"
|
||||
reqwest = { version = "0.13.2", features = ["blocking"] }
|
||||
swash = "0.2.5"
|
||||
tar = "0.4.44"
|
||||
wgpu = { version = "27.0.1", default-features = false, features = ["std", "parking_lot", "vulkan", "wgsl"] }
|
||||
wgpu = { version = "27.0.1", default-features = false, features = ["std", "parking_lot", "vulkan", "metal", "wgsl"] }
|
||||
winit = "0.30"
|
||||
zstd = "0.13.3"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
smithay-clipboard = "0.7.3"
|
||||
|
||||
[features]
|
||||
|
||||
+18
-3
@@ -445,14 +445,29 @@ fn get_index_at_cur(
|
||||
let font_type = font_type.parse::<PoBFontType>()?;
|
||||
|
||||
let job = build_layout_job(&text, Srgba::WHITE, font_type, line_height, None);
|
||||
let index = ctx.fonts().get_text_index_at_cursor(
|
||||
let index_stripped = ctx.fonts().get_text_index_at_cursor(
|
||||
job,
|
||||
Point::new(cur_x, cur_y),
|
||||
ctx.window().scale_factor(),
|
||||
);
|
||||
|
||||
// convert to lua's 1-based indexing
|
||||
Ok(index + 1)
|
||||
// build_layout_job() strips all color escape strings from the original string. The
|
||||
// resulting [`LayoutJob`] is then passed to get_text_index_at_cursor() which returns an
|
||||
// index into the **stripped* string.
|
||||
// But PoB expects an index into the **original, unstripped** text. Therefore we need to add
|
||||
// the length of all color escapes up until the cursor position to return the right value.
|
||||
//
|
||||
// TODO: avoid matching and iterating over string twice
|
||||
let mut color_escapes_total_length = 0;
|
||||
for capture in ESCAPE_STR_REGEX.find_iter(&text) {
|
||||
if capture.start() - color_escapes_total_length > index_stripped {
|
||||
break;
|
||||
}
|
||||
color_escapes_total_length += capture.len();
|
||||
}
|
||||
|
||||
// add length of color escapes and convert to lua's 1-based indexing
|
||||
Ok(index_stripped + color_escapes_total_length + 1)
|
||||
}
|
||||
|
||||
pub static ESCAPE_STR_REGEX: LazyLock<Regex> =
|
||||
|
||||
+3
-10
@@ -392,24 +392,17 @@ fn pob_font_definitions() -> FontDefinitions {
|
||||
|
||||
definitions.generic_families.insert(
|
||||
parley::GenericFamily::Monospace,
|
||||
vec!["bitstream-vera-sans-mono".to_owned()],
|
||||
vec!["Bitstream Vera Sans Mono".to_owned()],
|
||||
);
|
||||
|
||||
definitions.generic_families.insert(
|
||||
parley::GenericFamily::SansSerif,
|
||||
vec![
|
||||
"liberation-sans".to_owned(),
|
||||
"liberation-sans-bold".to_owned(),
|
||||
],
|
||||
vec!["Liberation Sans".to_owned()],
|
||||
);
|
||||
|
||||
definitions.generic_families.insert(
|
||||
parley::GenericFamily::Serif,
|
||||
vec![
|
||||
"fontin-regular".to_owned(),
|
||||
"fontin-italic".to_owned(),
|
||||
"fontin-smallcaps".to_owned(),
|
||||
],
|
||||
vec!["Fontin".to_owned(), "Fontin SmallCaps".to_owned()],
|
||||
);
|
||||
|
||||
definitions
|
||||
|
||||
+5
-5
@@ -5,7 +5,7 @@ use raw_window_handle::RawDisplayHandle;
|
||||
/// `smithay_clipboard`: Used on wayland
|
||||
/// `arboard`: All other platforms (check arboard docs for platform support)
|
||||
pub struct Clipboard {
|
||||
#[cfg(target_family = "unix")]
|
||||
#[cfg(target_os = "linux")]
|
||||
smithay: Option<smithay_clipboard::Clipboard>,
|
||||
arboard: Option<arboard::Clipboard>,
|
||||
// fallback if everything else fails. only supports intra-application copy/paste
|
||||
@@ -15,7 +15,7 @@ pub struct Clipboard {
|
||||
impl Clipboard {
|
||||
pub fn new(_raw_display_handle: Option<RawDisplayHandle>) -> Self {
|
||||
Self {
|
||||
#[cfg(target_family = "unix")]
|
||||
#[cfg(target_os = "linux")]
|
||||
smithay: create_smithay_clipboard(_raw_display_handle),
|
||||
arboard: create_arboard_clipboard(),
|
||||
fallback: None,
|
||||
@@ -24,7 +24,7 @@ impl Clipboard {
|
||||
|
||||
/// Sets the text content of clipboard
|
||||
pub fn set_text(&mut self, text: String) {
|
||||
#[cfg(target_family = "unix")]
|
||||
#[cfg(target_os = "linux")]
|
||||
if let Some(clipboard) = &mut self.smithay {
|
||||
clipboard.store(text);
|
||||
return;
|
||||
@@ -40,7 +40,7 @@ impl Clipboard {
|
||||
|
||||
/// Gets the text content of clipboard
|
||||
pub fn get_text(&mut self) -> Option<String> {
|
||||
#[cfg(target_family = "unix")]
|
||||
#[cfg(target_os = "linux")]
|
||||
if let Some(clipboard) = &mut self.smithay {
|
||||
return clipboard.load().ok();
|
||||
}
|
||||
@@ -57,7 +57,7 @@ impl Clipboard {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn create_smithay_clipboard(
|
||||
raw_display_handle: Option<RawDisplayHandle>,
|
||||
) -> Option<smithay_clipboard::Clipboard> {
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ impl GraphicsContext {
|
||||
|
||||
let required_features = wgpu::Features::TEXTURE_COMPRESSION_BC;
|
||||
let required_limits = wgpu::Limits {
|
||||
max_texture_array_layers: 512,
|
||||
max_texture_array_layers: 1024,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
||||
+32
-13
@@ -8,6 +8,15 @@ use winit::{
|
||||
keyboard::{Key, ModifiersState, NamedKey, SmolStr},
|
||||
};
|
||||
|
||||
const DOUBLE_CLICK_DURATION: Duration = Duration::from_millis(500);
|
||||
const DOUBLE_CLICK_MOVE_THRESHOLD: f32 = 5.0;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct MousePressState {
|
||||
time: Instant,
|
||||
pos: LogicalPoint<f32>,
|
||||
}
|
||||
|
||||
/// Current state of various keyboard and mouse inputs for the application.
|
||||
#[derive(Default)]
|
||||
pub struct InputState {
|
||||
@@ -18,7 +27,7 @@ pub struct InputState {
|
||||
/// HashSet of currently pressed mouse buttons.
|
||||
mouse_pressed: HashSet<MouseButton>,
|
||||
/// HashMap of mouse buttons (keys) with the last time they were pressed.
|
||||
mouse_last_pressed: HashMap<MouseButton, Instant>,
|
||||
mouse_last_pressed: HashMap<MouseButton, MousePressState>,
|
||||
/// Current cursor position relative to the top-left corner of the window.
|
||||
cursor_pos: LogicalPoint<f32>,
|
||||
}
|
||||
@@ -41,22 +50,31 @@ impl InputState {
|
||||
/// Updates [`Self::mouse_pressed`](field@Self::mouse_pressed) based on provided
|
||||
/// `button` and `is_pressed`.
|
||||
pub fn set_mouse_pressed(&mut self, button: MouseButton, is_pressed: bool) -> bool {
|
||||
if is_pressed {
|
||||
self.mouse_pressed.insert(button);
|
||||
} else {
|
||||
if !is_pressed {
|
||||
self.mouse_pressed.remove(&button);
|
||||
return false;
|
||||
}
|
||||
|
||||
self.mouse_pressed.insert(button);
|
||||
let now = Instant::now();
|
||||
let last = self.mouse_last_pressed.entry(button);
|
||||
|
||||
match last {
|
||||
std::collections::hash_map::Entry::Occupied(mut occupied_entry) => {
|
||||
let last = occupied_entry.insert(now);
|
||||
now.duration_since(last) < Duration::from_millis(400)
|
||||
let pos = self.cursor_pos;
|
||||
match self.mouse_last_pressed.entry(button) {
|
||||
std::collections::hash_map::Entry::Occupied(mut entry) => {
|
||||
let last = entry.get();
|
||||
let delta = (last.pos - pos).abs();
|
||||
let is_double = now.duration_since(last.time) < DOUBLE_CLICK_DURATION
|
||||
&& delta.x <= DOUBLE_CLICK_MOVE_THRESHOLD
|
||||
&& delta.y <= DOUBLE_CLICK_MOVE_THRESHOLD;
|
||||
if is_double {
|
||||
// Reset so that a triple-click is not treated as two consecutive
|
||||
// double-clicks; the next click starts a fresh timing window.
|
||||
entry.remove();
|
||||
} else {
|
||||
entry.insert(MousePressState { time: now, pos });
|
||||
}
|
||||
is_double
|
||||
}
|
||||
std::collections::hash_map::Entry::Vacant(vacant_entry) => {
|
||||
vacant_entry.insert(now);
|
||||
std::collections::hash_map::Entry::Vacant(entry) => {
|
||||
entry.insert(MousePressState { time: now, pos });
|
||||
false
|
||||
}
|
||||
}
|
||||
@@ -82,6 +100,7 @@ impl InputState {
|
||||
pub fn clear_pressed(&mut self) {
|
||||
self.keys_pressed.clear();
|
||||
self.mouse_pressed.clear();
|
||||
self.mouse_last_pressed.clear();
|
||||
self.key_modifiers = ModifiersState::empty();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user