-
Posts
30 -
Joined
-
Last visited
-
Days Won
4
conceptgame last won the day on November 23 2019
conceptgame had the most liked content!
Recent Profile Visitors
conceptgame's Achievements
Newbie (1/14)
4
Reputation
-
Mike at BrashMonkey reacted to a post in a topic: Generic Java Importer
-
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.
-
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.
-
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; }
-
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?
-
Hi SHinfan, The videos I made were rather memos without any explanation to get quickly an answer for a particular topic. The idea was to make them as short as possible to only get the essentials. I agree that it is not really for beginners. I planned to make some more in-depth tutorials but I prefer to invest time solving bugs at the moment. Can you give more explanation or send me a file so that I can solve your particular problem?
- 2 replies
-
- clickteam fusion 2.5
- spriter pro
-
(and 1 more)
Tagged with:
-
SpriterPlusPlus - a C++ Spriter implementation
conceptgame replied to lucid's topic in Spriter Implementations
Hi lucid, thanks for the feedback, I will try this. Regarding subentities, is there a simple example file like that in video linked above to allow me to easily debug this feature? -
SpriterPlusPlus - a C++ Spriter implementation
conceptgame replied to lucid's topic in Spriter Implementations
Related to the issue of callofAS, is it now possible to change current entity on the fly with void EntityInstance::setCurrentEntity(int newEntityId)? Or is the only way to delete and recreate from top API? For example, instead of this: SpriterEngine::EntityInstance * inst = scmlModel->getNewEntityInstance(0); delete inst; inst = scmlModel->getNewEntityInstance(1); just this: SpriterEngine::EntityInstance * inst = scmlModel->getNewEntityInstance(0); inst->setCurrentEntity(1); -
SpriterPlusPlus - a C++ Spriter implementation
conceptgame replied to lucid's topic in Spriter Implementations
It is more how can I use atlases in the current implementation. If I understood properly, by creating image file, I can use the sprite sheet image files instead of all single files and then by rendering I can use the AtlasData container from AtlasFile to locate the sprite on the spritesheet and draw it properly. Did I understood correctly that I only need to change the rendering method to get it work? In other words, is the loading of atlases already implemented. I saw Labsin's commit but I did not check in Details. This change can improve the performance of the game engine and it is really cool if we can already use it. -
SpriterPlusPlus - a C++ Spriter implementation
conceptgame replied to lucid's topic in Spriter Implementations
Hi Lucid, 1) I did not generate the file myself. I will forward the answer to the user who is using my extension for Clickteam Fusion 2.5. If he wants to keep this option checked, what should be done? 2) For the atlases, I just merged the last commit and noticed that the code was not retrocompatible anymore. Nothing serious but it makes me wonder what I can do with it. Thanks for your answer. -
SpriterPlusPlus - a C++ Spriter implementation
conceptgame replied to lucid's topic in Spriter Implementations
Hi Lucid, I did not follow all the updates but it seems that there are changes that are not applied to comply with new releases. 1) First one of my user has some nodes with "realname" attribute. For example in void SpriterDocumentLoader::getObjectInfoFromEntityElement(SpriterFileElementWrapper *entityElement, Entity *entity, PointMap *defaultBoxPivotMap), no attribute realname is read. Is it as simple as replacing the name by realname if it exists? SOmething like this: SpriterFileAttributeWrapper *att = objInfoElement->getFirstAttribute("realname"); if (!att->isValid()) { att = objInfoElement->getFirstAttribute("name"); } I suppose that it leads to the problem I have that collision boxes used do not appear anymore. This user released with r7 version. Are there any other nodes which have this "new" attribute? 2) I saw that atlases were added? Do you have any example code which overrides this new feature? I must admit that I did not try this feature in Spriter itself and does not know exactly how it works. -
lucid reacted to a post in a topic: SpriterPlusPlus - a C++ Spriter implementation
-
SpriterPlusPlus - a C++ Spriter implementation
conceptgame replied to lucid's topic in Spriter Implementations
Oh yes, thanks. It was exactly the problem. -
SpriterPlusPlus - a C++ Spriter implementation
conceptgame replied to lucid's topic in Spriter Implementations
I began to find some bugs in Easing curve. First the obvious ones in getEasingCurveFromKeyElement in spriterdocumentloader.cpp: while (i < MAX_CONTROL_POINTS) { att = element->getFirstAttribute("c"+std::to_string(i+1)); if(att->isValid()) { controlPoints = att->getRealValue(); } i++; } After these fixes, Bezier Curves still do not work. The sprites are at completely wrong places by rendering. Without easing they are correct. I am searching for the source of the bug but if you have any idea, I could save some time. -
SpriterPlusPlus - a C++ Spriter implementation
conceptgame replied to lucid's topic in Spriter Implementations
Thanks for the commit lucid. I have implemented almost all of these changes in my current build. I have found one other critical point though: If the current animation is finished, there is no rendering anymore. That is weird since the position of the object can be changed or if there is a scrolling the display on the screen should be changed. I have changed void EntityInstance::setTimeElapsed(real timeElapsed) so that it is not checking the isPlaying flag and it is working properly. -
SpriterPlusPlus - a C++ Spriter implementation
conceptgame replied to lucid's topic in Spriter Implementations
After some time spent on a tricky bug, I definitely think that the setCurrentAnimation should stop any animation blending like this: void EntityInstance::setCurrentAnimation(const std::string & animationName) { currentEntity->setCurrentAnimation(animationName, ¤tAnimation); blendedAnimation = 0; blendCurrentTime = 0; blendTotalTime = 0; isPlaying = true; } Otherwise it can happen that a call to it during an animation blending will just be ignored. -
The engine I am rendering in is based on DirectX. Even if they are some abstraction layers in between, it is working the same. Look at the smfl example which handles what you basically need. In the renderSprite function (yourEngineimagefile.cpp), it is where you need to put your dedicated Directx rendering code. That's all about rendering itself.