KLingo Project Documentation
1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
Macro.h
이 파일의 문서화 페이지로 가기
1
// Copyright (c) 2025 Doppleddiggong. All rights reserved. Unauthorized copying, modification, or distribution of this file, via any medium is strictly prohibited. Proprietary and confidential.
2
7
#pragma once
8
9
10
// 공통 선언-구현 매크로
11
#define DEFINE_SUBSYSTEM_GETTER_INLINE(ClassName) \
12
UFUNCTION(BlueprintPure, Category="CoffeeLibrary|Subsystem", meta=(WorldContext="WorldContextObject")) \
13
static ClassName* Get(UObject* WorldContext) \
14
{ \
15
if (!WorldContext) \
16
return nullptr; \
17
if (auto* World = WorldContext->GetWorld()) \
18
if (auto* GI = World->GetGameInstance()) \
19
return GI->GetSubsystem<ClassName>(); \
20
return nullptr; \
21
}
22
23
24
#define DEFINE_LOCALPLAYER_SUBSYSTEM_GETTER_INLINE(ClassName) \
25
UFUNCTION(BlueprintPure, Category="CoffeeLibrary|Subsystem", meta=(WorldContext="WorldContextObject")) \
26
static ClassName* Get(UObject* WorldContextObject) \
27
{ \
28
if (!WorldContextObject) \
29
return nullptr; \
30
if (UWorld* World = WorldContextObject->GetWorld()) \
31
{ \
32
if (UGameInstance* GameInstance = World->GetGameInstance()) \
33
{ \
34
if (ULocalPlayer* LocalPlayer = GameInstance->GetFirstGamePlayer()) \
35
{ \
36
return LocalPlayer->GetSubsystem<ClassName>(); \
37
} \
38
} \
39
} \
40
return nullptr; \
41
}
42
43
// Optional: PlayerController를 받아서 해당 LocalPlayer의 서브시스템을 가져오는 매크로도 만들 수 있어요
44
#define DEFINE_LOCALPLAYER_FROM_PC_SUBSYSTEM_GETTER_INLINE(ClassName) \
45
UFUNCTION(BlueprintPure, Category="CoffeeLibrary|Subsystem", meta=(WorldContext="WorldContextObject")) \
46
static ClassName* GetFromPlayerController(UObject* WorldContextObject, APlayerController* PC) \
47
{ \
48
if (!WorldContextObject || !PC) \
49
return nullptr; \
50
if (ULocalPlayer* LP = Cast<ULocalPlayer>(PC->Player)) \
51
{ \
52
return LP->GetSubsystem<ClassName>(); \
53
} \
54
return nullptr; \
55
}
56
57
58
59
// 공통 선언 매크로
60
#define DECLARE_SUBSYSTEM_GETTER(ClassName) \
61
UFUNCTION(BlueprintPure, Category="CoffeeLibrary|Subsystem", meta=(WorldContext="WorldContextObject")) \
62
static ClassName* Get(UObject* WorldContext);
63
64
// 공통 구현 매크로
65
#define DEFINE_SUBSYSTEM_GETTER_IMPL(ClassName) \
66
static ClassName* Get(UObject* WorldContext) \
67
{ \
68
if (!WorldContext) \
69
return nullptr; \
70
if (auto* World = WorldContext->GetWorld()) \
71
if (auto* GI = World->GetGameInstance()) \
72
return GI->GetSubsystem<ClassName>(); \
73
return nullptr; \
74
}
75
76
#define BIND_DYNAMIC_DELEGATE(DelegateType, Obj, ClassType, FuncName) \
77
[] (auto* InObj) { \
78
DelegateType Tmp; \
79
Tmp.BindUFunction(InObj, GET_FUNCTION_NAME_CHECKED(ClassType, FuncName)); \
80
return Tmp; \
81
} (Obj)
82
83
#define ENUM_TO_NAME(EnumType, Value) \
84
(StaticEnum<EnumType>()->GetNameStringByValue(static_cast<int64>(Value)))
85
86
#define ENUM_TO_TEXT(EnumType, Value) \
87
(StaticEnum<EnumType>()->GetDisplayNameTextByValue(static_cast<int64>(Value)))
Source
LatteLibrary
Manager
Public
Macro.h
생성시간 : 금 1월 9 2026 00:25:57, 프로젝트명 : KLingo Project Documentation, 생성자 :
1.9.8