Add -carla-no-hud command-line parameter
This commit is contained in:
parent
a1143b3be0
commit
b32c476fd4
|
@ -16,8 +16,9 @@ To run the game windowed at a given resolution
|
||||||
Other CARLA related command-line options
|
Other CARLA related command-line options
|
||||||
|
|
||||||
* `-carla-settings=<ini-file-path>` Load settings from the given INI file. See Example.CarlaSettings.ini.
|
* `-carla-settings=<ini-file-path>` Load settings from the given INI file. See Example.CarlaSettings.ini.
|
||||||
* `-world-port=<port-number>` Listen for client connections at <port-number>, write and read ports are set to <port-number>+1 and <port-number>+2 respectively. Activates networking.
|
* `-carla-world-port=<port-number>` Listen for client connections at <port-number>, write and read ports are set to <port-number>+1 and <port-number>+2 respectively. Activates networking.
|
||||||
* `-carla-no-networking` Disable networking. Overrides any other settings file.
|
* `-carla-no-networking` Disable networking. Overrides any other settings file.
|
||||||
|
* `-carla-no-hud` Do not display the HUD by default.
|
||||||
|
|
||||||
To activate semantic segmentation
|
To activate semantic segmentation
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
|
@ -20,8 +20,6 @@ DECLARE_LOG_CATEGORY_EXTERN(LogCarlaServer, Log, All);
|
||||||
// #define CARLA_TAGGER_EXTRA_LOG
|
// #define CARLA_TAGGER_EXTRA_LOG
|
||||||
#endif // WITH_EDITOR
|
#endif // WITH_EDITOR
|
||||||
|
|
||||||
// #define CARLA_CINEMATIC_MODE
|
|
||||||
|
|
||||||
class FCarlaModule : public IModuleInterface
|
class FCarlaModule : public IModuleInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -4,12 +4,17 @@
|
||||||
#include "CarlaHUD.h"
|
#include "CarlaHUD.h"
|
||||||
|
|
||||||
#include "CarlaVehicleController.h"
|
#include "CarlaVehicleController.h"
|
||||||
|
#include "CommandLine.h"
|
||||||
#include "ConstructorHelpers.h"
|
#include "ConstructorHelpers.h"
|
||||||
#include "Engine/Canvas.h"
|
#include "Engine/Canvas.h"
|
||||||
#include "Engine/Font.h"
|
#include "Engine/Font.h"
|
||||||
|
|
||||||
#define LOCTEXT_NAMESPACE "CarlaHUD"
|
#define LOCTEXT_NAMESPACE "CarlaHUD"
|
||||||
|
|
||||||
|
static bool GetDefaultHUDVisibility() {
|
||||||
|
return !FParse::Param(FCommandLine::Get(), TEXT("carla-no-hud"));
|
||||||
|
}
|
||||||
|
|
||||||
static FText RoundedFloatAsText(float Value)
|
static FText RoundedFloatAsText(float Value)
|
||||||
{
|
{
|
||||||
return FText::AsNumber(FMath::RoundHalfFromZero(Value));
|
return FText::AsNumber(FMath::RoundHalfFromZero(Value));
|
||||||
|
@ -74,25 +79,6 @@ static FText GetHUDText(const ACarlaPlayerState &Vehicle)
|
||||||
Args.Add("IntersectionOtherLane", RoundedFloatAsText(100.0f * Vehicle.GetOtherLaneIntersectionFactor()));
|
Args.Add("IntersectionOtherLane", RoundedFloatAsText(100.0f * Vehicle.GetOtherLaneIntersectionFactor()));
|
||||||
Args.Add("IntersectionOffRoad", RoundedFloatAsText(100.0f * Vehicle.GetOffRoadIntersectionFactor()));
|
Args.Add("IntersectionOffRoad", RoundedFloatAsText(100.0f * Vehicle.GetOffRoadIntersectionFactor()));
|
||||||
return FText::Format(
|
return FText::Format(
|
||||||
#ifdef CARLA_CINEMATIC_MODE
|
|
||||||
LOCTEXT("HUDTextFormat",
|
|
||||||
"Speed: {Speed} km/h\n"
|
|
||||||
"Gear: {Gear}\n"
|
|
||||||
"\n"
|
|
||||||
"Speed Limit: {SpeedLimit} km/h\n"
|
|
||||||
"Traffic Light: {TrafficLightState}\n"
|
|
||||||
"\n"
|
|
||||||
"Location: {Location}\n"
|
|
||||||
"Orientation: {Orientation}\n"
|
|
||||||
"Acceleration: {Acceleration}\n"
|
|
||||||
"\n"
|
|
||||||
"Collision (Cars): {CollisionCars}\n"
|
|
||||||
"Collision (Pedestrian): {CollisionPedestrians}\n"
|
|
||||||
"Collision (Other): {CollisionOther}\n"
|
|
||||||
"\n"
|
|
||||||
"Intersection (Lane): {IntersectionOtherLane}%\n"
|
|
||||||
"Intersection (OffRoad): {IntersectionOffRoad}%")
|
|
||||||
#else
|
|
||||||
LOCTEXT("HUDTextFormat",
|
LOCTEXT("HUDTextFormat",
|
||||||
"FPS: {FPS}\n"
|
"FPS: {FPS}\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -112,17 +98,12 @@ static FText GetHUDText(const ACarlaPlayerState &Vehicle)
|
||||||
"\n"
|
"\n"
|
||||||
"Intersection (Lane): {IntersectionOtherLane}%\n"
|
"Intersection (Lane): {IntersectionOtherLane}%\n"
|
||||||
"Intersection (OffRoad): {IntersectionOffRoad}%")
|
"Intersection (OffRoad): {IntersectionOffRoad}%")
|
||||||
#endif // CARLA_CINEMATIC_MODE
|
|
||||||
,
|
,
|
||||||
Args);
|
Args);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACarlaHUD::ACarlaHUD() :
|
ACarlaHUD::ACarlaHUD() :
|
||||||
#ifdef CARLA_CINEMATIC_MODE
|
bIsVisible(GetDefaultHUDVisibility())
|
||||||
bIsVisible(false)
|
|
||||||
#else
|
|
||||||
bIsVisible(true)
|
|
||||||
#endif // CARLA_CINEMATIC_MODE
|
|
||||||
{
|
{
|
||||||
static ConstructorHelpers::FObjectFinder<UFont> Font(TEXT("/Engine/EngineFonts/DroidSansMono"));
|
static ConstructorHelpers::FObjectFinder<UFont> Font(TEXT("/Engine/EngineFonts/DroidSansMono"));
|
||||||
HUDFont = Font.Object;
|
HUDFont = Font.Object;
|
||||||
|
|
Loading…
Reference in New Issue