Fray Engine
Loading...
Searching...
No Matches
main.cpp File Reference
#include "main.hpp"
#include <filesystem>
#include <string>

Go to the source code of this file.

Functions

static F_err launchElectron (const char *executable, F_ushort port)
 Starts the Electron UI (npm run start in the Electron folder) without waiting for it. The Electron folder is located relative to the Engine executable (three directories up, then "Electron"). The UI is told the engine's TCP port through the FRAY_ENGINE_PORT environment variable.
F_err main (F_long argc, F_char *argv[])
 Engine entry point: builds the managers, starts the TCP server and message threads, then blocks until quit. Runs on the main thread. Pass --no-ui to skip launching Electron. Engine startup logs are buffered until managers are ready, and shutdown logs are stored until the application log worker stops.

Function Documentation

◆ launchElectron()

F_err launchElectron ( const char * executable,
F_ushort port )
static

Starts the Electron UI (npm run start in the Electron folder) without waiting for it. The Electron folder is located relative to the Engine executable (three directories up, then "Electron"). The UI is told the engine's TCP port through the FRAY_ENGINE_PORT environment variable.

Parameters
executablePath of the running Engine executable (argv[0]).
portTCP port the engine server is listening on.
Returns
fray::errors::NONE on success, otherwise the error from fray::process::spawn (FAILED_SPAWN_PROCESS).

Definition at line 15 of file main.cpp.

◆ main()

F_err main ( F_long argc,
F_char * argv[] )

Engine entry point: builds the managers, starts the TCP server and message threads, then blocks until quit. Runs on the main thread. Pass --no-ui to skip launching Electron. Engine startup logs are buffered until managers are ready, and shutdown logs are stored until the application log worker stops.

Parameters
argcNumber of command-line arguments.
argvCommand-line arguments; argv[0] locates the logs folder and the Electron folder.
Returns
fray::errors::NONE on a normal exit, or the error returned when launching the UI fails.

Definition at line 33 of file main.cpp.