- Added functionality to display an FPS counter in various games based on a cookie setting. - Introduced a utility function to retrieve cookies and check if the FPS counter is enabled. - Updated the FPS calculation logic to start or hide the counter based on user preferences. - Ensured consistent implementation across multiple HTML files, including games like "Bubble Game", "Basketball Legends", and others. - Enhanced the main index and settings pages to manage FPS counter visibility and added a clock feature.
74 lines
2.7 KiB
HTML
74 lines
2.7 KiB
HTML
<h1>play thes gamies in orter</h1>
|
|
<a href="/games.html">Games</a>
|
|
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6951907799659255"
|
|
crossorigin="anonymous"></script>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="shortcut icon" type="x-icon" href="/game online.png">
|
|
<title>home</title>
|
|
<link rel="stylesheet" href="/ecstra/ecsta.css">
|
|
<a href="/games/henreystikman/Crossing The Pit.html">henreystikman Crossing The Pit</a>
|
|
<a href="/games/henreystikman/BreakingTheBank.html">henreystikman BreakingTheBank</a>
|
|
<a href="/games/henreystikman/Escaping The Prison.html"> henrey Escaping The Prison</a>
|
|
<a href="/games/henreystikman/Stealing_the_Diamond.html">Stealing_the_Diamond</a>
|
|
<a href="/games/flasharchive-main/flasharchive-main/html/hs-ita-1.html">Henry Stickmin - Infiltrating the Airship</a>
|
|
<a href="/games/flasharchive-main/flasharchive-main/html/hs-ftc.html">Henry Stickmin - Fleeing the Complex</a>
|
|
|
|
<div id="fps-counter"></div>
|
|
<style>
|
|
#fps-counter {
|
|
position: fixed;
|
|
top: 10px;
|
|
right: 10px;
|
|
font-size: 12px;
|
|
color: white;
|
|
background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
|
|
padding: 5px;
|
|
border-radius: 5px;
|
|
z-index: 1000; /* Ensure it stays on top */
|
|
}
|
|
</style>
|
|
<script>
|
|
const fpsCounter = document.getElementById("fps-counter");
|
|
|
|
// Utility function to get a cookie
|
|
function getCookie(name) {
|
|
const cookies = document.cookie.split(';');
|
|
for (let i = 0; i < cookies.length; i++) {
|
|
const cookie = cookies[i].trim();
|
|
if (cookie.startsWith(name + '=')) {
|
|
return cookie.substring(name.length + 1);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// Check if FPS Counter is enabled
|
|
const fpsCounterEnabled = getCookie('fpsCounter') === 'true';
|
|
|
|
if (fpsCounterEnabled) {
|
|
fpsCounter.style.display = 'block'; // Show FPS counter
|
|
|
|
function calculateFPS() {
|
|
let lastFrameTime = performance.now();
|
|
let frames = 0;
|
|
|
|
function frameLoop() {
|
|
const now = performance.now();
|
|
frames++;
|
|
|
|
if (now - lastFrameTime >= 1000) {
|
|
const fps = Math.round(frames / ((now - lastFrameTime) / 1000));
|
|
fpsCounter.textContent = `FPS: ${fps}`;
|
|
frames = 0;
|
|
lastFrameTime = now;
|
|
}
|
|
requestAnimationFrame(frameLoop);
|
|
}
|
|
frameLoop();
|
|
}
|
|
|
|
calculateFPS(); // Start FPS calculation
|
|
} else {
|
|
fpsCounter.style.display = 'none'; // Hide FPS counter
|
|
}
|
|
</script> |