Hello
I am working on a C++ book (I have been around the forums a lot lately ,since this book is apparently really bad)
I am trying to create a function that will allow me to draw a backing color to a text box.
The errors I am getting are as follows
Here is the current code for MyHUD.c++ file
#include "MyHUD.h"
#include "CoreMinimal.h"
void AMyHUD::DrawHUD()
{
Super::DrawHUD();
for (int c = messages.Num() - 1; c >= 0; c--)
{
// draw the background box the right size
// for the message
float outputWidth, outputHeight, pad = 10.f;
GetTextSize(messages[c].message, outputWidth, outputHeight,
hudFont, 1.f);
float messageH = outputHeight + 2.f*pad;
float x = 0.f, y = c * messageH;
// black backing
DrawRect(FLinearColor::Black, x, y, Canvas->SizeX, messageH);
// draw our message using the hudFont
DrawText(messages[c].message, messages[c].color, x + pad, y +
pad, hudFont);
// reduce lifetime by the time that passed since last
// frame.
messages[c].time -= GetWorld()->GetDeltaSeconds();
// if the message's time is up, remove it
if (messages[c].time < 0)
{
messages.RemoveAt(c);
}
}
}
void AMyHUD::addMessage(Message msg)
{
messages.Add(msg);
}
I hate to ask for help, but this book is really bad (Like the downloaded source code often does not work).
Thank you for your time.