Dear Gideros Community, i just started using gideros a few days ago, so i have plenty of questions. I want to make a basic sort-of drawing app and for that i'd like to get the pressure information of the stylus on my android tablet. Is there a way to get this info? Maybe via a a plugin? I don't have any clue, so any help is appreaciated.
Native android development equivalent would be this, i think:
http://developer.android.com/reference/android/view/MotionEvent.html#getPressure()Thanks
Comments
For input handling, currently Gideros support mouse and touch input. And there is currently no way to handle pressure information on touch input (or using stylus).
http://www.nightspade.com
Fragmenter - animated loop machine and IKONOMIKON - the memory game
http://www.giderosmobile.com/forum/discussion/1532/adplugin-for-android
yup its really easy to write plugin you can download my project from google docs click on file -> download. and see the jni folder and mk file try to change the code in any function and see how it is working most likely you will not face any issue as i am facing with that plugin as you need to simply pass the data from my example you can find how to pass data from lua->c or c++ -> java now for the reverse process you can look at the plugin bitop to see how to pass data from c or c++ ->lua and for java to c/c++ you need to do some google. let me know if you need help in any thing.
just wondering as per i know not every device can give you the info about pressure so if you feel comfort than try to find hack may be with timer you can get the difference between mousedown and mouseup and calculate how long user has touched the screen and guess of pressure or by tilt of the device not sure this will work or not.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
I could finally make the plugin. Here are attached the example files.
It should work out of the box, maybe the only thing you need to be careful about is that:
"Once that done, go to exported project folder, which in my case is in "ExamplePlugin" folder and copy "libs" folder in to your "exports" folder, which should be just one step up if you did what I recommended. You only need to do that once per new Gideros version and all exported projects will be available to use same "libs" when compiling your plugin. That's why it's so handy."
I.e. one level higher in the file hierarchy make a lib folder which contains the appropriate
files (copy here the files from the project folder/libs folder).
I made only the minimal changes needed to the above example. Note that I made some changes in the main activity java file also. namely in the touch handling part, which passes the pressure info to our plugin.
I only tested on the Thinkpad Tablet, so if you are able to test it on other devices, please leave some feedback how it works.
Finally, many thanks to ar2rsawseen and hgvyas123.
Edit: beware that after gideros ver 2012.9 there is a new so file included so you have to add the above code your android.mk file (i was having a hard time to make my plugin work with this version, so thought i could save the time for you). actually this is needed for any plugin.
#
# Lua google billing plugin
#
include $(CLEAR_VARS)
LOCAL_MODULE := ggooglebilling
LOCAL_SRC_FILES := ../../libs/$(TARGET_ARCH_ABI)/libggooglebilling.so
include $(PREBUILT_SHARED_LIBRARY)
Fragmenter - animated loop machine and IKONOMIKON - the memory game