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,59 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dpi/DpiForms.h"
|
||||
|
||||
#include <QPoint>
|
||||
#include <QString>
|
||||
|
||||
namespace Cevo {
|
||||
|
||||
// TDrawDlg equivalent: a borderless, custom-painted dialog that can be
|
||||
// dragged by its title area and closed with Escape.
|
||||
class DrawDlg : public Dpi::Form {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DrawDlg(QWidget *parent = nullptr);
|
||||
|
||||
virtual void smartInvalidate();
|
||||
void centerToScreen();
|
||||
void centerToScreen(int w, int h);
|
||||
|
||||
protected:
|
||||
int titleHeight = 0; // area (from the top) that can be used to drag the window
|
||||
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
|
||||
private:
|
||||
QPoint m_moveFormPos;
|
||||
QPoint m_moveMousePos;
|
||||
bool m_moveActive = false;
|
||||
};
|
||||
|
||||
// TBaseMessgDlg equivalent: a simple word-wrapped message box drawn with the
|
||||
// game's own frame/background style.
|
||||
class BaseMessgDlg : public DrawDlg {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BaseMessgDlg(QWidget *parent = nullptr);
|
||||
|
||||
QString messageText;
|
||||
|
||||
protected:
|
||||
static constexpr int Border = 3;
|
||||
static constexpr int MessageLineSpacing = 20;
|
||||
|
||||
int lines = 0;
|
||||
int topSpace = 0;
|
||||
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
// Pass preview=true to just measure how many lines the text needs
|
||||
// (fills `lines`) without drawing anything.
|
||||
void splitText(bool preview);
|
||||
void correctHeight();
|
||||
};
|
||||
|
||||
} // namespace Cevo
|
||||
Reference in new issue
Block a user