This has been tested and works for me (inside GE IDE and PC export) and it's a pretty cool thing to know for C programmers who are at entry or beginner level.
You can initialize an array of structs through a static declaration of data in one go in the globals. This is just a quick example of what I mean:
- Code: Select all
struct POINT
{
int x;
int y;
}
struct POINT points[] =
{
{0, 21},
{35, 78},
{8, 219}
}
... this is a very simple example, but I have done it with much larger and more complex structs with no problems. Great for specifying big ranges of data in-code rather than with an external file. I have also done this with single char * string arrays, but have not tried using the "string" variable type inside a struct yet.
Almost anything that would work in standard C code, will also work in C-script, with only a few limitations here and there. This opens up a pretty big world of code and you could write some extremely complex programs with this kind of infrastructure. I'm working on an iso game using a lot of data and object oriented pointers to functions right now in GE.