1 /* Copyright (c) 2013-2017 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 "AssetView.h"
9 
10 #include "ui_MapView.h"
11 
12 #include <mgba/core/map-cache.h>
13 
14 namespace QGBA {
15 
16 class CoreController;
17 
18 class MapView : public AssetView {
19 Q_OBJECT
20 
21 public:
22 	MapView(std::shared_ptr<CoreController> controller, QWidget* parent = nullptr);
23 
24 public slots:
25 	void exportMap();
26 	void copyMap();
27 
28 private slots:
29 	void selectMap(int);
30 	void selectTile(int x, int y);
31 
32 protected:
33 	bool eventFilter(QObject*, QEvent*) override;
34 
35 private:
36 #ifdef M_CORE_GBA
37 	void updateTilesGBA(bool force) override;
38 #endif
39 #ifdef M_CORE_GB
40 	void updateTilesGB(bool force) override;
41 #endif
42 
43 	Ui::MapView m_ui;
44 
45 	std::shared_ptr<CoreController> m_controller;
46 	mMapCacheEntry m_mapStatus[128 * 128] = {}; // TODO: Correct size
47 	mBitmapCacheEntry m_bitmapStatus[512 * 2] = {}; // TODO: Correct size
48 	int m_map = 0;
49 	QImage m_rawMap;
50 	int m_boundary;
51 	int m_addressBase;
52 	int m_addressWidth;
53 };
54 
55 }
56