-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathNotifications.h
80 lines (63 loc) · 1.47 KB
/
Notifications.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#pragma once
#include <imgui.h>
#include "list.h"
#include "Timer.h"
#include "windowContext.h"
class Notification_Manager
{
bool open;
bool notificationPush;
STACK_CHILD notification_stack; //notification stack..
Timer t; //timer..
char *data; //data casted to void,held in stack
//context-flags
bool active;
window_context ctx;
ImVec2 window_pos;
public:
Notification_Manager()
{
active=false;
open=true;
notificationPush=false;
notification_stack=STACK_CHILD();
ctx.generate_and_imply_default_settings();
}
void render()
{
if(!notification_stack.isEmpty())
{
t.startTimer();
notificationPush=true;
}
if(t.isActive())
{
int count =0;
if(notificationPush)
{
data=(char*)notification_stack.pop();
notificationPush=false;
}
else;
ImGui::SetNextWindowPos(ctx.win_pos);
ImGui::SetNextWindowBgAlpha(ctx.bg_alfa);
ImGui::SetNextWindowSize(ctx.win_size);
ImGui::Begin("overlay_notification",&open,ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_Tooltip);
ImGui::Textview(ImGui::GetCurrentWindow()->ID,data);
ImGui::End();
if(t.getTicks()>2.0)
t.reset();
else;
}
}
void pushNotification(char msg[1024])
{
data=(char*)malloc(sizeof(char)*1024);
strcpy_s(data,1024,msg);
notification_stack.push((void*)data);
notificationPush=true;
}
~Notification_Manager()
{
}
};