40 lines
1.4 KiB
C++
40 lines
1.4 KiB
C++
// IAEngine: 2D Game Engine by IA
|
|
// Copyright (C) 2025 IAS (ias@iasoft.dev)
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
#include <IAEngine/IAEngine.hpp>
|
|
#include <IAEngine/Texture.hpp>
|
|
|
|
#include <IAEngine/Rendering/Renderer.hpp>
|
|
#include <IAEngine/Rendering/Mesh/Quad.hpp>
|
|
|
|
namespace ia::iae
|
|
{
|
|
Texture::Texture(IN Handle handle,IN INT32 width, IN INT32 height):
|
|
m_handle(handle), m_size({(FLOAT32)width, (FLOAT32)height, 1.0f})
|
|
{
|
|
}
|
|
|
|
Texture::~Texture()
|
|
{
|
|
}
|
|
|
|
VOID Texture::Draw(IN CONST iam::Vec3f &position, IN CONST iam::Vec3f &scale, IN FLOAT32 rotation, IN BOOL flipH,
|
|
IN BOOL flipV, IN CONST iam::Vec4f &colorOverlay) CONST
|
|
{
|
|
Renderer::BindTexture(m_handle, flipV, flipH, colorOverlay);
|
|
QuadMesh::Draw(position, m_size * scale, rotation);
|
|
}
|
|
} // namespace ia::iae
|