2024-02-19 00:08:03 +01:00
|
|
|
#include "Background.hpp"
|
|
|
|
#include "../Renderer.hpp"
|
|
|
|
|
|
|
|
CBackground::CBackground(const Vector2D& viewport_, const std::string& resourceID_) : viewport(viewport_), resourceID(resourceID_) {
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2024-02-19 17:26:08 +01:00
|
|
|
bool CBackground::draw(const SRenderData& data) {
|
2024-02-19 00:08:03 +01:00
|
|
|
if (!asset)
|
|
|
|
asset = g_pRenderer->asyncResourceGatherer->getAssetByID(resourceID);
|
|
|
|
|
|
|
|
if (!asset)
|
|
|
|
return false;
|
|
|
|
|
2024-02-19 17:26:08 +01:00
|
|
|
CBox monbox = {0, 0, viewport.x, viewport.y};
|
2024-02-19 00:08:03 +01:00
|
|
|
|
2024-02-19 17:26:08 +01:00
|
|
|
g_pRenderer->renderTexture(monbox, asset->texture, data.opacity);
|
2024-02-19 00:08:03 +01:00
|
|
|
|
2024-02-19 17:26:08 +01:00
|
|
|
return data.opacity < 1.0;
|
2024-02-19 00:08:03 +01:00
|
|
|
}
|