[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2797 - in branches/pingus_sdl/src: . editor
From: |
jsalmon3 |
Subject: |
[Pingus-CVS] r2797 - in branches/pingus_sdl/src: . editor |
Date: |
Sat, 4 Aug 2007 20:23:36 +0200 |
Author: jsalmon3
Date: 2007-08-04 20:23:29 +0200 (Sat, 04 Aug 2007)
New Revision: 2797
Modified:
branches/pingus_sdl/src/editor/level_objs.cpp
branches/pingus_sdl/src/editor/level_objs.hpp
branches/pingus_sdl/src/file_writer.hpp
branches/pingus_sdl/src/sexpr_file_writer.cpp
Log:
Fixed write_color and write_vector
Modified: branches/pingus_sdl/src/editor/level_objs.cpp
===================================================================
--- branches/pingus_sdl/src/editor/level_objs.cpp 2007-08-04 17:58:46 UTC
(rev 2796)
+++ branches/pingus_sdl/src/editor/level_objs.cpp 2007-08-04 18:23:29 UTC
(rev 2797)
@@ -220,7 +220,7 @@
if (attribs & HAS_RELEASE_RATE)
fw.write_int("release-rate", release_rate);
if (attribs & HAS_COLOR)
- ////fw.write_color("color", color);
+ fw.write_color("color", color);
if (attribs & HAS_STRETCH)
{
fw.write_bool("stretch-x", stretch_x);
@@ -242,7 +242,7 @@
write_extra_properties(fw);
// Write the Vector3f position - all objects have this
- ////fw.write_vector("position", pos);
+ fw.write_vector("position", pos);
fw.end_section(); // object's section_name
}
Modified: branches/pingus_sdl/src/editor/level_objs.hpp
===================================================================
--- branches/pingus_sdl/src/editor/level_objs.hpp 2007-08-04 17:58:46 UTC
(rev 2796)
+++ branches/pingus_sdl/src/editor/level_objs.hpp 2007-08-04 18:23:29 UTC
(rev 2797)
@@ -33,21 +33,21 @@
namespace Editor {
- const unsigned HAS_TYPE = 1;
- const unsigned HAS_SPEED = 2;
- const unsigned HAS_PARALLAX = 4;
- const unsigned HAS_WIDTH = 8;
- const unsigned HAS_OWNER = 16;
- const unsigned HAS_COLOR = 32;
- const unsigned HAS_SCROLL = 64;
- const unsigned HAS_PARA = 128;
- const unsigned HAS_STRETCH = 256;
- const unsigned HAS_DIRECTION = 512;
- const unsigned HAS_RELEASE_RATE = 1024;
- const unsigned HAS_SURFACE = 2048;
+ const unsigned HAS_TYPE = 1 << 0;
+ const unsigned HAS_SPEED = 1 << 1;
+ const unsigned HAS_PARALLAX = 1 << 2;
+ const unsigned HAS_WIDTH = 1 << 3;
+ const unsigned HAS_OWNER = 1 << 4;
+ const unsigned HAS_COLOR = 1 << 5;
+ const unsigned HAS_SCROLL = 1 << 6;
+ const unsigned HAS_PARA = 1 << 7;
+ const unsigned HAS_STRETCH = 1 << 8;
+ const unsigned HAS_DIRECTION = 1 << 9;
+ const unsigned HAS_RELEASE_RATE = 1 << 10;
+ const unsigned HAS_SURFACE = 1 << 11;
// HAS_SURFACE_FAKE means it has a generic image in the editor, but
isn't saved.
- const unsigned HAS_SURFACE_FAKE = 4096;
- const unsigned CAN_ROTATE = 8192;
+ const unsigned HAS_SURFACE_FAKE = 1 << 12;
+ const unsigned CAN_ROTATE = 1 << 13;
/** Returns a number representing which attributes this object
possesses */
inline unsigned int get_attributes(std::string obj_type)
Modified: branches/pingus_sdl/src/file_writer.hpp
===================================================================
--- branches/pingus_sdl/src/file_writer.hpp 2007-08-04 17:58:46 UTC (rev
2796)
+++ branches/pingus_sdl/src/file_writer.hpp 2007-08-04 18:23:29 UTC (rev
2797)
@@ -25,6 +25,7 @@
class Vector3f;
class Size;
+class Color;
/** Interface to write out name/value pairs out of some kind of file or
structure */
@@ -39,6 +40,7 @@
virtual void write_int (const char* name, int) =0;
virtual void write_float (const char* name, float) =0;
+ virtual void write_color (const char* name, const Color&) =0;
virtual void write_bool (const char* name, bool) =0;
virtual void write_string (const char* name, const std::string&) =0;
virtual void write_vector (const char* name, const Vector3f&) =0;
Modified: branches/pingus_sdl/src/sexpr_file_writer.cpp
===================================================================
--- branches/pingus_sdl/src/sexpr_file_writer.cpp 2007-08-04 17:58:46 UTC
(rev 2796)
+++ branches/pingus_sdl/src/sexpr_file_writer.cpp 2007-08-04 18:23:29 UTC
(rev 2797)
@@ -66,12 +66,8 @@
void
SExprFileWriter::write_color(const char* name, const Color& color)
{
- (*out) << indent() << "(" << name << "\n"
- << indent() << " (red " << int(color.r * 255) << ")\n"
- << indent() << " (green " << int(color.g * 255) << ")\n"
- << indent() << " (blue " << int(color.b * 255) << ")\n"
- << indent() << " (alpha " << int(color.a * 255) << ")\n"
- << indent() << ")\n";
+ (*out) << indent() << "(" << name << " "
+ << (int)color.r << " " << (int)color.g << " " << (int)color.b << " "
<< (int)color.a << ")\n";
}
void
@@ -108,11 +104,8 @@
void
SExprFileWriter::write_vector(const char* name, const Vector3f& value)
{
- (*out) << indent() << "(" << name << "\n"
- << indent() << " (x " << value.x << ")\n"
- << indent() << " (y " << value.y << ")\n"
- << indent() << " (z " << value.z << ")\n"
- << indent() << ")\n";
+ (*out) << indent() << "(" << name << " "
+ << value.x << " " << value.y << " " << value.z << ")\n";
}
void
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2797 - in branches/pingus_sdl/src: . editor,
jsalmon3 <=