clangd auto-format
This commit is contained in:
parent
a9c8643318
commit
7c95e8c693
4 changed files with 350 additions and 305 deletions
|
@ -1,7 +1,7 @@
|
|||
#include "Game.hpp"
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
#include <string>
|
||||
|
||||
const sf::Time Game::TimePerFrame = sf::seconds(1.f / 60.f);
|
||||
|
||||
|
@ -24,13 +24,14 @@ void Game::run() {
|
|||
sf::Time elapsedTime = clock.restart();
|
||||
timeSinceLastUpdate += elapsedTime;
|
||||
while (timeSinceLastUpdate > TimePerFrame) {
|
||||
if (32.f - fmod(audioEmitter.getTime(), 32.f) < audioEmitter.timeBeforeNewGeneration) {
|
||||
if (!generated) {
|
||||
audioEmitter.generateMusic();
|
||||
generated = true;
|
||||
}
|
||||
if (32.f - fmod(audioEmitter.getTime(), 32.f) <
|
||||
audioEmitter.timeBeforeNewGeneration) {
|
||||
if (!generated) {
|
||||
audioEmitter.generateMusic();
|
||||
generated = true;
|
||||
}
|
||||
} else {
|
||||
generated = false;
|
||||
generated = false;
|
||||
}
|
||||
timeSinceLastUpdate -= TimePerFrame;
|
||||
|
||||
|
@ -44,7 +45,7 @@ void Game::run() {
|
|||
}
|
||||
}
|
||||
|
||||
void Game::processEvents(AudioEmitter& audioEmitter) {
|
||||
void Game::processEvents(AudioEmitter &audioEmitter) {
|
||||
while (const std::optional event = mWindow.pollEvent()) {
|
||||
if (const auto *keyPressed = event->getIf<sf::Event::KeyPressed>()) {
|
||||
mTarget.handlePlayerInput(keyPressed->code, true);
|
||||
|
@ -52,7 +53,7 @@ void Game::processEvents(AudioEmitter& audioEmitter) {
|
|||
event->getIf<sf::Event::KeyReleased>()) {
|
||||
mTarget.handlePlayerInput(keyReleased->code, false);
|
||||
} else if (event->is<sf::Event::Closed>()) {
|
||||
audioEmitter.audioEnd();
|
||||
audioEmitter.audioEnd();
|
||||
mWindow.close();
|
||||
}
|
||||
}
|
||||
|
@ -67,11 +68,11 @@ void Game::render() {
|
|||
mWindow.display();
|
||||
}
|
||||
|
||||
void Game::updateStatistics(AudioEmitter& audioEmitter) {
|
||||
mStatisticsText.setString(std::format(
|
||||
"Mesure = {}\nBeat = {} us", ceil(audioEmitter.getTime()/8.f),
|
||||
ceil(fmod(audioEmitter.getTime(),8.f))));
|
||||
void Game::updateStatistics(AudioEmitter &audioEmitter) {
|
||||
mStatisticsText.setString(std::format(
|
||||
"Mesure = {}\nBeat = {} us", ceil(audioEmitter.getTime() / 8.f),
|
||||
ceil(fmod(audioEmitter.getTime(), 8.f))));
|
||||
|
||||
mStatisticsUpdateTime -= sf::seconds(1.0f);
|
||||
mStatisticsNumFrames = 0;
|
||||
}
|
||||
mStatisticsUpdateTime -= sf::seconds(1.0f);
|
||||
mStatisticsNumFrames = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue