Added resolution and monitor launch arg for editor

This commit is contained in:
antopilo
2023-03-15 20:29:10 -04:00
parent 3c40cacaf8
commit e0950b15a4
3 changed files with 61 additions and 2 deletions

View File

@@ -34,6 +34,9 @@ int main(int argc, char* argv[])
{
bool playMode = false;
std::string projectPath = "";
Vector2 editorResolution = Vector2(1280, 720);
int monitorIdx = -1;
for (uint32_t i = 0; i < argc; i++)
{
char* arg = argv[i];
@@ -47,6 +50,31 @@ int main(int argc, char* argv[])
}
playMode = true;
}
if (args == "--resolution")
{
if (argc >= i + 1)
{
std::string resString = std::string(argv[i + 1]);
const auto& resSplits = String::Split(resString, 'x');
if (resSplits.size() == 2)
{
int width = stoi(resSplits[0]);
int height = stoi(resSplits[1]);
editorResolution = Vector2(width, height);
}
}
}
if (args == "--monitor")
{
if (argc >= i + 1)
{
std::string monitorIdxString = std::string(argv[i + 1]);
monitorIdx = stoi(monitorIdxString);
}
}
}
bool shouldLoadProject = false;
@@ -95,12 +123,19 @@ int main(int argc, char* argv[])
else
{
Nuake::Engine::Init();
Engine::GetCurrentWindow()->SetSize(editorResolution);
Nuake::EditorInterface editor;
editor.BuildFonts();
Ref<Nuake::Window> window = Nuake::Engine::GetCurrentWindow();
window->SetTitle(WindowTitle);
if (monitorIdx != -1)
{
window->SetMonitor(monitorIdx);
}
using namespace Nuake;
GizmoDrawer gizmoDrawer = GizmoDrawer();