pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r2584 - trunk/src/editor


From: jave27
Subject: [Pingus-CVS] r2584 - trunk/src/editor
Date: Mon, 9 Jan 2006 19:17:52 +0100

Author: jave27
Date: 2006-01-09 19:17:45 +0100 (Mon, 09 Jan 2006)
New Revision: 2584

Modified:
   trunk/src/editor/level_objs.cxx
   trunk/src/editor/level_objs.hxx
Log:
Editor takes translation origin into account when loading object now.

Modified: trunk/src/editor/level_objs.cxx
===================================================================
--- trunk/src/editor/level_objs.cxx     2006-01-09 16:36:54 UTC (rev 2583)
+++ trunk/src/editor/level_objs.cxx     2006-01-09 18:17:45 UTC (rev 2584)
@@ -97,6 +97,10 @@
                        && y > pos.y && y < pos.y + sprite.get_height());
        else
                return false;
+               
+       // FIXME: The above method doesn't take translation origins into 
account.
+       // FIXME: This means that some objects (entrances & exits, for example)
+       // FIXME: are drawn incorrectly.
 }
 
 void
@@ -122,12 +126,15 @@
 {
        if (attribs & HAS_SURFACE)
        {
+               sprite = Resource::load_sprite(desc);
+               int x, y;
+               sprite.get_alignment(origin, x, y);
+                               
                CL_PixelBuffer pb;
 
                // Apply modifier, then change the sprite loaded for this 
object in memory.
                if (stretch_x || stretch_y)
                {
-                       sprite = Resource::load_sprite(desc);
                        float w = (float)sprite.get_width();
                        float h = (float)sprite.get_height();
                        
@@ -159,10 +166,8 @@
                CL_SpriteDescription sprite_desc;
                sprite_desc.add_frame(pb);
                sprite = CL_Sprite(sprite_desc);
-               
-               // FIXME: The above method doesn't take translation origins 
into account.
-               // FIXME: This means that some objects (entrances & exits, for 
example)
-               // FIXME: are drawn incorrectly.
+
+               sprite.set_alignment(origin, x, y);
        }
 }
 

Modified: trunk/src/editor/level_objs.hxx
===================================================================
--- trunk/src/editor/level_objs.hxx     2006-01-09 16:36:54 UTC (rev 2583)
+++ trunk/src/editor/level_objs.hxx     2006-01-09 18:17:45 UTC (rev 2584)
@@ -139,6 +139,9 @@
 
        /** Optional color field for certain objects */
        CL_Colorf color;
+       
+       /** Optional translation origin of the sprite */
+       CL_Origin origin;
 
        /** Number representing which attributes this object possesses */
        unsigned attribs;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]