Skip to content

Commit

Permalink
Code style change and reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirius902 committed Oct 23, 2023
1 parent b93f312 commit 3dc9e1f
Show file tree
Hide file tree
Showing 15 changed files with 1,029 additions and 922 deletions.
7 changes: 2 additions & 5 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
Language: Cpp
BasedOnStyle: Google
ColumnLimit: 120
AccessModifierOffset: -4
DerivePointerAlignment: false
IndentWidth: 4
BasedOnStyle: LLVM
PointerAlignment: Left
---
42 changes: 21 additions & 21 deletions src/ConsoleLib.cpp
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
#include "ConsoleLib.h"

void ConsoleLib::MessageOutput(const std::string& Text, int MessageType) {
HANDLE _hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
HANDLE _hConsole = GetStdHandle(STD_OUTPUT_HANDLE);

switch (MessageType) {
case 0:
SetConsoleTextAttribute(_hConsole, 11);
std::cout << "MESSAGE: ";
break;
case 1:
SetConsoleTextAttribute(_hConsole, 10);
std::cout << "SUCCESS: ";
break;
case 2:
SetConsoleTextAttribute(_hConsole, 14);
std::cout << "WARNING: ";
break;
case 3:
SetConsoleTextAttribute(_hConsole, 12);
std::cout << "ERROR: ";
break;
}
switch (MessageType) {
case 0:
SetConsoleTextAttribute(_hConsole, 11);
std::cout << "MESSAGE: ";
break;
case 1:
SetConsoleTextAttribute(_hConsole, 10);
std::cout << "SUCCESS: ";
break;
case 2:
SetConsoleTextAttribute(_hConsole, 14);
std::cout << "WARNING: ";
break;
case 3:
SetConsoleTextAttribute(_hConsole, 12);
std::cout << "ERROR: ";
break;
}

SetConsoleTextAttribute(_hConsole, 7);
std::cout << Text;
SetConsoleTextAttribute(_hConsole, 7);
std::cout << Text;
}
2 changes: 1 addition & 1 deletion src/ConsoleLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

namespace ConsoleLib {
void MessageOutput(const std::string& Text, int MessageType);
}; // namespace ConsoleLib
}; // namespace ConsoleLib
33 changes: 17 additions & 16 deletions src/DCInstance.cpp
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
#include "DCInstance.h"

void DCInstance::InitializeRPC(const char* applicationID) {
Discord_Initialize(applicationID, NULL, 1, NULL);
Discord_Initialize(applicationID, NULL, 1, NULL);

std::memset(&DCInstance::Presence, 0, sizeof(DCInstance::Presence));
std::memset(&DCInstance::Presence, 0, sizeof(DCInstance::Presence));

auto _currTime = std::chrono::system_clock::now().time_since_epoch();
auto _secondCast = std::chrono::duration_cast<std::chrono::seconds>(_currTime);
auto _currTime = std::chrono::system_clock::now().time_since_epoch();
auto _secondCast =
std::chrono::duration_cast<std::chrono::seconds>(_currTime);

DCInstance::Presence.startTimestamp = _secondCast.count();
Discord_UpdatePresence(&DCInstance::Presence);
DCInstance::Presence.startTimestamp = _secondCast.count();
Discord_UpdatePresence(&DCInstance::Presence);
}

void DCInstance::UpdateDetails(const char* input) {
DCInstance::Presence.details = input;
Discord_UpdatePresence(&DCInstance::Presence);
DCInstance::Presence.details = input;
Discord_UpdatePresence(&DCInstance::Presence);
}

void DCInstance::UpdateState(const char* input) {
DCInstance::Presence.state = input;
Discord_UpdatePresence(&DCInstance::Presence);
DCInstance::Presence.state = input;
Discord_UpdatePresence(&DCInstance::Presence);
}

void DCInstance::UpdateLImage(const char* key, const char* text) {
DCInstance::Presence.largeImageKey = key;
DCInstance::Presence.largeImageText = text;
Discord_UpdatePresence(&DCInstance::Presence);
DCInstance::Presence.largeImageKey = key;
DCInstance::Presence.largeImageText = text;
Discord_UpdatePresence(&DCInstance::Presence);
}

void DCInstance::UpdateSImage(const char* key, const char* text) {
DCInstance::Presence.smallImageKey = key;
DCInstance::Presence.smallImageText = text;
Discord_UpdatePresence(&DCInstance::Presence);
DCInstance::Presence.smallImageKey = key;
DCInstance::Presence.smallImageText = text;
Discord_UpdatePresence(&DCInstance::Presence);
}
12 changes: 6 additions & 6 deletions src/DCInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

class DCInstance {
public:
static inline DiscordRichPresence Presence;
static inline DiscordRichPresence Presence;

static void InitializeRPC(const char* applicationID);
static void InitializeRPC(const char* applicationID);

static void UpdateDetails(const char* input);
static void UpdateState(const char* input);
static void UpdateLImage(const char* key, const char* text);
static void UpdateSImage(const char* key, const char* text);
static void UpdateDetails(const char* input);
static void UpdateState(const char* input);
static void UpdateLImage(const char* key, const char* text);
static void UpdateSImage(const char* key, const char* text);
};
Loading

0 comments on commit 3dc9e1f

Please sign in to comment.