Page 1 of 1

Quick pointer question

Posted: Mon Apr 18, 2005 5:47 am
by Amiga5k
In the manual, under Pointers and Memory Access is this example:

Code: Select all

*MyScreen.Screen = OpenScreen(0,320,200,8,0)
  mouseX = *MyScreen\MouseX ; Assuming than the Screen structure contains a MouseX field
Judging by the above, it looks like the OpenScreen() function returns a pointer of some kind.

Can someone explain this example a bit? I understand pointers 90%, but the fact that this example uses the OpenScreen() function is what throws me off a little.

Thanks in advance!
Russell

p.s. If other commands return a pointer to a structure, then it may mean we can get the address of sprites, images, etc.... (If we can get the format of the returned structure - what fields are available, etc).

Posted: Mon Apr 18, 2005 6:43 am
by Xombie
Yeah. It seems like it's returning an address to a structure full of information about the newly created OpenScreen() call. So you copy the address locally into *MyScreen and then reference *MyScreen\XXXXXX to get whatever bit of information you need from the structure.

I can't seem to find any information on what the Screen structure is or information under OpenScreen about it's return value, however. Also, I've never used OpenScreen() or any other sprite function so... ^_^

Re: Quick pointer question

Posted: Mon Apr 18, 2005 8:16 am
by traumatic
Amiga5k wrote:[...](If we can get the format of the returned structure - what fields are available, etc).
It's far form perfect but some internals are explained in
"/PureBasic/Library SDK/PureBasic library descriptor.txt"

Posted: Sat Apr 23, 2005 2:05 am
by Amiga5k
Thanks traumatic, I'll check it out!

Russell

p.s. Saw Sin City last night. Strange. Gory. Fascinating overall. I give it 4 out of 5 stars (the second story is the best).