Message prompt

Hi, I’m looking into making a function that could be reused to display messages in the center of the screen. But I have no idea where to start to be honest. I’ve been looking around and I’ve come across the BP widget stuff (which is more or less what I would like to program).

Is there a way to program this yourself? In short I would like to know how could you program a function that takes in some text and prints it out on the screen on the place of your choosing? Is this even possible? I am aware of the “GEngine->AddOnScreenDebugMessage” but this doesn’t seem to fit my needs of configurability.

my function would be some like

void MyFunction(FString TextToPrint)
{
cout << "the text contained in TexToPrint << endl;
}

this is a very basic representation of what I’m thinking off.