src/platform/qt/TileView.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_VIEW
7#define QGBA_TILE_VIEW
8
9#include <QWidget>
10
11#include "GameController.h"
12
13#include "ui_TileView.h"
14
15extern "C" {
16#include "core/tile-cache.h"
17}
18
19namespace QGBA {
20
21class TileView : public QWidget {
22Q_OBJECT
23
24public:
25 TileView(GameController* controller, QWidget* parent = nullptr);
26
27public slots:
28 void updateTiles(bool force = false);
29 void updatePalette(int);
30
31protected:
32 void resizeEvent(QResizeEvent*) override;
33 void showEvent(QShowEvent*) override;
34
35private:
36#ifdef M_CORE_GBA
37 void updateTilesGBA(bool force);
38#endif
39#ifdef M_CORE_GB
40 void updateTilesGB(bool force);
41#endif
42
43 Ui::TileView m_ui;
44
45 GameController* m_controller;
46 std::shared_ptr<mTileCache> m_tileCache;
47 mTileCacheEntry m_tileStatus[3072 * 32]; // TODO: Correct size
48 int m_paletteId;
49 QTimer m_updateTimer;
50};
51
52}
53
54#endif