I just read the oF-code-style but I’m still not really sure, on what’s the way to declare global(?) variables—by global I mean, I want to initialize them in setup() but also access them in update() and draw().
Especially I’m talking about the variables of type auto and string. For example, int could just be declared like int intVar; in ofApp.h and initialized in ofApp.cpp like intVar = 23; … or we could initialize it like int intVar = 42; in ofApp.h …
But it seems auto and string cannot be just declared like auto foo; in ofApp.h …
So, what’s the ideal way on achieving this? Thank you!
yeah you can’t use auto in the class declaration, you need to use the type. string or any other type is ok with or without initialization.
so both:
string a;
string b = "foo";
are valid. “foo” here is just an example you should use a value that makes sense in the context of you program or just leave it as it is which would default to an empty string in the case of strings.
The environment should tell you what return value is expected from the method. I’ve never used xcode, but the autocomplete should show information about the method, its parameters, and the return