NWengine 0.9
Loading...
Searching...
No Matches
Image.h
1#pragma once
2
3#include <Globals.h>
4#include <string>
5
6#include "Asset.h"
7
8
12class Image : public Asset {
13public:
14 std::string path = "";
15 uint8* pixelBuffer = nullptr;
16 int channels = 0;
17 int width = 0;
18 int height = 0;
19 bool alpha = 0;
24 Image() = default;
25
35 Image(const std::string& x, uint8* buf, int ch, int w, int h, bool a) : path{x}, pixelBuffer{buf}, channels{ch},
36 width{w}, height{h}, alpha{a} {};
37
44 Asset* LoadFromFile(const char* path, void* output) override;
45
49 void Clean() override;
50};
The base class for all assets.
Definition Asset.h:9
Represents an image asset.
Definition Image.h:12
bool alpha
Definition Image.h:19
Asset * LoadFromFile(const char *path, void *output) override
Loads an image from a file.
Definition Image.cpp:12
int height
Definition Image.h:18
Image()=default
Default constructor for Image.
int channels
Definition Image.h:16
void Clean() override
Cleans up the image asset.
Definition Image.cpp:22
uint8 * pixelBuffer
Definition Image.h:15
Image(const std::string &x, uint8 *buf, int ch, int w, int h, bool a)
Constructor for Image.
Definition Image.h:35
int width
Definition Image.h:17
std::string path
Definition Image.h:14