You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For touch screen anti-spin the `Touch` object use and EMA (exponential moving average calculation with high/low threshold) that could be differ on each device thepending on the touch-screen sensiticity and device speed, you have to make an estimated pre-calculation to find the best parameters. By default the following constats are used:
85
+
For touch screen anti-spin the `Touch` object use and EMA (exponential moving average calculation with high/low threshold) could differ on each device depending on the touch-screen sensitivity and device speed, you have to make an estimated pre-calculation to find the best parameters. By default, the following constants are used:
86
86
```
87
87
#define SCREEN_DEFAULT_CLK_ALPHA 10
88
88
#define SCREEN_DEFAULT_CLK_MAX 150
89
89
#define SCREEN_DEFAULT_CLK_MIN 30
90
90
```
91
91
You can predefine them before including the `Screen.h` or by passing them directly to the `Touch::begin` function as optional parameters.
92
92
93
-
The `Touch::begin` function calibration parameters and the `Calibration`sturct:
93
+
The `Touch::begin` function calibration parameters and the `Calibration`struct:
94
94
```
95
95
struct Calibration {
96
96
@@ -110,31 +110,31 @@ struct Calibration {
110
110
```
111
111
112
112
## `Screen`
113
-
After you created a `Screen` object, for e.g:
113
+
After you create a `Screen` object, for e.g:
114
114
```
115
115
Screen<5> screen(gfx, ts);
116
116
```
117
-
then you can access to each element as an array like:
117
+
then you can access each element as an array like:
118
118
```
119
119
Screen::Elem elem = screen[n]; // where `n` is the index of UI element (starts from zero)
120
120
```
121
121
122
122
## `Screen::reset(size_t size)`
123
-
Resets the screen and redraw all element. `size` parameter is optional, tells the `Screen` object how many elemet you are using. It's usefull when you set different pages and just redefined the screen elements bt using less or even more elements.
123
+
Resets the screen and redraw all elements. `size` parameter is optional, and tells the `Screen` object how many elements you are using. It's useful when you set different pages and just redefine the screen elements by using fewer or even more elements.
124
124
125
125
Example:
126
126
```
127
127
screen.reset(3); // the screen.loop() method will taking care only the first 3 elements
128
128
```
129
129
## `Screen::size(size_t size)`
130
-
Same as the `Screen::reset(size_t size)` but it won't reset the elements onli re-size the screen.
130
+
Same as the `Screen::reset(size_t size)` but it won't reset the elements only re-size the screen.
131
131
132
132
Example:
133
133
```
134
134
screen.size(3); // the screen.loop() method will taking care only the first 3 elements
135
135
```
136
136
## `Screen::refresh()`
137
-
Refreshes the screen. Usefull when you re-define the UI elements or re-size the screen.
137
+
Refreshes the screen. Useful when you re-define the UI elements or re-size the screen.
138
138
139
139
Example:
140
140
```
@@ -146,7 +146,7 @@ The default Screen background color is defined by the theme file (`ScreenThemeXX
146
146
```
147
147
screen.color = COLOR(EGA_BRIGHT_BLUE);
148
148
```
149
-
or by using the direct `Color` type which is different on each platform. If you are using SDL library, the Color will be an RED/GREEN/BLUE/Alpha SDL_Color struct:
149
+
or by using the direct `Color` type which is different on each platform. If you are using the SDL library, the Color will be a RED/GREEN/BLUE/Alpha SDL_Color struct:
150
150
```
151
151
struct SDL_Color_ext {
152
152
Uint8 r;
@@ -161,7 +161,7 @@ color = 0x1234;
161
161
```
162
162
163
163
## `Screen::Elem` struct
164
-
Each UI elements (buttons) on the screen represented by the `Elem` struct and it's properties can be overwritten any time and the `Screen::loop()` function will update it accordingly
164
+
Each UI element (buttons) on the screen is represented by the `Elem` struct and its properties can be overwritten at any time and the `Screen::loop()` function will update it accordingly
165
165
```
166
166
struct Elem {
167
167
uint16_t top = 0, left = 0, slider = 0, width = SCREEN_THEME_ELEM_WIDTH, height = SCREEN_THEME_ELEM_HEIGHT;
@@ -176,7 +176,7 @@ struct Elem {
176
176
```
177
177
178
178
## `Screen::Elem::Top/Left/Width/Height/Text`
179
-
The size and text of an elemenet.
179
+
The size and text of an element.
180
180
181
181
Example:
182
182
```
@@ -188,7 +188,7 @@ scr[n].text = "Touch ME!"
188
188
```
189
189
190
190
## `Screen::touch/release/move`
191
-
The event handlers that can be attached to an element.
191
+
The event handlers can be attached to an element.
192
192
193
193
Example:
194
194
```
@@ -200,7 +200,7 @@ void touch_event(int x, int y) {
200
200
201
201
screen[n].touch = touch_event;
202
202
```
203
-
Note: each event handler needs two (x/y) parameter that will be passed where the event happend.
203
+
Note: each event handler needs two (x/y) parameters that will be passed where the event happened.
204
204
205
205
## Screen::Elem::props
206
206
Elem properties, packed into a single `uint16_t` variable containing the following properties:
0 commit comments