I have a question about using Super::something(). I’m following a FPS tutorial from ue4 documentation, and there is a point where I’m declaring virtual DrawHUD() function override in the header, and then, in the declaration, I’m using Super::DrawHUD(). From what I read, Super:: is supposed to call a base DrawHUD(), even if we have a child that overrides some of its functions. So, what’s the point of declaring virtual and overrided function if we will still call a base one? Ordo I understand something wrong?
public:
// Primary draw call for the HUD.
virtual void DrawHUD() override;
void AFPSHUD::DrawHUD()
{
Super::DrawHUD();
if (CrosshairTexture)
{
// Find the center of our canvas.
FVector2D Center(Canvas->ClipX * 0.5f, Canvas->ClipY * 0.5f);
// Offset by half of the texture's dimensions so that the center of the texture aligns with the center of the Canvas.
FVector2D CrossHairDrawPosition(Center.X - (CrosshairTexture->GetSurfaceWidth() * 0.5f), Center.Y - (CrosshairTexture->GetSurfaceHeight() * 0.5f));
// Draw the crosshair at the centerpoint.
FCanvasTileItem TileItem(CrossHairDrawPosition, CrosshairTexture->Resource, FLinearColor::White);
TileItem.BlendMode = SE_BLEND_Translucent;
Canvas->DrawItem(TileItem);
}
}