![]() |
SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
|
#include <gamepp.h>
Public Member Functions | |
| std::string | getWindowTitle () const |
| Get the human-readable window title. | |
| sourcepp::math::Vec2i | getWindowPos () const |
| Get the window position on-screen. | |
| sourcepp::math::Vec2i | getWindowSize () const |
| Get the window size on-screen. | |
| const GameInstance & | command (std::string_view command) const |
| Send a command to the engine (ran as if it was entered into the console by the user). | |
| const GameInstance & | inputBegin (std::string_view input) const |
| Begin "pressing" an input such as forward or left. | |
| const GameInstance & | inputEnd (std::string_view input) const |
| End "pressing" an input such as forward or left. | |
| const GameInstance & | inputOnce (std::string_view input) const |
| Begin and end "pressing" an input in one tick, like tapping the use key. | |
| const GameInstance & | inputHold (std::string_view input, double sec) const |
| Begin and end "pressing" an input in the given timespan, like holding the use key. | |
| const GameInstance & | wait (double sec) const |
| Sleep on the current thread for the given number of seconds. | |
Static Public Member Functions | |
| static std::optional< GameInstance > | find (std::string_view windowNameOverride="") |
| Find a running instance of a Source engine game. | |
Protected Member Functions | |
| GameInstance ()=default | |
Protected Attributes | |
| void * | hwnd |
|
protecteddefault |
| const GameInstance & GameInstance::command | ( | std::string_view | command | ) | const |
Send a command to the engine (ran as if it was entered into the console by the user).
| command | The command to run. |
Definition at line 83 of file gamepp.cpp.
|
staticnodiscard |
Find a running instance of a Source engine game.
Note that this function will only ever succeed on Windows, because Valve never bothered to expose this functionality on Linux.
| windowNameOverride | The classname of the window to search for, e.g. "Valve001". If unspecified it will check for "Valve001" and "Strata001". |
Definition at line 67 of file gamepp.cpp.
|
nodiscard |
Get the window position on-screen.
Definition at line 75 of file gamepp.cpp.
|
nodiscard |
|
nodiscard |
Get the human-readable window title.
Definition at line 71 of file gamepp.cpp.
| const GameInstance & GameInstance::inputBegin | ( | std::string_view | input | ) | const |
Begin "pressing" an input such as forward or left.
| input | The input to run (without the plus sign prefix). |
Definition at line 89 of file gamepp.cpp.
| const GameInstance & GameInstance::inputEnd | ( | std::string_view | input | ) | const |
End "pressing" an input such as forward or left.
| input | The input to run (without the minus sign prefix). |
Definition at line 94 of file gamepp.cpp.
| const GameInstance & GameInstance::inputHold | ( | std::string_view | input, |
| double | sec ) const |
Begin and end "pressing" an input in the given timespan, like holding the use key.
| input | The input to run (without any prefix). |
| sec | The time to hold the input for. |
Definition at line 104 of file gamepp.cpp.
| const GameInstance & GameInstance::inputOnce | ( | std::string_view | input | ) | const |
Begin and end "pressing" an input in one tick, like tapping the use key.
| input | The input to run (without any prefix). |
Definition at line 99 of file gamepp.cpp.
| const GameInstance & GameInstance::wait | ( | double | sec | ) | const |
Sleep on the current thread for the given number of seconds.
| sec | The number of seconds. |
Definition at line 109 of file gamepp.cpp.