aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/classes/GFXSpriteTexture.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-02-24 23:07:24 +0100
committer GitHub <noreply@github.com>2024-02-24 23:07:24 +0100
commit9e305db5e5090a1a24979c480d64eebfe2de65da (patch)
tree487fea19d42106c08b60f5bba99bc76485073002 /extension/src/openvic-extension/classes/GFXSpriteTexture.cpp
parent5d7c6eafe35e2c6e952bc0b3f91d27d760c8e75e (diff)
parent843edde55306e3fbdb5e37ef9b7c09c7b53f50c4 (diff)
Merge pull request #209 from OpenVicProject/scrollbar
Added GUIScrollbar and GFXCorneredTileSupportingTexture
Diffstat (limited to 'extension/src/openvic-extension/classes/GFXSpriteTexture.cpp')
-rw-r--r--extension/src/openvic-extension/classes/GFXSpriteTexture.cpp26
1 files changed, 1 insertions, 25 deletions
diff --git a/extension/src/openvic-extension/classes/GFXSpriteTexture.cpp b/extension/src/openvic-extension/classes/GFXSpriteTexture.cpp
index e002461..41bea4b 100644
--- a/extension/src/openvic-extension/classes/GFXSpriteTexture.cpp
+++ b/extension/src/openvic-extension/classes/GFXSpriteTexture.cpp
@@ -24,15 +24,11 @@ void GFXSpriteTexture::_bind_methods() {
OV_BIND_METHOD(GFXSpriteTexture::get_icon_index);
OV_BIND_METHOD(GFXSpriteTexture::get_icon_count);
- OV_BIND_METHOD(GFXSpriteTexture::is_cornered_tile_texture);
- OV_BIND_METHOD(GFXSpriteTexture::draw_rect_cornered, { "to_canvas_item", "rect" });
-
ADD_PROPERTY(PropertyInfo(Variant::INT, "icon_index"), "set_icon_index", "get_icon_index");
}
GFXSpriteTexture::GFXSpriteTexture()
- : gfx_texture_sprite { nullptr }, icon_index { GFX::NO_FRAMES }, icon_count { GFX::NO_FRAMES },
- cornered_tile_texture { false }, cornered_tile_border_size {} {}
+ : gfx_texture_sprite { nullptr }, icon_index { GFX::NO_FRAMES }, icon_count { GFX::NO_FRAMES } {}
Ref<GFXSpriteTexture> GFXSpriteTexture::make_gfx_sprite_texture(GFX::TextureSprite const* gfx_texture_sprite, GFX::frame_t icon) {
Ref<GFXSpriteTexture> texture;
@@ -47,7 +43,6 @@ void GFXSpriteTexture::clear() {
_clear_button_states();
icon_index = GFX::NO_FRAMES;
icon_count = GFX::NO_FRAMES;
- cornered_tile_texture = false;
cornered_tile_border_size = {};
}
@@ -84,10 +79,8 @@ Error GFXSpriteTexture::set_gfx_texture_sprite(GFX::TextureSprite const* new_gfx
GFX::CorneredTileTextureSprite const* const cornered_tile_texture_sprite =
gfx_texture_sprite->cast_to<GFX::CorneredTileTextureSprite>();
if (cornered_tile_texture_sprite != nullptr) {
- cornered_tile_texture = true;
cornered_tile_border_size = Utilities::to_godot_ivec2(cornered_tile_texture_sprite->get_border_size());
} else {
- cornered_tile_texture = false;
cornered_tile_border_size = {};
}
}
@@ -140,20 +133,3 @@ Error GFXSpriteTexture::set_icon_index(int32_t new_icon_index) {
_update_button_states();
return OK;
}
-
-void GFXSpriteTexture::draw_rect_cornered(RID const& to_canvas_item, Rect2 const& rect) const {
- const Ref<Texture2D> atlas_texture = get_atlas();
- if (atlas_texture.is_valid()) {
- if (cornered_tile_texture) {
- RenderingServer* rendering_server = RenderingServer::get_singleton();
- if (rendering_server != nullptr) {
- rendering_server->canvas_item_add_nine_patch(
- to_canvas_item, rect, { {}, atlas_texture->get_size() }, atlas_texture->get_rid(),
- cornered_tile_border_size, atlas_texture->get_size() - cornered_tile_border_size
- );
- }
- } else {
- draw_rect(to_canvas_item, rect, false);
- }
- }
-}