Skip to content

Commit

Permalink
Merge branch 'master' into macos-premultiply-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
zkxs committed Jul 3, 2024
2 parents 1369ec3 + 469f12a commit 0732ccf
Show file tree
Hide file tree
Showing 25 changed files with 116 additions and 395 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
[package]
version = "1.1.3"
version = "1.1.4"
authors = ["Michael Ripley <[email protected]"]
edition = "2021"
license = "GPL-3.0-only"
name = "simple-crosshair-overlay"
description = "A simple native crosshair overlay"
readme = "README.md"
homepage = "https://github.com/zkxs/simple-crosshair-overlay"
repository = "https://github.com/zkxs/simple-crosshair-overlay"
documentation = "https://github.com/zkxs/simple-crosshair-overlay"
keywords = ["application", "overlay", "window", "crosshair"]
categories = []

Expand Down
16 changes: 12 additions & 4 deletions MAINTENANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ This document contains some common commands that I need to remember for package

To check all supported targets for compilation/lint errors, run:

`cargo clippy --target x86_64-pc-windows-msvc --target x86_64-apple-darwin --target aarch64-apple-darwin --all-features`
`cargo clippy --target x86_64-pc-windows-msvc --target x86_64-apple-darwin --target aarch64-apple-darwin --all-features --all-targets`

## Tests

`cargo test`

## Bloat Measurement

1. Temporarily comment out `strip = true` in [Cargo.toml](Cargo.toml)
1. Install [cargo-bloat](https://github.com/RazrFalcon/cargo-bloat)
2. Run `cargo +nightly bloat -Z build-std=std --target x86_64-pc-windows-msvc --profile=release-optimized-debug -n 50 --crates`

## Benchmarks
Expand All @@ -33,8 +33,16 @@ Run [benchmarks](benches) with

## Profiling

1. elevate to administrator privileges
2. `cargo flamegraph --profile=release-optimized-debug`
1. Install [flamegraph](https://github.com/flamegraph-rs/flamegraph)
2. elevate to administrator privileges
3. `cargo flamegraph --profile=release-optimized-debug`

## Unused Dependencies

1. Install [cargo-udeps](https://github.com/est31/cargo-udeps)
2. Be able to compile for the target you want to test
3. This MUST be run under the nightly toolchain
4. `cargo +nightly udeps`

## Size-Optimized Build Using Nightly Rust

Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A performant native crosshair overlay without unnecessary bloat. Free and open-s

## Features

- Works on any application that's not fullscreen exclusive. You **must** use windowed or borderless-windowed mode on your game. This was an intentional design choice, as rendering into a fullscreen-exclusive game is not anticheat-compatible.
- Works on any application that's not fullscreen exclusive. You **must** use windowed or borderless-windowed mode on your game. This was an intentional design choice, as rendering into a fullscreen-exclusive game is not anti-cheat-compatible.
- Performant: the overlay is only redrawn when you change the crosshair. CPU, GPU, and memory usage are minimal.
- Minimal UI: managed via a tray icon and hotkeys.
- Comes with a simple default crosshair that can be scaled and recolored to your preference.
Expand All @@ -26,10 +26,13 @@ A performant native crosshair overlay without unnecessary bloat. Free and open-s
2. Run simple-crosshair-overlay.exe
3. Optionally, if you want a start menu shortcut you can make one yourself! Simply right-click simple-crosshair-overlay.exe and select "Pin to Start". This will automatically create a shortcut in `%appdata%\Microsoft\Windows\Start Menu\Programs`.

**MacOS** binaries are available, but completely untested as I lack hardware to test against. See the [MacOS support tracking issue](https://github.com/zkxs/simple-crosshair-overlay/issues/3).
**macOS** binaries are available, but I lack hardware to test against so I do not know if they work. If you're using simple-crosshair-overlay on macOS please let me know in the [macOS support tracking issue](https://github.com/zkxs/simple-crosshair-overlay/issues/3).

**Linux** is presently unsupported, pending resolution of a few issues. See the [Linux support tracking issue](https://github.com/zkxs/simple-crosshair-overlay/issues/6). Additionally, you must have the following prerequisites installed:
**Linux** is presently unsupported, pending resolution of a few issues. See the [Linux support tracking issue](https://github.com/zkxs/simple-crosshair-overlay/issues/6) for details.
<!--
Additionally, you must have the following prerequisites installed:
- libappindicator-gtk3
-->

## Usage

Expand Down
2 changes: 1 addition & 1 deletion benches/color_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use std::hint::black_box;
use criterion::{BatchSize, Criterion};

use simple_crosshair_overlay::util::image;
use simple_crosshair_overlay::private::util::image;

pub fn bench_color_picker(c: &mut Criterion) {
let mut group = c.benchmark_group("Color Picker Implementations");
Expand Down
11 changes: 3 additions & 8 deletions benches/hotkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use std::time::{Duration, Instant};

use criterion::Criterion;

use simple_crosshair_overlay::hotkey::KeyBindings;
use simple_crosshair_overlay::platform;
use simple_crosshair_overlay::platform::KeyboardState;
use simple_crosshair_overlay::private::hotkey::KeyBindings;
use simple_crosshair_overlay::private::platform;
use simple_crosshair_overlay::private::platform::KeyboardState;

pub fn bench_key_poll(c: &mut Criterion) {
let mut group = c.benchmark_group("Key poll");
Expand All @@ -21,11 +21,6 @@ pub fn bench_key_poll(c: &mut Criterion) {
bencher.iter(|| keyboard_state.poll())
});

let mut keyboard_state = platform::windows::WinApiKeyboardState::default();
group.bench_function("winapi", |bencher| {
bencher.iter(|| keyboard_state.poll());
});

group.finish();
}

Expand Down
12 changes: 8 additions & 4 deletions src-lib/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
// See LICENSE file for full text.
// Copyright © 2023 Michael Ripley

pub mod hotkey;
pub mod platform;
pub mod settings;
pub mod util;
//! This library is used by the simple-crosshair-overlay application and is not intended for public
//! use. Due to limitations of criterion, I can only benchmark functions in the public library. Due
//! to limitations of crates.io, all used libraries must be published. The result is I'm forced to
//! publish my internal API publicly.
//!
//! **This library will not be following semantic-versioning** as again, it is not intended to be
//! public API.
pub mod private;
Loading

0 comments on commit 0732ccf

Please sign in to comment.