-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
372 additions
and
60 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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
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
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include "eNotifManager.h" | ||
#include <iostream> | ||
#include <Windows.h> | ||
#include "..\imgui\imgui.h" | ||
|
||
eNotificationManager* Notifications = new eNotificationManager(); | ||
|
||
void eNotificationManager::Init() | ||
{ | ||
m_bIsNotificationActive = false; | ||
m_tTimer = GetTickCount64(); | ||
} | ||
|
||
void eNotificationManager::Update() | ||
{ | ||
if (GetTickCount64() - m_tTimer <= m_nNotificationTime) return; | ||
m_tTimer = GetTickCount64(); | ||
|
||
m_bIsNotificationActive = false; | ||
} | ||
|
||
void eNotificationManager::Draw() | ||
{ | ||
if (m_bIsNotificationActive) | ||
{ | ||
ImGui::SetNextWindowPos(ImVec2(5, 10)); | ||
ImGui::SetNextWindowSize(ImVec2(ImGui::GetIO().DisplaySize.x / 3, 0.0f)); | ||
ImGui::Begin("setup", nullptr, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoInputs | ||
| ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing); | ||
ImGui::TextUnformatted(szMessageBuffer); | ||
} | ||
} | ||
|
||
void eNotificationManager::SetNotificationTime(int time) | ||
{ | ||
m_nNotificationTime = time; | ||
} | ||
|
||
void eNotificationManager::PushNotification(const char * format, ...) | ||
{ | ||
va_list args; | ||
va_start(args, format); | ||
vsprintf(szMessageBuffer, format, args); | ||
va_end(args); | ||
m_bIsNotificationActive = true; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
#include "mk10utils.h" | ||
|
||
class eNotificationManager { | ||
public: | ||
char szMessageBuffer[2048] = {}; | ||
bool m_bIsNotificationActive; | ||
int m_nNotificationTime; | ||
int64 m_tTimer; | ||
|
||
|
||
void Init(); | ||
|
||
void Update(); | ||
void Draw(); | ||
void SetNotificationTime(int time); | ||
void PushNotification(const char* format, ...); | ||
}; | ||
|
||
extern eNotificationManager* Notifications; |
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
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
Oops, something went wrong.