all repos — mgba @ faceb902c823411f8199705a02e196e8cf969337

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
22	QPixmap backing() const { return m_backing; }
23
24public slots:
25	void setTile(int index, const color_t*);
26	void setTileCount(int tiles);
27	void setTileMagnification(int mag);
28
29signals:
30	void indexPressed(int index);
31	void needsRedraw();
32
33protected:
34	void paintEvent(QPaintEvent*) override;
35	void mousePressEvent(QMouseEvent*) override;
36	void resizeEvent(QResizeEvent*) override;
37
38private:
39	QPixmap m_backing{256, 768};
40	int m_size = 8;
41	int m_tileCount;
42};
43
44}