Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
igagis committed Apr 4, 2024
1 parent a86f940 commit 97533ac
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 10 deletions.
39 changes: 30 additions & 9 deletions src/car_widget.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
/*
carcockpit - Car cockpit example GUI project
Copyright (C) 2024 Gagistech Oy <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

/* ================ LICENSE END ================ */

#include "car_widget.hpp"

#include <ratio>
Expand Down Expand Up @@ -36,13 +57,15 @@ car_widget::car_widget(utki::shared_ref<ruis::context> context, all_parameters p

auto tex_vbo = this->context.get().renderer.get().factory->create_vertex_buffer(utki::make_span(cube_tex));

// clang-format off
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
std::array<uint16_t, 36> indices = {
{// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35
}
};
std::array<uint16_t, 36> indices = {{
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35
}};
// clang-format on

auto cube_indices = this->context.get().renderer.get().factory->create_index_buffer(utki::make_span(indices));

Expand All @@ -54,16 +77,14 @@ car_widget::car_widget(utki::shared_ref<ruis::context> context, all_parameters p

this->tex = this->context.get().loader.load<ruis::res::texture>("tex_sample").to_shared_ptr();
this->rot.set_identity();


}

void car_widget::update(uint32_t dt)
{
this->fps_sec_counter += dt;
++this->fps;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
this->rot *=
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
ruis::quaternion().set_rotation(r4::vector3<float>(1, 2, 1).normalize(), 1.5f * (float(dt) / std::milli::den));
if (this->fps_sec_counter >= std::milli::den) {
std::cout << "fps = " << std::dec << fps << std::endl;
Expand Down
23 changes: 23 additions & 0 deletions src/car_widget.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
/*
carcockpit - Car cockpit example GUI project
Copyright (C) 2024 Gagistech Oy <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

/* ================ LICENSE END ================ */

#pragma once

#include <ruis/res/texture.hpp>
Expand All @@ -21,6 +42,8 @@ class car_widget : public ruis::widget, public ruis::updateable
struct parameters {};

private:
// TODO: remove lint suppression
// NOLINTNEXTLINE(clang-diagnostic-unused-private-field)
parameters params;

public:
Expand Down
2 changes: 1 addition & 1 deletion src/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ utki::shared_ref<ruis::widget> carcockpit::make_root_layout(utki::shared_ref<rui
.id = "car_widget"s,
.lp = {
.dims = {lp::fill, lp::fill},
.weight = 5
.weight = 5 // NOLINT(cppcoreguidelines-avoid-magic-numbers)
}
}
}
Expand Down

0 comments on commit 97533ac

Please sign in to comment.