Add a node warning using NinePatchRect's Tile or Tile Fit modes in GLES2
This commit is contained in:
parent
1bbc7c9c3a
commit
a9d0baa4f4
2 changed files with 19 additions and 0 deletions
|
@ -156,6 +156,7 @@ bool NinePatchRect::is_draw_center_enabled() const {
|
|||
|
||||
void NinePatchRect::set_h_axis_stretch_mode(AxisStretchMode p_mode) {
|
||||
axis_h = p_mode;
|
||||
update_configuration_warning();
|
||||
update();
|
||||
}
|
||||
|
||||
|
@ -165,6 +166,7 @@ NinePatchRect::AxisStretchMode NinePatchRect::get_h_axis_stretch_mode() const {
|
|||
|
||||
void NinePatchRect::set_v_axis_stretch_mode(AxisStretchMode p_mode) {
|
||||
axis_v = p_mode;
|
||||
update_configuration_warning();
|
||||
update();
|
||||
}
|
||||
|
||||
|
@ -172,6 +174,21 @@ NinePatchRect::AxisStretchMode NinePatchRect::get_v_axis_stretch_mode() const {
|
|||
return axis_v;
|
||||
}
|
||||
|
||||
String NinePatchRect::get_configuration_warning() const {
|
||||
String warning = Control::get_configuration_warning();
|
||||
|
||||
if (String(GLOBAL_GET("rendering/quality/driver/driver_name")) == "GLES2") {
|
||||
if (axis_v > AXIS_STRETCH_MODE_STRETCH || axis_h > AXIS_STRETCH_MODE_STRETCH) {
|
||||
if (!warning.empty()) {
|
||||
warning += "\n\n";
|
||||
}
|
||||
warning += TTR("The Tile and Tile Fit options for Axis Stretch properties are only effective when using the GLES3 rendering backend.\nThe GLES2 backend is currently in use, so these modes will act like Stretch instead.");
|
||||
}
|
||||
}
|
||||
|
||||
return warning;
|
||||
}
|
||||
|
||||
NinePatchRect::NinePatchRect() {
|
||||
margin[MARGIN_LEFT] = 0;
|
||||
margin[MARGIN_RIGHT] = 0;
|
||||
|
|
|
@ -74,6 +74,8 @@ public:
|
|||
void set_v_axis_stretch_mode(AxisStretchMode p_mode);
|
||||
AxisStretchMode get_v_axis_stretch_mode() const;
|
||||
|
||||
String get_configuration_warning() const;
|
||||
|
||||
NinePatchRect();
|
||||
~NinePatchRect();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue