diff options
author | Mattes D <github@xoft.cz> | 2014-09-14 01:32:00 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-09-14 01:33:05 +0200 |
commit | e3a2dc5a1391d8aaaa3fdb83e946838540a07e75 (patch) | |
tree | 1a665fcc4ae0ea097ba476f70dddb5ef03539a28 /Tools/QtBiomeVisualiser/BiomeView.h | |
parent | OSSupport: Fixed UNICODE Windows builds. (diff) | |
download | cuberite-e3a2dc5a1391d8aaaa3fdb83e946838540a07e75.tar cuberite-e3a2dc5a1391d8aaaa3fdb83e946838540a07e75.tar.gz cuberite-e3a2dc5a1391d8aaaa3fdb83e946838540a07e75.tar.bz2 cuberite-e3a2dc5a1391d8aaaa3fdb83e946838540a07e75.tar.lz cuberite-e3a2dc5a1391d8aaaa3fdb83e946838540a07e75.tar.xz cuberite-e3a2dc5a1391d8aaaa3fdb83e946838540a07e75.tar.zst cuberite-e3a2dc5a1391d8aaaa3fdb83e946838540a07e75.zip |
Diffstat (limited to '')
-rw-r--r-- | Tools/QtBiomeVisualiser/BiomeView.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Tools/QtBiomeVisualiser/BiomeView.h b/Tools/QtBiomeVisualiser/BiomeView.h new file mode 100644 index 000000000..c54c66491 --- /dev/null +++ b/Tools/QtBiomeVisualiser/BiomeView.h @@ -0,0 +1,65 @@ +#pragma once + +#include <QWidget> +#include "ChunkCache.h" +#include "ChunkSource.h" + + + + + +class BiomeView : + public QWidget +{ + typedef QWidget super; + Q_OBJECT + +public: + explicit BiomeView(QWidget * parent = NULL); + + QSize minimumSizeHint() const; + QSize sizeHint() const; + + /** Replaces the chunk source used by the biome view to get the chunk biome data. + The entire view is then invalidated and regenerated. */ + void setChunkSource(std::shared_ptr<ChunkSource> a_ChunkSource); + +signals: + +public slots: + /** Redraw the entire widget area. */ + void redraw(); + + /** A specified chunk has become available, redraw it. */ + void chunkAvailable(int a_ChunkX, int a_ChunkZ); + +protected: + double m_X, m_Z; + int m_Zoom; + ChunkCache m_Cache; + QImage m_Image; + + /** Data used for rendering a chunk that hasn't been loaded yet */ + uchar m_EmptyChunkImage[16 * 16 * 4]; + + + /** Draws the specified chunk into m_Image */ + void drawChunk(int a_ChunkX, int a_ChunkZ); + + /** Returns true iff the biome view has been initialized to contain proper biome data. */ + bool hasData(void) const { return m_Cache.hasData(); } + + /** Called when the widget is resized */ + virtual void resizeEvent(QResizeEvent *) override; + + /** Paints the entire widget */ + virtual void paintEvent(QPaintEvent *) override; + + /** Queues the chunk for rendering. */ + void queueChunkRender(ChunkPtr a_Chunk); +}; + + + + + |