|
|
@@ -1,31 +1,39 @@
|
|
|
#include "Texture.h"
|
|
|
#include "utility/Rect.h"
|
|
|
+#include "render/Pixel.h"
|
|
|
#include <cstdint>
|
|
|
|
|
|
+using WalrusRPG::Graphics::Black;
|
|
|
+using WalrusRPG::Graphics::Pixel;
|
|
|
using WalrusRPG::Graphics::Texture;
|
|
|
using WalrusRPG::Utils::Rect;
|
|
|
|
|
|
-namespace {
|
|
|
- /*texture_type_t*/ char* loadPNG(char *data) {
|
|
|
+namespace
|
|
|
+{
|
|
|
+ texture_data_t loadPNG(char *data)
|
|
|
+ {
|
|
|
// stuff
|
|
|
return nullptr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-Texture::Texture(char *data)
|
|
|
+Texture::Texture(char *data) : texture(loadPNG(data))
|
|
|
{
|
|
|
- // TODO
|
|
|
- // load data from texture
|
|
|
- // texture = loadPNG(data);
|
|
|
+ width = texture[0];
|
|
|
+ height = texture[1];
|
|
|
}
|
|
|
|
|
|
Texture::~Texture()
|
|
|
{
|
|
|
- // destroy(texture);
|
|
|
+ delete (texture);
|
|
|
+}
|
|
|
+
|
|
|
+Rect Texture::get_dimensions()
|
|
|
+{
|
|
|
+ return Rect(0, 0, width, height);
|
|
|
}
|
|
|
|
|
|
-WalrusRPG::Utils::Rect Texture::get_dimensions()
|
|
|
+const Pixel Texture::get_pixel(unsigned x, unsigned y)
|
|
|
{
|
|
|
- // return Rect(0, 0, texture[0], texture[1]);
|
|
|
- return Rect(0, 0, 0, 0);
|
|
|
+ return Pixel(texture[2 + width*y + x]);
|
|
|
}
|