Skip to content

Commit cb6b309

Browse files
committed
last changes for events (maybe)
1 parent 6da4043 commit cb6b309

File tree

6 files changed

+21
-17
lines changed

6 files changed

+21
-17
lines changed

include/gf2/core/Keycode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ namespace gf {
230230
Mode = details::to_keycode(Scancode::Mode),
231231
};
232232

233-
constexpr Keycode AnyKeycode = static_cast<Keycode>(0xFFFFFFFF);
233+
constexpr Keycode AnyKeycode = Keycode{ std::numeric_limits<std::underlying_type_t<Keycode>>::max() };
234234

235235
}
236236

include/gf2/core/Scancode.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
#include <cstdint>
77

8+
#include <limits>
9+
#include <type_traits>
10+
811
namespace gf {
912

1013
enum class Scancode : uint32_t { // NOLINT(performance-enum-size)
@@ -224,7 +227,7 @@ namespace gf {
224227
Mode = 257,
225228
};
226229

227-
constexpr Scancode AnyScancode = static_cast<Scancode>(0xFFFFFFFF);
230+
constexpr Scancode AnyScancode = Scancode{ std::numeric_limits<std::underlying_type_t<Scancode>>::max() };
228231

229232
}
230233

include/gf2/graphics/Cursor.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ namespace gf {
1515
Default,
1616
Text,
1717
Wait,
18-
Cross,
18+
Crosshair,
1919
Progress,
20-
SizeTopLeftBottomRight,
21-
SizeBottomLeftTopRight,
22-
SizeHorizontal,
23-
SizeVertical,
20+
NorthWestSouthEastResize,
21+
NorthEastSouthWestResize,
22+
EastWestResize,
23+
NorthSouthResize,
2424
Move,
2525
NotAllowed,
2626
Pointer,

library/graphics/Cursor.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ namespace gf {
2424
cursor_type_check<CursorType::Default, SDL_SYSTEM_CURSOR_DEFAULT>();
2525
cursor_type_check<CursorType::Text, SDL_SYSTEM_CURSOR_TEXT>();
2626
cursor_type_check<CursorType::Wait, SDL_SYSTEM_CURSOR_WAIT>();
27-
cursor_type_check<CursorType::Cross, SDL_SYSTEM_CURSOR_CROSSHAIR>();
27+
cursor_type_check<CursorType::Crosshair, SDL_SYSTEM_CURSOR_CROSSHAIR>();
2828
cursor_type_check<CursorType::Progress, SDL_SYSTEM_CURSOR_PROGRESS>();
29-
cursor_type_check<CursorType::SizeTopLeftBottomRight, SDL_SYSTEM_CURSOR_NWSE_RESIZE>();
30-
cursor_type_check<CursorType::SizeBottomLeftTopRight, SDL_SYSTEM_CURSOR_NESW_RESIZE>();
31-
cursor_type_check<CursorType::SizeHorizontal, SDL_SYSTEM_CURSOR_EW_RESIZE>();
32-
cursor_type_check<CursorType::SizeVertical, SDL_SYSTEM_CURSOR_NS_RESIZE>();
29+
cursor_type_check<CursorType::NorthWestSouthEastResize, SDL_SYSTEM_CURSOR_NWSE_RESIZE>();
30+
cursor_type_check<CursorType::NorthEastSouthWestResize, SDL_SYSTEM_CURSOR_NESW_RESIZE>();
31+
cursor_type_check<CursorType::EastWestResize, SDL_SYSTEM_CURSOR_EW_RESIZE>();
32+
cursor_type_check<CursorType::NorthSouthResize, SDL_SYSTEM_CURSOR_NS_RESIZE>();
3333
cursor_type_check<CursorType::Move, SDL_SYSTEM_CURSOR_MOVE>();
3434
cursor_type_check<CursorType::Pointer, SDL_SYSTEM_CURSOR_POINTER>();
3535
cursor_type_check<CursorType::NotAllowed, SDL_SYSTEM_CURSOR_NOT_ALLOWED>();

library/graphics/Keyboard.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
#include <type_traits>
77

88
#include <SDL3/SDL.h>
9-
#include "gf2/core/Modifier.h"
109

1110
namespace gf {
1211

1312
namespace {
1413

1514
static_assert(std::is_same_v<std::underlying_type_t<Modifier>, SDL_Keymod>);
15+
static_assert(std::is_same_v<std::underlying_type_t<Keycode>, SDL_Keycode>);
16+
static_assert(std::is_same_v<std::underlying_type_t<Scancode>, std::make_unsigned_t<SDL_Scancode>>);
1617

1718
template<Modifier Mod, SDL_Keymod Value>
1819
constexpr void modifier_check()

library/imgui/ImguiManager.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ namespace gf {
3333
case ImGuiMouseCursor_ResizeAll:
3434
return CursorType::Move;
3535
case ImGuiMouseCursor_ResizeNS:
36-
return CursorType::SizeVertical;
36+
return CursorType::NorthSouthResize;
3737
case ImGuiMouseCursor_ResizeEW:
38-
return CursorType::SizeHorizontal;
38+
return CursorType::EastWestResize;
3939
case ImGuiMouseCursor_ResizeNESW:
40-
return CursorType::SizeBottomLeftTopRight;
40+
return CursorType::NorthEastSouthWestResize;
4141
case ImGuiMouseCursor_ResizeNWSE:
42-
return CursorType::SizeTopLeftBottomRight;
42+
return CursorType::NorthEastSouthWestResize;
4343
case ImGuiMouseCursor_Hand:
4444
return CursorType::Pointer;
4545
case ImGuiMouseCursor_NotAllowed:

0 commit comments

Comments
 (0)