[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2503 - in trunk/src: . editor
From: |
jave27 |
Subject: |
[Pingus-CVS] r2503 - in trunk/src: . editor |
Date: |
Tue, 15 Nov 2005 04:11:00 +0100 |
Author: jave27
Date: 2005-11-15 04:10:40 +0100 (Tue, 15 Nov 2005)
New Revision: 2503
Added:
trunk/src/editor/level_impl.hxx
trunk/src/editor/xml_level.cxx
trunk/src/editor/xml_level.hxx
Modified:
trunk/src/editor/Makefile.am
trunk/src/editor/editor_screen.cxx
trunk/src/editor/editor_screen.hxx
trunk/src/xml_file_writer.cxx
Log:
Some more framework stuff for the editor.
Modified: trunk/src/editor/Makefile.am
===================================================================
--- trunk/src/editor/Makefile.am 2005-11-14 22:05:41 UTC (rev 2502)
+++ trunk/src/editor/Makefile.am 2005-11-15 03:10:40 UTC (rev 2503)
@@ -1,4 +1,4 @@
-# Pingus - A free Lemmings clone
+# Pingus - A free Lemmings clone
# Copyright (C) 1999 Ingo Ruhnke <address@hidden>
#
# This program is free software; you can redistribute it and/or
@@ -25,6 +25,8 @@
editor_screen.cxx editor_screen.hxx \
editor_panel.cxx editor_panel.hxx \
panel_button.cxx panel_button.hxx \
- editor_viewport.cxx editor_viewport.hxx
+ editor_viewport.cxx editor_viewport.hxx \
+ xml_level.cxx xml_level.hxx \
+ level_impl.hxx
# EOF #
\ No newline at end of file
Modified: trunk/src/editor/editor_screen.cxx
===================================================================
--- trunk/src/editor/editor_screen.cxx 2005-11-14 22:05:41 UTC (rev 2502)
+++ trunk/src/editor/editor_screen.cxx 2005-11-15 03:10:40 UTC (rev 2503)
@@ -27,22 +27,20 @@
#include "../res_descriptor.hxx"
#include "../resource.hxx"
#include "../fonts.hxx"
-#include "../xml_pingus_level.hxx"
#include "editor_screen.hxx"
#include "editor_panel.hxx"
#include "editor_viewport.hxx"
+#include "xml_level.hxx"
namespace Pingus {
- class PingusLevel;
-
namespace Editor {
// Default constructor
-EditorScreen::EditorScreen(PingusLevel* level)
+EditorScreen::EditorScreen(XMLLevel* level)
: plf(level)
{
- if (!plf) plf = new PingusLevel();
+ if (!plf) plf = new XMLLevel();
}
// Destructor
Modified: trunk/src/editor/editor_screen.hxx
===================================================================
--- trunk/src/editor/editor_screen.hxx 2005-11-14 22:05:41 UTC (rev 2502)
+++ trunk/src/editor/editor_screen.hxx 2005-11-15 03:10:40 UTC (rev 2503)
@@ -26,10 +26,10 @@
class DrawingContext;
class GUI::GUIManager;
-class PingusLevel;
namespace Editor {
+class XMLLevel;
class EditorPanel;
class EditorViewport;
@@ -39,7 +39,7 @@
{
private:
/* The level currently being edited */
- PingusLevel* plf;
+ XMLLevel* plf;
/* Panel which contains all of the buttons for each action */
EditorPanel* panel;
@@ -49,7 +49,7 @@
public:
/** Default constructor */
- EditorScreen(PingusLevel* level = 0);
+ EditorScreen(XMLLevel* level = 0);
/** Destructor */
~EditorScreen();
Added: trunk/src/editor/level_impl.hxx
===================================================================
--- trunk/src/editor/level_impl.hxx 2005-11-14 22:05:41 UTC (rev 2502)
+++ trunk/src/editor/level_impl.hxx 2005-11-15 03:10:40 UTC (rev 2503)
@@ -0,0 +1,78 @@
+// $Id: level_impl.hxx,v 1.00 2005/11/11 23:41:12 Jave27 Exp $
+//
+// Pingus - A free Lemmings clone
+// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#include <ClanLib/Core/System/sharedptr.h>
+#include <ClanLib/Core/Math/size.h>
+#include <ClanLib/Display/color.h>
+#include <string>
+#include <vector>
+#include <map>
+
+#ifndef HEADER_PINGUS_EDITOR_LEVEL_IMPL_HXX
+#define HEADER_PINGUS_EDITOR_LEVEL_IMPL_HXX
+
+namespace Pingus {
+
+namespace Editor {
+
+ class LevelObjs;
+
+class LevelImpl
+{
+public:
+ // Set defaults in constructor
+ LevelImpl()
+ : ambient_light(CL_Colorf(1.0f, 1.0f, 1.0f, 1.0f)),
+ music("none")
+ {
+ // Do nothing
+ }
+
+ std::string resname;
+
+ std::string levelname;
+ std::string description;
+
+ CL_Colorf ambient_light;
+ CL_Size size;
+
+ int number_of_pingus;
+ int number_to_save;
+
+ std::map<std::string, int> actions;
+
+ int time;
+ int difficulty;
+
+ std::string author;
+ std::string music;
+
+ std::vector<LevelObjs*> objects;
+
+private:
+ LevelImpl (const LevelImpl&);
+ LevelImpl& operator= (const LevelImpl&);
+}; // LevelImpl class
+
+} // Editor namespace
+} // Pingus namespace
+
+#endif
+
+/* EOF */
\ No newline at end of file
Added: trunk/src/editor/xml_level.cxx
===================================================================
--- trunk/src/editor/xml_level.cxx 2005-11-14 22:05:41 UTC (rev 2502)
+++ trunk/src/editor/xml_level.cxx 2005-11-15 03:10:40 UTC (rev 2503)
@@ -0,0 +1,81 @@
+// $Id: xml_level.cxx,v 1.00 2005/11/11 23:41:12 Jave27 Exp $
+//
+// Pingus - A free Lemmings clone
+// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#include <iostream>
+#include "xml_level.hxx"
+#include "level_impl.hxx"
+#include "../xml_pingus_level.hxx"
+
+namespace Pingus {
+
+namespace Editor {
+
+// Default constructor
+XMLLevel::XMLLevel() :
+ impl(new LevelImpl())
+{
+
+}
+
+// Default Destructor
+XMLLevel::~XMLLevel()
+{
+ delete impl;
+}
+
+// Verify that level is valid
+bool XMLLevel::is_valid()
+{
+ std::cout << "XMLLevel::is_valid() - Not yet implemented" << std::endl;
+ return false;
+}
+
+// Save the level to a file. Returns true if successful
+bool XMLLevel::save_level(const std::string& filename)
+{
+ std::cout << "XMLLevel::save_level() - Not yet implemented" <<
std::endl;
+ return false;
+}
+
+// Load an existing level from a file
+void XMLLevel::load_level(const std::string& filename)
+{
+ std::cout << "XMLLevel::load_level() - Not yet implemented" <<
std::endl;
+
+ // Load the level from the file - we don't care what it's res_name is.
+ XMLPingusLevel existing_level("", filename);
+
+ // Assign all of the level information to our LevelImpl
+ impl->levelname = existing_level.get_levelname();
+ impl->description = existing_level.get_description();
+ impl->ambient_light = existing_level.get_ambient_light();
+ impl->size = existing_level.get_size();
+ impl->number_of_pingus = existing_level.get_number_of_pingus();
+ impl->number_to_save = existing_level.get_number_to_save();
+ impl->actions = existing_level.get_actions();
+ impl->time = existing_level.get_time();
+ impl->difficulty = existing_level.get_difficulty();
+ impl->author = existing_level.get_author();
+ impl->music = existing_level.get_music();
+
+ // TODO: Get the objects
+}
+
+} // Editor namespace
+} // Pingus namespace
\ No newline at end of file
Added: trunk/src/editor/xml_level.hxx
===================================================================
--- trunk/src/editor/xml_level.hxx 2005-11-14 22:05:41 UTC (rev 2502)
+++ trunk/src/editor/xml_level.hxx 2005-11-15 03:10:40 UTC (rev 2503)
@@ -0,0 +1,61 @@
+// $Id: xml_level.hxx,v 1.00 2005/11/11 23:41:12 Jave27 Exp $
+//
+// Pingus - A free Lemmings clone
+// Copyright (C) 2005 Ingo Ruhnke <address@hidden>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef HEADER_PINGUS_EDITOR_XMLLEVEL_HXX
+#define HEADER_PINGUS_EDITOR_XMLLEVEL_HXX
+
+namespace Pingus {
+
+namespace Editor {
+
+ class LevelImpl;
+
+class XMLLevel
+{
+private:
+ LevelImpl* impl;
+
+public:
+
+ /** Construct new blank level */
+ XMLLevel();
+
+ /** Destructor */
+ ~XMLLevel();
+
+ /** Verify that level is valid */
+ bool is_valid();
+
+ /** Save the level to a file. Returns true if successful */
+ bool save_level(const std::string& filename);
+
+ /** Load an existing level from a file */
+ void load_level(const std::string& filename);
+
+private:
+ XMLLevel (const XMLLevel&);
+ XMLLevel& operator= (const XMLLevel&);
+}; // XMLLevel class
+
+} // Editor namespace
+} // Pingus namespace
+
+#endif
+
+/* EOF */
\ No newline at end of file
Modified: trunk/src/xml_file_writer.cxx
===================================================================
--- trunk/src/xml_file_writer.cxx 2005-11-14 22:05:41 UTC (rev 2502)
+++ trunk/src/xml_file_writer.cxx 2005-11-15 03:10:40 UTC (rev 2503)
@@ -98,9 +98,9 @@
XMLFileWriter::write_vector (const char* name, const Vector& value)
{
(*out) << "<" << name << ">\n"
- << " <x-pos>" << value.x << "</x-pos>\n"
- << " <y-pos>" << value.y << "</y-pos>\n"
- << " <z-pos>" << value.z << "</z-pos>\n"
+ << " <x>" << value.x << "</x>\n"
+ << " <y>" << value.y << "</y>\n"
+ << " <z>" << value.z << "</z>\n"
<< "</" << name << ">\n";
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2503 - in trunk/src: . editor,
jave27 <=