MeshLib C++ Docs
Loading...
Searching...
No Matches
MRSplashWindow.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRViewerFwd.h"
4#include <string>
5#include <functional>
6#include <atomic>
7#include <thread>
8#include <memory>
9
10struct GLFWwindow;
11struct ImGuiContext;
12
13namespace MR
14{
17
18
21class MRVIEWER_CLASS SplashWindow
22{
23public:
24 MRVIEWER_API SplashWindow( std::string name );
25
27 MRVIEWER_API virtual ~SplashWindow();
28
31 MRVIEWER_API void start();
32
34 MRVIEWER_API void stop();
35
37 virtual float minimumTimeSec() const { return 2.f; }
38
39protected:
40 std::string name_;
41
42 GLFWwindow* window_{ nullptr };
43 ImGuiContext* guiContext_{ nullptr };
44
45 std::atomic<bool> terminate_{ false };
46private:
48 virtual void afterStart_() {}
50 virtual void beforeStop_() {}
51
53 virtual void setup_() const = 0;
55 virtual void postInit_() {}
57 virtual void positioning_( float hdpiScale ) = 0;
59 virtual void reloadFont_( float hdpiScale, float pixelRatio ) = 0;
61 virtual bool frame_( float scaling ) = 0;
63 virtual void preDestruct_() {}
65 virtual void postDestruct_() {}
66
67 std::thread thread_;
68};
69
70#ifndef __EMSCRIPTEN__
71class MRVIEWER_CLASS DefaultSplashWindow final : public SplashWindow
72{
73public:
74 MRVIEWER_API DefaultSplashWindow();
75private:
76 virtual void setup_() const override;
77 virtual void postInit_() override;
78 virtual void positioning_( float hdpiScale ) override;
79 virtual void reloadFont_( float hdpiScale, float pixelRatio ) override;
80 virtual bool frame_( float scaling ) override;
81 virtual void preDestruct_() override;
82
83 std::shared_ptr<ImGuiImage> splashImage_;
84 std::string versionStr_;
85};
86#endif
87}
Definition MRSplashWindow.h:72
Definition MRSplashWindow.h:22
virtual float minimumTimeSec() const
Returns minimum time in seconds, splash screen to be present.
Definition MRSplashWindow.h:37
MRVIEWER_API void stop()
Closes splash window if it is still opened.
MRVIEWER_API DefaultSplashWindow()
MRVIEWER_API SplashWindow(std::string name)
std::string name_
Definition MRSplashWindow.h:40
virtual MRVIEWER_API ~SplashWindow()
Thread should be stopped before destructor.
MRVIEWER_API void start()
only for bindings generation
Definition MRCameraOrientationPlugin.h:8