ソースを参照

Begin texture abstraction

Eiyeron Fulmincendii 10 年 前
コミット
1e1326ca3c
共有2 個のファイルを変更した62 個の追加0 個の削除を含む
  1. 31 0
      platform/include/Texture.h
  2. 31 0
      platform/nspire/Texure.cpp

+ 31 - 0
platform/include/Texture.h

@@ -0,0 +1,31 @@
+#ifndef INCLUDE_TEXTURE_H
+#define INCLUDE_TEXTURE_H
+
+/*
+ * Texture.h
+ * Texture backend abstraction
+ */
+
+#include "utility/Rect.h"
+//#include "PLATFORM/texture_type.h"
+
+namespace WalrusRPG
+{
+    namespace Graphics
+    {
+        // This class only exists to get the common functions
+        class Texture
+        {
+          private:
+            // texture_type_t texture;
+          public:
+            // The get function is implemented by the child
+            // TextureHolder &get_texture();
+            Texture(char *data);
+            ~Texture();
+            WalrusRPG::Utils::Rect get_dimensions();
+        };
+    }
+}
+
+#endif

+ 31 - 0
platform/nspire/Texure.cpp

@@ -0,0 +1,31 @@
+#include "Texture.h"
+#include "utility/Rect.h"
+#include <cstdint>
+
+using WalrusRPG::Graphics::Texture;
+using WalrusRPG::Utils::Rect;
+
+namespace {
+    /*texture_type_t*/ char* loadPNG(char *data) {
+        // stuff
+        return nullptr;
+    }
+}
+
+Texture::Texture(char *data)
+{
+    // TODO
+    // load data from texture
+    // texture = loadPNG(data);
+}
+
+Texture::~Texture()
+{
+    // destroy(texture);
+}
+
+WalrusRPG::Utils::Rect Texture::get_dimensions()
+{
+    // return Rect(0, 0, texture[0], texture[1]);
+    return Rect(0, 0, 0, 0);
+}