Skip to content

Commit

Permalink
docs: updated README.md to reflect changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaskowicz1 committed Jan 9, 2024
1 parent dd9737d commit 1e65441
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Rcon++ is a modern Source RCON library for C++, allowing people to easily use RC

This library is used in:
- [Factorio-Discord-Relay Revamped](https://github.com/Jaskowicz1/fdr-remake)
- RCON-UE

If you're using this library, feel free to message me and show me, you might just get your project shown here!

Expand All @@ -31,18 +32,26 @@ We do not test support for MinGW, nor do we want to actively try and support it.

# Getting Started

rcon++ can be installed from the .deb file in the recent actions (soon to be released!).
rcon++ can be installed from the releases section!

We're aiming to start rolling out to package managers soon!

# Quick Example

### Client
```c++
#include <iostream>
#include <rconpp/rcon.h>

int main() {
rconpp::rcon_client client("127.0.0.1", 27015, "changeme");

client.on_log = [](const std::string_view& log) {
std::cout << log << "\n";
};

client.start(true);

client.send_data("Hello!", 3, rconpp::data_type::SERVERDATA_EXECCOMMAND, [](const rconpp::response& response) {
std::cout << "response: " << response.data << "\n";
});
Expand All @@ -51,6 +60,32 @@ int main() {
}
```

### Server
```c++
#include <iostream>
#include <rconpp/rcon.h>

int main() {
rconpp::rcon_server server("0.0.0.0", 27015, "testing");

server.on_log = [](const std::string_view log) {
std::cout << log << "\n";
};

server.on_command = [](const rconpp::client_command& command) {
if (command.command == "/test") {
return "This is a test!";
} else {
return "Hello!";
}
};

server.start(false);
return 0;
}
```

# Contributing

If you want to help out, simply make a fork and submit your PR!
Expand Down

0 comments on commit 1e65441

Please sign in to comment.