initial port for Cevo game in C++ (libs)
This commit is contained in:
commit
8436242032
375 files changed
+46282
No files matched your search
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dpi/DpiGraphics.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <functional>
|
||||
|
||||
namespace Cevo {
|
||||
|
||||
// TButtonN equivalent: a 42x42 unit-selection button with its own
|
||||
// Possible/Lit toggle model (distinct from ButtonBase's Down/Permanent),
|
||||
// so it is a standalone widget rather than a ButtonBase subclass.
|
||||
class ButtonN : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ButtonN(QWidget *parent = nullptr);
|
||||
|
||||
bool possible() const { return m_possible; }
|
||||
void setPossible(bool value);
|
||||
bool lit() const { return m_lit; }
|
||||
void setLit(bool value);
|
||||
int buttonIndex() const { return m_index; }
|
||||
void setButtonIndex(int value);
|
||||
QString smartHint() const { return m_smartHint; }
|
||||
void setSmartHint(const QString &value);
|
||||
|
||||
Dpi::Bitmap *graphic() const { return m_graphic; }
|
||||
void setGraphic(Dpi::Bitmap *value) { m_graphic = value; }
|
||||
Dpi::Bitmap *mask() const { return m_mask; }
|
||||
void setMask(Dpi::Bitmap *value) { m_mask = value; }
|
||||
Dpi::Bitmap *backGraphic() const { return m_backGraphic; }
|
||||
void setBackGraphic(Dpi::Bitmap *value) { m_backGraphic = value; }
|
||||
|
||||
std::function<void()> onClick;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
Dpi::Bitmap *m_graphic = nullptr;
|
||||
Dpi::Bitmap *m_mask = nullptr;
|
||||
Dpi::Bitmap *m_backGraphic = nullptr;
|
||||
bool m_possible = true;
|
||||
bool m_lit = false;
|
||||
int m_index = -1;
|
||||
int m_backIndex = 1;
|
||||
QString m_smartHint;
|
||||
Dpi::Bitmap m_buffer;
|
||||
};
|
||||
|
||||
} // namespace Cevo
|
||||
Reference in new issue
Block a user