diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-11 19:24:48 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-11 19:24:48 (GMT) |
| commit | 08b4e5553aa10df74c4fdb0ba519fb700fa8100b (patch) | |
| tree | 68cda233dcd82978c377978bb19b1fd61bbe0c70 /src/graphics | |
| parent | ecbb1e910352aec1cda4e2d4c36cf3599bc43963 (diff) | |
| download | powder-08b4e5553aa10df74c4fdb0ba519fb700fa8100b.zip powder-08b4e5553aa10df74c4fdb0ba519fb700fa8100b.tar.gz | |
Implement some missing lua functions, PNG format creation (requires zlib)
Diffstat (limited to 'src/graphics')
| -rw-r--r-- | src/graphics/Graphics.cpp | 9 | ||||
| -rw-r--r-- | src/graphics/Graphics.h | 3 | ||||
| -rw-r--r-- | src/graphics/Renderer.cpp | 17 | ||||
| -rw-r--r-- | src/graphics/Renderer.h | 2 |
4 files changed, 31 insertions, 0 deletions
diff --git a/src/graphics/Graphics.cpp b/src/graphics/Graphics.cpp index eb92435..e7cce03 100644 --- a/src/graphics/Graphics.cpp +++ b/src/graphics/Graphics.cpp @@ -909,3 +909,12 @@ void Graphics::draw_image(VideoBuffer * vidBuf, int x, int y, int a) draw_image(vidBuf->Buffer, x, y, vidBuf->Width, vidBuf->Height, a); } +VideoBuffer Graphics::DumpFrame() +{ +#ifdef OGLI +#else + VideoBuffer newBuffer(XRES+BARSIZE, YRES+MENUSIZE); + std::copy(vid, vid+((XRES+BARSIZE)*(YRES+MENUSIZE)), newBuffer.Buffer); + return newBuffer; +#endif +}
\ No newline at end of file diff --git a/src/graphics/Graphics.h b/src/graphics/Graphics.h index e74239e..46d28b4 100644 --- a/src/graphics/Graphics.h +++ b/src/graphics/Graphics.h @@ -4,6 +4,7 @@ #include <string> #include <cstdlib> #include <cstring> +#include <vector> #if defined(OGLI) #include "OpenGLHeaders.h" #endif @@ -135,6 +136,8 @@ public: static int textwidth(const char *s); static void textsize(const char * s, int & width, int & height); + VideoBuffer DumpFrame(); + void Acquire(); void Release(); diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp index 11cf9c3..6c1a31b 100644 --- a/src/graphics/Renderer.cpp +++ b/src/graphics/Renderer.cpp @@ -2475,6 +2475,23 @@ unsigned int Renderer::GetColourMode() return colour_mode; } +VideoBuffer Renderer::DumpFrame() +{ +#ifdef OGLR +#elif defined(OGLI) + VideoBuffer newBuffer(XRES, YRES); + std::copy(vid, vid+(XRES*YRES), newBuffer.Buffer); + return newBuffer; +#else + VideoBuffer newBuffer(XRES, YRES); + for(int y = 0; y < YRES; y++) + { + std::copy(vid+(y*(XRES+BARSIZE)), vid+(y*(XRES+BARSIZE))+XRES, newBuffer.Buffer+(y*XRES)); + } + return newBuffer; +#endif +} + Renderer::~Renderer() { #if !defined(OGLR) diff --git a/src/graphics/Renderer.h b/src/graphics/Renderer.h index 6691ef1..cc7debe 100644 --- a/src/graphics/Renderer.h +++ b/src/graphics/Renderer.h @@ -113,6 +113,8 @@ public: void draw_image(pixel *img, int x, int y, int w, int h, int a); #endif + VideoBuffer DumpFrame(); + void drawblob(int x, int y, unsigned char cr, unsigned char cg, unsigned char cb); //... //Display mode modifiers |
