made Editor non reliant on GLFW aka i added an IRenderTexture interface of use in non renderer specific aplications
This commit is contained in:
@@ -118,12 +118,12 @@ TSE::Vector2 TSE::Texture::size() const
|
||||
return Size;
|
||||
}
|
||||
|
||||
float TSE::Texture::width() const
|
||||
float TSE::Texture::Width() const
|
||||
{
|
||||
return Size.x;
|
||||
}
|
||||
|
||||
float TSE::Texture::height() const
|
||||
float TSE::Texture::Height() const
|
||||
{
|
||||
return Size.y;
|
||||
}
|
||||
@@ -181,9 +181,9 @@ void TSE::Texture::SetPixel(const int &x, const int &y, const Color &c)
|
||||
|
||||
void TSE::Texture::GetPixel(const int &x, const int &y, Color &c) const
|
||||
{
|
||||
if(x >= width() || x < 0 ||y >= height() || y < 0)
|
||||
if(x >= Width() || x < 0 ||y >= Height() || y < 0)
|
||||
{
|
||||
TSE_WARNING("trying to access pixel outside of texture.\n pixel: (" + std::to_string(x) + ";" + std::to_string(y) + ")\nTexture size: (" + std::to_string(width()) + ";" + std::to_string(height()) );
|
||||
TSE_WARNING("trying to access pixel outside of texture.\n pixel: (" + std::to_string(x) + ";" + std::to_string(y) + ")\nTexture size: (" + std::to_string(Width()) + ";" + std::to_string(Height()) );
|
||||
return;
|
||||
}
|
||||
byte* pixel = getPixelPointer(x,y);
|
||||
@@ -201,9 +201,9 @@ void TSE::Texture::GetPixel(const int &x, const int &y, Color &c) const
|
||||
|
||||
void TSE::Texture::Fill(const Color &c)
|
||||
{
|
||||
for (int x = 0; x < width(); x++)
|
||||
for (int x = 0; x < Width(); x++)
|
||||
{
|
||||
for (int y = 0; y < height(); y++)
|
||||
for (int y = 0; y < Height(); y++)
|
||||
{
|
||||
SetPixelNoApply(x,y,c);
|
||||
}
|
||||
@@ -214,9 +214,9 @@ void TSE::Texture::Fill(const Color &c)
|
||||
|
||||
void TSE::Texture::SetPixelNoApply(const int &x, const int &y, const Color &c)
|
||||
{
|
||||
if(x >= width() || x < 0 ||y >= height() || y < 0)
|
||||
if(x >= Width() || x < 0 ||y >= Height() || y < 0)
|
||||
{
|
||||
TSE_WARNING("trying to access pixel outside of texture.\n pixel: (" + std::to_string(x) + ";" + std::to_string(y) + ")\nTexture size: (" + std::to_string(width()) + ";" + std::to_string(height()) );
|
||||
TSE_WARNING("trying to access pixel outside of texture.\n pixel: (" + std::to_string(x) + ";" + std::to_string(y) + ")\nTexture size: (" + std::to_string(Width()) + ";" + std::to_string(Height()) );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -244,9 +244,9 @@ void TSE::Texture::SetPixelNoApply(const int &x, const int &y, const Color &c)
|
||||
|
||||
void TSE::Texture::AddPixelNoApply(const int &x, const int &y, const Color &c)
|
||||
{
|
||||
if(x >= width() || x < 0 ||y >= height() || y < 0)
|
||||
if(x >= Width() || x < 0 ||y >= Height() || y < 0)
|
||||
{
|
||||
TSE_WARNING("trying to access pixel outside of texture.\n pixel: (" + std::to_string(x) + ";" + std::to_string(y) + ")\nTexture size: (" + std::to_string(width()) + ";" + std::to_string(height()) );
|
||||
TSE_WARNING("trying to access pixel outside of texture.\n pixel: (" + std::to_string(x) + ";" + std::to_string(y) + ")\nTexture size: (" + std::to_string(Width()) + ";" + std::to_string(Height()) );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ TSE::byte *TSE::Texture::getPixelPointer(const int &x, const int &y) const
|
||||
int alphaoffset = y * 2;
|
||||
if(bpp() > 24)
|
||||
alphaoffset = 0;
|
||||
int offset = ((y * width() + x) * (bpp() / 8) + alphaoffset);
|
||||
int offset = ((y * Width() + x) * (bpp() / 8) + alphaoffset);
|
||||
return imagePtr + offset;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ namespace TSE
|
||||
|
||||
uint bpp() const;
|
||||
Vector2 size() const override;
|
||||
float width() const override;
|
||||
float height() const override;
|
||||
float Width() const override;
|
||||
float Height() const override;
|
||||
byte Chanels() const;
|
||||
byte* GetImagePtr() const;
|
||||
void SetPixel(const Vector2& pos, const Color& c);
|
||||
|
||||
Reference in New Issue
Block a user