I do just Lua code, so everything I want to use there must be exposed to Lua for my apps, but then I get history, completion, incomplete chunks, colors, ect. and I like working with Lua so it's worth it to me. I was thinking about a simplified bash-like input without braces and commas or about adding moonscript or typedscript input (or even some user provided input handler via callback instead of making all go through Lua) but didn't try to do any of that yet.
That's pretty cool. I'll check out your project.
Progress update
Okay, I'm almost done with Animation Tool. Here's how it looks now:
This gif actually uses Meta system I've been working on for so long. Previous gifs just used JSON and reloaded animation when something changed. This one changes C++ value, so when I change "frameTime", corresponding C++ variable changes!
Stuff I've also added:
- Can select animations
- Type displayed (I have std::map<std::type_index, std::string> for that, so it's accurate)
Stuff I need to add:
- Add/delete animation. Will be very easy to make
- Save to file. Again, pretty easy, considering Meta<T>::serialize function
Later I'll use this project to make entity editor. It will work by the same principle. What's cool is that most of the members in component classes are of these types: bool, int, float, size_t, std::string, sf::Vector2i, sf::Vector2f, sf::IntRect, sf::FloatRect which are supported by my meta system very well.
One current problem I have which someone may help me solve is this. Suppose I want to do this:
std::cout << meta.get("someProperty");
This isn't going to work, because I need to do this:
std::cout << meta.get<int>("someProperty"); // if someProperty is int
Why do I need to specify the type? I need this type to convert from
IProperty<Class> to
Property<T, Class> inside get function! (where
T is type of property,
Class is class to which this property belongs)
Property<T, Class> has
T Property<T, Class>::get() function which returns value of the property, but IProperty can't have it as virtual, because it's a base class which I use to store all properties in one map.
When I store
Property<T, Class> as
IProperty<Class> pointer I lose type of the property. I've solved this by storing type_index of T inside IProperty, so I can later get it to identify which type Property has.
So I can do this:
if(meta.getPropertyType("someProperty") == typeid(int)) {
std::cout << meta.get<int>("someProperty");
} else if(meta.getPropertyType("someProperty") == typeid(double)) {
std::cout << meta.get<double>("someProperty");
} ...
but those if/else things are pretty awful to write! (but they work, he-he)
Are there any other solutions?
What I want to do is do is call template function by getting the type out of type_index. Any way to do it without if/else?