diff options
Diffstat (limited to 'Tools/QtBiomeVisualiser/BiomeView.h')
-rw-r--r-- | Tools/QtBiomeVisualiser/BiomeView.h | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/Tools/QtBiomeVisualiser/BiomeView.h b/Tools/QtBiomeVisualiser/BiomeView.h index f0521571d..cd9c7ead9 100644 --- a/Tools/QtBiomeVisualiser/BiomeView.h +++ b/Tools/QtBiomeVisualiser/BiomeView.h @@ -2,7 +2,7 @@ #include <QWidget> #include <memory> -#include "ChunkCache.h" +#include "RegionCache.h" #include "ChunkSource.h" @@ -25,14 +25,34 @@ public: The entire view is then invalidated and regenerated. */ void setChunkSource(std::shared_ptr<ChunkSource> a_ChunkSource); + /** Sets the position of the central pixel of the map to the specified point and redraws the view. */ + void setPosition(int a_BlockX, int a_BlockZ); + + /** Sets the zoom level to the specified value and redraws the view. */ + void setZoomLevel(double a_ZoomLevel); + signals: + /** Signalled when the user uses the wheel to scroll upwards. */ + void wheelUp(); + + /** Signalled when the user uses the wheel to scroll downwards. */ + void wheelDown(); + + /** Signalled when the user presses a key to increase zoom. */ + void increaseZoom(); + + /** Signalled when the user presses a key to decrease zoom. */ + void decreaseZoom(); + + /** Emitted when the user moves the mouse, to reflect the current block under the cursor. */ + void hoverChanged(int a_BlockX, int a_BlockZ, int a_Biome); 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); + /** A specified region has become available, redraw it. */ + void regionAvailable(int a_RegionX, int a_RegionZ); /** Reloads the current chunk source and redraws the entire workspace. */ void reload(); @@ -42,7 +62,7 @@ protected: double m_Zoom; /** Cache for the loaded chunk data. */ - ChunkCache m_Cache; + RegionCache m_Cache; /** The entire view's contents in an offscreen image. */ QImage m_Image; @@ -59,6 +79,9 @@ protected: /** Data used for rendering a chunk that hasn't been loaded yet */ uchar m_EmptyChunkImage[16 * 16 * 4]; + /** Data placeholder for chunks that aren't valid. */ + short m_EmptyChunkBiomes[16 * 16]; + /** Draws the specified chunk into m_Image */ void drawChunk(int a_ChunkX, int a_ChunkZ); @@ -86,12 +109,6 @@ protected: /** Called when the user presses a key. */ virtual void keyPressEvent(QKeyEvent * a_Event) override; - - /** Decreases the zoom level and queues a redraw. */ - void decreaseZoom(); - - /** Increases the zoom level and queues a redraw. */ - void increaseZoom(); }; |