Skip to content

Commit 2dd7964

Browse files
committed
update docs
1 parent 57874c8 commit 2dd7964

File tree

3 files changed

+293
-11
lines changed

3 files changed

+293
-11
lines changed

docs/unity/changelog.html

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,143 @@ <h1>Changelog for Unity Plugin</h1>
6767
<div class="row">
6868
<div class="col-sm-8 lesson-main">
6969
<ul>
70+
<li><p>1.2</p>
71+
<ul>
72+
<li><p>Added Export/Install/Publish menu items</p>
73+
</li>
74+
<li><p>added HFTGamepad.BUTTON_TOUCH for whether or not the user is touching the screen
75+
on the orientation and touch controllers.</p>
76+
</li>
77+
<li><p>added ability to play sound through controller</p>
78+
<p>There are currently 2 ways to make sounds for the controllers.</p>
79+
<ol>
80+
<li><p>JSFX</p>
81+
<p>This is the recommended way as it&#39;s light weight.</p>
82+
<ol>
83+
<li><p>Go to the <a href="http://egonelbre.com/project/jsfx/">JSFX sound maker</a>.</p>
84+
</li>
85+
<li><p>Adjust the values until you get a sound you like.</p>
86+
</li>
87+
<li><p>Copy the sound values (near top of the page just below the buttons) to a text file with the extension &quot;.jsfx.txt&quot;
88+
putting a name in front of each set of values. Save that file in Assets/WebPlayerTemplates/HappyFunTimes</p>
89+
</li>
90+
</ol>
91+
<p>For example here is the sample <code>sounds.jsfx.txt</code> file</p>
92+
<pre><code>coin [&quot;square&quot;,0.0000,0.4000,0.0000,0.0240,0.4080,0.3480,20.0000,909.0000,2400.0000,0.0000,0.0000,0.0000,0.0100,0.0003,0.0000,0.2540,0.1090,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
93+
jump [&quot;square&quot;,0.0000,0.4000,0.0000,0.0960,0.0000,0.1720,20.0000,245.0000,2400.0000,0.3500,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.5000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
94+
coinland [&quot;square&quot;,0.0000,0.4000,0.0000,0.0520,0.3870,0.1160,20.0000,1050.0000,2400.0000,0.0000,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
95+
bonkhead [&quot;sine&quot;,0.0000,0.4000,0.0000,0.0000,0.5070,0.1400,20.0000,1029.0000,2400.0000,-0.7340,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.3780,0.0960,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
96+
land [&quot;sine&quot;,0.0000,0.4000,0.0000,0.1960,0.0000,0.1740,20.0000,1012.0000,2400.0000,-0.7340,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.3780,0.0960,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
97+
kicked [&quot;noise&quot;,0.0000,1.0000,0.0000,0.0400,0.0000,0.2320,20.0000,822.0000,2400.0000,-0.6960,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0270,0.0000]
98+
dropkick [&quot;sine&quot;,0.0000,1.0000,0.0000,0.0880,0.0000,0.3680,20.0000,653.0000,2400.0000,0.2360,0.0000,0.1390,47.1842,0.9623,-0.4280,0.0000,0.0000,0.4725,0.0000,0.0000,-0.0060,-0.0260,1.0000,0.0000,0.0000,0.0000,0.0000]
99+
bounce [&quot;noise&quot;,0.0000,1.0000,0.0000,0.0220,0.0000,0.1480,20.0000,309.0000,2400.0000,-0.3300,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
100+
</code></pre></li>
101+
<li><p>Use sounds files</p>
102+
<p>Put sound files (<code>.mp3</code> or <code>.wav</code>) in <code>Assets/WebPlayerTemplates/HappyFunTimes/sounds</code>
103+
They have to be in there because they must be served to the phone. Note that it&#39;s a
104+
good idea to keep them as small as possible because each time a player connects to
105+
the game his phone will have to download all the sounds. JSFX sounds comming soon.</p>
106+
</li>
107+
</ol>
108+
<h2 id="playing-sounds">Playing Sounds</h2>
109+
<p>To use the sounds, on some global gameobject (like LevelManager in all the samples)
110+
add an <code>HFTGlobalSoundHelper</code> script component.</p>
111+
<p>Then, on the prefab that gets spawned for your players, the same prefab you put
112+
an <code>HFTInput</code> or <code>HFTGamepad</code> script component add the <code>HFTSoundPlayer</code> script
113+
component.</p>
114+
<p>In your <code>Awake</code> or <code>Start</code> look it up</p>
115+
<pre><code>private HFTSoundPlayer m_soundPlayer;
116+
117+
void Awake()
118+
{
119+
m_soundPlayer = GetComponent&lt;HFTSoundPlayer&gt;();
120+
}
121+
</code></pre><p>To play a sound call <code>m_soundPlayer.PlaySound</code> with the name of the sound (no extension).
122+
In other words if you have <code>sounds/explosion.mp3</code> then you can trigger that sound on
123+
the user&#39;s phone with</p>
124+
<pre><code>m_soundPlayer.PlaySound(&quot;explosion&quot;);
125+
</code></pre><p>Or if you named a JSFX sound like</p>
126+
<pre><code>bounce [&quot;noise&quot;,0.0000,1.0000,0.0000,0.0220,0.0000,0.1480,20.0000,309.0000,2400.0000,-0.3300,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
127+
</code></pre><p>Then</p>
128+
<pre><code>m_soundPlayer.PlaySound(&quot;bounce&quot;);
129+
</code></pre></li>
130+
</ul>
131+
</li>
132+
</ul>
133+
<pre><code>* added mulit-touch support to HFTInput via the standard `GetTouch` function
134+
as well as `axes` and `buttons`
135+
136+
public const int AXIS_TOUCH0_X = 13;
137+
public const int AXIS_TOUCH0_Y = 14;
138+
public const int AXIS_TOUCH1_X = 15;
139+
public const int AXIS_TOUCH1_Y = 16;
140+
public const int AXIS_TOUCH2_X = 17;
141+
public const int AXIS_TOUCH2_Y = 18;
142+
public const int AXIS_TOUCH3_X = 19;
143+
public const int AXIS_TOUCH3_Y = 20;
144+
public const int AXIS_TOUCH4_X = 21;
145+
public const int AXIS_TOUCH4_Y = 22;
146+
public const int AXIS_TOUCH5_X = 23;
147+
public const int AXIS_TOUCH5_Y = 24;
148+
public const int AXIS_TOUCH6_X = 25;
149+
public const int AXIS_TOUCH6_Y = 26;
150+
public const int AXIS_TOUCH7_X = 27;
151+
public const int AXIS_TOUCH7_Y = 28;
152+
public const int AXIS_TOUCH8_X = 29;
153+
public const int AXIS_TOUCH8_Y = 30;
154+
public const int AXIS_TOUCH9_X = 31;
155+
public const int AXIS_TOUCH9_Y = 32;
156+
157+
public const int BUTTON_TOUCH0 = 18;
158+
public const int BUTTON_TOUCH1 = 19;
159+
public const int BUTTON_TOUCH2 = 20;
160+
public const int BUTTON_TOUCH3 = 21;
161+
public const int BUTTON_TOUCH4 = 22;
162+
public const int BUTTON_TOUCH5 = 23;
163+
public const int BUTTON_TOUCH6 = 24;
164+
public const int BUTTON_TOUCH7 = 25;
165+
public const int BUTTON_TOUCH8 = 26;
166+
public const int BUTTON_TOUCH9 = 27;
167+
168+
Note: The Touch.rawPosition is currently in screen pixels of Unity
169+
not the controller. It&#39;s not clear what the best way to handle this
170+
is.
171+
172+
The Unity `Input` API says those value are in pixels but they are
173+
assuming the game is running on the phone. In the case of HappyFunTimes
174+
though each phone is different so having it be in phone screen pixels
175+
would make no sense unless you also knew the resolution of each phone.
176+
I could provide that but that would make it more complicated for you.
177+
178+
Personally I&#39;d prefer normalized values (0.0 to 1.0). If you want those
179+
then take `Touch.rawPosition` and divide `x` by `Screen.width` and `y` by `Screen.height`
180+
as in
181+
182+
HFTInput.Touch touch = m_hftInput.GetTouch(0);
183+
float normalizedX = touch.x / Screen.width;
184+
float normalziedY = touch.y / Screen.height;
185+
186+
Also note the AXIS versions of these are already normalized to
187+
a -1.0 to +1.0 range.
188+
189+
* Changed sample HFTGamepad code to not issue an error if it&#39;s not actually
190+
connected to a controller.
191+
192+
Users often leave a prefab in their scene. That prefab would generate
193+
errors because it&#39;s not actually connected to a controller and was
194+
trying to access the controllers `NetPlayer`.
195+
</code></pre><ul>
196+
<li><p>1.1</p>
197+
<ul>
198+
<li>Moved samples into samples folder</li>
199+
</ul>
200+
</li>
201+
<li><p>1.0</p>
202+
<ul>
203+
<li>made the plugin based on <a href="http://github.com/greggman/hft-unity-gamepad">hft-unity-gamepad</a>
204+
that implements 12 controllers.</li>
205+
</ul>
206+
</li>
70207
<li><p>0.0.7</p>
71208
<ul>
72209
<li>Added <code>maxPlayers</code> to PlayerSpawner</li>

docs/unity/changelog.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,151 @@
11
Title: Changelog for Unity Plugin
22
Description: Changes for Unity Plugin
33

4+
* 1.2
5+
6+
* Added Export/Install/Publish menu items
7+
8+
* added HFTGamepad.BUTTON_TOUCH for whether or not the user is touching the screen
9+
on the orientation and touch controllers.
10+
11+
* added ability to play sound through controller
12+
13+
There are currently 2 ways to make sounds for the controllers.
14+
15+
1. JSFX
16+
17+
This is the recommended way as it's light weight.
18+
19+
1. Go to the [JSFX sound maker](http://egonelbre.com/project/jsfx/).
20+
21+
2. Adjust the values until you get a sound you like.
22+
23+
3. Copy the sound values (near top of the page just below the buttons) to a text file with the extension ".jsfx.txt"
24+
putting a name in front of each set of values. Save that file in Assets/WebPlayerTemplates/HappyFunTimes
25+
26+
For example here is the sample `sounds.jsfx.txt` file
27+
28+
coin ["square",0.0000,0.4000,0.0000,0.0240,0.4080,0.3480,20.0000,909.0000,2400.0000,0.0000,0.0000,0.0000,0.0100,0.0003,0.0000,0.2540,0.1090,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
29+
jump ["square",0.0000,0.4000,0.0000,0.0960,0.0000,0.1720,20.0000,245.0000,2400.0000,0.3500,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.5000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
30+
coinland ["square",0.0000,0.4000,0.0000,0.0520,0.3870,0.1160,20.0000,1050.0000,2400.0000,0.0000,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
31+
bonkhead ["sine",0.0000,0.4000,0.0000,0.0000,0.5070,0.1400,20.0000,1029.0000,2400.0000,-0.7340,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.3780,0.0960,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
32+
land ["sine",0.0000,0.4000,0.0000,0.1960,0.0000,0.1740,20.0000,1012.0000,2400.0000,-0.7340,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.3780,0.0960,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
33+
kicked ["noise",0.0000,1.0000,0.0000,0.0400,0.0000,0.2320,20.0000,822.0000,2400.0000,-0.6960,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0270,0.0000]
34+
dropkick ["sine",0.0000,1.0000,0.0000,0.0880,0.0000,0.3680,20.0000,653.0000,2400.0000,0.2360,0.0000,0.1390,47.1842,0.9623,-0.4280,0.0000,0.0000,0.4725,0.0000,0.0000,-0.0060,-0.0260,1.0000,0.0000,0.0000,0.0000,0.0000]
35+
bounce ["noise",0.0000,1.0000,0.0000,0.0220,0.0000,0.1480,20.0000,309.0000,2400.0000,-0.3300,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
36+
37+
2. Use sounds files
38+
39+
Put sound files (`.mp3` or `.wav`) in `Assets/WebPlayerTemplates/HappyFunTimes/sounds`
40+
They have to be in there because they must be served to the phone. Note that it's a
41+
good idea to keep them as small as possible because each time a player connects to
42+
the game his phone will have to download all the sounds. JSFX sounds comming soon.
43+
44+
## Playing Sounds
45+
46+
To use the sounds, on some global gameobject (like LevelManager in all the samples)
47+
add an `HFTGlobalSoundHelper` script component.
48+
49+
Then, on the prefab that gets spawned for your players, the same prefab you put
50+
an `HFTInput` or `HFTGamepad` script component add the `HFTSoundPlayer` script
51+
component.
52+
53+
In your `Awake` or `Start` look it up
54+
55+
private HFTSoundPlayer m_soundPlayer;
56+
57+
void Awake()
58+
{
59+
m_soundPlayer = GetComponent<HFTSoundPlayer>();
60+
}
61+
62+
To play a sound call `m_soundPlayer.PlaySound` with the name of the sound (no extension).
63+
In other words if you have `sounds/explosion.mp3` then you can trigger that sound on
64+
the user's phone with
65+
66+
m_soundPlayer.PlaySound("explosion");
67+
68+
Or if you named a JSFX sound like
69+
70+
bounce ["noise",0.0000,1.0000,0.0000,0.0220,0.0000,0.1480,20.0000,309.0000,2400.0000,-0.3300,0.0000,0.0000,0.0100,0.0003,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,0.0000,0.0000,0.0000]
71+
72+
Then
73+
74+
m_soundPlayer.PlaySound("bounce");
75+
76+
77+
* added mulit-touch support to HFTInput via the standard `GetTouch` function
78+
as well as `axes` and `buttons`
79+
80+
public const int AXIS_TOUCH0_X = 13;
81+
public const int AXIS_TOUCH0_Y = 14;
82+
public const int AXIS_TOUCH1_X = 15;
83+
public const int AXIS_TOUCH1_Y = 16;
84+
public const int AXIS_TOUCH2_X = 17;
85+
public const int AXIS_TOUCH2_Y = 18;
86+
public const int AXIS_TOUCH3_X = 19;
87+
public const int AXIS_TOUCH3_Y = 20;
88+
public const int AXIS_TOUCH4_X = 21;
89+
public const int AXIS_TOUCH4_Y = 22;
90+
public const int AXIS_TOUCH5_X = 23;
91+
public const int AXIS_TOUCH5_Y = 24;
92+
public const int AXIS_TOUCH6_X = 25;
93+
public const int AXIS_TOUCH6_Y = 26;
94+
public const int AXIS_TOUCH7_X = 27;
95+
public const int AXIS_TOUCH7_Y = 28;
96+
public const int AXIS_TOUCH8_X = 29;
97+
public const int AXIS_TOUCH8_Y = 30;
98+
public const int AXIS_TOUCH9_X = 31;
99+
public const int AXIS_TOUCH9_Y = 32;
100+
101+
public const int BUTTON_TOUCH0 = 18;
102+
public const int BUTTON_TOUCH1 = 19;
103+
public const int BUTTON_TOUCH2 = 20;
104+
public const int BUTTON_TOUCH3 = 21;
105+
public const int BUTTON_TOUCH4 = 22;
106+
public const int BUTTON_TOUCH5 = 23;
107+
public const int BUTTON_TOUCH6 = 24;
108+
public const int BUTTON_TOUCH7 = 25;
109+
public const int BUTTON_TOUCH8 = 26;
110+
public const int BUTTON_TOUCH9 = 27;
111+
112+
Note: The Touch.rawPosition is currently in screen pixels of Unity
113+
not the controller. It's not clear what the best way to handle this
114+
is.
115+
116+
The Unity `Input` API says those value are in pixels but they are
117+
assuming the game is running on the phone. In the case of HappyFunTimes
118+
though each phone is different so having it be in phone screen pixels
119+
would make no sense unless you also knew the resolution of each phone.
120+
I could provide that but that would make it more complicated for you.
121+
122+
Personally I'd prefer normalized values (0.0 to 1.0). If you want those
123+
then take `Touch.rawPosition` and divide `x` by `Screen.width` and `y` by `Screen.height`
124+
as in
125+
126+
HFTInput.Touch touch = m_hftInput.GetTouch(0);
127+
float normalizedX = touch.x / Screen.width;
128+
float normalziedY = touch.y / Screen.height;
129+
130+
Also note the AXIS versions of these are already normalized to
131+
a -1.0 to +1.0 range.
132+
133+
* Changed sample HFTGamepad code to not issue an error if it's not actually
134+
connected to a controller.
135+
136+
Users often leave a prefab in their scene. That prefab would generate
137+
errors because it's not actually connected to a controller and was
138+
trying to access the controllers `NetPlayer`.
139+
140+
* 1.1
141+
142+
* Moved samples into samples folder
143+
144+
* 1.0
145+
146+
* made the plugin based on [hft-unity-gamepad](http://github.com/greggman/hft-unity-gamepad)
147+
that implements 12 controllers.
148+
4149
* 0.0.7
5150

6151
* Added `maxPlayers` to PlayerSpawner

todo.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,6 @@ To Do
1111
* download
1212
* export
1313
* run
14-
* Export in Unity
15-
* why textarea is not big for description?
16-
* If install make it say "install"
17-
* If install select platform and hide platform choices
18-
* Make install and platform expanded by default
19-
* (remove install check. Its' confusing)
20-
* make semver editor?
21-
* Check when installing game appears in /games.html
22-
* progress?
23-
* check package.json gets saved
24-
* make prefab in scene not generate errors
2514
* remove upgrade warning with install --upgrade. change to "upgrading ...."
2615
* add "touch to start" on android (and iOS?) both sound and fullscreen can be added
2716
* make unity provide files for controller
@@ -922,6 +911,17 @@ Runs Repo noid
922911
Done
923912
====
924913

914+
* Export in Unity
915+
* why textarea is not big for description?
916+
* If install make it say "install"
917+
* If install select platform and hide platform choices
918+
* Make install and platform expanded by default
919+
* (remove install check. Its' confusing)
920+
* make semver editor?
921+
* Check when installing game appears in /games.html
922+
* progress?
923+
* check package.json gets saved
924+
* make prefab in scene not generate errors
925925
* fix HFT not noticing new game installed/removed
926926
* keep backups of installed-games
927927
* make unity input tester

0 commit comments

Comments
 (0)