summaryrefslogtreecommitdiff
path: root/src/graphics/Graphics.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-07-21 17:43:46 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-07-21 17:43:46 (GMT)
commitf7d8556965832821036c210ffc1f9e73f3ff70cc (patch)
tree58e985bdc6e99a2ad8e7382ebaf33553ae93d836 /src/graphics/Graphics.cpp
parent5bf0a084ace0e6b673efa4552b40de8b36e0668e (diff)
downloadpowder-f7d8556965832821036c210ffc1f9e73f3ff70cc.zip
powder-f7d8556965832821036c210ffc1f9e73f3ff70cc.tar.gz
Icons for menu items
Diffstat (limited to 'src/graphics/Graphics.cpp')
-rw-r--r--src/graphics/Graphics.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/graphics/Graphics.cpp b/src/graphics/Graphics.cpp
index 5f84088..23ee092 100644
--- a/src/graphics/Graphics.cpp
+++ b/src/graphics/Graphics.cpp
@@ -7,6 +7,36 @@
#define INCLUDE_FONTDATA
#include "font.h"
+VideoBuffer::VideoBuffer(int width, int height):
+ Width(width),
+ Height(height)
+{
+ Buffer = new pixel[width*height];
+ std::fill(Buffer, Buffer+(width*height), 0);
+};
+
+VideoBuffer::VideoBuffer(const VideoBuffer & old):
+ Width(old.Width),
+ Height(old.Height)
+{
+ Buffer = new pixel[old.Width*old.Height];
+ std::copy(old.Buffer, old.Buffer+(old.Width*old.Height), Buffer);
+};
+
+VideoBuffer::VideoBuffer(VideoBuffer * old):
+ Width(old->Width),
+ Height(old->Height)
+{
+ Buffer = new pixel[old->Width*old->Height];
+ std::copy(old->Buffer, old->Buffer+(old->Width*old->Height), Buffer);
+};
+
+
+VideoBuffer::~VideoBuffer()
+{
+ delete[] Buffer;
+};
+
TPT_INLINE void VideoBuffer::BlendPixel(int x, int y, int r, int g, int b, int a)
{
#ifdef PIX32OGL
@@ -786,4 +816,13 @@ pixel *Graphics::render_packed_rgb(void *image, int width, int height, int cmp_s
return res;
}
+void Graphics::draw_image(const VideoBuffer & vidBuf, int x, int y, int a)
+{
+ draw_image(vidBuf.Buffer, x, y, vidBuf.Width, vidBuf.Height, a);
+}
+
+void Graphics::draw_image(VideoBuffer * vidBuf, int x, int y, int a)
+{
+ draw_image(vidBuf->Buffer, x, y, vidBuf->Width, vidBuf->Height, a);
+}