Skip to content

Commit 22c06a1

Browse files
committed
feat: check sfml/imgui-sfml init values
1 parent c78fc1d commit 22c06a1

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/Audio.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ void Audio::play(unsigned value) {
6363
sf::SoundChannel::Mono,
6464
};
6565

66-
sound().stop();
67-
bool _might = buffer().loadFromSamples(samples, 44100, 1, 44100, channelMap);
68-
sound().setPitch(pitch);
69-
sound().play();
66+
if (buffer().loadFromSamples(samples, 44100, 1, 44100, channelMap)) {
67+
sound().stop();
68+
sound().setPitch(pitch);
69+
sound().play();
70+
}
7071
}

src/Interface.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,19 @@ void Interface::changedAlgorithm() {
5555
}
5656

5757
void Interface::initialize(sf::RenderWindow& window) {
58-
bool _might = ImGui::SFML::Init(window);
58+
if (ImGui::SFML::Init(window)) {
59+
ImGui::CreateContext();
60+
ImPlot::CreateContext();
5961

60-
ImGui::CreateContext();
61-
ImPlot::CreateContext();
62+
Interface::changedAntialiasing();
6263

63-
Interface::changedAntialiasing();
64-
65-
Interface::changedAlgorithm();
64+
Interface::changedAlgorithm();
6665

67-
ImVec4 PlotCursorColormap[] = {{0.f, 0.f, 0.f, 0.f}, {0.f, 0.f, 0.f, 1.f}}; //will remove when ImPlot gets ColormapRemove feature
68-
ImPlot::AddColormap("HeatmapCursorColormap", PlotCursorColormap, 2);
66+
ImVec4 PlotCursorColormap[] = {{0.f, 0.f, 0.f, 0.f}, {0.f, 0.f, 0.f, 1.f}}; //will remove when ImPlot gets ColormapRemove feature
67+
ImPlot::AddColormap("HeatmapCursorColormap", PlotCursorColormap, 2);
68+
} else {
69+
Interface::shutdown();
70+
}
6971
}
7072

7173
void Interface::shutdown() {

0 commit comments

Comments
 (0)