Skip to content

Commit 09f6540

Browse files
committed
Move 0.6.4.0 to be first in the tabs (so james stop crying for no good reasons)
Added some information for 0.6.x & more notes
1 parent e9579c4 commit 09f6540

File tree

5 files changed

+163
-137
lines changed

5 files changed

+163
-137
lines changed

code_and_explain/bindings.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
11
# Bindings
22

33
::::{tabs}
4-
:::{tab} 0.5.3.3
4+
:::{tab} 0.6.4.0
55
```csharp
66
[PluginName("My Binding")]
7-
public class MyBinding : IBinding, IValidateBinding
7+
public class MyBinding : IStateBinding
88
{
9-
[Property("Property")]
9+
[Property("Property"), PropertyValidated(nameof(ValidProperties))]
1010
public string Property { set; get; } = string.Empty;
1111

12-
public Action Press
12+
public void Press(TabletReference tablet, IDeviceReport report)
1313
{
14-
get => () => {
15-
// do something depending on <see cref="Property"/>
16-
};
14+
// do something depending on <see cref="Key"/>
1715
}
1816

19-
public Action Release
17+
public void Release(TabletReference tablet, IDeviceReport report)
2018
{
21-
get => () => {
22-
// do something depending on <see cref="Property"/>
23-
};
19+
// do something depending on <see cref="Key"/>
2420
}
2521

2622
/// <summary>
2723
/// A list of valid keys for this category
2824
/// </summary>
29-
public string[] ValidProperties => new string[] { "Option 1", "Option 2" };
25+
public static IEnumerable<string> ValidProperties => new List<string> { "Option 1",
26+
"Option 2" };
3027

31-
public override string ToString() => $"My Binding: {Property}";
28+
public override string ToString() => $"My Binding: {Key}";
3229
}
3330
```
3431
:::
35-
:::{tab} 0.6.4.0
32+
:::{tab} 0.5.3.3
3633
```csharp
3734
[PluginName("My Binding")]
38-
public class MyBinding : IStateBinding
35+
public class MyBinding : IBinding, IValidateBinding
3936
{
40-
[Property("Key"), PropertyValidated(nameof(ValidKeys))]
41-
public string Key { set; get; } = string.Empty;
37+
[Property("Property")]
38+
public string Property { set; get; } = string.Empty;
4239

43-
public void Press(TabletReference tablet, IDeviceReport report)
40+
public Action Press
4441
{
45-
// do something depending on <see cref="Key"/>
42+
get => () => {
43+
// do something depending on <see cref="Property"/>
44+
};
4645
}
4746

48-
public void Release(TabletReference tablet, IDeviceReport report)
47+
public Action Release
4948
{
50-
// do something depending on <see cref="Key"/>
49+
get => () => {
50+
// do something depending on <see cref="Property"/>
51+
};
5152
}
5253

5354
/// <summary>
5455
/// A list of valid keys for this category
5556
/// </summary>
56-
public static IEnumerable<string> ValidKeys => new List<string> { "Option 1",
57-
"Option 2" };
57+
public string[] ValidProperties => new string[] { "Option 1", "Option 2" };
5858

59-
public override string ToString() => $"My Binding: {Key}";
59+
public override string ToString() => $"My Binding: {Property}";
6060
}
6161
```
6262
:::
6363
::::
6464

6565
Bindings from plugins can only get selected by the user from the Advanced Binding Editor. \
66-
Any options in the `ValidKeys` array will be displayed in the UI as a dropdown list of 'My Binding'.
66+
Any options in the `ValidProperties` / `ValidKeys` array will be displayed in the UI as a dropdown list of 'My Binding'.
6767

