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
Copy file name to clipboardExpand all lines: README.md
+39-7Lines changed: 39 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,9 @@ Key features:
12
12
* Easy configurable
13
13
* Production hardened
14
14
15
-
15
+
*Imporant*
16
+
From here on this library will be published and updated under [@orange-games/phaser-input](https://www.npmjs.com/package/@orange-games/phaser-input) at NPM, the old [phaser-input](https://www.npmjs.com/package/phaser-input) will no longer be maintained.
17
+
If you are comming from v1 you can read the migration guide at the bottom
16
18
Getting Started
17
19
---------------
18
20
First you want to get a fresh copy of the plugin. You can get it from this repo or from npm, ain't that handy.
@@ -27,7 +29,7 @@ Next up you'd want to add it to your list of js sources you load into your game
27
29
28
30
After adding the script to the page you can activate it by enabling the plugin:
29
31
```javascript
30
-
game.add.plugin(Fabrique.Plugins.InputField);
32
+
game.add.plugin(PhaserInput.Plugin);
31
33
```
32
34
33
35
Usage
@@ -51,7 +53,7 @@ var password = game.add.inputField(10, 90, {
51
53
borderColor:'#000',
52
54
borderRadius:6,
53
55
placeHolder:'Password',
54
-
type:Fabrique.InputType.password
56
+
type:PhaserInput.InputType.password
55
57
});
56
58
```
57
59
### Using zoom
@@ -61,17 +63,17 @@ First of all, it's only meant for mobile. Second; it modifies the scale and pivo
61
63
62
64
Also, when the keyboard is shown, sometimes a resize event will be triggered.
63
65
64
-
Ideally you use a custom resize event, check for the static property `Fabrique.Plugins.InputField.KeyboardOpen` and don't resize when it's set to true.
66
+
Ideally you use a custom resize event, check for the static property `PhaserInput.KeyboardOpen` and don't resize when it's set to true.
65
67
66
68
### Using keyboard open/close signals
67
69
Current version includes two event dispatchers that notify when a device keyboard is opened or closed.
68
70
69
71
You can add listeners which trigger events based on this feedback.
the API of the objects is the same as before but the namespace changed. We decided to remove the Fabrique namespace, and house the plugin in it's own (PhaserInput).
133
+
so:
134
+
Fabrique.Plugins.Input
135
+
becomes:
136
+
PhaserInput.Plugin
137
+
138
+
and all other references of Fabrique.Plugins can be replaced with PhaserInput.
139
+
If you are still unsure how or what, both the example and this readme have been adjusted to work with the new namespace.
140
+
128
141
FAQ
129
142
---
130
143
### I Don't see the cursor blinking!
@@ -138,6 +151,25 @@ update: function () {
138
151
},
139
152
```
140
153
154
+
### How do I focus on the element!
155
+
Normally the element is only focused trough user interaction (due to mobile limitations) you can get around this by manually calling the focus method yourself:
156
+
```javascript
157
+
var input =game.add.inputField(10, 90);
158
+
//start with focus on the element
159
+
input.startFocus();
160
+
161
+
//and then end the focus
162
+
input.endFocus();
163
+
```
164
+
Please note that this will not work on mobile wihtout a user interaction
165
+
166
+
### Can I change the width later on in the code?
167
+
Well thanks for asking, yes you can!
168
+
```javascript
169
+
var input =game.add.inputField(10, 90);
170
+
input.width=200;
171
+
```
172
+
141
173
Credits
142
174
-------
143
175
phaser-input is inspired by [CanvasInput](https://github.com/goldfire/CanvasInput)
0 commit comments