diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-19 14:31:18 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-19 14:31:18 +0200 |
commit | 4398156b2e56ccfcb41f750906501ecf446be045 (patch) | |
tree | dc1c070c6c7490619d8b05e30ace2c959f085bb2 /Tools/QtBiomeVisualiser/BiomeView.h | |
parent | Derp (diff) | |
parent | QtBiomeVisualiser: More gcc fixes. (diff) | |
download | cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar.gz cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar.bz2 cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar.lz cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar.xz cuberite-4398156b2e56ccfcb41f750906501ecf446be045.tar.zst cuberite-4398156b2e56ccfcb41f750906501ecf446be045.zip |
Diffstat (limited to 'Tools/QtBiomeVisualiser/BiomeView.h')
-rw-r--r-- | Tools/QtBiomeVisualiser/BiomeView.h | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/Tools/QtBiomeVisualiser/BiomeView.h b/Tools/QtBiomeVisualiser/BiomeView.h index c54c66491..f0521571d 100644 --- a/Tools/QtBiomeVisualiser/BiomeView.h +++ b/Tools/QtBiomeVisualiser/BiomeView.h @@ -1,6 +1,7 @@ #pragma once #include <QWidget> +#include <memory> #include "ChunkCache.h" #include "ChunkSource.h" @@ -33,12 +34,28 @@ public slots: /** A specified chunk has become available, redraw it. */ void chunkAvailable(int a_ChunkX, int a_ChunkZ); + /** Reloads the current chunk source and redraws the entire workspace. */ + void reload(); + protected: double m_X, m_Z; - int m_Zoom; + double m_Zoom; + + /** Cache for the loaded chunk data. */ ChunkCache m_Cache; + + /** The entire view's contents in an offscreen image. */ QImage m_Image; + /** Coords of the mouse for the previous position, used while dragging. */ + int m_LastX, m_LastY; + + /** Set to true when the user has a mouse button depressed, and is dragging the view. */ + bool m_IsMouseDragging; + + /** Accumulator for the mouse wheel's delta. When the accumulator hits a threshold, the view zooms. */ + int m_MouseWheelDelta; + /** Data used for rendering a chunk that hasn't been loaded yet */ uchar m_EmptyChunkImage[16 * 16 * 4]; @@ -55,8 +72,26 @@ protected: /** Paints the entire widget */ virtual void paintEvent(QPaintEvent *) override; - /** Queues the chunk for rendering. */ - void queueChunkRender(ChunkPtr a_Chunk); + /** Called when the user presses any mouse button. */ + virtual void mousePressEvent(QMouseEvent * a_Event); + + /** Called when the user moves the mouse. */ + virtual void mouseMoveEvent(QMouseEvent * a_Event); + + /** Called when the user releases a previously held mouse button. */ + virtual void mouseReleaseEvent(QMouseEvent * a_Event) override; + + /** Called when the user rotates the mouse wheel. */ + virtual void wheelEvent(QWheelEvent * a_Event) override; + + /** 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(); }; |