[FEATURE REQUEST] Getting interpolation type by String
See original GitHub issueIssue details
Requesting for feature addition to get interpolation instance by interpolation name.
Sometimes I’d like to be able to get an interpolation type from, for example, a text file. The Interpolation class doesn’t feature a method to get an instance of Interpolation via String input. Current workaround would be something like
private Interpolation getInterpolationByName(String name) {
try {
Field field = Interpolation.class.getField(name);
return (Interpolation) field.get(Interpolation.class);
} catch (NoSuchFieldException | IllegalAccessException ex) {
ex.printStackTrace();
return Interpolation.linear;
}
}
This is a feature request for a static function in the Interpolation class, that returns the appropriate instance of a built in interpolation type.
Version of LibGDX and/or relevant dependencies
1.9.10
Please select the affected platforms
- Android
- iOS (robovm)
- iOS (MOE)
- HTML/GWT
- Windows
- Linux
- MacOS
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Feature request: String interpolation - Change Proposals
String interpolation must emit a series of delimiter tokens. It's no longer a single token, but you must have things like TokStringStart , ......
Read more >feature request - conditional in string interpolation · Issue #4646
I've been burned by "Welcome, #{if user? then user.name}!" becoming “Welcome, undefined!” on more than one occasion. I like the idea of this....
Read more >Email String Interpolation - Evaluate Variables withing HTML ...
I wanted to check if there inbuilt activity that does the simplifies email templating easily. Would automatically attempt to replace the ...
Read more >String Interpolation in JavaScript - Dmitri Pavlutin
String interpolation is replacing placeholders with values in a string literal. Let's see in more detail, with examples and best practices, how ...
Read more >String interpolation revamp: design decisions - Swift Forums
Although String doesn't care, many types want to treat them differently. The new design calls different methods for each one. New features: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d suggest to use a map, populate it with the interpolations you need (using reflection or anything else). IMO this is application level code, it doesn’t need to be in libgdx.
You can grab this for now. Might be handy to have in core also. https://github.com/rockbite/talos/blob/bd668638f1ed197c6c1fa00fb7c37e0d7241aed4/runtimes/talos-libgdx/src/com/rockbite/tools/talos/runtime/utils/InterpolationMappings.java