์•ˆ๋…›์•„์„ธ์š” ๋นŒ๊ฒŒ์ด์ธ ํ–‰๋‹˜๋œ


c++ ํ”„๋กœ์ ํŠธ ์‹œ์ž‘ํ•œ ์ดˆ๋ณด์ž…๋‹ˆ๋‹ค

์ €๋Š” ํƒ‘๋‹ค์šด ํ…œํ”Œ๋ฆฟ์„ c++๋กœ ๋งŒ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค


์ €๋Š” ์ƒํƒœ ํŒจํ„ด(?)์ฒ˜๋Ÿผ ์•ก์…˜์„ ๋ฐ”์ธ๋”ฉํ•˜๋ ค๊ณ  ํ–‡์Šต๋‹ˆ๋‹ค

์˜ˆ๋ฅผ ๋“ค์–ด ์™ผ์ชฝ ๋งˆ์šฐ์Šค๋ฅผ ๋ˆ„๋ฅด๋ฉด ์บ๋ฆญํ„ฐ๊ฐ€ ์ปค์„œ์ž‡๋Š”์ชฝ์œผ๋กœ ์ด๋™ํ•˜์ง€๋งŒ Q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋งˆ์šฐ์Šค ์™ผ์ชฝ ๋ฒ„ํŠผ์ด ์Šคํ‚ฌ ์‹คํ–‰ ๋ฒ„ํŠผ์œผ๋กœ ๋ฐ”๋€Œ๋Š”๊ฒ๋‹ˆ๋‹ค


๊ทธ๋ž˜์„œ ์›๋ณธ ์ฝ”๋“œ๋ฅผ:

EnhancedInputComponent->BindAction(MouseLeftClickAction, ETriggerEvent::Started, this, &AMyPlayerController::OnInputStarted);

EnhancedInputComponent->BindAction(MouseLeftClickAction, ETriggerEvent::Triggered, this, &AMyPlayerController::OnMouseLeftButtonTriggered);

EnhancedInputComponent->BindAction(MouseLeftClickAction, ETriggerEvent::Completed, this, &AMyPlayerController::OnMouseLeftButtonReleased);

EnhancedInputComponent->BindAction(MouseLeftClickAction, ETriggerEvent::Canceled, this, &AMyPlayerController::OnMouseLeftButtonReleased);


์ด๋Ÿฐ์‹์œผ๋กœ ๋ณ€๊ฒฝํ•ด์„œ ์‚ฌ์šฉํ•˜๋ ค๊ณ ย ์‹œ๋„ํ–ˆ์Šต๋‹ˆ๋‹ค:

voidย AMyPlayerController::BindInputAction(UInputAction* InputAction,ย AMyPlayerController* BindInputActionHandler)

{

UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(InputComponent);

EnhancedInputComponent->BindAction(InputAction, ETriggerEvent::Started, this, &BindInputActionHandler::OnStarted);

EnhancedInputComponent->BindAction(InputAction, ETriggerEvent::Triggered, this, &BindInputActionHandler::OnTriggered);

EnhancedInputComponent->BindAction(InputAction, ETriggerEvent::Completed, this, &BindInputActionHandler::OnCompleted);

EnhancedInputComponent->BindAction(InputAction, ETriggerEvent::Canceled, this, &BindInputActionHandler::OnCanceled);

}


๋ฌธ์ œ๋Š” ๋งˆ์ง€๋ง‰ ์ธ์ˆ˜ย &BindInputActionHandler::OnStarted ์ด ๋ถ€๋ถ„์ธ๋ฐ ๋ณด๋‹ˆ๊นŒย AMyPlayerControllerย ๋ฐ–์— ๋ชป ๋„˜๊ฒจ์ฃผ๋”๋ผ๊ณ ์š”.

๊ทธ๋Ÿผ ํ•จ์ˆ˜๋ฅผ ์ „๋ถ€ย AMyPlayerController์— ์ž‘์„ฑํ•ด์•ผ ๋˜๋‚˜์š”? ๋ฏธ์น˜๊ฒŸ์–ด์šฉ

BindInputActionHandler ํด๋ž˜์Šค๋ฅผย AMyPlayerController ์ƒ์†๋ฐ›๊ฒŒ ํ–‡๋Š”๋ฐ๋„ ์•ˆ๋˜์„œ ์ฃฝ๊ฒ์–ด์šฉ

์–ด๋–ขํ•˜์ฃ ์–ด๋–ขํ•˜์ฃ