pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata info_box_data.cxx,NONE,


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata info_box_data.cxx,NONE,1.1 info_box_data.hxx,NONE,1.1 Makefile.am,1.3,1.4
Date: 14 Sep 2002 13:35:40 -0000

Update of /usr/local/cvsroot/Games/Pingus/src/worldobjsdata
In directory dark:/tmp/cvs-serv823/worldobjsdata

Modified Files:
        Makefile.am 
Added Files:
        info_box_data.cxx info_box_data.hxx 
Log Message:
splitted InfoBox


--- NEW FILE: info_box_data.cxx ---
//  $Id: info_box_data.cxx,v 1.1 2002/09/14 13:35:38 torangan Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 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 <fstream>
#include <ClanLib/Display/Font/font.h>
#include "../pingus_resource.hxx"
#include "../xml_helper.hxx"
#include "../editorobjs/info_box_obj.hxx"
#include "../worldobjs/info_box.hxx"
#include "info_box_data.hxx"

namespace WorldObjsData {

InfoBoxData::InfoBoxData () : sprite("infobox", "worldobjs"),
                              
font(PingusResource::load_font("Fonts/pingus_small", "fonts"))
{
  sprite.set_align_center_bottom ();
}

InfoBoxData::~InfoBoxData ()
{
}

WorldObj* 
InfoBoxData::create_WorldObj ()
{
  return new WorldObjs::InfoBox(this);
}

EditorObjLst
InfoBoxData::create_EditorObj ()
{
  return EditorObjLst(1, new EditorObjs::InfoBoxObj(this));
}

InfoBoxData::InfoBoxData (xmlDocPtr doc, xmlNodePtr cur)
{
  cur = cur->children;
  
  while (cur)
    {
      if (xmlIsBlankNode(cur)) 
        {
          cur = cur->next;
          continue;
        }
      else if (XMLhelper::equal_str(cur->name, "position"))
        {
          pos = XMLhelper::parse_vector (doc, cur);
        }
      else if (XMLhelper::equal_str(cur->name, "info-text"))
        {
          info_text = XMLhelper::parse_string (doc, cur);
        }
      else
        std::cout << "InfoBox::creata (): Unhandled " << cur->name << std::endl;
      cur = cur->next;
    }
}

InfoBoxData::InfoBoxData (const InfoBoxData& old) : WorldObjData(old),
                                                    info_text(old.info_text),
                                                    pos(old.pos),
                                                    text_pos(old.text_pos),
                                                    sprite(old.sprite),
                                                    font(old.font)
{
}

void 
InfoBoxData::write_xml (std::ostream& xml)
{
  xml << "  <worldobj type=\"infobox\">\n";
  XMLhelper::write_vector_xml (xml, pos);
  xml << "   <info-text>" << info_text << "</info-text>\n" 
      << "  </worldobj>\n" << std::endl;
}

} // namespace WorldObjsData

/* EOF */

--- NEW FILE: info_box_data.hxx ---
//  $Id: info_box_data.hxx,v 1.1 2002/09/14 13:35:38 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 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_WORLDOBJSDATA_INFO_BOX_DATA_HXX
#define HEADER_PINGUS_WORLDOBJSDATA_INFO_BOX_DATA_HXX

#include <ClanLib/Core/Math/cl_vector.h>
#include "../sprite.hxx"
#include "../worldobj_data.hxx"
#include "../libxmlfwd.hxx"

class CL_Font;

namespace WorldObjsData {

class InfoBoxData : public WorldObjData
{
public:
  std::string info_text;
  CL_Vector pos;
  CL_Vector text_pos;
  Sprite    sprite;
  CL_Font*  font;

public:
  InfoBoxData ();
  InfoBoxData (xmlDocPtr doc, xmlNodePtr cur);
  
  InfoBoxData (const InfoBoxData& old);
  
  ~InfoBoxData ();

  void write_xml (std::ostream& xml);  
  
  WorldObj* create_WorldObj ();
  EditorObjLst create_EditorObj ();
  
private:
  InfoBoxData operator= (const InfoBoxData&);
};

} // namespace WorldObjsData

#endif

/* EOF */

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjsdata/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Makefile.am 11 Sep 2002 15:27:19 -0000      1.3
+++ Makefile.am 14 Sep 2002 13:35:38 -0000      1.4
@@ -22,6 +22,7 @@
        fake_exit_data.cxx   fake_exit_data.hxx \
        guillotine_data.cxx  guillotine_data.hxx \
        hammer_data.cxx      hammer_data.hxx \
+       info_box_data.cxx    info_box_data.hxx \
        laser_exit_data.cxx  laser_exit_data.hxx \
        smasher_data.cxx     smasher_data.hxx \
        spike_data.cxx       spike_data.hxx  \





reply via email to

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