Docs

Post screenshots, binaries and projectfiles of the projects you have made with ZGE that you want to share!

Moderator: Moderators

User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et » Mon Nov 02, 2009 9:32 pm

I'm thinking of adding this to the docs. Would someone else confirm I have it correct.

title - the OpenGL difference

Many users are confused by the co-ordinate system of OpenGl.

OpenGl vs DirectX -

2D - Both are the same. Looking at your monitor -
X is horizontal
Y is vertical

3D - X,Y the same.
DirectX : If your monitor could expand to your size
and if you stood up and could walk thru it, you
would be looking at the Z co-ordinate.

OpenGl : Lay back in your chair, put your feet on
the screen, and look at the ceiling. Your are
looking at the Z co-ordinate.

------------------------------------------------------

I think that's wrong - try this -

OpenGl : Push your monitor over backwards so it is facing up :) . Look up at the ceiling at the Z-co-ordinate.

User avatar
Kjell
Posts: 1726
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell » Mon Nov 02, 2009 11:54 pm

:?

OpenGL and Direct3D are identical when it comes to X, Y and Z axes. The only difference is that OGL is a right-handed system, while D3D is left-handed ( unlike for example 3ds which does use Z as up ).

Image

Also, they are both 3D API's and don't have a 2D mode of some sort.

K

User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et » Tue Nov 03, 2009 12:42 am

You're right - I seem to recall that.
I've got to stop playing with that steering controller. It's a 2D component that doesn't seem to meld into 3D, except in a confusing configuration.

User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et » Fri Nov 27, 2009 5:31 pm

Updated Nov. 27 / 09

User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et » Sun Dec 06, 2009 8:00 pm

In writing expressions/
C-style-loops

the example is for(int x=0; x<4; x++){do something ;}

1) you forgot the end semi-colon on your page - no big deal.

2) the "int" - Like... is it required or optional? I would have thought integer would be the default. Else, what's required to use floats?

3) Any way to break out of loops before finished?

User avatar
Kjell
Posts: 1726
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell » Sun Dec 06, 2009 8:20 pm

Hello,

1) The "do something" is commented out using "//" .. so it doesn't need a semi-column :wink:

2) Variables have to be initialized one way or the other. So when you want to use a global variable that is already defined by the DefineVariable Component, you can simply write ..

Code: Select all

for(x=0; x<4; ++x){expression;}
But in case you want to use a local variable ( only exists within the scope that it is defined in ), initializing the variable as you need it is most convenient ..

Code: Select all

for(int x=0; x<4; ++x){expression;}
Change "int" into "float" when you want to use a floating point variable.

3) Yes, although not in the way you'd normally do in other languages ( the break instruction isn't supported yet ). Either use a variable that you test in the for loop like so ..

Code: Select all

for(int x=0; x<4 && done==0; ++x){expression;}
Or you can use the "return" instruction without actually returning a value.

Code: Select all

for(int x=0; x<4; ++x)
{
  if(done)return;
  expression;
}
K
Last edited by Kjell on Mon Dec 07, 2009 2:48 pm, edited 1 time in total.

User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et » Sun Dec 06, 2009 10:24 pm

Thanks. I'm building a project and beefing the Docs as I go.

Next question - DefineArray component / the persistent checkbox

Does that mean the values are made static vs dynamic?

User avatar
Kjell
Posts: 1726
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell » Mon Dec 07, 2009 12:58 pm

Not exactly ..

When a Array is not persistent, all cells / slots will be 0 every time you start your build ( please note that the values aren't reset to 0 when starting a preview ).

When a array is persistent, the values of the array are stored in your project file and thus can contain data other then 0 upon start ( setting a Array to persistent will also enable the "Edit Array Values" dialog ). However, this doesn't mean that the values are constant / unchangeable, any changes made to the Array through script in the Editor will be permanent.

K

User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et » Mon Dec 07, 2009 4:39 pm

OK. That explains a problem I've been having.
Also points out another difference between preview and build with arrays. I'll document it.

Thanks again.

EDIT- In practice I've found a slightly different behavior of Persistent, which is useful in error checking. I found that if the values of a persistent array are changed during preview runtime , upon the next preview run of the project the new values are now initially in the array.

This means you can set an array to persistent, run preview, stop and then view the resulting values in your array. :)
Last edited by y offs et on Tue Dec 08, 2009 3:29 am, edited 2 times in total.

User avatar
VilleK
Site Admin
Posts: 2072
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK » Mon Dec 07, 2009 5:11 pm

Kjells answers are excellent and 100% correct :). You guys can write much better documentation than me. I need to update the wiki with the latest zge-components and I might take some bits from yoffsets help file because it's more up to date than the wiki. Yoffset let me know if you want the wiki-password if you want to help edit the online-help too.

User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et » Tue Dec 15, 2009 10:38 pm

We need an explanation of the rules for writing user-defined functions in a ZLibrary, please and thank you.

User avatar
Kjell
Posts: 1726
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell » Wed Dec 16, 2009 4:24 pm

@y_offs_et

The entry in the wiki isn't sufficient? I guess you could add that void / int / float are the only valid function types as of yet.

In case you want to add information on the concept of functions in programming / scripting languages .. this tutorial is pretty accurate for ZGE*

*Page I only ( ZLibrary's don't support variable declarations outside of functions though ) .. not page II, where they explain referenced arguments, function overloading and other features not supported by ZGE.

K

User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et » Thu Dec 17, 2009 5:50 pm

Updated Dec 17, 2009

- Re-organized
- corrected writing expressions
- added Use Tips

User avatar
Kjell
Posts: 1726
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell » Thu Dec 17, 2009 6:55 pm

:!:

Something you might want to reconsider .. I noticed you're using &nbsp; tags to manually? wrap / indent sentences. However, this only looks the way it should when the content window is around 620 pixels wide. As soon as it's another width, the spacing happens in the wrong places.

Also, you might want to move all visual elements to a css file / header instead of wrapping each element individually. For example, on the Getting Started page alone you have 217 (!) statements to define the font to be Arial. Once per page ( or once for the whole help file ideally ) should be sufficient. Makes it easier to change, plus saves kb's as well :wink:

Let me know if you need any help with this.

Keep up the good work ~
K

User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et » Thu Dec 17, 2009 8:46 pm

Er, umm, well, I'm just a poor plebe bumbling along, filling in the blanks of a freeware application. Perhaps you may want to look here.

www.vizacc.com

:roll:

I'm more concerned that I have the content correct.

Post Reply