CARLA
载入中...
搜索中...
未找到
Unreal
CarlaUE4
Plugins
Carla
Source
Carla
Game
CarlaHUD.h
浏览该文件的文档.
1
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
2
// de Barcelona (UAB).
3
//
4
// This work is licensed under the terms of the MIT license.
5
// For a copy, see <https://opensource.org/licenses/MIT>.
6
7
#pragma once
8
9
// Workaround to fix Windows conflict: Windows changes the name of some functions (DrawText, LoadLibrary...)
10
// with Unicode / ANSI versions for his own API (DrawTextW, DrawTextA, LoadLibraryW, LoadLibraryA...).
11
// But the changes are global for the compiler. Deep in headers, Windows has something like:
12
// #ifdef UNICODE
13
// #define DrawText DrawTextW
14
// #define LoadLibrary LoadLibraryW
15
// #else
16
// #define DrawText DrawTextA
17
// #define LoadLibrary LoadLibraryA
18
// #endif
19
// Then the linker tries to find the function DrawTextW on an external DLL and an unresolved external error happens because
20
// Unreal has no function DrawTextW, it has just DrawText.
21
// We can fix that by just undefining the function that conflicts with the name of the Windows API in Unicode.
22
#undef DrawText
23
24
#include "
Carla.h
"
25
#include "Containers/Array.h"
26
#include "GameFramework/HUD.h"
27
#include "WheeledVehicleMovementComponent.h"
28
#include "CarlaHUD.generated.h"
29
30
struct
HUDString
31
{
32
FString
Str
{
""
};
33
FVector
Location
;
34
FColor
Color
;
35
double
TimeToDie
;
36
};
37
38
struct
HUDLine
39
{
40
FVector
Begin
;
41
FVector
End
;
42
float
Thickness
;
43
FColor
Color
;
44
double
TimeToDie
;
45
};
46
47
/// Class to draw on HUD
48
UCLASS()
49
class CARLA_API
ACarlaHUD
: public
AHUD
50
{
51
GENERATED_BODY()
52
53
public
:
54
55
ACarlaHUD
(
const
FObjectInitializer& ObjectInitializer)
56
: Super(ObjectInitializer)
57
{
58
PrimaryActorTick.bCanEverTick =
false
;
59
}
60
61
virtual
void
DrawHUD()
override
;
62
63
UWheeledVehicleMovementComponent* DebugVehicle{
nullptr
};
64
void
AddDebugVehicleForTelemetry
(UWheeledVehicleMovementComponent* Veh) { DebugVehicle = Veh; }
65
66
void
AddHUDString(
const
FString Str,
const
FVector Location,
const
FColor Color,
double
LifeTime);
67
void
AddHUDLine(
const
FVector Begin,
const
FVector End,
const
float
Thickness,
const
FColor Color,
double
LifeTime);
68
69
private
:
70
TArray<HUDString>
StringList
;
71
TArray<HUDLine>
LineList
;
72
};
Carla.h
ACarlaHUD
Class to draw on HUD
Definition
CarlaHUD.h:50
ACarlaHUD::LineList
TArray< HUDLine > LineList
Definition
CarlaHUD.h:71
ACarlaHUD::StringList
TArray< HUDString > StringList
Definition
CarlaHUD.h:70
ACarlaHUD::AddDebugVehicleForTelemetry
void AddDebugVehicleForTelemetry(UWheeledVehicleMovementComponent *Veh)
Definition
CarlaHUD.h:64
ACarlaHUD::ACarlaHUD
ACarlaHUD(const FObjectInitializer &ObjectInitializer)
Definition
CarlaHUD.h:55
AHUD
HUDLine
Definition
CarlaHUD.h:39
HUDLine::Color
FColor Color
Definition
CarlaHUD.h:43
HUDLine::Begin
FVector Begin
Definition
CarlaHUD.h:40
HUDLine::TimeToDie
double TimeToDie
Definition
CarlaHUD.h:44
HUDLine::End
FVector End
Definition
CarlaHUD.h:41
HUDLine::Thickness
float Thickness
Definition
CarlaHUD.h:42
HUDString
Definition
CarlaHUD.h:31
HUDString::Location
FVector Location
Definition
CarlaHUD.h:33
HUDString::TimeToDie
double TimeToDie
Definition
CarlaHUD.h:35
HUDString::Str
FString Str
Definition
CarlaHUD.h:32
HUDString::Color
FColor Color
Definition
CarlaHUD.h:34
制作者
1.10.0