/
d.vision
/
division_engine_cpp
Обзор
Документация
Войти
/
d.vision
/
division_engine_cpp
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
include/division_engine/canvas/components/render_order.hpp
25 строк
636 B
den163
Added user defined rendering order support
05 ноя 2024, 22:20
05 ноя 2024, 22:20
f4a24bb
Код
Авторство
О чём код?
#pragma once #include <cstdint> #include <stdio.h> namespace division_engine::canvas::components { struct RenderOrder { /// Order in creation sequence uint32_t natural_order; /// User defined order int custom_order; int compare(const RenderOrder& other) const { auto same_custom = custom_order == other.custom_order; auto natural_order_diff = (static_cast<int>(natural_order) - static_cast<int>(other.natural_order)); auto custom_order_diff = custom_order - other.custom_order; return same_custom * natural_order_diff + !same_custom * custom_order_diff; } }; }