Game Development Using The TouchScreen As Input On A PC

I am developing a game that becomes more enjoyable and more extensible when using just the touchscreen. However, I have not been able to find any game example that uses the touchscreen for a PC application. Can someone let me know if there is anything special that needs to be done to enable access to the PC touchscreen to be used for input and/or can point me to an example of a Monogame sample game, or just code example, that uses just the touchscreen for input on a PC; be it Windows or Linux? Thanks in advance for any help that anyone can provide! :wink:

Hi @PDX_Manny, Welcome to the Community!

Funny enough I just posted this in the community discord:

Happy Coding!

Hi MrValentine,

Thanks for such a quick reply!

While it is neat that you got things working with the Hanspree HT225 Touchscreen monitor, which I might need to get one now as I did not know that they made monitors that have touchscreens, but I was simply trying to use the touchscreen that is include with my Notebook computer, specifically a HP ENVY x360, it is actually one of those 2-1 computers that can go into tablet mode when I fold the screen all the way back. Without needing to go into tablet mode I use the touchscreen just fine, but when I run my simple test in Monogame it does not even seem to detect that the Computer has a touchscreen. Here is the code snippet that I am using:

=================================
using Microsoft.Xna.Framework.Input.Touch;
.
.
public class GameName : Microsoft.Xna.Framework.Game
{
private GraphicsDeviceManager _graphics;
private TouchCollection touchState;

    public GameName()
    {
        _graphics = new GraphicsDeviceManager(this);
        touchState = TouchPanel.GetState();
        if (touchState.IsConnected)
        {
            System.Diagnostics.Debug.WriteLine("!!!! CONNECTED TO TOUCHSCREEN !!!! ");
        } else
        {
            System.Diagnostics.Debug.WriteLine("**** NOT CONNECTED TO TOUCHSCREEN **** ");
        }
    }
 }

========================================

Is there something more that I need to do to enable game application running on the PC to activate the PC’s touchscreen capabilities from within the game application that I am missing. When the application comes up, the touches in the area of the game application’s screen area does not even show that a touch on the game’s screen has occurred which is not surprising as the code snippet above reports that the game is “**** NOT CONNECTED TO TOUCHSCREEN ****”.

Is there something really basic that I a missing to be able to get the PC’s touchscreen to be enabled during a Monogame game? Again, any help would truly be appreciated!!! :slight_smile:

Regards,

Manny

I think the issue there is, no keyboard connected as it will disable the hardware keyboard.

To test this theory, attach a USB keyboard.