Codex CLI commited on
Commit
9b606b6
·
1 Parent(s): 5cf582c

feat(ui): update health gauge and HUD styling for a cleaner look

Browse files
Files changed (2) hide show
  1. index.html +61 -23
  2. src/main.js +1 -2
index.html CHANGED
@@ -69,34 +69,63 @@
69
  .bl { bottom: 20px; left: 20px; }
70
  .br { bottom: 20px; right: 20px; }
71
 
72
- /* Health gauge */
73
- #ui-health { width: 360px; padding: 14px 16px; }
 
 
 
 
 
 
 
 
 
74
  #health-bar {
75
  position: relative;
76
- width: 100%; height: 18px;
77
- background: linear-gradient(180deg, rgba(20,30,36,0.9), rgba(12,16,22,0.9));
78
- border: 1px solid rgba(80, 120, 140, 0.55);
79
- border-radius: 8px;
 
 
80
  overflow: hidden;
81
- box-shadow: inset 0 0 10px rgba(0,0,0,0.45);
 
 
82
  }
83
  #health-fill {
84
- position: absolute; left: 0; top: 0; bottom: 0; width: 60%;
85
- background: linear-gradient(90deg, rgba(34,197,94,0.85), rgba(16,185,129,0.95));
86
- box-shadow: 0 0 12px rgba(34,197,94,0.55);
 
 
 
 
87
  }
88
  #health-stripes {
89
- position: absolute; inset: 0;
90
- background: repeating-linear-gradient(45deg, rgba(255,255,255,0.05) 0, rgba(255,255,255,0.05) 6px, transparent 6px, transparent 12px);
 
 
 
 
 
 
 
 
91
  pointer-events: none;
92
  }
93
- #health-text { font-size: 16px; color: #eafff1; text-shadow: 0 0 6px rgba(34,197,94,0.6); }
 
 
 
 
94
  #health-label { margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; }
95
  #health-label .hud-title { margin: 0; }
96
 
97
  /* Ammo */
98
  #ui-ammo { min-width: 220px; text-align: right; }
99
- #ammo { font-size: 40px; font-weight: 800; color: #e6f7ff; text-shadow: 0 0 8px rgba(96,165,250,0.6); }
100
  #ammo:before { content: 'AMMO'; display: block; font-size: 12px; color: var(--muted); letter-spacing: 1.5px; margin-bottom: 6px; text-align: right; }
101
 
102
  /* Score */
@@ -104,11 +133,20 @@
104
  #score:before { content: 'SCORE'; display: block; font-size: 12px; color: var(--muted); letter-spacing: 1.5px; margin-bottom: 6px; }
105
  #score { font-size: 28px; font-weight: 800; color: #fff; }
106
 
 
 
 
 
 
 
 
 
 
107
  /* Top-right stats */
108
- #ui-topright { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
109
- .mini-card { padding: 8px 10px; background: rgba(12,18,26,0.55); border: 1px solid rgba(120, 200, 255, 0.35); border-radius: 8px; }
110
- .mini-card .label { font-size: 11px; color: var(--muted); letter-spacing: 1.2px; }
111
- .mini-card .value { font-size: 22px; font-weight: 700; color: #fff; }
112
  #overlay {
113
  position: absolute;
114
  top: 0; left: 0; right: 0; bottom: 0;
@@ -151,7 +189,7 @@
151
  <div class="hud-value" id="score">0</div>
152
  </div>
153
 
154
- <!-- Wave + Enemies Top-Right -->
155
  <div id="ui-topright" class="hud-card tr">
156
  <div class="mini-card">
157
  <div class="label">WAVE</div>
@@ -161,14 +199,14 @@
161
  <div class="label">ENEMIES</div>
162
  <div class="value" id="enemies">0</div>
163
  </div>
164
- <div class="mini-card">
165
- <div class="label">FPS</div>
166
- <div class="value" id="fps">-</div>
167
- </div>
168
  <div class="mini-card">
169
  <div class="label">GRENADES</div>
170
  <div class="value" id="grenades">0</div>
171
  </div>
 
 
 
 
172
  </div>
173
 
174
  <!-- Health Bottom-Left -->
 
69
  .bl { bottom: 20px; left: 20px; }
70
  .br { bottom: 20px; right: 20px; }
71
 
72
+ /* Health gauge (modern white-on-white) */
73
+ #ui-health {
74
+ width: 360px;
75
+ padding: 14px 16px;
76
+ /* remove container visuals for a cleaner look */
77
+ background: transparent !important;
78
+ border: none !important;
79
+ box-shadow: none !important;
80
+ backdrop-filter: none !important;
81
+ -webkit-backdrop-filter: none !important;
82
+ }
83
  #health-bar {
84
  position: relative;
