Skip to content

Commit

Permalink
Fix some clang-tidy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Jul 15, 2024
1 parent 2ca2a08 commit 2af7eb1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/jngl/Shader.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018-2023 Jan Niklas Hasse <[email protected]>
// Copyright 2018-2024 Jan Niklas Hasse <[email protected]>
// For conditions of distribution and use, see copyright notice in LICENSE.txt
/// @file
#pragma once
Expand All @@ -12,7 +12,7 @@ namespace jngl {
class Shader {
public:
/// Type of a Shader. To link a ShaderProgram, one shader of each type is needed.
enum class Type {
enum class Type : uint8_t {
VERTEX,
FRAGMENT,
};
Expand Down
5 changes: 3 additions & 2 deletions src/jngl/effects.hpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
// Copyright 2020-2022 Jan Niklas Hasse <[email protected]>
// Copyright 2020-2024 Jan Niklas Hasse <[email protected]>
// For conditions of distribution and use, see copyright notice in LICENSE.txt
/// Effects that can be applied to jngl::Widget
/// @file
#pragma once

#include "Vec2.hpp"
#include <cstdint>
#include <functional>

namespace jngl {

/// Base class for effects that can be applied to jngl::Widget
class Effect {
public:
enum class Action {
enum class Action : uint8_t {
NONE,
REMOVE_EFFECT,
REMOVE_WIDGET,
Expand Down
10 changes: 5 additions & 5 deletions src/jngl/input.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2022 Jan Niklas Hasse <[email protected]>
// Copyright 2012-2024 Jan Niklas Hasse <[email protected]>
// For conditions of distribution and use, see copyright notice in LICENSE.txt
/// Input related functions
/// @file
Expand All @@ -21,7 +21,7 @@ namespace jngl {

namespace key {
/// Keyboard keys
enum KeyType {
enum KeyType : uint8_t {
Left,
Up,
Right,
Expand Down Expand Up @@ -72,7 +72,7 @@ enum KeyType {
void setKeyboardVisible(bool);

/// Whether a normal or a numbers-only keyboard should appear
enum KeyboardType { Default, Numpad };
enum KeyboardType : uint8_t { Default, Numpad };

/// Type of the onscreen keyboard
void setKeyboardType(KeyboardType);
Expand Down Expand Up @@ -144,7 +144,7 @@ optional<Vec2> getCursorPos();

namespace mouse {
/// Mouse buttons
enum Button { Left, Middle, Right };
enum Button : uint8_t { Left, Middle, Right };
} // namespace mouse

/// Returns mouse wheel movement between -100 and 100 (0 if the mousewheel doesn't move)
Expand All @@ -167,7 +167,7 @@ void setMouse(Vec2 position);

namespace controller {
/// Gamepad buttons
enum Button {
enum Button : uint8_t {
/// x axis of left stick, -1 to 1
LeftStickX,

Expand Down
2 changes: 1 addition & 1 deletion src/jngl/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void Text::step() {

void Text::draw() const {
jngl::pushMatrix();
jngl::translate(int(getX()), int(getY()));
jngl::translate(static_cast<int>(getX()), static_cast<int>(getY()));
for (auto& line : lines) {
line->draw();
}
Expand Down
2 changes: 1 addition & 1 deletion src/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Pixels Window::getLineHeight() {
}

void Window::setLineHeight(Pixels h) {
return fonts_[fontSize_][fontName_]->setLineHeight(h);
fonts_[fontSize_][fontName_]->setLineHeight(h);
}

std::shared_ptr<FontImpl> Window::getFontImpl() {
Expand Down

0 comments on commit 2af7eb1

Please sign in to comment.