Global variables

Talk about making games.

Global variables

Postby koala » Sat Apr 11, 2015 3:15 pm

Hi! :D

What is the difference between a variable defined in Global Code outside functions and variable defined with Variables->Add buttons?

Thanks! :D
Phascolarctos cinereus
YouTube: Marko Radivojevic
Google+: Marko Radivojevic
User avatar
koala
 
Posts: 301
Joined: Thu Mar 26, 2015 7:03 pm
Location: Serbia
Score: 30 Give a positive score

Re: Global variables

Postby Turon » Sat Apr 11, 2015 4:16 pm

if you are asking if there is a difference between the variables you set in global code to the variables set in text editor, then no I wouldn't have thought so...
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

Re: Global variables

Postby bat78 » Sun Apr 12, 2015 12:22 am

Short answer - They are much different.

  • Variables declared in global code can be more flexible. If you declare a variable using gE declarator you can not specify storage class, length modifiers and not even all the type qualifiers (the following are not supported by gE variable declarator pane: char, short, long long). You can't also declare them as pointers in there and you can not declare them as more than 1d arrays.
  • On the other hand, gE declarator dedicates save system that is handy, because it saves data in compressed variation and also groups it. Only variables declared there can be used by that system.
  • With gE declarator you can declare local variables. These will be members, part of the Actor structure. On that way, each actor will have its own new variable.
  • The "string" type in gE declarations pane is just an array of 256 chars.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron