Skip to content

🤪 Tweak constant variables live when running a program

License

Notifications You must be signed in to change notification settings

tversteeg/const-tweaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

		// ...
	}
}