added rest of basics in TSE_Core
This commit is contained in:
62
TSE_Core/src/elements/Texture.hpp
Normal file
62
TSE_Core/src/elements/Texture.hpp
Normal file
@@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
|
||||
#include "Sprite.hpp"
|
||||
#include "interfaces/ITexture.hpp"
|
||||
#include "Types.hpp"
|
||||
#include "Vector2.hpp"
|
||||
#include "interfaces/ITextureHelper.hpp"
|
||||
|
||||
#define FREEIMAGE_LIB
|
||||
#include "FI/FreeImage.h"
|
||||
|
||||
namespace TSE
|
||||
{
|
||||
class Texture : public ITexture
|
||||
{
|
||||
protected:
|
||||
uint TextureID = 0;
|
||||
Vector2 Size;
|
||||
uint Bpp;
|
||||
byte chanels = 0;
|
||||
FIBITMAP* bmp = nullptr;
|
||||
byte* imagePtr = nullptr;
|
||||
|
||||
public:
|
||||
string name = "Unnamed";
|
||||
static ITextureHelper* helper;
|
||||
|
||||
Texture(const string& path);
|
||||
Texture(const int& width, const int& height, int bpp = 32);
|
||||
Texture(const Vector2& size, int bpp = 32);
|
||||
~Texture();
|
||||
|
||||
uint bpp() const;
|
||||
Vector2 size() const override;
|
||||
float width() const override;
|
||||
float height() const override;
|
||||
byte Chanels() const;
|
||||
byte* GetImagePtr() const;
|
||||
void SetPixel(const Vector2& pos, const Color& c);
|
||||
void GetPixel(const Vector2& pos, Color& c) const;
|
||||
void SetPixelNoApply(const Vector2& pos, const Color& c);
|
||||
void ToSprite(Sprite& s);
|
||||
void SetChanels(const byte& ch);
|
||||
uint GetTextureId() const override;
|
||||
void SetTextureId(uint id);
|
||||
void SetPixel(const int& x, const int& y, const Color& c);
|
||||
void GetPixel(const int& x, const int& y, Color& c) const;
|
||||
void Fill(const Color& c);
|
||||
void SetPixelNoApply(const int& x, const int& y, const Color& c);
|
||||
void AddPixelNoApply(const int& x, const int& y, const Color& c);
|
||||
void Recreate(const int& x, const int& y, const int& bpp, const int& chanels);
|
||||
void SavePNG(const std::string& path) const;
|
||||
byte* getPixelPointer(const int& x, const int& y) const;
|
||||
static void makeError(Texture& tex);
|
||||
|
||||
void bind() const;
|
||||
void unbind() const;
|
||||
void Apply();
|
||||
void regist();
|
||||
void PlatformDestroy();
|
||||
};
|
||||
} // namespace TSE
|
||||
Reference in New Issue
Block a user