You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: hud.go
    path of file: ./repos/OpenDiablo2/d2game/d2player
    
    the code of the file until where you have to start completion: package d2player

import (
	"fmt"
	"math"
	"strings"

	"github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
	"github.com/OpenDiablo2/OpenDiablo2/d2com
    
func (h *HUD) loadCustomWidgets() {
	// static background
	_, height, err := h.mainPanel.GetFrameSize(0) // health globe is the frame with max height
	if err != nil {
		h.Error(err.Error())
		return
	}

	h.panelBackground = h.uiManager.NewCustomWidgetCached(h.renderPanelStatic, screenWidth, height)
	h.panelBackground.SetPosition(0, screenHeight-height)
	h.panelGroup.AddWidget(h.panelBackground)

	// stamina bar
	h.widgetStamina = h.uiManager.NewCustomWidget(h.renderStaminaBar, staminaBarWidth, staminaBarHeight)
	h.widgetStamina.SetPosition(staminaBarOffsetX, staminaBarOffsetY)
	h.widgetStamina.SetTooltip(h.staminaTooltip)
	h.panelGroup.AddWidget(h.widgetStamina)

	// experience bar
	h.widgetExperience = h.uiManager.NewCustomWidget(h.renderExperienceBar, expBarWidth, expBarHeight)
	h.widgetExperience.SetPosition(experienceBarOffsetX, experienceBarOffsetY)
	h.widgetExperience.SetTooltip(h.experienceTooltip)
	h.panelGroup.AddWidget(h.widgetExperience)

	// Left skill widget
	leftRenderFunc := func(target d2interface.Surface) {
		x, y := h.widgetLeftSkill.GetPosition()
		h.renderLeftSkill(x, y, target)
	}

	h.widgetLeftSkill = h.uiManager.NewCustomWidget(leftRenderFunc, skillIconWidth, skillIconHeight)
	h.widgetLeftSkill.SetPosition(leftSkillX, screenHeight)
	h.panelGroup.AddWidget(h.widgetLeftSkill)

	// Right skill widget
	rightRenderFunc := func(target d2interface.Surface) {
		x, y := h.widgetRightSkill.GetPosition()
		h.renderRightSkill(x, y, target)
	}

	h.widgetRightSkill = h.uiManager.NewCustomWidget(rightRenderFunc, skillIconWidth, skillIconHeight)
	h.widgetRightSkill.SetPosition(rightSkillX, screenHeight)
	h.panelGroup.AddWidget(h.widgetRightSkill)
}