-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Cattn/web
Add Discord RPC + Clean up server
- Loading branch information
Showing
7 changed files
with
4,470 additions
and
4,317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,56 @@ | ||
#ifndef DATASERVER_H | ||
#define DATASERVER_H | ||
|
||
#include <vector> | ||
#include <iostream> | ||
#include <string> | ||
#include <cstring> | ||
#ifdef _WIN32 | ||
#include <winsock2.h> | ||
#include <ws2tcpip.h> | ||
#pragma comment(lib, "ws2_32.lib") | ||
#else | ||
#include <sys/socket.h> | ||
#include <netinet/in.h> | ||
#include <arpa/inet.h> | ||
#include <unistd.h> | ||
#define SOCKET int | ||
#define INVALID_SOCKET -1 | ||
#define closesocket close | ||
#endif | ||
|
||
#include <thread> | ||
#include <sstream> | ||
#include <json.hpp> | ||
|
||
void sendJsonToServer(const char *json_data, const char *path); | ||
void sendShotDataToServer(); | ||
void sendTurnDataToServer(); | ||
void updateData(const char *value, const std::string &dataTypeInfo, const std::string &path); | ||
void resetData(); | ||
void updateDoubleData(const double &value, const std::string &dataTypeInfo, const std::string &path); | ||
class HoleClass | ||
{ | ||
public: | ||
std::string name; | ||
int shots; | ||
int score; | ||
int par; | ||
int aimTime; | ||
int ranking; | ||
std::string path = "hole"; | ||
|
||
void clear() | ||
{ | ||
name = ""; | ||
shots = 0; | ||
score = 0; | ||
par = 0; | ||
aimTime = 0; | ||
ranking = 0; | ||
}; | ||
}; | ||
|
||
void sendHoleDataToServer(HoleClass& hole); | ||
#ifndef DATASERVER_H | ||
#define DATASERVER_H | ||
|
||
#include <vector> | ||
#include <iostream> | ||
#include <string> | ||
#include <cstring> | ||
#ifdef _WIN32 | ||
#include <winsock2.h> | ||
#include <ws2tcpip.h> | ||
#pragma comment(lib, "ws2_32.lib") | ||
#else | ||
#include <sys/socket.h> | ||
#include <netinet/in.h> | ||
#include <arpa/inet.h> | ||
#include <unistd.h> | ||
#define SOCKET int | ||
#define INVALID_SOCKET -1 | ||
#define closesocket close | ||
#endif | ||
|
||
#include <thread> | ||
#include <sstream> | ||
#include <json.hpp> | ||
|
||
void sendJsonToServer(const char *json_data, const char *path); | ||
void sendShotDataToServer(); | ||
void sendTurnDataToServer(); | ||
void updateData(const std::string& value, const std::string &dataTypeInfo, const std::string &path); | ||
void resetData(); | ||
void updateDoubleData(const double &value, const std::string &dataTypeInfo, const std::string &path); | ||
class HoleClass | ||
{ | ||
public: | ||
std::string name; | ||
std::string holeName; | ||
int shots; | ||
int score; | ||
int par; | ||
int aimTime; | ||
int ranking; | ||
std::string path = "hole"; | ||
|
||
void clear() | ||
{ | ||
name = ""; | ||
shots = 0; | ||
score = 0; | ||
par = 0; | ||
aimTime = 0; | ||
ranking = 0; | ||
}; | ||
}; | ||
|
||
void sendHoleDataToServer(HoleClass& hole); | ||
#endif |
Oops, something went wrong.