27 lines
536 B
C++
27 lines
536 B
C++
#include "client_node.h"
|
|
#include "ydi_client.h"
|
|
|
|
void ClientNode::_bind_methods() {
|
|
ClassDB::bind_method(D_METHOD("connect_to_server"), &self_type::connect_to_server);
|
|
}
|
|
|
|
void ClientNode::exit_tree() {
|
|
ydi::client::disconnect();
|
|
}
|
|
|
|
void ClientNode::_notification(int what) {
|
|
if (Engine::get_singleton()->is_editor_hint()) {
|
|
return;
|
|
}
|
|
switch (what) {
|
|
case NOTIFICATION_EXIT_TREE:
|
|
exit_tree();
|
|
return;
|
|
default:
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ClientNode::connect_to_server(String const &server) {
|
|
ydi::client::connect(server);
|
|
}
|