Skip to content

Commit bbe87c2

Browse files
committed
Fixed some linux warnings
and removed vcxproj.user
1 parent eab86f1 commit bbe87c2

File tree

8 files changed

+19
-13
lines changed

8 files changed

+19
-13
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77

88
/resources/*.txt
99

10+
*.user
11+
1012
*.ini

Blockodu.vcxproj.user

Lines changed: 0 additions & 6 deletions
This file was deleted.

include/settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Settings
2020
inline static unsigned refreshRateImgui;
2121

2222
inline static bool vsync;
23-
inline static int aalevel; //0 - None, 1 - 2x, 2 - 4x, 3 - 8x, 4 - 16x
23+
inline static unsigned aalevel; //0 - None, 1 - 2x, 2 - 4x, 3 - 8x, 4 - 16x
2424

2525
static void defaultValues();
2626
static void save(std::stringstream& sstream);

include/utilities.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ namespace Random
1515
int getNumberInBetween(unsigned a, unsigned b);
1616
}
1717

18+
namespace Math
19+
{
20+
unsigned pow(unsigned base, unsigned power);
21+
}
22+
1823
namespace Files
1924
{
2025
bool exists(const char* fileName);

src/game.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "spacing.h"
77
#include "audio.h"
8+
#include "utilities.h"
89

910
Score *Game::theScore = nullptr;
1011
Table *Game::theTable = nullptr;
@@ -84,7 +85,7 @@ void Game::destroyWindow() {
8485

8586
void Game::initializeWindow() {
8687
sf::ContextSettings settings;
87-
settings.antialiasingLevel = Settings::General::aalevel == 0 ? 0 : (unsigned)pow(2, Settings::General::aalevel);
88+
settings.antialiasingLevel = Settings::General::aalevel == 0 ? 0 : Math::pow(2u, Settings::General::aalevel);
8889

8990
window = new sf::RenderWindow(sf::VideoMode(WINDOW_HEIGHT, WINDOW_WIDTH), "Blockudoku", sf::Style::Close, settings);
9091

src/imguiInterface.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "imguiInterface.h"
33

44
#include <numeric>
5-
#include <execution>
65

76
#include "imgui-SFML.h"
87
#include <SFML/Window/Event.hpp>
@@ -35,7 +34,7 @@ void ImguiInterface::Data::update() {
3534
if (data.historyFps.size() > HISTORYFPS_COUNT)
3635
data.historyFps.erase(data.historyFps.begin());
3736

38-
data.averageFps = static_cast<unsigned>(std::reduce(std::execution::par, data.historyFps.begin(), data.historyFps.end()) / data.historyFps.size());
37+
data.averageFps = static_cast<unsigned>(std::reduce(data.historyFps.begin(), data.historyFps.end()) / data.historyFps.size());
3938

4039
data.latestFrametime = Game::fetchFrametime();
4140
}
@@ -165,7 +164,7 @@ void ImguiInterface::draw(sf::RenderWindow& window) {
165164
else if (Settings::Gameplay::blockModel == -2)
166165
ImGui::Text("Custom");
167166
else
168-
ImGui::Text(structures::grouped[Settings::Gameplay::blockModel]->name);
167+
ImGui::TextUnformatted( structures::grouped[Settings::Gameplay::blockModel]->name);
169168

170169
if (Settings::Gameplay::blockModel == -2) {
171170
ImGui::Separator();

src/settings.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11

2-
#pragma once
3-
42
#include "settings.h"
53
#include "utilities.h"
64
#include "game.h"

src/utilities.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ int Random::getNumberInBetween(unsigned a, unsigned b) {
1313
return distr(gen);
1414
}
1515

16+
unsigned Math::pow(unsigned base, unsigned power) {
17+
if (power == 0)
18+
return 1;
19+
20+
return base * pow(base, power - 1);
21+
}
22+
1623
bool Files::exists(const char* fileName) {
1724
return std::ifstream(fileName).good();
1825
}

0 commit comments

Comments
 (0)