SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Toggle main menu visibility
Loading...
Searching...
No Matches
gamepp.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <optional>
4
#include <string>
5
#include <string_view>
6
7
#include <
sourcepp/Math.h
>
8
9
namespace
gamepp
{
10
11
class
GameInstance
{
12
public
:
20
[[nodiscard]]
static
std::optional<GameInstance>
find
(std::string_view windowNameOverride =
""
);
21
26
[[nodiscard]] std::string
getWindowTitle
()
const
;
27
32
[[nodiscard]] sourcepp::math::Vec2i
getWindowPos
()
const
;
33
38
[[nodiscard]] sourcepp::math::Vec2i
getWindowSize
()
const
;
39
45
const
GameInstance
&
command
(std::string_view
command
)
const
;
// NOLINT(*-use-nodiscard)
46
52
const
GameInstance
&
inputBegin
(std::string_view input)
const
;
// NOLINT(*-use-nodiscard)
53
59
const
GameInstance
&
inputEnd
(std::string_view input)
const
;
// NOLINT(*-use-nodiscard)
60
66
const
GameInstance
&
inputOnce
(std::string_view input)
const
;
// NOLINT(*-use-nodiscard)
67
74
const
GameInstance
&
inputHold
(std::string_view input,
double
sec)
const
;
// NOLINT(*-use-nodiscard)
75
81
const
GameInstance
&
wait
(
double
sec)
const
;
// NOLINT(*-use-nodiscard)
82
83
protected
:
84
GameInstance
() =
default
;
85
86
void
*
hwnd
;
87
};
88
89
}
// namespace gamepp
Math.h
gamepp::GameInstance::inputHold
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.
Definition
gamepp.cpp:104
gamepp::GameInstance::inputBegin
const GameInstance & inputBegin(std::string_view input) const
Begin "pressing" an input such as forward or left.
Definition
gamepp.cpp:89
gamepp::GameInstance::getWindowSize
sourcepp::math::Vec2i getWindowSize() const
Get the window size on-screen.
Definition
gamepp.cpp:79
gamepp::GameInstance::wait
const GameInstance & wait(double sec) const
Sleep on the current thread for the given number of seconds.
Definition
gamepp.cpp:109
gamepp::GameInstance::command
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).
Definition
gamepp.cpp:83
gamepp::GameInstance::GameInstance
GameInstance()=default
gamepp::GameInstance::find
static std::optional< GameInstance > find(std::string_view windowNameOverride="")
Find a running instance of a Source engine game.
Definition
gamepp.cpp:67
gamepp::GameInstance::hwnd
void * hwnd
Definition
gamepp.h:86
gamepp::GameInstance::inputOnce
const GameInstance & inputOnce(std::string_view input) const
Begin and end "pressing" an input in one tick, like tapping the use key.
Definition
gamepp.cpp:99
gamepp::GameInstance::inputEnd
const GameInstance & inputEnd(std::string_view input) const
End "pressing" an input such as forward or left.
Definition
gamepp.cpp:94
gamepp::GameInstance::getWindowTitle
std::string getWindowTitle() const
Get the human-readable window title.
Definition
gamepp.cpp:71
gamepp::GameInstance::getWindowPos
sourcepp::math::Vec2i getWindowPos() const
Get the window position on-screen.
Definition
gamepp.cpp:75
gamepp
Definition
gamepp.h:9
include
gamepp
gamepp.h
Generated on
for SourcePP by
1.17.0