Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
get stylus pressure information — Gideros Forum

get stylus pressure information

keszeghkeszegh Member
edited August 2012 in General questions
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
Tagged:

Comments

  • Hi @keszegh
    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).
    have fun with our games~
    http://www.nightspade.com
  • Thanks, that sounds bad for me. Any hope for future support for pressure sensitivity? Also i got the idea that via native plugins you can do anything that you could do with direct android programming. so is it not possible even with plugins? in case yes, how hard is it to write such a plugin; can anybody help me how to write it?
  • ar2rsawseenar2rsawseen Maintainer
    edited August 2012
    I think yes, it could be done through plugins. Myself I'm not in friends with Java so much, but there are people here who wrote plugins for Gideros, for example:
    http://www.giderosmobile.com/forum/discussion/1532/adplugin-for-android
  • hgvyas123hgvyas123 Guru
    edited September 2012 Accepted Answer
    hi @keszegh

    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.

    :)
  • hgvyas123 and others, thanks for the answer, apparently then i have to use java->c++->lua and use the ndk to get the pressure info. this will have to wait as it is not crucial for me now but when i manage to do it i may post here the source.
  • keszeghkeszegh Member
    edited October 2012
    Following the example on http://appcodingeasy.com/Gideros-Mobile/Creating-plugins-for-Android-in-Gideros
    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)
    rar
    rar
    PressureSensitivityExamplePluginGideros.rar
    1K
    rar
    rar
    PressureSensitivityExamplePlugin.rar
    7M
Sign In or Register to comment.