From 0a42df9a0029164448d600ec8270268382c4a438 Mon Sep 17 00:00:00 2001 From: frank Date: Tue, 14 Nov 2023 17:57:45 -0500 Subject: [PATCH] add sprite texture index increment function --- src/Sprite.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Sprite.hpp b/src/Sprite.hpp index ae774d5..db79036 100644 --- a/src/Sprite.hpp +++ b/src/Sprite.hpp @@ -192,6 +192,17 @@ namespace sb return _texture_index; } + /*! + * Increment the texture index the given number of times. Defaults to 1. It will wrap around at the end. Negative increment can be used. + * + * @param increment amount to increment the texture index + */ + void texture_increment(int increment = 1) + { + /* Add and wrap (even though model wraps as well) */ + _texture_index = glm::mod(_texture_index + increment, static_cast(plane.textures().size())); + } + /*! * If the GL context is active, this can be called to load image paths previously associated with textures attached to the * sprite's plane object.