8000 GitHub - kevinmkchin/noclip: Single-header library for console commands
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

kevinmkchin/noclip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

noclip

Single header C++11 library for parsing and interpreting commands and arguments from an input stream. Can be used to make REPL-like environments e.g. drop-down console.

Type information is baked into the anonymous functions for setting/getting variables and invoking commands. Type information is used to reify arguments at execution time.

For input and output, noclip.h uses std::istream and std::ostream. This makes parsing of custom types possible by overloading the insertion and extraction operators.

image

Console Commands

void set_cheats(int mode) { ... }
...
console.bind_cmd("sv_cheats", set_cheats);
console.execute("sv_cheats 1", std::cout); // calls set_cheats with mode 1

Console Variables

int hp = 100;
console.bind_cvar("health", &hp);
console.execute("set health 99", std::cout);
console.execute("get health", std::cout); // prints value of hp

Creating the Console

#include "noclip.h"
noclip::console c; // default constructor

More documentation included directly in the header file.

About

Single-header library for console commands

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0