Skip to content

Instantly share code, notes, and snippets.

@Journeyman1337
Created September 30, 2021 20:55
Show Gist options
  • Save Journeyman1337/e207e9de81cc2f97bce7e15788451b44 to your computer and use it in GitHub Desktop.
Save Journeyman1337/e207e9de81cc2f97bce7e15788451b44 to your computer and use it in GitHub Desktop.
#pragma once
#include <variant>
namespace prpg::window_event
{
struct PositionChanged
{
const int xpos;
const int ypos;
PositionChanged(const int xpos, const int ypos) noexcept;
};
struct Close
{
Close() noexcept = default;
};
struct Focus
{
const bool focused;
Focus(const bool focused) noexcept;
};
struct Iconify
{
const bool iconified;
Iconify(const bool iconified) noexcept;
};
struct Maximize
{
const bool maximized;
Maximize(const bool maximized) noexcept;
};
struct Resize
{
const int pixel_width;
const int pixel_height;
Resize(const int pixel_width, const int pixel_height);
};
struct ContentScale
{
const float scale_wide;
const float scale_tall;
ContentScale(const float scale_wide, const float scale_tall) noexcept;
};
struct Key
{
const int key;
const int scancode;
const int button_state;
const int mod;
Key(const int key, const int scancode, const int button_state, const int mod) noexcept;
};
struct Char
{
const int charcode;
Char(const int charcode) noexcept;
};
struct MouseButton
{
const int mouse_button;
const int button_state;
const int mod;
MouseButton(const int mouse_button, const int button_state, const int mod) noexcept;
};
struct CursorMove
{
const double x_position;
const double y_position;
CursorMove(const double x_position, const double y_position) noexcept;
};
struct CursorEnter
{
const bool entered;
CursorEnter(const bool entered) noexcept;
};
struct Scroll
{
const double xscroll;
const double yscroll;
Scroll(const double xscroll, const double yscroll) noexcept;
};
struct Refresh
{
Refresh() noexcept = default;
};
typedef std::variant<
PositionChanged,
Close,
Focus,
Iconify,
Maximize,
Resize,
ContentScale,
Key,
Char,
MouseButton,
CursorMove,
CursorEnter,
Scroll,
Refresh
> Event_t;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment