Skip to content

Commit d817753

Browse files
committed
Replaced deprecated code in the DemoTextPixels class. Removed unused code in the DemoBoxes class. Updated project settings.
1 parent afd0478 commit d817753

File tree

8 files changed

+29
-41
lines changed

8 files changed

+29
-41
lines changed

Core/Solution/Hover.Common/Hover.Common.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<Reference Include="UnityEngine">
4343
<HintPath>..\..\Packages\Unity\UnityEngine.dll</HintPath>
4444
</Reference>
45-
<Reference Include="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
45+
<Reference Include="UnityEngine.UI">
4646
<SpecificVersion>False</SpecificVersion>
4747
<HintPath>..\..\Packages\Unity\GUISystem\UnityEngine.UI.dll</HintPath>
4848
</Reference>

Unity/Assets/Hover/Demo/BoardKeys/DemoBoxes.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ public DemoBoxes() {
4040
////////////////////////////////////////////////////////////////////////////////////////////////
4141
/*--------------------------------------------------------------------------------------------*/
4242
public void Awake() {
43-
var rand = new System.Random();
44-
4543
for ( int xi = 0 ; xi < Width ; ++xi ) {
4644
for ( int yi = 0 ; yi < Height ; ++yi ) {
4745
var mainTex = new Texture2D(1, 1);

Unity/Assets/Hover/Demo/BoardKeys/DemoTextPixels.cs

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,58 +27,43 @@ public DemoTextPixels(UiLabel pLabel) {
2727
/*--------------------------------------------------------------------------------------------*/
2828
public float[,] GetPixels(char pLetter, out int pWidth, out int pHeight) {
2929
Texture2D tex = vUiLabel.Texture;
30-
//string data = "";
3130
CharacterInfo charInfo;
3231

3332
if ( !vUiLabel.FontObject.GetCharacterInfo(pLetter, out charInfo) ) {
3433
throw new Exception("Character pixels not found: "+pLetter);
3534
}
3635

37-
int x = (int)Math.Round(charInfo.uv.x*tex.width);
38-
int y = (int)Math.Round(charInfo.uv.y*tex.height);
39-
int w = (int)Math.Round(charInfo.uv.width*tex.width);
40-
int h = (int)Math.Round(charInfo.uv.height*tex.height);
36+
int x0 = (int)Math.Round(charInfo.uvTopLeft.x*tex.width);
37+
int y0 = (int)Math.Round(charInfo.uvTopLeft.y*tex.height);
38+
int x1 = (int)Math.Round(charInfo.uvBottomRight.x*tex.width);
39+
int y1 = (int)Math.Round(charInfo.uvBottomRight.y*tex.height);
40+
int texW = x1-x0;
41+
int texH = y1-y0;
42+
bool xPos = (texW > 0);
43+
bool yPos = (texH > 0);
4144

42-
if ( w < 0 ) {
43-
w *= -1;
44-
x -= w;
45-
}
46-
47-
if ( h < 0 ) {
48-
h *= -1;
49-
y -= h;
50-
}
45+
texW = Math.Abs(texW);
46+
texH = Math.Abs(texH);
47+
bool swap = (texW == charInfo.glyphHeight && texH == charInfo.glyphWidth);
5148

52-
var pixels = new float[w, h];
49+
pWidth = (swap ? texH : texW);
50+
pHeight = (swap ? texW : texH);
5351

54-
for ( int hi = y ; hi < y+h ; ++hi ) {
55-
for ( int wi = x ; wi < x+w ; ++wi ) {
56-
float a = tex.GetPixel(wi, hi).a;
57-
pixels[wi-x, hi-y] = a;
58-
//data += (a < 0.25f ? " " : (a < 0.5f ? "." : (a < 0.75f ? "*" : "#")));
59-
}
52+
Debug.Log("WH: "+x0+"/"+x1+" ... "+y0+"/"+y1+" ... "+xPos+"/"+yPos+" ... "+
53+
pWidth+"/"+pHeight+" ... "+charInfo.glyphWidth+"/"+charInfo.glyphHeight+" ... "+swap);
6054

61-
//data += "\n";
62-
}
55+
var pixels = new float[pWidth, pHeight];
6356

64-
if ( charInfo.flipped ) {
65-
float[,] oldPixels = pixels;
66-
67-
pixels = new float[h, w];
57+
for ( int yi = 0 ; yi < texH ; yi++ ) {
58+
for ( int xi = 0 ; xi < texW ; xi++ ) {
59+
int xt = (xPos ? x0+xi : x0-xi);
60+
int yt = (yPos ? y0+yi : y0-yi);
61+
float a = tex.GetPixel(xt, yt).a;
6862

69-
for ( int hi = 0 ; hi < h ; ++hi ) {
70-
for ( int wi = 0 ; wi < w ; ++wi ) {
71-
pixels[hi, w-wi-1] = oldPixels[wi, hi];
72-
}
63+
pixels[(swap ? yi : xi), (swap ? xi : yi)] = a;
7364
}
74-
75-
int old = h;
76-
h = w;
77-
w = old;
7865
}
7966

80-
pWidth = w;
81-
pHeight = h;
8267
return pixels;
8368
}
8469

Unity/ProjectSettings/EditorSettings.asset

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ EditorSettings:
1010
m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d
1111
m_DefaultBehaviorMode: 0
1212
m_SpritePackerMode: 2
13+
m_SpritePackerPaddingPower: 1
14+
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd
15+
m_ProjectGenerationRootNamespace:

Unity/ProjectSettings/ProjectSettings.asset

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ PlayerSettings:
261261
ps4pnGameCustomData: 1
262262
playerPrefsSupport: 0
263263
ps4ReprojectionSupport: 0
264+
ps4UseAudio3dBackend: 0
265+
ps4Audio3dVirtualSpeakerCount: 14
264266
ps4attribUserManagement: 0
265267
ps4attribMoveSupport: 0
266268
ps4attrib3DSupport: 0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
m_EditorVersion: 5.2.1f1
1+
m_EditorVersion: 5.2.1p1
22
m_StandardAssetsVersion: 0
-3.8 KB
Binary file not shown.
-3.82 KB
Binary file not shown.

0 commit comments

Comments
 (0)