I'm using a Microsoft Surface Pro. I noticed that Pico-8 doesn't respond correctly to touch events. This affects the use of the touchscreen as well as the use of a stylus. I'm using the Surface Pen.
Although you can control the cursor with touch inputs, triggering clicks is difficult. Tap events aren't registered as click. They move the mouse cursor but don't click. Tap and drag is correctly recognized as click and drag. So in order to click you need to basically draw tiny circles with the pen.
I would love to use the pen as a convenient way to do some Pico-8 pixelart on the go.
I recently saw an iOS keyboard mockup for Pico-8 by @zep so I'm hoping touchscreen support is given love across all touchscreen devices. I'm a Surface Pro user as well with the Surface Pen.
I've not found it difficult to use the pen to draw, but every click requires a double-tap to activate (such as to change tools or colors) and on-screen virtual keyboard arrow keys on Surface Pro do not work. (yes, I'm only using virtual controls to keep "luggability" weight as low as possible)
While I'm thinking of it, Krystman, Christopher:
Can you test this cart for touchscreen ? Please let me know if it works or not - I don't have a touchscreen myself and would be curious to know if this is a good programming angle to take for input if a keyboard is not available (like an Android tablet).
So, there are a couple of things to keep in mind I believe.
- Running your cart in the web-player, I get the virtual controls displayed, but touch input doesn't work at all.
- Running in Pico-8 directly I get the same frustrations with your cart I do with Pico-8 itself. Tapping anything requires a double-tap to register. The first tap seems to position the mouse cursor, the second tap performs the actual tap().
- If I run Pico-8 native player in full screen, the keyboard seems usable but it does not provide the virtual controls the web-player does. So, I cannot use d-pad or Z/X buttons unless I bring up the Windows-native virtual keyboard. But then, if I bring up the native virtual keyboard, I kind of don't need another one like yours?
Best situation would be for the native/web players to provide virtual controls, and to allow touch in place of mouse. Because Pico-8 display is 1:1 and monitors are 3:2 or 4:3, there is plenty of room to provide the virtual controls in a full-screen mode. At which point, providing we have "works as expected" touch controls, this virtual keyboard for Pico-8 games would be very nice.
The current state of touch input in the players, both native app and web, are not yet refined enough to elevate the use of this kind of NDS-style keyboard.
It works perfectly with mouse, offline or online. That was the original intent when I wrote it. :) Shame it doesn't work with touch-screen, you figure it would as I am reading and reacting on the correct commands.
Of course now PICO has true keyboard input so this is more nostalgic than functional for now.
Thanks for checking it out !
@dw817 The touch limitations are purely related to the player app; I'm sure you've done all you can code-wise. However, for the Surface Pro I want to run Pico-8 full screen and not have the giant Microsoft virtual keyboard obscuring half the screen nor shrinking Pico-8 to fit in a small window above the keyboard. In such a case, an in-game, touch-control keyboard would be quite nice.
I found this thread while looking for solutions to the "tapping problem". I ended up writing a function like the following for handling my mouse and touch needs. This is for a grid-based game, where I wanted the player to be able to drag and select multiple map tiles, and movement inside a map tile isn't important.
function update_mouse() -- x and y: mouse pixel coordinates -- celx and cely: mouse map cell -- press_celx and press_cely: a map cell that was "selected" by the mouse, either by clicking, clicking and dragging or touching and dragging -- pressed: was the mouse button clicked -- down: is the mouse button held down at this moment -- released: was the mouse button released -- drag: is the player moving the mouse over multiple tiles while touching/pressing the button mouse.x = stat(32) mouse.y = stat(33) mouse.celx = flr(mouse.x/8) mouse.cely = flr(mouse.y/8) -- btnp-like functionality (without repeating) mouse.pressed = stat(34)==1 mouse.released = false if mouse.down and not mouse.pressed then mouse.down = false mouse.released = true else mouse.down = mouse.pressed end local temp_mouse = mouse.pressed mouse.pressed = mouse.pressed!=mouse.last and mouse.pressed or false mouse.last = temp_mouse -- touch screen if mouse.drag then mouse.press_celx=mouse.celx mouse.press_cely=mouse.cely end if mouse.pressed then mouse.press_celx,mouse.press_cely = mouse.celx,mouse.cely end mouse.drag = mouse.down and (mouse.celx!=mouse.press_celx or mouse.cely!=mouse.press_cely) end
If any of you made something better, please share!
[Please log in to post a comment]