BASIC

Author Topic: Help Please with iPhone Accelerometer  (Read 3798 times)

Offline ggindlesperger

  • Mr. Drawsprite
  • **
  • Posts: 63
    • View Profile
I have been been having a great time trying different things in GL Basic. I have been writing various programs for Windows and Mac and have been trying to get a grasp on doing things for the iPhone/iPod. For the most part I am not having much trouble, but I can not get anything to work with the accelerometer. I tried using getjoyx(0) and other things I found on this site, but nothing seems to work how I am expecting it. My goal here is to make a sprite move left or right based on how you tilt the iPhone. I plan for it to work upright and not be landscape. Any help or code snipet that would show me the correct way to do this would be greatly appreciated. I really like to try to figure these things out myself, but I am at a loss on this one.

Thank You in Advance

MrTAToad

  • Guest
Re: Help Please with iPhone Accelerometer
« Reply #1 on: 2010-Jun-26 »
It should work with the joysticks, if I remember correctly, but you may need to use GETDIGIX or perhaps GETJOYRX

Offline ggindlesperger

  • Mr. Drawsprite
  • **
  • Posts: 63
    • View Profile
Re: Help Please with iPhone Accelerometer
« Reply #2 on: 2010-Jun-26 »
Thanks for the info. I have the educational version. Do you know if those commands work in it? I will not have time to try it out until later tonight.  I just got it the other day and have been trying to learn this before I incorporate it into a programming class when school starts back up in August. I believe showing some of these things to the students will get them more excited about what they can do. We have been using XNA and it is quite a bit of programming for the results. For the amount of time we have with the class I believe GL Basic will allow us to get into more projects in a semester.

Thanks again..

MrTAToad

  • Guest
Re: Help Please with iPhone Accelerometer
« Reply #3 on: 2010-Jun-27 »
Quote
and you need a licensed GLBasic installation, as these functions are not available (or activated) in the demo version.
Good point there!

I dont know whether they are in the educational version, mainly because I dont have it :)  Gernot will know though.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10708
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Help Please with iPhone Accelerometer
« Reply #4 on: 2010-Jun-28 »
yes, it's disabled in the DEMO. I will have to change that.

Offline ggindlesperger

  • Mr. Drawsprite
  • **
  • Posts: 63
    • View Profile
Re: Help Please with iPhone Accelerometer
« Reply #5 on: 2010-Jun-28 »
Is it disabled in the education version? I have tried all I can think of. I have tried some examples and nothing seems to get values from the accelerometer. If someone could please post just a little snippet that displays values as you rotate it so I can test on mine and see what it does.

Thanks so much

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10708
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Help Please with iPhone Accelerometer
« Reply #6 on: 2010-Jun-28 »
Yes, it's disabled. It "might" work with JOYSTATE, but you lose the Z direction.