|
| 1 | +# Android/IOS keyboard for Game Maker Studio (1.4/2 ?) |
| 2 | +# Introduction |
| 3 | + |
| 4 | +<details> |
| 5 | + |
| 6 | +<summary></summary> |
| 7 | + |
| 8 | +I created this keyboard because there was no good *free* keyboard on the marketplace. |
| 9 | + |
| 10 | +Furthermore, paid extensions were for the **native keyboard**, which means we need a different keyboard for **both** IOS and Android, alongside the lack of customization they have. |
| 11 | + |
| 12 | +So I spent 20 initial hours creating this keyboard, and less than 4 a few days after to fix few bugs and optimize the project. |
| 13 | + |
| 14 | +</details> |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +# Features |
| 19 | + |
| 20 | +<details> |
| 21 | + |
| 22 | +<summary></summary> |
| 23 | + |
| 24 | +* Fast and easy to setup ! |
| 25 | +* Highly customizable through simple and straightforward ~~functions~~ scripts ! |
| 26 | +* Minimal performance impact on your game ! |
| 27 | +* Supports up 5 keys at the same time ! |
| 28 | +* Compatible both Android and IOS ! |
| 29 | + |
| 30 | +</details> |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +# Setup |
| 35 | + |
| 36 | +<details> |
| 37 | + |
| 38 | +<summary></summary> |
| 39 | + |
| 40 | +### Create the keyboard |
| 41 | + keyboard_create(Left_position, Top_position, Width, Height); |
| 42 | + |
| 43 | +[Then customize it with to get the design you want.](#visual-customization) |
| 44 | + |
| 45 | +### Get keyboard text |
| 46 | + keyboard_get_text(); |
| 47 | +**returns:** String |
| 48 | + |
| 49 | +### Clear keyboard text |
| 50 | + keyboard_clear_text(); |
| 51 | + |
| 52 | +### Destroy the keyboard |
| 53 | + keyboard_destroy(); |
| 54 | + |
| 55 | +<br> |
| 56 | + |
| 57 | +------------ |
| 58 | + |
| 59 | +<br> |
| 60 | + |
| 61 | +</details> |
| 62 | + |
| 63 | +# Obtaining key presses |
| 64 | + |
| 65 | +<details> |
| 66 | + |
| 67 | +<summary></summary> |
| 68 | + |
| 69 | +### Obtaining last pressed key |
| 70 | + keyboard_get_lastkey(); |
| 71 | +**returns:** String |
| 72 | + |
| 73 | +### Obtaining pressed key |
| 74 | + keyboard_get_pressed_key(); |
| 75 | +**returns:** String |
| 76 | + |
| 77 | +### Obtaining released key |
| 78 | + keyboard_get_released_key(); |
| 79 | +**returns:** String |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | +<br> |
| 84 | + |
| 85 | +------------ |
| 86 | + |
| 87 | +<br> |
| 88 | + |
| 89 | +</details> |
| 90 | + |
| 91 | +# Keyboard coordinates |
| 92 | + |
| 93 | +<details> |
| 94 | + |
| 95 | +<summary></summary> |
| 96 | + |
| 97 | +The x and y coordinates represents the top left of the keyboard. |
| 98 | +However, **DON'T** move the keyboard by accessing directly thoses values ! |
| 99 | + |
| 100 | +The keyboard is defined by its 4 borders (Left, Top, Right, Bottom). |
| 101 | +You can set and/or get the coordinate of any of the keyboard borders. |
| 102 | + |
| 103 | +## Moving the keyboard around |
| 104 | + |
| 105 | +<details> |
| 106 | + |
| 107 | +<summary></summary> |
| 108 | + |
| 109 | +### Move the keyboard from its top border |
| 110 | + keyboard_set_from_top(Y_coordinate); |
| 111 | + |
| 112 | +### Move the keyboard from its bottom border |
| 113 | + keyboard_set_from_bottom(Y_coordinate); |
| 114 | + |
| 115 | +### Move the keyboard from its left border |
| 116 | + keyboard_set_from_left(X_coordinate); |
| 117 | + |
| 118 | +### Move the keyboard from its right border |
| 119 | + keyboard_set_from_right(X_coordinate); |
| 120 | + |
| 121 | +</details> |
| 122 | + |
| 123 | +## Getting keyboard coordinates |
| 124 | + |
| 125 | +<details> |
| 126 | + |
| 127 | +<summary></summary> |
| 128 | + |
| 129 | +### Get the top border |
| 130 | + keyboard_get_bbox_top(); |
| 131 | +**returns:** real number |
| 132 | + |
| 133 | +### Get the bottom border |
| 134 | + keyboard_get_bbox_bottom(); |
| 135 | +**returns:** real number |
| 136 | + |
| 137 | +### Get the left border |
| 138 | + keyboard_get_bbox_left(); |
| 139 | +**returns:** real number |
| 140 | + |
| 141 | +### Get the right border |
| 142 | + keyboard_get_bbox_right(); |
| 143 | +**returns:** real number |
| 144 | + |
| 145 | +</details> |
| 146 | + |
| 147 | +<br> |
| 148 | + |
| 149 | +------------ |
| 150 | + |
| 151 | +<br> |
| 152 | + |
| 153 | +</details> |
| 154 | + |
| 155 | + |
| 156 | +# Visual customization |
| 157 | + |
| 158 | +<details> |
| 159 | + |
| 160 | +<summary></summary> |
| 161 | + |
| 162 | +The keyboard have many visual properties that can be customized. |
| 163 | +*I don't want to describe them all but here I am* |
| 164 | + |
| 165 | +<br> |
| 166 | + |
| 167 | +## Keyboard Size |
| 168 | + |
| 169 | +<details> |
| 170 | + |
| 171 | +<summary></summary> |
| 172 | + |
| 173 | +### Resize the keyboard |
| 174 | + keyboard_resize(Width, Height); |
| 175 | + |
| 176 | +### Get keyboard size |
| 177 | + keyboard_get_width(); |
| 178 | +**returns:** real number |
| 179 | + |
| 180 | + keyboard_get_height(); |
| 181 | +**returns:** real number |
| 182 | + |
| 183 | +<br> |
| 184 | + |
| 185 | +</details> |
| 186 | + |
| 187 | +## Keyboard background |
| 188 | + |
| 189 | +<details> |
| 190 | + |
| 191 | +<summary></summary> |
| 192 | + |
| 193 | +### Background state |
| 194 | + keyboard_set_background_visible(Boolean); |
| 195 | + |
| 196 | +  |
| 197 | + |
| 198 | + keyboard_get_background_visible(); |
| 199 | +**returns:** boolean |
| 200 | + |
| 201 | +### Background color |
| 202 | + keyboard_set_background_color(Color); |
| 203 | + |
| 204 | + keyboard_get_background_color(); |
| 205 | +**returns:** color |
| 206 | + |
| 207 | +</details> |
| 208 | + |
| 209 | +## Keyboard font |
| 210 | + |
| 211 | +<details> |
| 212 | + |
| 213 | +<summary></summary> |
| 214 | + |
| 215 | +### Font used |
| 216 | + |
| 217 | +<details> |
| 218 | + |
| 219 | +<summary></summary> |
| 220 | + |
| 221 | + keyboard_set_font(Font); |
| 222 | + |
| 223 | +  |
| 224 | + |
| 225 | + keyboard_get_font(); |
| 226 | +**returns:** Font index |
| 227 | + |
| 228 | +</details> |
| 229 | + |
| 230 | +### Font color |
| 231 | + |
| 232 | +<details> |
| 233 | + |
| 234 | +<summary></summary> |
| 235 | + |
| 236 | + keyboard_set_text_color(Color); |
| 237 | + |
| 238 | +   |
| 239 | + |
| 240 | + keyboard_get_text_color(); |
| 241 | +**returns:** color |
| 242 | + |
| 243 | +</details> |
| 244 | + |
| 245 | +</details> |
| 246 | + |
| 247 | +## Keyboard keycaps |
| 248 | + |
| 249 | +<details> |
| 250 | + |
| 251 | +<summary></summary> |
| 252 | + |
| 253 | +### State |
| 254 | + |
| 255 | +<details> |
| 256 | + |
| 257 | +<summary></summary> |
| 258 | + |
| 259 | + keyboard_set_keycaps_visible(boolean); |
| 260 | + |
| 261 | +</details> |
| 262 | + |
| 263 | +### Corners |
| 264 | + |
| 265 | +<details> |
| 266 | + |
| 267 | +<summary></summary> |
| 268 | + |
| 269 | + keyboard_set_keycaps_radius(real_number); |
| 270 | + |
| 271 | +If desired, you can set the radius on each axis individually. |
| 272 | + |
| 273 | + keyboard_set_keycaps_x_radius(Radius); |
| 274 | + keyboard_set_keycaps_y_radius(Radius); |
| 275 | + |
| 276 | +</details> |
| 277 | + |
| 278 | +### Offsets |
| 279 | + |
| 280 | +<details> |
| 281 | + |
| 282 | +<summary></summary> |
| 283 | + |
| 284 | + keyboard_set_keycaps_offset(Offset); |
| 285 | + |
| 286 | +If desired, you can set the offset on each axis individually. |
| 287 | + |
| 288 | + keyboard_set_keycaps_x_offset(Offset); |
| 289 | + keyboard_set_keycaps_y_offset(Offset); |
| 290 | + |
| 291 | +</details> |
| 292 | + |
| 293 | +### Colors |
| 294 | + |
| 295 | +<details> |
| 296 | + |
| 297 | +<summary></summary> |
| 298 | + |
| 299 | +#### Idle state |
| 300 | + |
| 301 | +<details> |
| 302 | + |
| 303 | +<summary></summary> |
| 304 | + |
| 305 | + keyboard_set_keycaps_color(Color); |
| 306 | + |
| 307 | +  |
| 308 | + |
| 309 | + keyboard_get_keycaps_color(); |
| 310 | +**returns:** color |
| 311 | + |
| 312 | +</details> |
| 313 | + |
| 314 | +#### Pressed state |
| 315 | + |
| 316 | +<details> |
| 317 | + |
| 318 | +<summary></summary> |
| 319 | + |
| 320 | + keyboard_set_keycaps_pressed_color(Color); |
| 321 | +  |
| 322 | + |
| 323 | + keyboard_get_keycaps_pressed_color(); |
| 324 | +**returns:** color |
| 325 | + |
| 326 | +</details> |
| 327 | + |
| 328 | +</details> |
| 329 | + |
| 330 | +</details> |
| 331 | + |
| 332 | +<br> |
| 333 | + |
| 334 | +------------ |
| 335 | + |
| 336 | +<br> |
| 337 | + |
| 338 | +</details> |
| 339 | + |
| 340 | +# Things to improve on the keyboard |
| 341 | + |
| 342 | +<details> |
| 343 | + |
| 344 | +<summary></summary> |
| 345 | + |
| 346 | +* Check if it works with GM 2 I guess, or port it for GM 2 if it doesn't |
| 347 | +* Performance, always better performance ! |
| 348 | +Without kidding, drawing with round_rect on the surface is extremely inefficient. |
| 349 | +* Better handling of spriteless special keys like _ENTER_, _DELETE_... |
| 350 | +* Add a resizing system for keys with a sprite. |
| 351 | +* Make the keyboard works as a normal keyboard to allow seemless integration from a PC typing game ! |
| 352 | +* And surely other things that I can't think of right now. |
| 353 | + |
| 354 | +</details> |
| 355 | + |
| 356 | + |
| 357 | + |
| 358 | + |
0 commit comments