Skip to content

Commit

Permalink
Trying to hook into windows procedure messages for pointer (touch).
Browse files Browse the repository at this point in the history
  • Loading branch information
James committed Apr 8, 2013
1 parent 878e9fd commit 7d8352d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
3 changes: 3 additions & 0 deletions MonoGame.Framework/MonoGame.Framework.Windows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@
<Compile Include="Media\MediaLibrary.cs" />
<Compile Include="Media\MediaSource.cs" />
<Compile Include="FrameworkDispatcher.cs" />
<Compile Include="Windows\WinForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\WinFormsGamePlatform.cs" />
<Compile Include="Windows\WinFormsGameWindow.cs" />
</ItemGroup>
Expand Down
43 changes: 43 additions & 0 deletions MonoGame.Framework/Windows/WinForm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;



namespace Microsoft.Xna.Framework.Windows
{
[StructLayout(LayoutKind.Sequential)]
public struct WinProc
{
public const int WM_POINTERUP = 0x0247;
public const int WM_POINTERDOWN = 0x0246;
public const int WM_POINTERUPDATE = 0x0245;

public IntPtr handle;
public uint msg;
public IntPtr wParam;
public IntPtr lParam;
}

internal class WinForm : Form
{
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WinProc.WM_POINTERUP:
break;
case WinProc.WM_POINTERDOWN:
break;
case WinProc.WM_POINTERUPDATE:
break;
}

base.WndProc(ref m);
}
}
}
3 changes: 2 additions & 1 deletion MonoGame.Framework/Windows/WinFormsGameWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ purpose and non-infringement.
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Windows;
using ButtonState = Microsoft.Xna.Framework.Input.ButtonState;
using Rectangle = Microsoft.Xna.Framework.Rectangle;
using XnaKey = Microsoft.Xna.Framework.Input.Keys;
Expand Down Expand Up @@ -140,7 +141,7 @@ internal WinFormsGameWindow(WinFormsGamePlatform platform)
_platform = platform;
Game = platform.Game;

_form = new Form();
_form = new WinForm();

// When running unit tests this can return null.
var assembly = Assembly.GetEntryAssembly();
Expand Down

0 comments on commit 7d8352d

Please sign in to comment.