src/platform/qt/AssetView.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_ASSET_VIEW
7#define QGBA_ASSET_VIEW
8
9#include <QTimer>
10#include <QWidget>
11
12#include <mgba/core/tile-cache.h>
13
14#include <memory>
15
16namespace QGBA {
17
18class CoreController;
19
20class AssetView : public QWidget {
21Q_OBJECT
22
23public:
24 AssetView(std::shared_ptr<CoreController> controller, QWidget* parent = nullptr);
25
26 void compositeTile(unsigned tileId, void* image, size_t stride, size_t x, size_t y, int depth = 8);
27
28protected slots:
29 void updateTiles();
30 void updateTiles(bool force);
31
32protected:
33#ifdef M_CORE_GBA
34 virtual void updateTilesGBA(bool force) = 0;
35#endif
36#ifdef M_CORE_GB
37 virtual void updateTilesGB(bool force) = 0;
38#endif
39
40 void resizeEvent(QResizeEvent*) override;
41 void showEvent(QShowEvent*) override;
42
43 mTileCache* const m_tileCache;
44
45private:
46 std::shared_ptr<CoreController> m_controller;
47 QTimer m_updateTimer;
48};
49
50}
51
52#endif