aboutsummaryrefslogtreecommitdiff
path: root/BuddhaTest/include
diff options
context:
space:
mode:
Diffstat (limited to 'BuddhaTest/include')
-rw-r--r--BuddhaTest/include/Helpers.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/BuddhaTest/include/Helpers.h b/BuddhaTest/include/Helpers.h
index c24e2c7..ad14305 100644
--- a/BuddhaTest/include/Helpers.h
+++ b/BuddhaTest/include/Helpers.h
@@ -2,6 +2,7 @@
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <vector>
+#include <stdio.h> //includes FILE typedef
namespace Helpers
{
@@ -9,4 +10,16 @@ namespace Helpers
GLuint LoadComputeShader(const char * compute_file_path);
void WriteOutputPNG(const std::vector<uint32_t>& data, unsigned int width, unsigned int height);
+
+ /** Wraps around a C file descriptor. Libpng could be taught to use C++ streams, but I'm too lazy and rather wrap this ugly thing up, so it gets cleaned... */
+ class ScopedCFileDescriptor
+ {
+ public:
+ ScopedCFileDescriptor(const char *path, const char *mode);
+ ~ScopedCFileDescriptor();
+ FILE * Get() const;
+ bool IsValid() const;
+ private:
+ FILE * Descriptor;
+ };
}