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