Repository navigation
Expand file tree
/
Copy pathTactilityDisplaySetup.cpp
More file actions
63 lines (50 loc) · 1.68 KB
/
Copy pathTactilityDisplaySetup.cpp
File metadata and controls
63 lines (50 loc) · 1.68 KB
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
#include "TactilityDisplaySetup.h"
#include <deki/LogSystem.h>
#if !defined(DEKI_EDITOR) && defined(DEKI_PACKAGE_TACTILITY)
#include <memory>
#include <deki/Engine.h>
#include "TactilityDisplay.h"
#include "TactilityWindowDisplay.h"
#endif
namespace DekiTactility
{
#if !defined(DEKI_EDITOR) && defined(DEKI_PACKAGE_TACTILITY)
// The package owns the display's lifetime; engine-core only holds the pointer.
static std::unique_ptr<Deki::IDisplay> s_Display;
void TactilityDisplaySetup::Setup(SetupCallback onComplete)
{
const bool window = (mode == TactilityDisplayMode::Window);
if (window)
{
s_Display = std::make_unique<TactilityWindowDisplay>();
}
else
{
s_Display = std::make_unique<TactilityDisplay>();
}
// 0x0 means "no expectation": on Tactility the OS owns the panel and
// reports its real resolution. (The project's target size is in
// project_data.bin, which the engine may not have read before this
// component runs.)
if (s_Display && s_Display->Initialize(0, 0))
{
Deki::Engine::GetInstance().SetDisplay(s_Display.get(), "Tactility");
DEKI_LOG_INFO("TactilityDisplaySetup: display ready (%s)", window ? "window" : "panel");
onComplete(true);
}
else
{
DEKI_LOG_ERROR("TactilityDisplaySetup: failed to set up the display (%s)", window ? "window" : "panel");
s_Display.reset();
onComplete(false);
}
}
#else
void TactilityDisplaySetup::Setup(SetupCallback onComplete)
{
// Editor or a non-Tactility target: nothing to set up. Reporting success
// keeps the component usable on the desktop.
onComplete(true);
}
#endif
} // namespace DekiTactility