Files
Seele/src/Engine/Window/WindowManager.h
T

38 lines
726 B
C++
Raw Normal View History

#pragma once
2021-01-19 15:30:00 +01:00
#include "Graphics/GraphicsResources.h"
#include "Graphics/Graphics.h"
#include "Containers/Array.h"
2020-05-05 01:51:13 +02:00
#include "Window.h"
namespace Seele
{
2020-04-12 15:47:19 +02:00
class WindowManager
{
public:
WindowManager();
~WindowManager();
2021-11-11 20:12:50 +01:00
Job init();
2020-05-05 01:51:13 +02:00
PWindow addWindow(const WindowCreateInfo &createInfo);
2021-11-01 20:25:16 +01:00
void notifyWindowClosed(PWindow window);
2020-06-02 11:46:18 +02:00
static Gfx::PGraphics getGraphics()
2020-05-05 01:51:13 +02:00
{
return graphics;
}
2020-04-12 15:47:19 +02:00
inline bool isActive() const
{
2020-04-12 15:47:19 +02:00
return windows.size();
}
2021-11-11 20:12:50 +01:00
void waitForCompletion()
{
std::unique_lock lock(windowsLock);
windowsCV.wait(lock);
}
2020-04-12 15:47:19 +02:00
private:
2020-05-05 01:51:13 +02:00
Array<PWindow> windows;
2021-11-11 20:12:50 +01:00
std::mutex windowsLock;
std::condition_variable windowsCV;
2020-06-02 11:46:18 +02:00
static Gfx::PGraphics graphics;
2020-04-12 15:47:19 +02:00
};
2021-04-01 16:40:14 +02:00
DEFINE_REF(WindowManager)
2020-04-12 15:47:19 +02:00
} // namespace Seele