I have a cross platform application built with libgdx. The software is often used in conjunction with large touchscreens (like the microsoft coffee table thingy) with Windows (7 & 8) and MacOS. These screens are multitouch capable but I've only implemented single-touch, and would like to take the leap to multi.
I'm asking a few questions here in case someone knowledgeable could spare me a bunch of hours testing hypothesis that are undocumented and un-googleable AFAIK:
-does libgdx support the win7 multitouch interface? win8?
-if I must resort to mt4j, can it be used WITHOUT the 3d engine layer? Heck I don't even need gesture recognition, just the low level state of the fingers. There is no way I'm replacing 10000+ lines of libgdx with mt4j!
-has anyone tried sparsh-ui as an alternative to mt4j? Does it support win7 multitouch?
Thanks for any bit of information that can be provided on these matters!
Cheers!
As far as i know there shouldn't be a problem with multitouch. For libgdx mouse presses and touches are the same thing, so there shouldn't be a problem for win7 and win8.
The touchDown, touchUp and touchDragged methods give you an int pointer, which describes the number of the touch. So if you touch with 4 fingers, the touchDown with pointer = 4 describes the touch of the 4th finger.
You can read something about that here.
Note that i did not test this, as i don't have a win7/8 touch device. So you have to test it yourself, but as i said it should work. Let me know if it worked. Thanks
Related
I have a goal to build a robot that can collect table tennis balls and put them into the goals A and B seen to the left and right side of the added picture. For info, the course is rectangular with one single obstacle; a four-walled cross.
For now I have bought the Pixy 2 to recognize the balls it needs to pick up.
My two questions are:
Is Lego Mindstorm (LM) an easy/reasonable programming language to solve this, and can LM also easily control the robot’s movements?
Is it possible to use Java instead of LM to solve this? (This would be preferred, as I know Java but not LM)
As I understand LM is not a programming language and you can use several software kits to deploy a program on the LM. Some of them are Java based.
See
https://en.wikipedia.org/wiki/Lego_Mindstorms
Lego Mindstorm's default programming language is visual/blocks based. It's intended for kids with not programming experience. So, if you know Java you'll have no problem using it. Indeed you'll find it too simple.
Programming a robot's movement is very easy, and it comes as a sample project in the Mindstorm's set.
Plus: Your camera comes with plugins to add it's own block to the Mindstorms programming environment. You even have a sample project to build a chaser robot.
From my experience (with Mindstorms NXT2) trying to use LeJOS() was not straightforward. But that was several years ago, with an older version you've indicated in the tags (ev3).
so i've been playing with google PlayN, and i built a small sprite sheet loader for explosions.
what is weird thought is that the desktop java version (that uses the same core code) runs way slower than my web version.
for instance my web version: sapropwns.appspot.com (click with left mouse button and drag the pointer), as you can see its pretty smooth. on the other hand the java desktop version lags every like 2 secs and doesnt draw as much as this web version (the trail doesnt have as much drawing even though both use the same mouse callback for drawing at the same speed).
is there a limitation on the PlayN library that im missing?
thanks in advance.
It's been a while since I looked at PlayN (I was poking at it for a little while for fun). But performance for desktop apps may not be great for certain applications since they are using straight-up Java2D for their rendering. I'm also guessing it's not all that optimized at this point.
There is some discussion on the PlayN group about improving performance by switching from Java2D to LWJGL (Lightweight Java Game Library). This would improve performance greatly for desktop apps (Minecraft uses LWJGL).
I want to be able to record mouse movements, clicks and keyboard input from a user. It would be great if it was a cross platform solution.
I'd like to get back something like this (pseudo code):
mouse moved to 500, 500
mouse double clicked
mouse moved to 800, 300
mouse left clicked
keyboard typed "Hello World"
Does either C++ or Java have any classes that can do this? If I was using C++, I would probably working with the QT framework.
Edit:
I should have said this originally, but I want to record the movements and clicks outside of the applications gui, so on the desktop too.
GLUT does this, but it's tied to OpenGL which might be overkill for your project.
OpenGL is cross-platform.
I don't believe there's a cross-platform toolkit specifically for grabbing input from a window and nothing more, but most toolkits provide this capability. Two good options are:
Use SDL, as it's fairly lightweight and can handle simple input.
Implement the functionality natively per platform, as it should be trivial in X11, Windows, Mac OS X, etc.
On Windows, this is called a Journal Record Hook. You should write the hook part in C or C++, it might be technically possible to do in java, but it's not a good idea, you want your hook procedure to have as few dependencies as possible, and to be a quick as possible. System wide hooks, especially journal add a lot of overhead to keyboard and mouse input, you want to minized your impact as much as possible.
You Install Windows hooks by using SetWindowsHookEx passing WH_JOURNALRECORD to get a Journal Record Hook.
You could also (maybe) get this working by installing both WH_KEYBOARD_LL and WH_MOUSE_LL, but your two hook procedures would be called separately, and you would have to write your own code to put the events in order.
I doubt you will find a cross-platform solution.
It sounds like Qt might allow you to implement event filters that extend beyond the application to the window system. See also Qt - top level widget with keyboard and mouse event transparency?
If you want to trap events across the whole GUI system, not just one app, there's not much likelihood of a cross platform solution. However, the event hooking part could easily be separated from the recording part, so you could make most of the program cross-platform.
For Windows, you need this 17 year old (!) document. (Man, I'm getting old!)
My current problem is not so much a blackberry issue as it is a java
package issue.
In the application I have a rectangular region. This region is rotated by
about 30%.
I need to accomplish two things:
when a user clicks, is he inside the region?
when a user draws a straight line on the screen,
does any part of that line intersect the region? if so, what is the
length of the line inside the region?
I know that I can write my own functions to accomplish this (after dusting
off some algebra and geometry skills that aren't needed for web forms) but
I was thinking that this is a common issue in game programming. I found
some libraries for c++ and some for c# but nothing for java.
Does anyone have suggestions for good java packages? The packages don't need to have graphical components. In fact it would be best if they just handled the geometry and calculations based on x,y co-ordinates alone.
The usefulness of this answer will depend on exactly what type (SE or ME) and what version (and, for ME, what config and profile) of JVM you are targeting. Since it's a blackberry, you are likely J2ME of some flavor - YMMV.
That said, the functions you want appear to be present in java.awt.Rectangle, java.awt.geom.Rectangle2D and java.awt.geom.Line2D.
A friend of mine asked me to implement a blue and a red pointer to represent the inputs of two separate mice to expedite a mixing desk scenario for real time audio mixing. I'd love to, but as much as I think it is a great idea, I don't have a clue as to where to start looking for a possible solution.
Where should I start researching a viable method of implementing dual mouse inputs?
Look at jinput.
I have had multiple keyboards working with it, I am nearly certain it supports multiple mice too.
dont know about java.. but for C#/c++ you can try the
Microsoft Windows MultiPoint Software Development Kit
i've tried it on windows.. it works with 2 USB mice.
It depends on which operating system you intend to use.
On Windows, you can use:
CPNMouse - a driver+software combination, very flexible and allows to completely hide some of the mice from the operating system.
RawInput - an API provided by Windows XP only. You can use it to distinguish between two mouse inputs, draw the cursors yourself and hide the main cursor. Take a look at the code of SDGT, a C# usage of this API.
For both solutions you would have to build a JNI bridge to your application
If you are using X.Org (X11) server, there is patched version called MPX that should support multiple mice even for legacy applications. It should now be a part of the X.Org trunk, but I'm not very familiar with it. Anyway it has an API so you can use it via JNI bridge.
You can use multiple devices, but at the Java level, all mouse events are coalesced into a single stream. The event does not include which mouse it came from. You did say you wanted to mix audio, right? Well this mix might be interesting, but surely not what you want.
I'd suggest using the Java-supported midi interface and connecting some simple midi controller device with multiple knobs or trackballs. These will come in as midi events, and you can examine the state for the details you need.