/
d.vision
/
division_engine_cpp
Обзор
Документация
Войти
/
d.vision
/
division_engine_cpp
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
resources/scripts/hello_world.lua
106 строк
3 KB
den163
Fixed double texture deleting
05 дек 2024, 02:28
05 дек 2024, 02:28
08d53e2
Код
Авторство
О чём код?
local border_radius = require 'border_radius' local color = require 'color' local division = require 'division' local os = require 'os' local padding = require 'padding' local rect = require 'rect' local ui = require 'ui' local vec2 = require 'vec2' local vec4 = require 'vec4' local alignment = require 'alignment' if os.getenv('LOCAL_LUA_DEBUGGER_VSCODE') == '1' then local lldebugger = require 'lldebugger' lldebugger.start() end local count = 0 local composite_view = ui.view_builder { builder = function(state) return ui.clickable { on_click = function() count = count + 1 state:rebuild() end, child = ui.list { direction = 'vertical', children = { ui.aligned { alignment = alignment.top_left, child = ui.text { font_size = 64, text = string.format('Count: %i', count), color = vec4(0.1, 0.1, 0.1, 1), } } } } } end } local debug_info_view = ui.aligned { alignment = alignment.top_right, child = ui.container { background_color = color.BLACK:with_alpha(0.9), border_radius = border_radius.all(30), padding = padding.all(20), width = 400, height = 400, block_input = true, child = ui.frame_update_view { builder = function(state) return ui.text { text = string.format( 'Current time: %s\n\n' .. 'Memory usage: %.1f MB\n\n' .. 'Mouse position: %s\n\n' .. 'Left button pressed: %s', os.date('%X'), collectgarbage('count') / 1000, division:mouse_position(), division:is_mouse_button_pressed(division.mouse_button.left) ), font_size = 24, color = color.WHITE } end, } } } ui.run(ui.stack { fit = ui.stack.fit_type.expand, children = { ui.scrollable { direction = 'horizontal', child = ui.list { direction = 'horizontal', children = { ui.stack { fit = ui.stack.fit_type.shrink, children = { ui.decorated_box { color = color.PURPLE }, ui.sized_box { width = 100, child = ui.text { text = 'Hey' } }, } }, ui.decorated_box { color = color.BLACK }, composite_view, ui.decorated_box { color = color.WHITE, image_path = 'resources/images/nevsky.jpg', }, ui.decorated_box { color = color.BLUE }, ui.container { width = 200, margin = padding.all(10), background_color = color.RED }, } } }, debug_info_view } })