-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.cpp
More file actions
68 lines (46 loc) · 1.56 KB
/
Application.cpp
File metadata and controls
68 lines (46 loc) · 1.56 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
64
65
66
67
68
//
// Created by joao on 11/1/24.
//
#include "StudioSlab.h"
#include "Core/SlabCore.h"
#include "Core/Tools/Log.h"
#include "Application.h"
#include <utility>
#include "Graphics/Backend/PlatformWindow.h"
namespace Slab {
TPointer<Platform> FApplication::CreatePlatform() {
return Slab::DynamicPointerCast<Graphics::FGraphicBackend>(Slab::CreatePlatform("GLFW"));
}
FApplication::FApplication(Str name, const int argc, const char *argv[])
: ArgCount (argc)
, ArgValues( argv)
, m_Name(std::move(name))
{
Slab::Startup();
Core::FLog::Info() << "Compiled with " << USED_CXX_COMPILER << Core::FLog::Flush;
// FLog::Info() << "Compiler: " << COMPILER_NAME << FLog::Flush;
Core::FLog::Info() << "PWD: " << Common::GetPWD() << Core::FLog::Flush;
}
FApplication::~FApplication() {
if (p_Platform != nullptr) p_Platform->Terminate();
Core::FBackendManager::UnloadAllModules();
}
bool FApplication::Create(Resolution width, Resolution height) {
Core::ParseCLArgs(ArgCount, ArgValues);
p_Platform = CreatePlatform();
OnStart();
return true;
}
Int FApplication::Run() {
const auto self = Dummy(*this);
p_Platform->GetMainSystemWindow()->AddEventListener(self);
p_Platform->Run();
return 0;
}
void FApplication::SetTitle(const Str& title) const {
p_Platform->GetMainSystemWindow()->SetSystemWindowTitle(title);
}
auto FApplication::GetName() const -> Str {
return m_Name;
}
} // Slab