/
WebBrowserInputHandler.cs
78 lines (62 loc) · 2.12 KB
/
WebBrowserInputHandler.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// UnityWebBrowser (UWB)
// Copyright (c) 2021-2022 Voltstro-Studios
//
// This project is under the MIT license. See the LICENSE.md file for more details.
using UnityEngine;
using VoltstroStudios.UnityWebBrowser.Shared;
namespace VoltstroStudios.UnityWebBrowser.Input
{
/// <summary>
/// Abstraction layer for getting input
/// </summary>
public abstract class WebBrowserInputHandler : ScriptableObject
{
#region Position
/// <summary>
/// Get the scroll
/// </summary>
/// <returns></returns>
public abstract float GetScroll();
/// <summary>
/// Get the current cursor position on the screen as a <see cref="Vector2" />
/// </summary>
/// <returns></returns>
public abstract Vector2 GetCursorPos();
#endregion
#region Input
/// <summary>
/// Get all keys that are down this frame
/// </summary>
/// <returns>Returns an array of <see cref="WindowsKey" /> that are up</returns>
public abstract WindowsKey[] GetDownKeys();
/// <summary>
/// Get all keys that are up this frame
/// </summary>
/// <returns>Returns an array of <see cref="WindowsKey" /> that are down</returns>
public abstract WindowsKey[] GetUpKeys();
/// <summary>
/// Gets the input buffer for this frame
/// </summary>
/// <returns></returns>
public abstract string GetFrameInputBuffer();
#endregion
#region General
/// <summary>
/// Called when inputs are started
/// </summary>
public abstract void OnStart();
/// <summary>
/// Called when inputs are stopped
/// </summary>
public abstract void OnStop();
/// <summary>
/// Called when IME needs to be enabled
/// </summary>
public abstract void EnableIme(Vector2 location);
/// <summary>
/// Called when IME is no longer needed
/// </summary>
public abstract void DisableIme();
#endregion
}
}