Add -carla-no-hud command-line parameter

This commit is contained in:
nsubiron 2017-10-20 16:20:37 +02:00
parent a1143b3be0
commit b32c476fd4
3 changed files with 8 additions and 28 deletions

View File

@ -16,8 +16,9 @@ To run the game windowed at a given resolution
Other CARLA related command-line options
* `-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-hud` Do not display the HUD by default.
To activate semantic segmentation
---------------------------------

View File

@ -20,8 +20,6 @@ DECLARE_LOG_CATEGORY_EXTERN(LogCarlaServer, Log, All);
// #define CARLA_TAGGER_EXTRA_LOG
#endif // WITH_EDITOR
// #define CARLA_CINEMATIC_MODE
class FCarlaModule : public IModuleInterface
{
public:

View File

@ -4,12 +4,17 @@
#include "CarlaHUD.h"
#include "CarlaVehicleController.h"
#include "CommandLine.h"
#include "ConstructorHelpers.h"
#include "Engine/Canvas.h"
#include "Engine/Font.h"
#define LOCTEXT_NAMESPACE "CarlaHUD"
static bool GetDefaultHUDVisibility() {
return !FParse::Param(FCommandLine::Get(), TEXT("carla-no-hud"));
}
static FText RoundedFloatAsText(float 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("IntersectionOffRoad", RoundedFloatAsText(100.0f * Vehicle.GetOffRoadIntersectionFactor()));
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",
"FPS: {FPS}\n"
"\n"
@ -112,17 +98,12 @@ static FText GetHUDText(const ACarlaPlayerState &Vehicle)
"\n"
"Intersection (Lane): {IntersectionOtherLane}%\n"
"Intersection (OffRoad): {IntersectionOffRoad}%")
#endif // CARLA_CINEMATIC_MODE
,
Args);
}
ACarlaHUD::ACarlaHUD() :
#ifdef CARLA_CINEMATIC_MODE
bIsVisible(false)
#else
bIsVisible(true)
#endif // CARLA_CINEMATIC_MODE
bIsVisible(GetDefaultHUDVisibility())
{
static ConstructorHelpers::FObjectFinder<UFont> Font(TEXT("/Engine/EngineFonts/DroidSansMono"));
HUDFont = Font.Object;