weimingtom / emo-framework

Automatically exported from code.google.com/p/emo-framework
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Problem with trimmed animations #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a trimmed animation with Zoptex
2. Create a spritesheet with XML (Sparrow)
3. Animate using names with eduardonunesp patch

Index: EmoDrawable_glue.m
===================================================================
--- EmoDrawable_glue.m  (revision 1405)
+++ EmoDrawable_glue.m  (working copy)
@@ -2115,7 +2115,15 @@
                 SQInteger value;
                 sq_getinteger(v, -1, &value);
                 [animation setFrame:idx withValue:value];
+            } else if(sq_gettype(v, -1) == OT_STRING) {
+                const SQChar *value;
+                sq_getstring(v, -1, &value);
+                EmoImagePackInfo* info = [drawable getImagePack:[NSString 
stringWithCString:value 
+                    encoding:NSASCIIStringEncoding]];
+                if (info == nil) break;
+                [animation setFrame:idx withValue:info.index];
             }
+
             idx++;
             sq_pop(v, 2);
         }

The animation runs with wrong X and Y coordinates at the packed sprite, because 
the packet was trimmed, but when the trimmed is disable the positions are ok

Maybe the X and Y TextureAtlas definitions could be get at the animation play, 
BTW i looking at the code and learning how to help to improve emo-framework

Original issue reported on code.google.com by eduardon...@gmail.com on 2 Jan 2012 at 9:11

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a trimmed animation with Zoptex
2. Create a spritesheet with XML (Sparrow)
3. Animate using names with eduardonunesp patch

Index: EmoDrawable_glue.m
===================================================================
--- EmoDrawable_glue.m  (revision 1405)
+++ EmoDrawable_glue.m  (working copy)
@@ -2115,7 +2115,15 @@
                 SQInteger value;
                 sq_getinteger(v, -1, &value);
                 [animation setFrame:idx withValue:value];
+            } else if(sq_gettype(v, -1) == OT_STRING) {
+                const SQChar *value;
+                sq_getstring(v, -1, &value);
+                EmoImagePackInfo* info = [drawable getImagePack:[NSString 
stringWithCString:value 
+                    encoding:NSASCIIStringEncoding]];
+                if (info == nil) break;
+                [animation setFrame:idx withValue:info.index];
             }
+
             idx++;
             sq_pop(v, 2);
         }

The animation runs with wrong X and Y coordinates at the packed sprite, because 
the packet was trimmed, but when the trimmed is disable the positions are ok

Maybe the X and Y TextureAtlas definitions could be get at the animation play, 
BTW i looking at the code and learning how to help to improve emo-framework

Original comment by fawas...@gmail.com on 8 Oct 2013 at 11:31