pingus-cvs
[Top][All Lists]
Advanced

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

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


From: jave27
Subject: [Pingus-CVS] r2558 - trunk/src/editor
Date: Sun, 11 Dec 2005 19:02:03 +0100

Author: jave27
Date: 2005-12-11 19:01:39 +0100 (Sun, 11 Dec 2005)
New Revision: 2558

Modified:
   trunk/src/editor/level_objs.cxx
   trunk/src/editor/level_objs.hxx
   trunk/src/editor/xml_level.cxx
Log:
Getting closer to correct drawing on the editor.

Modified: trunk/src/editor/level_objs.cxx
===================================================================
--- trunk/src/editor/level_objs.cxx     2005-12-11 00:15:36 UTC (rev 2557)
+++ trunk/src/editor/level_objs.cxx     2005-12-11 18:01:39 UTC (rev 2558)
@@ -20,6 +20,7 @@
 #include <string>
 #include <iostream>
 #include "level_objs.hxx"
+#include "level_impl.hxx"
 #include "../blitter.hxx"
 #include "../resource.hxx"
 #include "../res_descriptor.hxx"
@@ -31,7 +32,8 @@
 namespace Editor {
 
 // Default constructor
-LevelObj::LevelObj(std::string obj_name) :
+LevelObj::LevelObj(std::string obj_name, LevelImpl* level_) :
+       level(level_),  
        section_name(obj_name),
        speed(0),
        parallax(0.0),
@@ -70,8 +72,11 @@
                }
                else if(attribs & HAS_STRETCH)
                {
-                       // Surface Background - tile it
-                       gc.draw(sprite, pos);
+                       // Surface Background - tile it or stretch
+                       // FIXME: Make stretch code happen.
+                       for (int x = 0; x < level->size.width; x += 
sprite.get_width())
+                               for (int y = 0; y < level->size.height; y += 
sprite.get_height())
+                                       gc.draw(sprite, Vector((float)x, 
(float)y));
                }
                else
                        gc.draw(sprite, pos);

Modified: trunk/src/editor/level_objs.hxx
===================================================================
--- trunk/src/editor/level_objs.hxx     2005-12-11 00:15:36 UTC (rev 2557)
+++ trunk/src/editor/level_objs.hxx     2005-12-11 18:01:39 UTC (rev 2558)
@@ -67,6 +67,8 @@
                return val;
        }
 
+       class LevelImpl;
+
 /** Generic Level Object (groundpiece, sign, etc.)  Only special objects will 
have
                to inherit from this class - most objects will be able to use 
this class alone */
        class LevelObj
@@ -75,6 +77,9 @@
        /** Sprite used to draw this object */
        CL_Sprite sprite;
 
+       /** Level to which this object belongs */
+       LevelImpl* level;
+
        /** Resource Desciptor of this object */
   ResDescriptor desc;
 
@@ -277,7 +282,7 @@
 
 
        /** Default Constructor */
-       LevelObj(const std::string obj_name);
+       LevelObj(const std::string obj_name, LevelImpl* level_);
 
        /** Destructor */
        virtual ~LevelObj() { }

Modified: trunk/src/editor/xml_level.cxx
===================================================================
--- trunk/src/editor/xml_level.cxx      2005-12-11 00:15:36 UTC (rev 2557)
+++ trunk/src/editor/xml_level.cxx      2005-12-11 18:01:39 UTC (rev 2558)
@@ -161,7 +161,7 @@
        for (std::vector<FileReader>::const_iterator i = objs.begin(); i != 
objs.end(); i++)
        {
                // Create new object
-               LevelObj* obj = new LevelObj(i->get_name());
+               LevelObj* obj = new LevelObj(i->get_name(), impl);
                attribs = obj->get_attribs();
 
                // All objects have a position - get that.





reply via email to

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