#const #gamedev #gui

macro const-tweaker-attribute

Tweak constant variables live from a web GUI

7 releases (4 breaking)

0.5.0 Apr 13, 2020
0.4.1 Mar 28, 2020
0.3.0 Mar 22, 2020
0.2.0 Mar 22, 2020
0.1.1 Mar 21, 2020

#174 in #const

45 downloads per month
Used in 3 crates (via const-tweaker)

AGPL-3.0-or-later

16KB
425 lines

const-tweaker

Tweak const variables live from a web GUI.

CI Version Rust Documentation License


This library opens a web interface when the application is run, allowing you to change the values of constants in real time. It's especially useful for gamedev where you want to tweak some variables without introducing a hot-reloading scripting language for it.

After running your application the web GUI to change constants is opened at 127.0.0.1:9938.

Example

// Create a slider to tweak 'VALUE' in the web GUI
#[const_tweaker::tweak]
const VALUE: f64 = 0.0;

fn main() {
	// Enter a GUI/Game loop
	loop {
		// Print the constant value that can be changed from the website
		println!("VALUE: {}", VALUE);

		// ...
	}
}

Dependencies

~2MB
~42K SLoC