You can use something like this to check if a given bit is set (or not) in a given value:
func is_bit_set(value, bit):
return value & (1 << bit) != 0
In your case, the FLAG_REPEAT
is documented to have a value of 2
. So, that'd be bit position 2. So, to test for that, you can do:
var flags = tex.get_flags()
var is_set = is_bit_set(flags, 2)
Note, you need to pass the bit POSITION as the second argument, not the bit VALUE. So, for example, FLAG_FILTER
is value4
, so that'd be bit position 3
.
And, to Wakatta's point, it doesn't really matter if complex bit combinations are set. The above will correctly check if any given bit is set in a specified value.