diff options
author | Julian T <julian@jtle.dk> | 2020-07-26 12:56:27 +0200 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2020-07-26 12:56:27 +0200 |
commit | 893176a0b18a2281abe09def716ccc3db5583c3f (patch) | |
tree | a34da79b7dc0fcdbdd39e2a3f4000cc6a1c0a896 /app/draw.cpp | |
parent | 18960c4b88ce912e08b12182b835a7de75388b78 (diff) |
Implemented object intersection and startet work on render gui
Diffstat (limited to 'app/draw.cpp')
-rw-r--r-- | app/draw.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/draw.cpp b/app/draw.cpp new file mode 100644 index 0000000..2f3a947 --- /dev/null +++ b/app/draw.cpp @@ -0,0 +1,24 @@ +#include "draw.hpp" +#include <qpainter.h> +#include <qglobal.h> +#include <qimage.h> +#include <qrgb.h> +#include <qwindowdefs.h> +#include <iostream> + +DrawWidget::DrawWidget(unsigned width, unsigned height) : QWidget() { + m_width = width; + m_height = height; + m_drawbuffer = new QRgb[width * height]; + + m_img = QImage((uchar*)m_drawbuffer, width, height, QImage::Format_ARGB32); +} + +void DrawWidget::paintEvent(QPaintEvent*) { + QPainter painter(this); + painter.drawImage(0, 0, m_img); +} + +DrawWidget::~DrawWidget() { + delete[] m_drawbuffer; +} |