6868
```{image} img/bindings-dropdown.png
6969
:alt: Bindings dropdown

code_and_explain/dependencies.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,6 @@
33
Your plugin may depend on objects, such as a reference to a tablet using the plugin or an instance of `IDriver`, and more.
44

55
::::{tabs}
6-
:::{tab} 0.5.3.3
7-
```csharp
8-
private IDriver _driverInstance = Info.Driver;
9-
10-
// Equivalent of TabletReference
11-
private TabletState _tabletState = Info.TabletState;
12-
13-
private ITimer _timer = SystemInterop.Timer;
14-
15-
private IAbsolutePointer _absolutepointer = SystemInterop.AbsolutePointer;
16-
17-
private IRelativePointer _relativePointer = SystemInterop.RelativePointer;
18-
19-
// Linux only
20-
private IVirtualTablet? _virtualTablet = SystemInterop.VirtualTablet;
21-
22-
private IVirtualScreen _virtualScreen = SystemInterop.VirtualScreen;
23-
24-
private IVirtualKeyboard _virtualKeyboard = SystemInterop.VirtualKeyboard;
25-
```
26-
:::
276
:::{tab} 0.6.4.0
287
```csharp
298
[TabletReference]
@@ -51,8 +30,33 @@ public IVirtualScreen VirtualScreen { get; set; }
5130
public IVirtualKeyboard VirtualKeyboard { get; set; }
5231
```
5332
:::
33+
:::{tab} 0.5.3.3
34+
```csharp
35+
private IDriver _driverInstance = Info.Driver;
36+
37+
// Equivalent of TabletReference
38+
private TabletState _tabletState = Info.TabletState;
39+
40+
private ITimer _timer = SystemInterop.Timer;
41+
42+
private IAbsolutePointer _absolutepointer = SystemInterop.AbsolutePointer;
43+
44+
private IRelativePointer _relativePointer = SystemInterop.RelativePointer;
45+
46+
// Linux only
47+
private IVirtualTablet? _virtualTablet = SystemInterop.VirtualTablet;
48+
49+
private IVirtualScreen _virtualScreen = SystemInterop.VirtualScreen;
50+
51+
private IVirtualKeyboard _virtualKeyboard = SystemInterop.VirtualKeyboard;
52+
```
53+
:::
5454
::::
5555

5656
```{admonition} Developing for 0.5.x
57-
`SystemInterop` is part of the `OpenTabletDriver.Desktop.Interop` namespace;
57+
`SystemInterop` is part of the `OpenTabletDriver.Desktop.Interop` namespace.
58+
```
59+
60+
```{admonition} Developing for 0.6.x
61+
`SystemInterop` is now `DesktopInterop`, and is still part of the `OpenTabletDriver.Desktop.Interop` namespace.
5862
```

code_and_explain/filters.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
11
# Filters
22

33
::::{tabs}
4-
:::{tab} 0.5.3.3
5-
```csharp
6-
[PluginName("My Name")]
7-
public class MyFilter : IFilter
8-
{
9-
public FilterStage FilterStage => FilterStage.PreTranspose;
10-
11-
// Position is received here
12-
public Vector2 Filter(Vector2 value)
13-
{
14-
return value;
15-
}
16-
}
17-
```
18-
:::
194
:::{tab} 0.6.4.0
205
```csharp
216
[PluginName("My Name")]
@@ -34,13 +19,34 @@ public class MyFilter : IPositionedPipelineElement<IDeviceReport>
3419
}
3520
```
3621
:::
22+
:::{tab} 0.5.3.3
23+
```csharp
24+
[PluginName("My Name")]
25+
public class MyFilter : IFilter
26+
{
27+
public FilterStage FilterStage => FilterStage.PreTranspose;
28+
29+
// Position is received here
30+
public Vector2 Filter(Vector2 value)
31+
{
32+
return value;
33+
}
34+
}
35+
```
36+
:::
3737
::::
3838

39-
In 0.5.3.3, you are able to alter positionnal reports via the `Filter` method, which is called on every report. \
40-
You may cancel the report by returning `Vector2.Zero` or less if the user has `Ignore output outside area` is enabled.
39+
In 0.6.x, You are able to alter positionnal reports via the `Consume()` method, which is called on every report. \
40+
You can also choose to not emit a positionnal report to prevent it from going further in the pipeline.
41+
42+
In 0.5.x, you are able to alter positionnal reports via the `Filter` method, which is called on every report. \
43+
You may discard the report by returning `Vector2.Zero` or less if the user has `Ignore output outside area` is enabled.
4144

4245
Filters can choose to be called at two different stages of the pipeline by changing the value of `Position`. \
43-
The possible values are : `FilterStage.PreTranspose` and `FilterStage.PostTranspose` \
46+
The possible values are :
47+
- Before the transformation: `PipelinePosition.PreTransform` (0.6.x) / `FilterStage.PreTranspose` (0.5.x),
48+
- After the transformation: `PipelinePosition.PostTransform` (0.6.x) / `FilterStage.PostTranspose` (0.5.x)
49+
4450
(before or after the transformation from tablet to screen coordinates).
4551

4652
```{admonition} Do not block non-handled input types (0.6.x Only)

