|
@@ -2,10 +2,9 @@
|
|
|
#include "BaseWindow.h"
|
|
|
|
|
|
#include <imfilebrowser.h>
|
|
|
-
|
|
|
#include <iostream>
|
|
|
|
|
|
-void window_resize_callback(GLFWwindow *, int width, int height) {
|
|
|
+void window_resize_callback(GLFWwindow * /*unused*/, int width, int height) {
|
|
|
glViewport(0, 0, width, height);
|
|
|
}
|
|
|
|
|
@@ -25,7 +24,7 @@ BaseWindow::~BaseWindow() {
|
|
|
glfwTerminate();
|
|
|
}
|
|
|
|
|
|
-int BaseWindow::run() {
|
|
|
+auto BaseWindow::run() -> int {
|
|
|
glfwInit();
|
|
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
|
@@ -34,8 +33,8 @@ int BaseWindow::run() {
|
|
|
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
|
|
|
|
|
m_window = glfwCreateWindow(m_window_width, m_window_height, m_window_title,
|
|
|
- NULL, NULL);
|
|
|
- if (m_window == NULL) {
|
|
|
+ nullptr, nullptr);
|
|
|
+ if (m_window == nullptr) {
|
|
|
std::cout << "could not intialize GLFW Window"
|
|
|
<< "\n";
|
|
|
glfwTerminate();
|
|
@@ -44,7 +43,7 @@ int BaseWindow::run() {
|
|
|
|
|
|
glfwMakeContextCurrent(m_window);
|
|
|
|
|
|
- if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
|
|
|
+ if (gladLoadGLLoader(reinterpret_cast<GLADloadproc>(glfwGetProcAddress)) == 0) {
|
|
|
std::cout << "Failed to initialize GLAD" << std::endl;
|
|
|
return 1;
|
|
|
}
|
|
@@ -52,7 +51,7 @@ int BaseWindow::run() {
|
|
|
glfwSetFramebufferSizeCallback(m_window, window_resize_callback);
|
|
|
IMGUI_CHECKVERSION();
|
|
|
ImGui::CreateContext();
|
|
|
- ImGuiIO &io = ImGui::GetIO();
|
|
|
+ ImGuiIO const&io = ImGui::GetIO();
|
|
|
(void)io;
|
|
|
ImGui::StyleColorsDark();
|
|
|
ImGui_ImplGlfw_InitForOpenGL(m_window, true);
|
|
@@ -63,7 +62,7 @@ int BaseWindow::run() {
|
|
|
fileDialog.SetTypeFilters({".mp3"});
|
|
|
|
|
|
// Main game loop
|
|
|
- while (!glfwWindowShouldClose(m_window)) {
|
|
|
+ while (glfwWindowShouldClose(m_window) == 0) {
|
|
|
// Create new imgui frames
|
|
|
ImGui_ImplOpenGL3_NewFrame();
|
|
|
ImGui_ImplGlfw_NewFrame();
|
|
@@ -77,13 +76,13 @@ int BaseWindow::run() {
|
|
|
}
|
|
|
|
|
|
static std::filesystem::path selected;
|
|
|
- if (m_audio_handler->loaded_files().size() > 0) {
|
|
|
+ if (!m_audio_handler->loaded_files().empty()) {
|
|
|
if (ImGui::BeginListBox(
|
|
|
"##",
|
|
|
ImVec2(-FLT_MIN,
|
|
|
5 * ImGui::GetTextLineHeightWithSpacing()))) {
|
|
|
- for (auto file : m_audio_handler->loaded_files()) {
|
|
|
- bool is_selected = selected.compare(file);
|
|
|
+ for (const auto& file : m_audio_handler->loaded_files()) {
|
|
|
+ bool const is_selected = selected.compare(file) != 0;
|
|
|
if (ImGui::Selectable(file.string().c_str(),
|
|
|
is_selected)) {
|
|
|
selected = file;
|