all repos — mgba @ df9616c15c58454332c0dfb7f2b37e0098f518b9

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