2023-07-21 09:50:06 +00:00
|
|
|
/**
|
|
|
|
* limbo_utility.h
|
|
|
|
* =============================================================================
|
|
|
|
* Copyright 2021-2023 Serhii Snitsaruk
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style
|
|
|
|
* license that can be found in the LICENSE file or at
|
|
|
|
* https://opensource.org/licenses/MIT.
|
|
|
|
* =============================================================================
|
|
|
|
*/
|
2022-08-28 10:54:34 +00:00
|
|
|
|
|
|
|
#ifndef LIMBO_UTILITY_H
|
|
|
|
#define LIMBO_UTILITY_H
|
|
|
|
|
2022-12-15 07:26:52 +00:00
|
|
|
#include "core/object/object.h"
|
2023-08-15 15:49:13 +00:00
|
|
|
|
|
|
|
#include "core/object/class_db.h"
|
2023-08-10 11:04:53 +00:00
|
|
|
#include "core/variant/variant.h"
|
2023-04-13 07:29:45 +00:00
|
|
|
#include "scene/resources/texture.h"
|
2022-08-28 10:54:34 +00:00
|
|
|
|
2023-08-26 13:41:11 +00:00
|
|
|
#define LOGICAL_XOR(a, b) (a) ? !(b) : (b)
|
|
|
|
|
2022-08-28 10:54:34 +00:00
|
|
|
class LimboUtility : public Object {
|
|
|
|
GDCLASS(LimboUtility, Object);
|
|
|
|
|
2023-08-10 11:04:53 +00:00
|
|
|
public:
|
|
|
|
enum CheckType : unsigned int {
|
|
|
|
CHECK_EQUAL,
|
|
|
|
CHECK_LESS_THAN,
|
|
|
|
CHECK_LESS_THAN_OR_EQUAL,
|
|
|
|
CHECK_GREATER_THAN,
|
|
|
|
CHECK_GREATER_THAN_OR_EQUAL,
|
|
|
|
CHECK_NOT_EQUAL
|
|
|
|
};
|
|
|
|
|
2022-08-28 10:54:34 +00:00
|
|
|
protected:
|
2022-09-21 21:56:04 +00:00
|
|
|
static LimboUtility *singleton;
|
2022-08-28 10:54:34 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2022-09-21 21:56:04 +00:00
|
|
|
static LimboUtility *get_singleton();
|
|
|
|
|
2022-11-01 13:03:20 +00:00
|
|
|
String decorate_var(String p_variable) const;
|
|
|
|
String get_status_name(int p_status) const;
|
2023-04-13 07:29:45 +00:00
|
|
|
Ref<Texture2D> get_task_icon(String p_class_or_script_path) const;
|
2022-09-21 21:56:04 +00:00
|
|
|
|
2023-08-10 11:04:53 +00:00
|
|
|
String get_check_operator_string(CheckType p_check_type);
|
|
|
|
bool perform_check(CheckType p_check_type, const Variant &left_value, const Variant &right_value);
|
|
|
|
|
2022-09-21 21:56:04 +00:00
|
|
|
LimboUtility();
|
|
|
|
~LimboUtility();
|
2022-08-28 10:54:34 +00:00
|
|
|
};
|
|
|
|
|
2023-08-10 11:04:53 +00:00
|
|
|
VARIANT_ENUM_CAST(LimboUtility::CheckType);
|
|
|
|
|
2022-08-28 10:54:34 +00:00
|
|
|
#endif // LIMBO_UTILITY_H
|