group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
AmmoCounter Struct Reference

Shows current magazine ammo and reserve ammo without panel chrome. More...

#include <AmmoCounter.hpp>

Inheritance diagram for AmmoCounter:
[legend]
Collaboration diagram for AmmoCounter:
[legend]

Public Member Functions

 AmmoCounter ()
void update (float dt, const HudGameState &state, HudTweenPool &tweens) override
 Called each frame before draw(). Update animation, consume events.
void draw (HudContext &ctx, float drawX, float drawY) override
 Emit geometry into the draw context.
Public Member Functions inherited from HudWidget
virtual ~HudWidget ()=default

Public Attributes

float panelWidth = 230.f
float panelHeight = 100.f
float clipFontSize = 125.5f
 Current ammo in the magazine.
float reserveFontSize = 75.f
 Reserve / total ammo.
float edgePadding = 0.f
 Inset from the panel edge to the rightmost number.
float backgroundScale = 1.26f
float backgroundOffsetX = -120.5f
float backgroundOffsetY = -4.f
float backgroundStretchX = 1.3f
float backgroundStretchY = 1.f
Public Attributes inherited from HudWidget
bool visible = true
HudAnchor anchor = HudAnchor::TopLeft
float offsetX = 0.f
float offsetY = 0.f
float width = 0.f
float height = 0.f
HudColor tint {1.f, 1.f, 1.f, 1.f}
float uiScale_ = 1.f
 Set by Hud each frame (screenH / 1080).

Private Attributes

int displayClip_ = 0
int displayReserve_ = 0
int weaponId_ = 0

Detailed Description

Shows current magazine ammo and reserve ammo without panel chrome.

Constructor & Destructor Documentation

◆ AmmoCounter()

AmmoCounter::AmmoCounter ( )

Member Function Documentation

◆ draw()

void AmmoCounter::draw ( HudContext & ctx,
float drawX,
float drawY )
overridevirtual

Emit geometry into the draw context.

Parameters
ctxImmediate-mode draw API.
drawXResolved pixel X (anchor + offset already applied).
drawYResolved pixel Y.

Implements HudWidget.

Here is the call graph for this function:

◆ update()

void AmmoCounter::update ( float dt,
const HudGameState & state,
HudTweenPool & tweens )
overridevirtual

Called each frame before draw(). Update animation, consume events.

Implements HudWidget.

Member Data Documentation

◆ backgroundOffsetX

float AmmoCounter::backgroundOffsetX = -120.5f

◆ backgroundOffsetY

float AmmoCounter::backgroundOffsetY = -4.f

◆ backgroundScale

float AmmoCounter::backgroundScale = 1.26f

◆ backgroundStretchX

float AmmoCounter::backgroundStretchX = 1.3f

◆ backgroundStretchY

float AmmoCounter::backgroundStretchY = 1.f

◆ clipFontSize

float AmmoCounter::clipFontSize = 125.5f

Current ammo in the magazine.

◆ displayClip_

int AmmoCounter::displayClip_ = 0
private

◆ displayReserve_

int AmmoCounter::displayReserve_ = 0
private

◆ edgePadding

float AmmoCounter::edgePadding = 0.f

Inset from the panel edge to the rightmost number.

◆ panelHeight

float AmmoCounter::panelHeight = 100.f

◆ panelWidth

float AmmoCounter::panelWidth = 230.f

◆ reserveFontSize

float AmmoCounter::reserveFontSize = 75.f

Reserve / total ammo.

◆ weaponId_

int AmmoCounter::weaponId_ = 0
private

The documentation for this struct was generated from the following files: