Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
MousePointer.hpp
Go to the documentation of this file.
1#pragma once
2
3namespace monopoly::chat { struct State; }
4struct SDL_Cursor;
5
6namespace monopoly::mouse
7{
8 enum class CursorKind { Pointer, Text };
9 enum class NativeCursorKind { Arrow, Text, Hidden };
10 struct State
11 {
12 int x{};
13 int y{};
15 bool enabled{true};
16 bool inside{};
17 bool leftDown{};
19 };
20
21 bool initialize();
22 void shutdown();
23 // Coordinates already converted by Application's 800x600 letterbox mapping.
24 void updatePosition(int x, int y, bool inside) noexcept;
25 void setLeftDown(bool down) noexcept;
26 void setEnabled(bool enabled) noexcept;
27 void updateChatCursor(const chat::State& chat) noexcept;
28 [[nodiscard]] const State& stateReadOnly() noexcept;
29 [[nodiscard]] bool assetVisible(const State& state) noexcept;
30 // Keep a usable native arrow when the DAT pointer failed to publish.
32 const State& state, bool assetReady) noexcept;
33
34 // Application-thread owner. Destroy/reset before SDL_Quit.
36 {
37 public:
38 NativeCursor() = default;
40 NativeCursor(const NativeCursor&) = delete;
42 [[nodiscard]] bool sync(NativeCursorKind kind);
43 void reset() noexcept;
44 private:
45 SDL_Cursor* text_{};
47 bool applied_{};
48 };
49}
bool enabled
Definition Engine.cpp:170
unsigned state
unsigned index
Kind kind
NativeCursor(const NativeCursor &)=delete
NativeCursor & operator=(const NativeCursor &)=delete
NativeCursorKind nativeCursorKind(const State &state, bool assetReady) noexcept
void setLeftDown(bool down) noexcept
bool assetVisible(const State &state) noexcept
void updatePosition(int x, int y, bool inside) noexcept
const State & stateReadOnly() noexcept
void setEnabled(bool enabled) noexcept
void updateChatCursor(const chat::State &chat) noexcept