From 05dd30a5158184fea83d93f53e8100aecaebb74a Mon Sep 17 00:00:00 2001 From: drumsetmonkey Date: Tue, 22 Nov 2016 21:25:34 -0500 Subject: Scaling textures (start) --- src/window.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/window.cpp') diff --git a/src/window.cpp b/src/window.cpp index 4c73b8b..f878ec3 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -66,6 +66,7 @@ void WindowSystem::die(void) void WindowSystem::configure(entityx::EventManager &ev) { ev.subscribe(*this); + ev.subscribe(*this); } @@ -78,6 +79,22 @@ void WindowSystem::receive(const WindowResizeEvent &wre) SDL_SetWindowSize(window, wre.x, wre.y); } +#include + +void WindowSystem::receive(const ScreenshotEvent &scr) +{ + // Make the BYTE array, factor of 3 because it's RBG. + static GLubyte* pixels; + pixels = new GLubyte[ 3 * scr.w * scr.h]; + //glReadPixels(0, 0, scr.w, scr.h, GL_RGB, GL_UNSIGNED_BYTE, pixels); + for(int i = 0; i < (3 * scr.w * scr.h); i++) { + pixels[i] = 255; + } + + ui::takeScreenshot(pixels); + std::cout << "Triggered\n"; +} + void WindowSystem::update(entityx::EntityManager &en, entityx::EventManager &ev, entityx::TimeDelta dt) { (void)en; -- cgit v1.2.3