1 #if !defined(_BTKIMPL_UTILS_HPP_) 2 #define _BTKIMPL_UTILS_HPP_ 4 #include <SDL2/SDL_events.h> 5 #include "../widget.hpp" 6 #include "../event.hpp" 23 return rect.x + rect.w - w;
25 return rect.x + ((rect.w - w) / 2);
43 return rect.y + rect.h - h;
45 return rect.y + ((rect.h - h) / 2);
75 MotionEvent TranslateEvent(
const SDL_MouseMotionEvent &event);
76 MouseEvent TranslateEvent(
const SDL_MouseButtonEvent &event);
77 WheelEvent TranslateEvent(
const SDL_MouseWheelEvent &event);
78 KeyEvent TranslateEvent(
const SDL_KeyboardEvent &event);
83 #endif // _BTKIMPL_UTILS_HPP_ a SDL_Rect with methods
Definition: rect.hpp:10
This header include many useful containers.
Definition: async.hpp:7
Rect CalculateRectByAlign(const Rect &rect, int w, int h, Align v_align, Align h_align)
Calcaute a area in a Rect by alignment.
Definition: utils.hpp:61
A Event of text input.
Definition: event.hpp:237
A event about mouse click.
Definition: event.hpp:106
A event about keyboard.
Definition: event.hpp:171
A event about mouse motion.
Definition: event.hpp:216
int CalculateYByAlign(const Rect &rect, int h, Align h_align)
Calcaute a area's Y in a Rect by alignment.
Definition: utils.hpp:38
Definition: event.hpp:287
int CalculateXByAlign(const Rect &rect, int w, Align v_align)
Calcaute a area's X in a Rect by alignment.
Definition: utils.hpp:18