Author Topic: question about the iphone touch demo  (Read 1839 times)

Offline CCJ

  • Mc. Print
  • *
  • Posts: 19
    • View Profile
    • CresCo Games
question about the iphone touch demo
« on: 2010-Apr-28 »
Hello,
The iphone touch example is extremely handy, but I have a question about some of the code, most particularly the mouse[].active function-- where is this function in the GLBasic documentation?  I searched but couldn't turn up any results in the help files.  This function is obviously pivotal for touch commands in GLBasic, so I would like to know more about it.  Also, I couldn't turn up any analogous examples of dot notation like that which is used in mouse[].active anywhere in the documentation so if anybody could explain the mechanics of this syntax in GLBasic and where I can find more about it I would be most appreciative.

Thank you,

CCJ
CresCo Games
Sample Our Reality...

http://crescogames.x10hosting.com

Offline Kuron

  • Mr. Polyvector
  • ***
  • Posts: 238
    • View Profile
Re: question about the iphone touch demo
« Reply #1 on: 2010-Apr-28 »
Quote
The iphone touch example is extremely handy, but I have a question about some of the code, most particularly the mouse[].active function-- where is this function in the GLBasic documentation?
Mouse commands are in the help file (admittedly things could be categorized better).  I do not have an iPhone, and I am guessing you are referring to the iPhone example somebody posted on the forum/showroom?  I just downloaded it and gave it a quick glance... 

iPhone's handling of "touches" seems to be similar to dealing with the old Palm Pilots ages ago.  GLB appears to handle touches/gestures as "mice".  Since the iPhone handles touches (plural) and not touch (singular), there is likely two sets of coordinates you need to track (mouse[0] and mouse[1]). 

You could probably play with this on a PC by plugging in an extra mouse and using the GETMOUSECOUNT() command and then tracking and interacting with each mouse using the same commands.


Quote
Also, I couldn't turn up any analogous examples of dot notation like that which is used in mouse[].active anywhere in the documentation
You will find an example of proper "." usage in the tutorials section of the documentation under Types.  When dealing with UDTs (User-Defined Types AKA Structs in C) languages use different ways of separating the object/data type.  I am not positive, but I think "." may be the ISO standard.  Other languages can use "\" or anything for that matter.
« Last Edit: 2010-Apr-28 by Kuron »

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1545
    • View Profile
Re: question about the iphone touch demo
« Reply #2 on: 2010-Apr-28 »
SETACTIVEMOUSE index%
Selects an active mouse. Only relevant if GETMOUSECOUNT() returns more than 1. ::)

Offline CCJ

  • Mc. Print
  • *
  • Posts: 19
    • View Profile
    • CresCo Games
Re: question about the iphone touch demo
« Reply #3 on: 2010-Apr-28 »
So then mouse[].active was a UDT programmed in C by the author of the example program???  I searched in the files associated with this program and couldn't find any extra .c/.h/.cpp external files that might have defined mouse[].active so I assumed it was a native GLBasic function... Also, doesn't GLBasic have support for the creation of UDTs with GLBasic alone?  It would be an awful hassle to have to program UDTs in C and then include them from within the GLBasic program.
CresCo Games
Sample Our Reality...

http://crescogames.x10hosting.com

Offline Kuron

  • Mr. Polyvector
  • ***
  • Posts: 238
    • View Profile
Re: question about the iphone touch demo
« Reply #4 on: 2010-Apr-28 »
Quote
So then mouse[].active was a UDT programmed in C by the author of the example program???
No, not at all. 

Quote
defined mouse[].active so I assumed it was a native GLBasic function..
It is.  As mentioned before, you need to read the docs for the mouse related commands, since you did not find my explanation beneficial ;)

Quote
Also, doesn't GLBasic have support for the creation of UDTs with GLBasic alone?
Of course.  Again, please read the docs on types it will explain your confusion based on your previous questions about "."  :)

Offline CCJ

  • Mc. Print
  • *
  • Posts: 19
    • View Profile
    • CresCo Games
Re: question about the iphone touch demo
« Reply #5 on: 2010-Apr-29 »
Ah yes I see it now... the section on types was what I really needed to clear this up.  Thanks!
CresCo Games
Sample Our Reality...

http://crescogames.x10hosting.com