src/platform/qt/TilePainter.h (view raw)
1/* Copyright (c) 2013-2016 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#pragma once
7
8#include <QColor>
9#include <QWidget>
10#include <QVector>
11
12namespace QGBA {
13
14class TilePainter : public QWidget {
15Q_OBJECT
16
17public:
18 TilePainter(QWidget* parent = nullptr);
19
20public slots:
21 void setTile(int index, const uint16_t*);
22 void setTileCount(int tiles);
23 void setTileMagnification(int mag);
24
25signals:
26 void indexPressed(int index);
27
28protected:
29 void paintEvent(QPaintEvent*) override;
30 void mousePressEvent(QMouseEvent*) override;
31 void resizeEvent(QResizeEvent*) override;
32
33private:
34 QPixmap m_backing{256, 768};
35 int m_size = 8;
36 int m_tileCount;
37};
38
39}