Trixt0r Posted December 1, 2016 Report Share Posted December 1, 2016 Okay... I am done... except for the LWJGL implementation, which I won't implement now, since it takes more effort to code a usable one and it seems that everyone uses LibGDX anyway. Every specific implementation has its own project: Generic, required by every implementation: https://github.com/Trixt0r/spriter LibGDX: https://github.com/Trixt0r/gdx-spriter Slick2D: https://github.com/Trixt0r/slick2d-spriter Java2D: https://github.com/Trixt0r/java2d-spriter Mike at BrashMonkey 1 Quote Link to comment Share on other sites More sharing options...
R T Posted January 1, 2017 Report Share Posted January 1, 2017 On 12/1/2016 at 5:01 PM, Trixt0r said: Okay... I am done... except for the LWJGL implementation, which I won't implement now, since it takes more effort to code a usable one and it seems that everyone uses LibGDX anyway. Every specific implementation has its own project: Generic, required by every implementation: https://github.com/Trixt0r/spriter LibGDX: https://github.com/Trixt0r/gdx-spriter Slick2D: https://github.com/Trixt0r/slick2d-spriter Java2D: https://github.com/Trixt0r/java2d-spriter Thanks for all your awesome work, it looks great! I look forward to trying this in my project. Happy Holidays! Mike at BrashMonkey 1 Quote Link to comment Share on other sites More sharing options...
WinterGuardian Posted January 19, 2017 Report Share Posted January 19, 2017 Hi and thanks for your work Trixt0r. How can I set the position of my (Animation)Player without having any interpolation ? I just want to set it's position normally (teleport it) since my game logic is controlling my character by itself. For now I got something like that https://i.gyazo.com/e5682ad2a6f8ea6c4579713a54e6385f.mp4 Thanks EDIT: Sorry, I was just setting the position before updating... So no problems Aaike64 1 Quote Link to comment Share on other sites More sharing options...
conceptgame Posted March 11, 2017 Report Share Posted March 11, 2017 Hi all, Thank you Trixt0r for your implementation. After adapting the generic C++ reference implementation for the Windows platform on the CF2.5 game engine, I am now porting this implementation to Android. I used your code to perform this but I have got the usual first nightmare which is the coordinate system which is not really standard on this game engine. I got this on grey guy standard example (see attached image). From your experience, where do you think I need to investigate first and where in code? - reverse Y on Load? - reverse angle on Load? Mike at BrashMonkey 1 Quote Link to comment Share on other sites More sharing options...
Trixt0r Posted March 18, 2017 Report Share Posted March 18, 2017 On 11.3.2017 at 9:58 PM, conceptgame said: From your experience, where do you think I need to investigate first and where in code? This looks like the origin of your sprites is not applied/renderer properly, i.e you don't calculate the pivot points correctly. It also looks like your y-axis is pointing down, i.e. it grows to the bottom while Spriter's y-axis points upwards. - Trixt0r Quote Link to comment Share on other sites More sharing options...
conceptgame Posted March 20, 2017 Report Share Posted March 20, 2017 Thanks for the help Trixt0r, I tried the obvious possibilities (1-pivot.y and -y) in SCMLReader but with no luck. protected void loadFiles(ArrayList<Element> files, Folder folder){ for(int j = 0; j < files.size(); j++){ Element f = files.get(j); File file = new File(f.getInt("id"), f.get("name"), new Dimension(f.getInt("width", 0), f.getInt("height", 0)), new Point(f.getFloat("pivot_x", 0f), 1.0f-f.getFloat("pivot_y", 1f))); folder.addFile(file); } } protected void loadTimelineKeys(ArrayList<Element> keys, Timeline timeline){ for(int i = 0; i< keys.size(); i++){ Element k = keys.get(i); Curve curve = new Curve(); curve.setType(Curve.getType(k.get("curve_type", "linear"))); curve.constraints.set(k.getFloat("c1", 0f),k.getFloat("c2", 0f),k.getFloat("c3", 0f),k.getFloat("c4", 0f)); Timeline.Key key = new Timeline.Key(k.getInt("id"), k.getInt("time", 0), k.getInt("spin", 1), curve); Element obj = k.getChildByName("bone"); if(obj == null) obj = k.getChildByName("object"); Point position = new Point(obj.getFloat("x", 0f), -1.0f*obj.getFloat("y", 0f)); Point scale = new Point(obj.getFloat("scale_x", 1f), obj.getFloat("scale_y", 1f)); Point pivot = new Point(obj.getFloat("pivot_x", 0f), 1.0f-obj.getFloat("pivot_y", (timeline.objectInfo.type == ObjectType.Bone)? .5f:1f)); float angle = obj.getFloat("angle", 0f), alpha = 1f; int folder = -1, file = -1; if(obj.getName().equals("object")){ if(timeline.objectInfo.type == ObjectType.Sprite){ alpha = obj.getFloat("a", 1f); folder = obj.getInt("folder", -1); file = obj.getInt("file", -1); File f = data.getFolder(folder).getFile(file); pivot = new Point(obj.getFloat("pivot_x", f.pivot.x), 1.0f-obj.getFloat("pivot_y", f.pivot.y)); timeline.objectInfo.size.set(f.size); } } Timeline.Key.Object object; if(obj.getName().equals("bone")) object = new Timeline.Key.Object(position, scale, pivot, angle, alpha, new FileReference(folder, file)); else object = new Timeline.Key.Object(position, scale, pivot, angle, alpha, new FileReference(folder, file)); key.setObject(object); timeline.addKey(key); } } The current result is in attachment. What we cannot see on screenshot is that the hands are going away from body when this one is going down although it should be the contrary in the original spriter file for the grey guy. I tried also all the combinations with angle (360-angle) and spin (-spin) but there is always something not working. From what I can see, all seems ok in the animation excepting the y axis which seems to go in the wrong direction. But as explained before just changing this: Point position = new Point(obj.getFloat("x", 0f), -1.0f*obj.getFloat("y", 0f)); does not help. I cannot figure out what is going wrong. I guess I need to debug with Android Studio, which is really a pain on my "little" configuration. EDIT: ok, i compared with my implementation in generic C++ importer and changed the right-handed transformation in Point to the left-handed system and it seems better (I replaced the last attachment before edit with the new screenshot) but still not perfect. Any ideas? public Point rotate(float degrees){ if(x != 0 || y != 0){ float cos = Calculator.cosDeg(degrees); float sin = Calculator.sinDeg(degrees); //float xx = x*cos-y*sin; //float yy = x*sin+y*cos; /* // Left Handed rotation in CF2.5 (Direct3D convention) p'x = p.x * c + p.y * s; p'y = -p.x * s + p.y * c;*/ float xx = x*cos+y*sin; float yy = -x*sin+y*cos; this.x = xx; this.y = yy; } return this; } Quote Link to comment Share on other sites More sharing options...
conceptgame Posted March 20, 2017 Report Share Posted March 20, 2017 I removed the pivot inversion in loadFiles from SCMLReader and finally all keyframes are placed correctly but the interpolation seems to be broken. Did I forget something related to my specific coordinate system? Edit: I found that the deltaTime between each update is not working properly. It happens often that asking for help is rising new ideas for debugging. Thanks for those who took time to read my questions. I can now go forward with the Android port. Quote Link to comment Share on other sites More sharing options...
conceptgame Posted March 21, 2017 Report Share Posted March 21, 2017 Hi again, What is the status of the following features: - SubEntities - Events (Triggers) - Sounds - Variables (I saw that there is a Meta class but it does not seem to be used at all and no parsing in SCMLReader) - Tags If not implemented I will look to make my changes so that I can push the changes back into to trunk afterwards. Quote Link to comment Share on other sites More sharing options...
phunnilemur@gmail.com Posted September 29, 2017 Report Share Posted September 29, 2017 I tried to add this and the gdx implementation in my project with gradle, but the repository URL specified above is broken. For now I'll try and add it as a local jar, but i sthere a working repo URL? Quote Link to comment Share on other sites More sharing options...
Matt_UK Posted November 21, 2019 Report Share Posted November 21, 2019 (edited) On 11/11/2014 at 11:18 PM, jraselin said: I've done some patch to fix these bugs Character map with "hidden" object => the objects are still drawed inside SCMLReader protected void loadCharacterMaps(ArrayList maps, Entity entity) { for (int i = 0; i < maps.size(); i++) { Element map = maps.get(i); Entity.CharacterMap charMap = new Entity.CharacterMap(map.getInt("id"), map.getAttribute("name", "charMap" + i)); entity.addCharacterMap(charMap); ArrayList mappings = map.getChildrenByName("map"); for (Element mapping : mappings) { int folder = mapping.getInt("folder"); int file = mapping.getInt("file"); if (mapping.get("target_folder", null) == null) { charMap.put(new FileReference(folder, file), null); } else { charMap.put(new FileReference(folder, file), new FileReference(mapping.getInt("target_folder"), mapping.getInt("target_file"))); } } } } and the Drawer public void draw(Iterator it, CharacterMap[] maps) { while (it.hasNext()) { Timeline.Key.Object object = it.next(); if (object.ref.hasFile()) { // apply map if (maps != null) { for (CharacterMap map : maps) { // key exists if (map != null && map.containsKey(object.ref)) { // draw if not "hidden" if (map.get(object.ref) != null) { object.ref.set(map.get(object.ref)); this.draw(object); } break; } else { this.draw(object); } } } else { this.draw(object); } } } } Hi.... this seems to be a good partial fix... it now recognises "hidden" sprites on the first character map but not on any others or am I doing something wrong? Edited November 21, 2019 by Matt_UK condescending Mike at BrashMonkey 1 Quote Link to comment Share on other sites More sharing options...
Matt_UK Posted November 23, 2019 Report Share Posted November 23, 2019 this was me doing it wrong.... I didnt understand the charactermaps example code properly (and probably I still don`t) i used: public boolean touchDown (int screenX, int screenY, int pointer, int button) { if(button != Input.Buttons.RIGHT) player.characterMaps[i] = charMaps[i]; //set the character map to the one saved in maps else player.characterMaps = null; //set the char map to null, to remove it i = (player.characterMaps.length+(++i))%player.characterMaps.length; return false; } but when i changed it to player.characterMaps[0] = charMaps[i]; //set the character map to the one saved in maps everything worked as planned. I then spent a day with a working character map demo and being unable to get the Spriter Player to render within my game logic. turns out I didn`t understand Camera classes properly either so now that`s fixed i seem to be able to completely get rid of spritesheets in my game and the world is a wonderful place again Mike at BrashMonkey 1 Quote Link to comment Share on other sites More sharing options...
Mike at BrashMonkey Posted January 2, 2020 Report Share Posted January 2, 2020 Awesome work Matt Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.