aboutsummaryrefslogtreecommitdiff
path: root/src/client/window/inventory_window.hh
blob: a77ae2f636f1356a2bd0ccd9880aaaead250d104 (plain)
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
36
37
38
39
40
#ifndef CLIENT_WINDOW_INVENTORY_WINDOW_HH_
#define CLIENT_WINDOW_INVENTORY_WINDOW_HH_

#include <cstdint>
#include <optional>

#include "client/item/item.hh"
#include "client/render/draw.hh"
#include "client/state/state.hh"
#include "client/window/basic_window.hh"

namespace client {
namespace window {

class inventory_window : public basic_window {
private:
    std::optional<unsigned long> grabbed;

private:
    std::optional<unsigned long>
    maybe_get_inventory_index(const glm::vec2& pos) const noexcept;

private:
    bool maybe_handle_mousebuttondown(const SDL_Event& event) noexcept;
    bool maybe_handle_mousebuttonup(const SDL_Event& event) noexcept;

public:
    template <typename... Args>
    inventory_window(Args&&... args) noexcept
        : basic_window(std::forward<Args>(args)...) {}
    virtual ~inventory_window() noexcept {}

    virtual bool maybe_handle_event(const SDL_Event& event) noexcept override;
    virtual void draw() noexcept override;
};

} // namespace window
} // namespace client

#endif