question about the iphone touch demo

Previous topic - Next topic

CCJ

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

Kuron

#1
QuoteThe 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.


QuoteAlso, 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.

matchy

SETACTIVEMOUSE index%
Selects an active mouse. Only relevant if GETMOUSECOUNT() returns more than 1. ::)

CCJ

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

Kuron

QuoteSo then mouse[].active was a UDT programmed in C by the author of the example program???
No, not at all. 

Quotedefined 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 ;)

QuoteAlso, 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 "."  :)

CCJ

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