85
+ width: 100%;
86
+ height: 18px;
87
+ /* subtle track in white tones */
88
+ background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0.10));
89
+ border: none;
90
+ border-radius: 10px;
91
  overflow: hidden;
92
+ box-shadow:
93
+ inset 0 1px 0 rgba(255,255,255,0.35),
94
+ inset 0 -1px 0 rgba(0,0,0,0.06);
95
  }
96
  #health-fill {
97
+ position: absolute;
98
+ left: 0; top: 0; bottom: 0;
99
+ width: 60%;
100
+ /* white fill with soft sheen */
101
+ background: linear-gradient(90deg, #ffffff, #f3f6fb);
102
+ box-shadow: 0 0 16px rgba(255,255,255,0.35);
103
+ transition: width 140ms ease-out;
104
  }
105
  #health-stripes {
106
+ position: absolute;
107
+ inset: 0;
108
+ background: repeating-linear-gradient(
109
+ 45deg,
110
+ rgba(255,255,255,0.18) 0,
111
+ rgba(255,255,255,0.18) 6px,
112
+ transparent 6px,
113
+ transparent 12px
114
+ );
115
+ mix-blend-mode: screen;
116
  pointer-events: none;
117
  }
118
+ #health-text {
119
+ font-size: 16px;
120
+ color: #ffffff;
121
+ text-shadow: 0 0 6px rgba(255,255,255,0.4);
122
+ }
123
  #health-label { margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; }
124
  #health-label .hud-title { margin: 0; }
125
 
126
  /* Ammo */
127
  #ui-ammo { min-width: 220px; text-align: right; }
128
+ #ammo { font-size: 32px; font-weight: 800; color: #fff; text-shadow: none; }
129
  #ammo:before { content: 'AMMO'; display: block; font-size: 12px; color: var(--muted); letter-spacing: 1.5px; margin-bottom: 6px; text-align: right; }
130
 
131
  /* Score */
 
133
  #score:before { content: 'SCORE'; display: block; font-size: 12px; color: var(--muted); letter-spacing: 1.5px; margin-bottom: 6px; }
134
  #score { font-size: 28px; font-weight: 800; color: #fff; }
135
 
136
+ /* Make score, ammo, and top-right containers match health (no chrome) */
137
+ #ui-score, #ui-ammo, #ui-topright {
138
+ background: transparent !important;
139
+ border: none !important;
140
+ box-shadow: none !important;
141
+ backdrop-filter: none !important;
142
+ -webkit-backdrop-filter: none !important;
143
+ }
144
+
145
  /* Top-right stats */
146
+ #ui-topright { display: flex; gap: 16px; align-items: flex-start; }
147
+ .mini-card { padding: 0; background: transparent; border: none; border-radius: 0; box-shadow: none; text-align: right; }
148
+ .mini-card .label { font-size: 12px; color: var(--muted); letter-spacing: 1.5px; margin-bottom: 2px; }
149
+ .mini-card .value { font-size: 18px; font-weight: 700; color: #fff; }
150
  #overlay {
151
  position: absolute;
152
  top: 0; left: 0; right: 0; bottom: 0;
 
189
  <div class="hud-value" id="score">0</div>
190
  </div>
191
 
192
+ <!-- Wave + Enemies + Grenades + FPS Top-Right (single row) -->
193
  <div id="ui-topright" class="hud-card tr">
194
  <div class="mini-card">
195
  <div class="label">WAVE</div>
 
199
  <div class="label">ENEMIES</div>
200
  <div class="value" id="enemies">0</div>
201
  </div>
 
 
 
 
202
  <div class="mini-card">
203
  <div class="label">GRENADES</div>
204
  <div class="value" id="grenades">0</div>
205
  </div>
206
+ <div class="mini-card">
207
+ <div class="label">FPS</div>
208
+ <div class="value" id="fps">-</div>
209
+ </div>
210
  </div>
211
 
212
  <!-- Health Bottom-Left -->
src/main.js CHANGED
@@ -258,8 +258,7 @@ function animate() {
258
  const fps = Math.round(G._fpsFrames / G._fpsAccum);
259
  const el = document.getElementById('fps');
260
  if (el) {
261
- const info = G.renderer?.info?.render || { calls: 0, triangles: 0 };
262
- el.textContent = `${fps} | calls:${info.calls} tris:${info.triangles}`;
263
  }
264
  G._fpsAccum = 0; G._fpsFrames = 0;
265
  }
 
258
  const fps = Math.round(G._fpsFrames / G._fpsAccum);
259
  const el = document.getElementById('fps');
260
  if (el) {
261
+ el.textContent = String(fps);
 
262
  }
263
  G._fpsAccum = 0; G._fpsFrames = 0;
264
  }