MXVK Vulkan Framework 0.35.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent Class Reference

Public Member Functions

uint8_t button () const
uint8_t clicks () const
bool down () const
int32_t key () const
bool key_down () const
bool key_up () const
uint16_t modifiers () const
bool mouse_button_down () const
bool mouse_button_up () const
bool mouse_motion () const
bool mouse_wheel () const
 PythonEvent (const SDL_Event *event)
float relative_x () const
float relative_y () const
bool repeat () const
uint32_t scancode () const
const std::string & text () const
uint64_t timestamp () const
uint32_t type () const
bool wheel_flipped () const
int32_t wheel_ticks_x () const
int32_t wheel_ticks_y () const
float wheel_x () const
float wheel_y () const
float x () const
float y () const

Detailed Description

Definition at line 107 of file mxvk_nanobind.cpp.

Constructor & Destructor Documentation

◆ PythonEvent()

anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::PythonEvent ( const SDL_Event * event)
inlineexplicit

Definition at line 109 of file mxvk_nanobind.cpp.

109 : value(*event) {
110 if (value.type == SDL_EVENT_TEXT_INPUT && event->text.text != nullptr)
111 text_value = event->text.text;
112 }

Member Function Documentation

◆ button()

uint8_t anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::button ( ) const
inlinenodiscard

Definition at line 147 of file mxvk_nanobind.cpp.

◆ clicks()

uint8_t anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::clicks ( ) const
inlinenodiscard

Definition at line 148 of file mxvk_nanobind.cpp.

148{ return mouse_button_down() || mouse_button_up() ? value.button.clicks : 0; }

◆ down()

bool anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::down ( ) const
inlinenodiscard

Definition at line 120 of file mxvk_nanobind.cpp.

120{ return value.key.down; }

◆ key()

int32_t anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::key ( ) const
inlinenodiscard

Definition at line 115 of file mxvk_nanobind.cpp.

115{ return value.key.key; }

◆ key_down()

bool anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::key_down ( ) const
inlinenodiscard

Definition at line 118 of file mxvk_nanobind.cpp.

118{ return value.type == SDL_EVENT_KEY_DOWN; }

◆ key_up()

bool anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::key_up ( ) const
inlinenodiscard

Definition at line 119 of file mxvk_nanobind.cpp.

119{ return value.type == SDL_EVENT_KEY_UP; }

◆ modifiers()

uint16_t anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::modifiers ( ) const
inlinenodiscard

Definition at line 117 of file mxvk_nanobind.cpp.

117{ return value.key.mod; }

◆ mouse_button_down()

bool anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::mouse_button_down ( ) const
inlinenodiscard

Definition at line 124 of file mxvk_nanobind.cpp.

124{ return value.type == SDL_EVENT_MOUSE_BUTTON_DOWN; }

◆ mouse_button_up()

bool anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::mouse_button_up ( ) const
inlinenodiscard

Definition at line 125 of file mxvk_nanobind.cpp.

125{ return value.type == SDL_EVENT_MOUSE_BUTTON_UP; }

◆ mouse_motion()

bool anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::mouse_motion ( ) const
inlinenodiscard

Definition at line 123 of file mxvk_nanobind.cpp.

123{ return value.type == SDL_EVENT_MOUSE_MOTION; }

◆ mouse_wheel()

bool anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::mouse_wheel ( ) const
inlinenodiscard

Definition at line 126 of file mxvk_nanobind.cpp.

126{ return value.type == SDL_EVENT_MOUSE_WHEEL; }

◆ relative_x()

float anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::relative_x ( ) const
inlinenodiscard

Definition at line 145 of file mxvk_nanobind.cpp.

145{ return mouse_motion() ? value.motion.xrel : 0.0F; }

◆ relative_y()

float anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::relative_y ( ) const
inlinenodiscard

Definition at line 146 of file mxvk_nanobind.cpp.

146{ return mouse_motion() ? value.motion.yrel : 0.0F; }

◆ repeat()

bool anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::repeat ( ) const
inlinenodiscard

Definition at line 121 of file mxvk_nanobind.cpp.

121{ return value.key.repeat; }

◆ scancode()

uint32_t anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::scancode ( ) const
inlinenodiscard

Definition at line 116 of file mxvk_nanobind.cpp.

116{ return value.key.scancode; }

◆ text()

const std::string & anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::text ( ) const
inlinenodiscard

Definition at line 122 of file mxvk_nanobind.cpp.

122{ return text_value; }

◆ timestamp()

uint64_t anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::timestamp ( ) const
inlinenodiscard

Definition at line 114 of file mxvk_nanobind.cpp.

114{ return value.common.timestamp; }

◆ type()

uint32_t anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::type ( ) const
inlinenodiscard

Definition at line 113 of file mxvk_nanobind.cpp.

113{ return value.type; }

◆ wheel_flipped()

bool anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::wheel_flipped ( ) const
inlinenodiscard

Definition at line 153 of file mxvk_nanobind.cpp.

153{ return mouse_wheel() && value.wheel.direction == SDL_MOUSEWHEEL_FLIPPED; }

◆ wheel_ticks_x()

int32_t anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::wheel_ticks_x ( ) const
inlinenodiscard

Definition at line 151 of file mxvk_nanobind.cpp.

151{ return mouse_wheel() ? value.wheel.integer_x : 0; }

◆ wheel_ticks_y()

int32_t anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::wheel_ticks_y ( ) const
inlinenodiscard

Definition at line 152 of file mxvk_nanobind.cpp.

152{ return mouse_wheel() ? value.wheel.integer_y : 0; }

◆ wheel_x()

float anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::wheel_x ( ) const
inlinenodiscard

Definition at line 149 of file mxvk_nanobind.cpp.

149{ return mouse_wheel() ? value.wheel.x : 0.0F; }

◆ wheel_y()

float anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::wheel_y ( ) const
inlinenodiscard

Definition at line 150 of file mxvk_nanobind.cpp.

150{ return mouse_wheel() ? value.wheel.y : 0.0F; }

◆ x()

float anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::x ( ) const
inlinenodiscard

Definition at line 127 of file mxvk_nanobind.cpp.

127 {
128 if (mouse_motion())
129 return value.motion.x;
131 return value.button.x;
132 if (mouse_wheel())
133 return value.wheel.mouse_x;
134 return 0.0F;
135 }

◆ y()

float anonymous_namespace{mxvk_nanobind.cpp}::PythonEvent::y ( ) const
inlinenodiscard

Definition at line 136 of file mxvk_nanobind.cpp.

136 {
137 if (mouse_motion())
138 return value.motion.y;
140 return value.button.y;
141 if (mouse_wheel())
142 return value.wheel.mouse_y;
143 return 0.0F;
144 }

The documentation for this class was generated from the following file: