Skip to content

Commit

Permalink
Extract PlayerInformationThroughWalls panels style parameters as cons…
Browse files Browse the repository at this point in the history
…tants
  • Loading branch information
danielkrupinski committed Jul 29, 2024
1 parent 0529f3e commit 8d4d80a
Show file tree
Hide file tree
Showing 10 changed files with 350 additions and 70 deletions.
4 changes: 2 additions & 2 deletions Source/CS2/Classes/Panorama.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ struct CUILength {
k_EUILengthPercent
};

[[nodiscard]] static CUILength pixels(float value) noexcept
[[nodiscard]] static constexpr CUILength pixels(float value) noexcept
{
return CUILength{value, k_EUILengthLength};
}

[[nodiscard]] static CUILength percent(float value) noexcept
[[nodiscard]] static constexpr CUILength percent(float value) noexcept
{
return CUILength{value, k_EUILengthPercent};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#pragma once

#include <CS2/Classes/Panorama.h>
#include <CS2/Constants/ColorConstants.h>
#include <FeatureHelpers/PanelShadowParams.h>

namespace active_weapon_ammo_panel_params::container_panel_params
{
static constexpr auto kHorizontalAlignment = cs2::k_EHorizontalAlignmentCenter;
static constexpr auto kVerticalAlignment = cs2::k_EVerticalAlignmentTop;
static constexpr auto kMarginLeft = cs2::CUILength::pixels(0);
static constexpr auto kMarginTop = cs2::CUILength::pixels(3);
static constexpr auto kMarginRight = cs2::CUILength::pixels(0);
static constexpr auto kMarginBottom = cs2::CUILength::pixels(0);
static constexpr auto kChildrenFlow = cs2::k_EFlowRight;
}

namespace active_weapon_ammo_panel_params::ammo_text_panel_params
{
static constexpr auto kFontFamily = "Stratum2, 'Arial Unicode MS'";
static constexpr auto kFontSize = 24.0f;
static constexpr auto kFontWeight = cs2::k_EFontWeightBlack;
static constexpr auto kHorizontalAlignment = cs2::k_EHorizontalAlignmentUnset;
static constexpr auto kVerticalAlignment = cs2::k_EVerticalAlignmentCenter;
static constexpr auto kShadowParams = PanelShadowParams{
.horizontalOffset{cs2::CUILength::pixels(0)},
.verticalOffset{cs2::CUILength::pixels(0)},
.blurRadius{cs2::CUILength::pixels(3)},
.strength = 3,
.color{cs2::kColorBlack}
};
static constexpr auto kColor = cs2::kColorWhite;
}

namespace active_weapon_ammo_panel_params::ammo_icon_panel_params
{
static constexpr auto kImageUrl = "s2r://panorama/images/hud/bullet_single.vsvg";
static constexpr auto kTextureHeight = 20;
static constexpr auto kHorizontalAlignment = cs2::k_EHorizontalAlignmentUnset;
static constexpr auto kVerticalAlignment = cs2::k_EVerticalAlignmentCenter;
static constexpr auto kMarginLeft = cs2::CUILength::pixels(5);
static constexpr auto kMarginTop = cs2::CUILength::pixels(0);
static constexpr auto kMarginRight = cs2::CUILength::pixels(0);
static constexpr auto kMarginBottom = cs2::CUILength::pixels(0);
static constexpr auto kShadowParams = PanelShadowParams{
.horizontalOffset{cs2::CUILength::pixels(0)},
.verticalOffset{cs2::CUILength::pixels(0)},
.blurRadius{cs2::CUILength::pixels(3)},
.strength = 3,
.color{cs2::kColorBlack}
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once

#include <CS2/Classes/Panorama.h>
#include <FeatureHelpers/PanelShadowParams.h>

namespace active_weapon_icon_panel_params
{
static constexpr auto kHorizontalAlignment = cs2::k_EHorizontalAlignmentCenter;
static constexpr auto kVerticalAlignment = cs2::k_EVerticalAlignmentTop;
static constexpr auto kMarginLeft = cs2::CUILength::pixels(0);
static constexpr auto kMarginTop = cs2::CUILength::pixels(3);
static constexpr auto kMarginRight = cs2::CUILength::pixels(0);
static constexpr auto kMarginBottom = cs2::CUILength::pixels(0);
static constexpr auto kShadowParams = PanelShadowParams{
.horizontalOffset{cs2::CUILength::pixels(0)},
.verticalOffset{cs2::CUILength::pixels(0)},
.blurRadius{cs2::CUILength::pixels(3)},
.strength = 3,
.color{cs2::kColorBlack}
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#pragma once

#include <CS2/Classes/Panorama.h>
#include <FeatureHelpers/PanelShadowParams.h>

namespace player_health_panel_params::container_panel_params
{
static constexpr auto kHorizontalAlignment = cs2::k_EHorizontalAlignmentCenter;
static constexpr auto kVerticalAlignment = cs2::k_EVerticalAlignmentTop;
static constexpr auto kMarginLeft = cs2::CUILength::pixels(0);
static constexpr auto kMarginTop = cs2::CUILength::pixels(1);
static constexpr auto kMarginRight = cs2::CUILength::pixels(0);
static constexpr auto kMarginBottom = cs2::CUILength::pixels(0);
static constexpr auto kChildrenFlow = cs2::k_EFlowRight;
}

namespace player_health_panel_params::health_icon_panel_params
{
static constexpr auto kImageUrl = "s2r://panorama/images/hud/health_cross.vsvg";
static constexpr auto kTextureHeight = 24;
static constexpr auto kHorizontalAlignment = cs2::k_EHorizontalAlignmentUnset;
static constexpr auto kVerticalAlignment = cs2::k_EVerticalAlignmentCenter;
static constexpr auto kMarginLeft = cs2::CUILength::pixels(0);
static constexpr auto kMarginTop = cs2::CUILength::pixels(0);
static constexpr auto kMarginRight = cs2::CUILength::pixels(5);
static constexpr auto kMarginBottom = cs2::CUILength::pixels(0);
static constexpr auto kShadowParams = PanelShadowParams{
.horizontalOffset{cs2::CUILength::pixels(0)},
.verticalOffset{cs2::CUILength::pixels(0)},
.blurRadius{cs2::CUILength::pixels(3)},
.strength = 3,
.color{cs2::kColorBlack}
};
}

namespace player_health_panel_params::health_text_panel_params
{
static constexpr auto kFontFamily = "Stratum2, 'Arial Unicode MS'";
static constexpr auto kFontSize = 24.0f;
static constexpr auto kFontWeight = cs2::k_EFontWeightBlack;
static constexpr auto kHorizontalAlignment = cs2::k_EHorizontalAlignmentUnset;
static constexpr auto kVerticalAlignment = cs2::k_EVerticalAlignmentCenter;
static constexpr auto kShadowParams = PanelShadowParams{
.horizontalOffset{cs2::CUILength::pixels(0)},
.verticalOffset{cs2::CUILength::pixels(0)},
.blurRadius{cs2::CUILength::pixels(3)},
.strength = 3,
.color{cs2::kColorBlack}
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include <CS2/Classes/Panorama.h>

namespace player_info_container_panel_params
{
static constexpr auto kWidth = cs2::CUILength::pixels(256);
static constexpr auto kHeight = cs2::CUILength::pixels(256);
static constexpr auto kPositionX = cs2::CUILength::pixels(-kWidth.m_flValue * 0.5f);
static constexpr auto kPositionY = cs2::CUILength::pixels(0.0f);
static constexpr auto kTransformOriginX = cs2::CUILength::percent(50);
static constexpr auto kTransformOriginY = cs2::CUILength::percent(0);
static constexpr auto kChildrenFlow = cs2::k_EFlowDown;
}
Loading

0 comments on commit 8d4d80a

Please sign in to comment.