Add warning when RenderTexture creation fails, closes #227
Previously enableRenderTexture() silently failed. Now emits a stderr warning with the requested dimensions, consistent with the engine's logging pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2062e4e4ad
commit
d195c0e390
1 changed files with 3 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
#include "UIDrawable.h"
|
#include "UIDrawable.h"
|
||||||
|
#include <iostream>
|
||||||
#include "UIFrame.h"
|
#include "UIFrame.h"
|
||||||
#include "UICaption.h"
|
#include "UICaption.h"
|
||||||
#include "UISprite.h"
|
#include "UISprite.h"
|
||||||
|
|
@ -428,6 +429,8 @@ void UIDrawable::enableRenderTexture(unsigned int width, unsigned int height) {
|
||||||
if (!render_texture || render_texture->getSize().x != width || render_texture->getSize().y != height) {
|
if (!render_texture || render_texture->getSize().x != width || render_texture->getSize().y != height) {
|
||||||
render_texture = std::make_unique<sf::RenderTexture>();
|
render_texture = std::make_unique<sf::RenderTexture>();
|
||||||
if (!render_texture->create(width, height)) {
|
if (!render_texture->create(width, height)) {
|
||||||
|
std::cerr << "[McRogueFace] Warning: Failed to create RenderTexture ("
|
||||||
|
<< width << "x" << height << ")" << std::endl;
|
||||||
render_texture.reset();
|
render_texture.reset();
|
||||||
use_render_texture = false;
|
use_render_texture = false;
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue