diff --git a/armorlab/sources/base_ext.ts b/armorlab/sources/base_ext.ts index 0dec8e56..3ff7209a 100644 --- a/armorlab/sources/base_ext.ts +++ b/armorlab/sources/base_ext.ts @@ -1,6 +1,6 @@ function base_ext_init() { - random_node_set_seed(math_floor(time_time() * 4294967295)); + random_node_set_seed(math_floor(sys_time() * 4294967295)); } function base_ext_render() { diff --git a/armorlab/sources/ui_nodes_ext.ts b/armorlab/sources/ui_nodes_ext.ts index 37955b04..5e3242b2 100644 --- a/armorlab/sources/ui_nodes_ext.ts +++ b/armorlab/sources/ui_nodes_ext.ts @@ -35,7 +35,7 @@ function ui_nodes_ext_run() { console_progress(tr("Processing")); - let timer: f32 = time_time(); + let timer: f32 = sys_time(); parser_logic_parse(project_canvas); photo_to_pbr_node_cached_source = null; @@ -118,7 +118,7 @@ function ui_nodes_ext_run() { } } - let t: f32 = time_time() - timer; + let t: f32 = sys_time() - timer; console_log("Processing finished in " + t); iron_ml_unload(); diff --git a/armorpaint/assets/plugins/hello_node_brush.js b/armorpaint/assets/plugins/hello_node_brush.js index 85cb1238..3645d0b8 100644 --- a/armorpaint/assets/plugins/hello_node_brush.js +++ b/armorpaint/assets/plugins/hello_node_brush.js @@ -51,7 +51,7 @@ nodes_brush_category_add(category_name, armpack_encode(node_list)); // Brush node parser_logic_custom_nodes_set(node_type, function(node, from) { - return Math.sin(time_time() * node.inputs[0].get(0)); + return Math.sin(sys_time() * node.inputs[0].get(0)); }); // Cleanup diff --git a/armorsculpt/sources/tab_layers.ts b/armorsculpt/sources/tab_layers.ts index 3df8b229..ac2d771a 100644 --- a/armorsculpt/sources/tab_layers.ts +++ b/armorsculpt/sources/tab_layers.ts @@ -263,8 +263,8 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { tab_layers_set_drag_layer(context_raw.layer, -(mouse_x - uix - ui._window_x - 3), -(mouse_y - uiy - ui._window_y + 1)); } else if (ui.input_released) { - if (time_time() - context_raw.select_time > 0.2) { - context_raw.select_time = time_time(); + if (sys_time() - context_raw.select_time > 0.2) { + context_raw.select_time = sys_time(); } } else if (ui.input_released_r) { @@ -275,7 +275,7 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { let state: ui_state_t = ui_text(l.name); if (state == ui_state_t.RELEASED) { - let td: f32 = time_time() - context_raw.select_time; + let td: f32 = sys_time() - context_raw.select_time; if (td < 0.2 && td > 0.0) { tab_layers_layer_name_edit = l.id; tab_layers_layer_name_handle.text = l.name; diff --git a/base/project.js b/base/project.js index b033340e..fe73c400 100644 --- a/base/project.js +++ b/base/project.js @@ -1,14 +1,7 @@ let flags = globalThis.flags; -flags.android = os_argv().indexOf("android") >= 0; -flags.ios = os_argv().indexOf("ios") >= 0; -flags.d3d12 = os_argv().indexOf("direct3d12") >= 0; -flags.vulkan = os_argv().indexOf("vulkan") >= 0; -flags.metal = os_argv().indexOf("metal") >= 0; -flags.raytrace = flags.d3d12 || flags.vulkan || flags.metal; flags.embed = os_argv().indexOf("--embed") >= 0; // os_argv().indexOf("--debug") == -1; // clang 19 flags.physics = true; - flags.with_d3dcompiler = true; flags.with_nfd = true; flags.with_compress = true; @@ -84,20 +77,21 @@ if (!flags.lite) { // project.add_define("arm_skin"); // project.add_define("arm_audio"); - if (flags.android) { + if (platform === "android") { project.add_define("arm_android_rmb"); } - if (flags.raytrace) { + let raytrace = true; + if (raytrace) { project.add_assets("assets/raytrace/*", { destination: "data/{name}" }); - if (flags.d3d12) { + if (graphics === "direct3d12") { project.add_assets("shaders/raytrace/*.cso", { destination: "data/{name}" }); } - else if (flags.vulkan) { + else if (graphics === "vulkan") { project.add_assets("shaders/raytrace/*.spirv", { destination: "data/{name}" }); } - else if (flags.metal) { + else if (graphics === "metal") { project.add_assets("shaders/raytrace/*.metal", { destination: "data/{name}" }); } } @@ -114,7 +108,7 @@ if (!flags.lite) { project.add_assets(dir + "/version.json", { destination: "data/{name}" }); } - let export_data_list = flags.android; // .apk contents + let export_data_list = platform === "android"; // .apk contents if (export_data_list) { let root = "../" + flags.name.toLowerCase(); let data_list = { diff --git a/base/sources/ts/iron/audio.ts b/base/sources/ts/iron/audio.ts deleted file mode 100644 index 9ab649f3..00000000 --- a/base/sources/ts/iron/audio.ts +++ /dev/null @@ -1,12 +0,0 @@ - -///if arm_audio - -function audio_play(sound: sound_t, loop: bool = false, pitch: f32 = 1.0, unique: bool = false): audio_channel_t { - return iron_a1_play_sound(sound.sound_, loop, pitch, unique); -} - -function audio_stop(sound: sound_t) { - iron_a1_stop_sound(sound.sound_); -} - -///end diff --git a/base/sources/ts/iron/input.ts b/base/sources/ts/iron/input.ts index 8d8eefa1..e079a028 100644 --- a/base/sources/ts/iron/input.ts +++ b/base/sources/ts/iron/input.ts @@ -358,8 +358,8 @@ function keyboard_end_frame() { array_splice(keyboard_keys_frame, 0, keyboard_keys_frame.length); } - if (time_time() - keyboard_repeat_time > 0.05) { - keyboard_repeat_time = time_time(); + if (sys_time() - keyboard_repeat_time > 0.05) { + keyboard_repeat_time = sys_time(); keyboard_repeat_key = true; } else { @@ -660,7 +660,7 @@ function keyboard_down_listener(code: key_code_t) { array_push(keyboard_keys_frame, s); map_set(keyboard_keys_started, s, true); map_set(keyboard_keys_down, s, true); - keyboard_repeat_time = time_time() + 0.4; + keyboard_repeat_time = sys_time() + 0.4; ///if arm_android_rmb // Detect right mouse button on Android.. if (code == key_code_t.BACK) { diff --git a/base/sources/ts/iron/render_path.ts b/base/sources/ts/iron/render_path.ts index 046a0e1c..f00b1c58 100644 --- a/base/sources/ts/iron/render_path.ts +++ b/base/sources/ts/iron/render_path.ts @@ -65,8 +65,8 @@ function render_path_render_frame() { _render_path_last_w = app_w(); _render_path_last_h = app_h(); - _render_path_frame_time = time_time() -_render_path_last_frame_time; - _render_path_last_frame_time = time_time(); + _render_path_frame_time = sys_time() -_render_path_last_frame_time; + _render_path_last_frame_time = sys_time(); render_path_current_w = app_w(); render_path_current_h = app_h(); diff --git a/base/sources/ts/iron/time.ts b/base/sources/ts/iron/time.ts index 51109a9f..210b0492 100644 --- a/base/sources/ts/iron/time.ts +++ b/base/sources/ts/iron/time.ts @@ -14,11 +14,7 @@ function time_real_delta(): f32 { return _time_real_delta; } -function time_time(): f32 { - return sys_time(); -} - function time_update() { - _time_real_delta = time_time() - _time_last; - _time_last = time_time(); + _time_real_delta = sys_time() - _time_last; + _time_last = sys_time(); } diff --git a/base/sources/ts/iron/uniforms.ts b/base/sources/ts/iron/uniforms.ts index 5fa86a77..91ee93fe 100644 --- a/base/sources/ts/iron/uniforms.ts +++ b/base/sources/ts/iron/uniforms.ts @@ -303,7 +303,7 @@ function uniforms_set_context_const(location: iron_gpu_constant_location_t, c: s let f: f32 = 0.0; if (c.link == "_time") { - f = time_time(); + f = sys_time(); } else if (c.link == "_aspect_ratio_window") { f = app_w() / app_h(); diff --git a/base/sources/ts/nodes/time_node.ts b/base/sources/ts/nodes/time_node.ts index 6060e87b..cb8fa3a4 100644 --- a/base/sources/ts/nodes/time_node.ts +++ b/base/sources/ts/nodes/time_node.ts @@ -12,7 +12,7 @@ function time_node_create(raw: ui_node_t, args: f32_array_t): time_node_t { function time_node_get(self: time_node_t, from: i32): logic_node_value_t { if (from == 0) { - let v: logic_node_value_t = { _f32: time_time() }; + let v: logic_node_value_t = { _f32: sys_time() }; return v; } else if (from == 1) { diff --git a/base/sources/ts/tab_brushes.ts b/base/sources/ts/tab_brushes.ts index 61ece579..9764d467 100644 --- a/base/sources/ts/tab_brushes.ts +++ b/base/sources/ts/tab_brushes.ts @@ -76,10 +76,10 @@ function tab_brushes_draw(htab: ui_handle_t) { if (context_raw.brush != project_brushes[i]) { context_select_brush(i); } - if (time_time() - context_raw.select_time < 0.25) { + if (sys_time() - context_raw.select_time < 0.25) { ui_base_show_brush_nodes(); } - context_raw.select_time = time_time(); + context_raw.select_time = sys_time(); // app_drag_off_x = -(mouse_x - uix - ui._windowX - 3); // app_drag_off_y = -(mouse_y - uiy - ui._windowY + 1); // app_drag_brush = raw.brush; diff --git a/base/sources/ts/tab_fonts.ts b/base/sources/ts/tab_fonts.ts index 6df23809..bb4f9f49 100644 --- a/base/sources/ts/tab_fonts.ts +++ b/base/sources/ts/tab_fonts.ts @@ -98,10 +98,10 @@ function tab_fonts_draw(htab: ui_handle_t) { context_select_font(i); }); } - if (time_time() - context_raw.select_time < 0.25) { + if (sys_time() - context_raw.select_time < 0.25) { ui_base_show_2d_view(view_2d_type_t.FONT); } - context_raw.select_time = time_time(); + context_raw.select_time = sys_time(); } if (ui.is_hovered && ui.input_released_r) { context_select_font(i); diff --git a/base/sources/ts/tab_layers.ts b/base/sources/ts/tab_layers.ts index f6601e21..bc8b4046 100644 --- a/base/sources/ts/tab_layers.ts +++ b/base/sources/ts/tab_layers.ts @@ -409,12 +409,12 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { let state: ui_state_t = ui_text(l.name); if (state == ui_state_t.RELEASED) { - if (time_time() - context_raw.select_time < 0.25) { + if (sys_time() - context_raw.select_time < 0.25) { tab_layers_layer_name_edit = l.id; tab_layers_layer_name_handle.text = l.name; ui_start_text_edit(tab_layers_layer_name_handle); } - context_raw.select_time = time_time(); + context_raw.select_time = sys_time(); } let in_focus: bool = ui.input_x > ui._window_x && ui.input_x < ui._window_x + ui._window_w && @@ -606,11 +606,11 @@ function tab_layers_handle_layer_icon_state(l: slot_layer_t, i: i32, state: ui_s tab_layers_set_drag_layer(context_raw.layer, -(mouse_x - uix - ui._window_x - 3), -(mouse_y - uiy - ui._window_y + 1)); } else if (state == ui_state_t.RELEASED) { - if (time_time() - context_raw.select_time < 0.2) { + if (sys_time() - context_raw.select_time < 0.2) { ui_base_show_2d_view(view_2d_type_t.LAYER); } - if (time_time() - context_raw.select_time > 0.2) { - context_raw.select_time = time_time(); + if (sys_time() - context_raw.select_time > 0.2) { + context_raw.select_time = sys_time(); } if (l.fill_layer != null) { context_set_material(l.fill_layer); diff --git a/base/sources/ts/tab_materials.ts b/base/sources/ts/tab_materials.ts index f87c48f1..679ed81d 100644 --- a/base/sources/ts/tab_materials.ts +++ b/base/sources/ts/tab_materials.ts @@ -139,12 +139,12 @@ function tab_materials_draw_slots(mini: bool) { base_drag_off_y = -(mouse_y - uiy - ui._window_y + 1); base_drag_material = context_raw.material; // Double click to show nodes - if (time_time() - context_raw.select_time < 0.25) { + if (sys_time() - context_raw.select_time < 0.25) { ui_base_show_material_nodes(); base_drag_material = null; base_is_dragging = false; } - context_raw.select_time = time_time(); + context_raw.select_time = sys_time(); } // Context menu diff --git a/base/sources/ts/tab_swatches.ts b/base/sources/ts/tab_swatches.ts index 55ac0388..b669741a 100644 --- a/base/sources/ts/tab_swatches.ts +++ b/base/sources/ts/tab_swatches.ts @@ -135,7 +135,7 @@ function tab_swatches_draw(htab: ui_handle_t) { drag_pos_set = true; } else if (state == ui_state_t.RELEASED) { - if (time_time() - context_raw.select_time < 0.25) { + if (sys_time() - context_raw.select_time < 0.25) { _tab_swatches_draw_i = i; @@ -180,7 +180,7 @@ function tab_swatches_draw(htab: ui_handle_t) { }); } - context_raw.select_time = time_time(); + context_raw.select_time = sys_time(); } if (ui.is_hovered && ui.input_released_r) { context_set_swatch(project_raw.swatches[i]); diff --git a/base/sources/ts/tab_textures.ts b/base/sources/ts/tab_textures.ts index f38387fb..2b40e4f3 100644 --- a/base/sources/ts/tab_textures.ts +++ b/base/sources/ts/tab_textures.ts @@ -92,10 +92,10 @@ function tab_textures_draw(htab: ui_handle_t) { base_drag_asset = asset; context_raw.texture = asset; - if (time_time() - context_raw.select_time < 0.25) { + if (sys_time() - context_raw.select_time < 0.25) { ui_base_show_2d_view(view_2d_type_t.ASSET); } - context_raw.select_time = time_time(); + context_raw.select_time = sys_time(); ui_view2d_hwnd.redraws = 2; } diff --git a/base/sources/ts/ui_base.ts b/base/sources/ts/ui_base.ts index 54152947..07a1f61c 100644 --- a/base/sources/ts/ui_base.ts +++ b/base/sources/ts/ui_base.ts @@ -1126,16 +1126,16 @@ function ui_base_update_ui() { // Two-finger tap to undo, three-finger tap to redo if (context_in_viewport() && config_raw.touch_ui) { if (mouse_started("middle")) { - ui_base_redo_tap_time = time_time(); + ui_base_redo_tap_time = sys_time(); } else if (mouse_started("right")) { - ui_base_undo_tap_time = time_time(); + ui_base_undo_tap_time = sys_time(); } - else if (mouse_released("middle") && time_time() - ui_base_redo_tap_time < 0.1) { + else if (mouse_released("middle") && sys_time() - ui_base_redo_tap_time < 0.1) { ui_base_redo_tap_time = ui_base_undo_tap_time = 0; redo_pressed = true; } - else if (mouse_released("right") && time_time() - ui_base_undo_tap_time < 0.1) { + else if (mouse_released("right") && sys_time() - ui_base_undo_tap_time < 0.1) { ui_base_redo_tap_time = ui_base_undo_tap_time = 0; undo_pressed = true; } @@ -1268,11 +1268,11 @@ function ui_base_draw_sidebar() { } } else if (ui_base_htabs[tab_area_t.SIDEBAR0].changed && ui_base_htabs[tab_area_t.SIDEBAR0].position == context_raw.last_htab0_pos) { - if (time_time() - context_raw.select_time < 0.25) { + if (sys_time() - context_raw.select_time < 0.25) { context_raw.maximized_sidebar_width = config_raw.layout[layout_size_t.SIDEBAR_W]; config_raw.layout[layout_size_t.SIDEBAR_W] = 0; } - context_raw.select_time = time_time(); + context_raw.select_time = sys_time(); } context_raw.last_htab0_pos = ui_base_htabs[tab_area_t.SIDEBAR0].position; } diff --git a/base/sources/ts/ui_files.ts b/base/sources/ts/ui_files.ts index 4353d170..8983df8f 100644 --- a/base/sources/ts/ui_files.ts +++ b/base/sources/ts/ui_files.ts @@ -361,7 +361,7 @@ function ui_files_file_browser(ui: ui_t, handle: ui_handle_t, drag_files: bool = } ui_files_selected = i; - if (time_time() - context_raw.select_time < 0.25) { + if (sys_time() - context_raw.select_time < 0.25) { base_drag_file = null; base_drag_file_icon = null; base_is_dragging = false; @@ -381,7 +381,7 @@ function ui_files_file_browser(ui: ui_t, handle: ui_handle_t, drag_files: bool = } ui_files_selected = -1; } - context_raw.select_time = time_time(); + context_raw.select_time = sys_time(); } // Label diff --git a/base/sources/ts/ui_nodes.ts b/base/sources/ts/ui_nodes.ts index 86b56800..7f18f8ec 100644 --- a/base/sources/ts/ui_nodes.ts +++ b/base/sources/ts/ui_nodes.ts @@ -388,8 +388,8 @@ function ui_viewnodes_on_canvas_released() { if (ui_input_in_rect(ui_nodes_ui._window_x + UI_NODE_X(node), ui_nodes_ui._window_y + UI_NODE_Y(node), UI_NODE_W(node), UI_NODE_H(canvas, node))) { if (nodes.nodes_selected_id.length > 0 && node.id == nodes.nodes_selected_id[0]) { ui_view2d_hwnd.redraws = 2; - if (time_time() - context_raw.select_time < 0.25) ui_base_show_2d_view(view_2d_type_t.NODE); - context_raw.select_time = time_time(); + if (sys_time() - context_raw.select_time < 0.25) ui_base_show_2d_view(view_2d_type_t.NODE); + context_raw.select_time = sys_time(); } break; }