Synchronize Inputs Events

Waits for all input events to be processed by flushing any buffered input events and then awaiting a full cycle of both the process and physics frames.

This is typically used to ensure that any simulated or queued inputs are fully processed before proceeding with the next steps in the scene.
It’s essential for reliable input simulation or when synchronizing logic based on inputs.

await_input_processed

The await_input_processed function do wait until all input events are processed.

  • ### Waits for all input events are processed
    func await_input_processed() -> void:
    

    Here is an example of how to use simulate_frames:

    var runner := scene_runner("res://test_scene.tscn")
    
    # Simulates key combination ctrl+C is pressed
    runner.simulate_key_pressed(KEY_C, false, true)
    
    # finalize the input event processing
    await await_input_processed()
    
  • /// <summary>
    ///     Waits for all input events to be processed by flushing any buffered input events and then awaiting a full cycle of
    ///     both the process and physics frames.
    ///     This is typically used to ensure that any simulated or queued inputs are fully processed before proceeding with the
    ///     next steps in the scene.
    ///     It's essential for reliable input simulation or when synchronizing logic based on inputs.
    /// </summary>
    public static Task AwaitInputProcessed()
    

    Here is an example of how to use AwaitInputProcessed:

    ISceneRunner runner = ISceneRunner.Load("res://test_scene.tscn");
    
    // Simulates key combination ctrl+C is pressed
    runner
        .SimulateKeyPress(Key.Ctrl)
        .SimulateKeyPress(Key.C);
    
    // finalize the input event processing
    await runner.AwaitInputProcessed();
    

document version v5.0.0


Copyright © 2021-2024 Mike Schulze. Distributed by an MIT license.