Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 2024 10 #4

Merged
merged 9 commits into from
Oct 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tidy
  • Loading branch information
krupkat committed Oct 21, 2024
commit fb1820c5e61dccddeb11c9559da72e288a1e9e67
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ BasedOnStyle: Google

SortIncludes: CaseInsensitive
IncludeCategories:
- Regex: '<(imgui|implot|SDL|GLFW).*>'
- Regex: '<(imgui|implot|SDL|GLFW|GL).*>'
Priority: 2
- Regex: '<[[:alnum:]._]+>'
Priority: 1
2 changes: 1 addition & 1 deletion misc/default.nix
Original file line number Diff line number Diff line change
@@ -5,10 +5,10 @@ pkgs.mkShell {
nativeBuildInputs = with pkgs; [
cmake
ninja
clang-tools_18
];

buildInputs = with pkgs; [
clang-tools
SDL2
libGL
glfw
4 changes: 2 additions & 2 deletions misc/scripts/format.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
clang-format --verbose -i `find src -name *.cpp -or -name *.hpp`
clang-format --verbose -i `find examples -name *.cpp -or -name *.hpp`
clang-format-18 --verbose -i `find src -name *.cpp -or -name *.hpp`
clang-format-18 --verbose -i `find examples -name *.cpp -or -name *.hpp`
12 changes: 7 additions & 5 deletions src/glfw_opengl3_app.cpp
Original file line number Diff line number Diff line change
@@ -3,8 +3,10 @@
#include "glfw_opengl3_app.hpp"

#include <algorithm>
#include <array>
#include <iostream>

#include <GL/gl.h>
#include <GLFW/glfw3.h>
#include <imgui.h>
#include <imgui_impl_glfw.h>
@@ -15,7 +17,7 @@ namespace imguiplot {

namespace {
void GlfwErrorCallback(int error, const char* description) {
std::cerr << "Glfw Error " << error << ": " << description << std::endl;
std::cerr << "Glfw Error " << error << ": " << description << '\n';
}

constexpr int kColorMaxValue = 255.0f;
@@ -33,7 +35,7 @@ std::array<float, 4> ToFloat(const std::array<int, 4>& clear_color,
bool GlfwOpenGL3Backend::Init() {
glfwSetErrorCallback(GlfwErrorCallback);
if (glfwInit() == GLFW_FALSE) {
std::cerr << "Failed to initialize GLFW" << std::endl;
std::cerr << "Failed to initialize GLFW" << '\n';
return false;
}

@@ -45,7 +47,7 @@ bool GlfwOpenGL3Backend::Init() {
window_ = glfwCreateWindow(options_.window_width, options_.window_height,
options_.window_title.c_str(), nullptr, nullptr);
if (window_ == nullptr) {
std::cerr << "Failed to create GLFW window" << std::endl;
std::cerr << "Failed to create GLFW window" << '\n';
return false;
}

@@ -63,7 +65,7 @@ bool GlfwOpenGL3Backend::Init() {
if (imgui_io.Fonts->AddFontFromFileTTF(
options_.font_path.c_str(),
options_.font_size * options_.gui_scale) == nullptr) {
std::cerr << "Error loading font " << options_.font_path << std::endl;
std::cerr << "Error loading font " << options_.font_path << '\n';
return false;
}

@@ -91,7 +93,7 @@ GlfwOpenGL3Backend::~GlfwOpenGL3Backend() {
}

bool GlfwOpenGL3Backend::IsRunning() {
bool should_close = glfwWindowShouldClose(window_) != GLFW_FALSE;
const bool should_close = glfwWindowShouldClose(window_) != GLFW_FALSE;
if (!should_close) {
glfwPollEvents();
}
1 change: 1 addition & 0 deletions src/glfw_opengl3_app.hpp
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

#include <array>
#include <cstdio>
#include <utility>

#include <GLFW/glfw3.h>

2 changes: 1 addition & 1 deletion src/sdl_renderer_app.cpp
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ namespace imguiplot {

bool SdlRendererBackend::Init() {
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
std::cerr << "Failed to initialize SDL: " << SDL_GetError() << std::endl;
std::cerr << "Failed to initialize SDL: " << SDL_GetError() << '\n';
return false;
}

1 change: 1 addition & 0 deletions src/sdl_renderer_app.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <cstdio>
#include <utility>

#include <SDL.h>

Loading