initial port for Cevo game in C++ (libs)

This commit is contained in:
Geoffray Levasseur committed 2026-10-22 17:20:45 +02:00
commit 8436242032
375 files changed
+46282

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
#include "Cevo/CevoButtonA.h"
#include "Cevo/CevoScreenTools.h"
namespace Cevo {
ButtonA::ButtonA(QWidget *parent) : ButtonBase(parent)
{
resize(100, 25);
}
void ButtonA::paint(Dpi::Canvas &canvas)
{
if (m_graphic) {
canvas.copyRect(QRect(0, 0, 100, 25), m_graphic->canvas(),
QRect(195, 243 + 26 * (down() ? 1 : 0), 100, 25));
canvas.font().assign(m_font);
canvas.font().setColor(Qt::black);
const QSize textSize = canvas.textExtent(m_caption);
canvas.textOut(50 - (textSize.width() + 1) / 2, 12 - textSize.height() / 2, m_caption);
} else {
canvas.brush().setColor(colorFromDelphi(0x0000FF));
canvas.frameRect(QRect(0, 0, 100, 25));
}
}
void ButtonA::setCaption(const QString &text)
{
if (text != m_caption) {
m_caption = text;
update();
}
}
void ButtonA::setFont(const Dpi::Font &font)
{
m_font.assign(font);
m_font.setColor(Qt::black);
}
} // namespace Cevo