all repos — mgba @ 686380b6c4d8acf219a704a8932668b11efc47c2

mGBA Game Boy Advance Emulator

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#ifndef QGBA_TILE_PAINTER
 7#define QGBA_TILE_PAINTER
 8
 9#include <QColor>
10#include <QWidget>
11#include <QVector>
12
13namespace QGBA {
14
15class TilePainter : public QWidget {
16Q_OBJECT
17
18public:
19	TilePainter(QWidget* parent = nullptr);
20
21public slots:
22	void setTile(int index, const uint16_t*);
23	void setTileCount(int tiles);
24	void setTileMagnification(int mag);
25
26signals:
27	void indexPressed(int index);
28
29protected:
30	void paintEvent(QPaintEvent*) override;
31	void mousePressEvent(QMouseEvent*) override;
32	void resizeEvent(QResizeEvent*) override;
33
34private:
35	QPixmap m_backing;
36	int m_size;
37	int m_tileCount;
38};
39
40}
41
42#endif