code_and_explain/interpolators.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,11 @@
11
# Interpolators
22

33
```{admonition} Help Wanted
4-
:class: error
4+
:class: danger
55
This section is incomplete. If you have experience with OpenTabletDriver's interpolators, please consider contributing to this documentation.
66
```
77

88
::::{tabs}
9-
:::{tab} 0.5.3.3
10-
```csharp
11-
[PluginName("My Name")]
12-
public class MyInterp : Interpolator
13-
{
14-
private SyntheticTabletReport syntheticReport;
15-
16-
public MyInterp(ITimer scheduler) : base(scheduler)
17-
{
18-
}
19-
20-
// Position is received here
21-
public override SyntheticTabletReport Interpolate()
22-
{
23-
return syntheticReport;
24-
}
25-
26-
public override void UpdateState(SyntheticTabletReport report)
27-
{
28-
syntheticReport = new SyntheticTabletReport(report);
29-
}
30-
}
31-
```
32-
:::
339
:::{tab} 0.6.4.0
3410
```csharp
3511
[PluginName("My Name")]
@@ -67,16 +43,33 @@ public class MyInterp : AsyncPositionedPipelineElement<IDeviceReport>
6743
}
6844
```
6945
:::
70-
::::
46+
:::{tab} 0.5.3.3
47+
```csharp
48+
[PluginName("My Name")]
49+
public class MyInterp : Interpolator
50+
{
51+
private SyntheticTabletReport syntheticReport;
7152

72-
The `UpdateState` in called on every tablet reports, while `Interpolate` is called at the frequency defined by the user, represented by the `Frequency` property.
53+
public MyInterp(ITimer scheduler) : base(scheduler)
54+
{
55+
}
7356

74-
```{admonition} Do not block non-handled input types (0.6.x Only)
75-
:class: danger
76-
Plugins such as Interpolators should emit non-handled report types in `ConsumeState()`.
77-
Failing in doing so may result in those reports being discarded.
78-
(Preventing Bindings set by the user from being invoked & other plugins from working properly)
57+
// Position is received here
58+
public override SyntheticTabletReport Interpolate()
59+
{
60+
return syntheticReport;
61+
}
62+
63+
public override void UpdateState(SyntheticTabletReport report)
64+
{
65+
syntheticReport = new SyntheticTabletReport(report);
66+
}
67+
}
7968
```
69+
:::
70+
::::
71+
72+
The `UpdateState` in called on every tablet reports, while `Interpolate` is called at the frequency defined by the user, represented by the `Frequency` property.
8073

8174
```{admonition} Confusing changes were made in 0.6.x
8275
:class: warning
@@ -85,6 +78,13 @@ The `UpdateState` method is instead called at the frequency defined by the user
8578
Keep this in mind if you make an interpolator in 0.5.x & want to make it work properly in 0.6.x.
8679
```
8780

81+
```{admonition} Do not block non-handled input types (0.6.x Only)
82+
:class: danger
83+
Plugins such as Interpolators should emit non-handled report types in `ConsumeState()`.
84+
Failing in doing so may result in those reports being discarded.
85+
(Preventing Bindings set by the user from being invoked & other plugins from working properly)
86+
```
87+
8888
You can make your interpolator configurable by the user by adding properties to your class.
8989

9090
```csharp

0 commit comments

Comments
 (0)