Skip to content

Commit c760d4b

Browse files
committed
[Toolkit.Input] Change PointerInput sample to use Arial10 font and Desktop to use 4.0 framework.
1 parent 2d9f166 commit c760d4b

File tree

6 files changed

+39
-46
lines changed

6 files changed

+39
-46
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<TkFont>
3+
<FontName>Arial</FontName>
4+
<Size>10</Size>
5+
<Spacing>0</Spacing>
6+
<LineSpacing>0</LineSpacing>
7+
<UseKerning>false</UseKerning>
8+
<Format>Auto</Format>
9+
<CharacterRegions>
10+
<CharacterRegion>
11+
<Start>32</Start>
12+
<End>127</End>
13+
</CharacterRegion>
14+
</CharacterRegions>
15+
<DefaultCharacter>32</DefaultCharacter>
16+
<Style>Regular</Style>
17+
<NoPremultiply>false</NoPremultiply>
18+
</TkFont>

Samples/Toolkit/Common/PointerInput/PointerInputGame.cs

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ private class PointerEventDescrption
4646
{
4747
private readonly int index;
4848
private readonly PointerPoint point;
49-
5049
private readonly string description;
5150

5251
private string cache;
@@ -145,39 +144,12 @@ public PointerInputGame()
145144
IsMouseVisible = true;
146145
}
147146

148-
private void AddEvent(PointerPoint point)
149-
{
150-
// uncomment and edit these lines to filter-out the unneeded events
151-
//if (recentEvents.Count > 0)
152-
//{
153-
// var e = recentEvents.Last();
154-
// var skipEvent = e.Point.DeviceType == point.DeviceType
155-
// && e.Point.PointerId == point.PointerId
156-
// && e.Point.Properties.PointerUpdateKind == point.Properties.PointerUpdateKind;
157-
158-
// if (skipEvent) return;
159-
//}
160-
161-
162-
if (recentEvents.Count == maxEvents)
163-
recentEvents.Dequeue();
164-
165-
recentEvents.Enqueue(new PointerEventDescrption(eventIndex++, point));
166-
}
167-
168147
protected override void LoadContent()
169148
{
170-
Window.AllowUserResizing = true;
171-
172-
// set the resolution to current window size:
173-
graphicsDeviceManager.PreferredBackBufferHeight = Window.ClientBounds.Height;
174-
graphicsDeviceManager.PreferredBackBufferWidth = Window.ClientBounds.Width;
175-
graphicsDeviceManager.ApplyChanges();
176-
177149
// SpriteFont supports the following font file format:
178150
// - DirectX Toolkit MakeSpriteFont or SharpDX Toolkit tkfont
179151
// - BMFont from Angelcode http://www.angelcode.com/products/bmfont/
180-
arial16BMFont = Content.Load<SpriteFont>("Arial16");
152+
arial16BMFont = Content.Load<SpriteFont>("Arial10");
181153

182154
// Instantiate a SpriteBatch
183155
spriteBatch = new SpriteBatch(GraphicsDevice);
@@ -195,6 +167,8 @@ protected override void UnloadContent()
195167
protected override void Initialize()
196168
{
197169
Window.Title = "MouseInput demo";
170+
Window.AllowUserResizing = true;
171+
IsMouseVisible = true;
198172
base.Initialize();
199173
}
200174

@@ -210,7 +184,7 @@ protected override void Draw(GameTime gameTime)
210184

211185
// Render the text
212186
spriteBatch.Begin();
213-
spriteBatch.DrawString(arial16BMFont, sb.ToString(), new Vector2(8, 32), Color.White);
187+
spriteBatch.DrawString(arial16BMFont, sb.ToString(), new Vector2(8, 8), Color.White);
214188
spriteBatch.End();
215189

216190
// Handle base.Draw
@@ -226,5 +200,13 @@ protected override void Update(GameTime gameTime)
226200
foreach(var point in pointerState.Points)
227201
AddEvent(point);
228202
}
203+
204+
private void AddEvent(PointerPoint point)
205+
{
206+
if (recentEvents.Count == maxEvents)
207+
recentEvents.Dequeue();
208+
209+
recentEvents.Enqueue(new PointerEventDescrption(eventIndex++, point));
210+
}
229211
}
230212
}

Samples/Toolkit/Desktop/PointerInput/App.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

Samples/Toolkit/Desktop/PointerInput/PointerInput.Desktop.csproj

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>PointerInput.Desktop</RootNamespace>
1111
<AssemblyName>PointerInput.Desktop</AssemblyName>
12-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
14+
<TargetFrameworkProfile />
1415
</PropertyGroup>
1516
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1617
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -57,6 +58,7 @@
5758
<Compile Include="Properties\Resources.Designer.cs">
5859
<AutoGen>True</AutoGen>
5960
<DependentUpon>Resources.resx</DependentUpon>
61+
<DesignTime>True</DesignTime>
6062
</Compile>
6163
<None Include="Properties\Settings.settings">
6264
<Generator>SettingsSingleFileGenerator</Generator>
@@ -69,11 +71,8 @@
6971
</Compile>
7072
</ItemGroup>
7173
<ItemGroup>
72-
<None Include="App.config" />
73-
</ItemGroup>
74-
<ItemGroup>
75-
<ToolkitFont Include="..\..\Common\PointerInput\Content\Arial16.xml">
76-
<Link>Content\Arial16.xml</Link>
74+
<ToolkitFont Include="..\..\Common\PointerInput\Content\Arial10.xml">
75+
<Link>Content\Arial10.xml</Link>
7776
</ToolkitFont>
7877
</ItemGroup>
7978
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

Samples/Toolkit/WP8/PointerInput/PointerInput.WP8.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@
124124
</None>
125125
</ItemGroup>
126126
<ItemGroup>
127-
<ToolkitFont Include="..\..\Common\PointerInput\Content\Arial16.xml">
128-
<Link>Content\Arial16.xml</Link>
127+
<ToolkitFont Include="..\..\Common\PointerInput\Content\Arial10.xml">
128+
<Link>Content\Arial10.xml</Link>
129129
</ToolkitFont>
130130
<Content Include="Assets\AlignmentGrid.png" />
131131
<Content Include="Assets\ApplicationIcon.png">

Samples/Toolkit/WinRT/PointerInput/PointerInput.WinRT.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@
116116
<None Include="PointerInput.WinRT_TemporaryKey.pfx" />
117117
</ItemGroup>
118118
<ItemGroup>
119-
<ToolkitFont Include="..\..\Common\PointerInput\Content\Arial16.xml">
120-
<Link>Content\Arial16.xml</Link>
119+
<ToolkitFont Include="..\..\Common\PointerInput\Content\Arial10.xml">
120+
<Link>Content\Arial10.xml</Link>
121121
</ToolkitFont>
122122
<Content Include="Assets\Logo.png" />
123123
<Content Include="Assets\SmallLogo.png" />

0 commit comments

Comments
 (0)