8#ifndef DESIGNLAB_ABSTRACT_DXLIB_GUI_H_
9#define DESIGNLAB_ABSTRACT_DXLIB_GUI_H_
48 void SetPos(
int pos_x,
int pos_y,
50 bool this_is_first_time =
false);
55 virtual void Draw()
const = 0;
65 bool CursorOnGui(
int cursor_x,
int cursor_y)
const noexcept override;
69 bool IsDraggable(
int cursor_x,
int cursor_y)
const override;
82 int cursor_dif_x,
int cursor_dif_y,
unsigned int mouse_key_bit)
override;
87 std::vector<std::unique_ptr<SimpleButton>>
button_;
int init_pos_y_
SetされたGUIの左上のY座標.
void SetDragged(const bool is_dragged) override
ドラッグ中かどうかを設定する.
void SetPos(int pos_x, int pos_y, unsigned int option=kDxlibGuiAnchorLeftTop, bool this_is_first_time=false)
GUIの位置を設定する. Dxlibの画面の座標は左上を原点とし,右下に行くほど値が大きくなる. 横方向にx軸,縦方向にy軸をとる.
void DrawBackground(const std::string &str) const
bool visible_
GUIが表示されているかどうかのフラグ.
int gui_left_pos_x_
GUIの左端の位置.
static constexpr int kTitleBarHeight
タイトルバーの高さ.
int gui_top_pos_y_
GUIの上端の位置.
bool IsDragged() const override
ドラッグ中かどうかを取得する.
AbstractDxlibGui()=delete
virtual void Draw() const =0
GUIの描画.
void SetVisible(bool visible) override
GUIの表示を行うかどうかを設定する.
void DraggedAction(int cursor_dif_x, int cursor_dif_y, unsigned int mouse_key_bit) override
ドラッグ中の処理を行う. カーソルは上にあるけど,ドラッグ中ではない場合でも呼び出される.
virtual ~AbstractDxlibGui()=default
bool IsDraggable(int cursor_x, int cursor_y) const override
ドラッグ可能な位置にあるかを判定する.
constexpr bool IsVisible() const override
GUIの表示を行うかどうかを返す.
virtual void Update()=0
GUIの更新,毎フレーム実行すること.
bool CursorOnGui(int cursor_x, int cursor_y) const noexcept override
GUIの上にカーソルがあるかどうかを返す.
int init_pos_x_
SetされたGUIの左上のX座標.
int font_handle_
フォントハンドル.
std::vector< std::unique_ptr< SimpleButton > > button_
ボタンのリスト.
void ClickedAction(const DxlibMouseState &state) override
GUIがクリックされたときに実行される関数. CursorOnGuiが true を返すときに呼び出される. 複数のGUIが重なっている場合は,優先度の高いものから順に呼び出される.
Dxlibの画面に表示するGUIのインターフェース.
constexpr unsigned int kDxlibGuiAnchorLeftTop