pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/editorobjs teleporter_obj.cxx,NONE,1.


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/editorobjs teleporter_obj.cxx,NONE,1.1 teleporter_obj.hxx,NONE,1.1 teleporter_target_obj.cxx,NONE,1.1 teleporter_target_obj.hxx,NONE,1.1
Date: 10 Sep 2002 12:11:31 -0000

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

Added Files:
        teleporter_obj.cxx teleporter_obj.hxx 
        teleporter_target_obj.cxx teleporter_target_obj.hxx 
Log Message:
added missing files


--- NEW FILE: teleporter_obj.cxx ---
//  $Id: teleporter_obj.cxx,v 1.1 2002/09/10 12:11:28 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 <stdio.h>
#include "teleporter_obj.hxx"
#include "../editor/editor_view.hxx"
#include "../worldobjsdata/teleporter_data.hxx"

namespace EditorObjs {

TeleporterObj::TeleporterObj (WorldObjsData::TeleporterData* data_)
                            : SpriteEditorObj ("teleporter", "worldobjs", 
data->pos),
                              data (new WorldObjsData::TeleporterData(*data_))
{
  data->sprite.set_align_center_bottom ();
}

CL_Vector&
TeleporterObj::get_target_pos_ref ()
{
  return data->target_pos;
}

EditorObj*
TeleporterObj::duplicate()
{
  std::cout << "EditorTeleporterObj::duplicate(): not implemented" << std::endl;
  return 0;
}

EditorObjLst
TeleporterObj::create (const CL_Vector& pos)
{
  WorldObjsData::TeleporterData newdata;

  std::cout << "EditorTeleporterObj: creating..." << std::endl;

  newdata.pos          = pos;
  newdata.target_pos.x = pos.x + 50;
  newdata.target_pos.y = pos.y + 50;

  return newdata.create_EditorObj();
}

void
TeleporterObj::draw (EditorView * view)
{
  //std::cout << "Drawing line" << std::endl;
  view->draw_line (static_cast<int>(data->pos.x), 
                   static_cast<int>(data->pos.y),
                   static_cast<int>(data->target_pos.x), 
                   static_cast<int>(data->target_pos.y),
                   0.0, 1.0, 0.0, 0.5);
  SpriteEditorObj::draw (view);
}

void
TeleporterObj::write_xml (std::ostream& xml) {
  data->write_xml(xml);
}

std::string
TeleporterObj::status_line ()
{
  char str[128];
  snprintf (str, 128, "Teleporter - %f %f %f", data->pos.x, data->pos.y, 
data->pos.z);
  return str;
}

}

/* EOF */

--- NEW FILE: teleporter_obj.hxx ---
//  $Id: teleporter_obj.hxx,v 1.1 2002/09/10 12:11:29 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_EDITOROBJS_TELEPORTER_OBJ_HXX
#define HEADER_PINGUS_EDITOROBJS_TELEPORTER_OBJ_HXX

#include "../editor/sprite_editorobj.hxx"

class EditorView;

namespace WorldObjsData {
  class TeleporterData;
}

namespace EditorObjs {

class TeleporterTargetObj;


class TeleporterObj : public SpriteEditorObj
{
private:
  WorldObjsData::TeleporterData* const data;
  TeleporterTargetObj* target;

public:
  TeleporterObj (WorldObjsData::TeleporterData* data_);

  CL_Vector& get_target_pos_ref ();

  EditorObj* duplicate ();

  void write_xml (std::ostream& xml);

  /** Create this object (and child objects) with reasonable defaults
      for the editor */
  static EditorObjLst create (const CL_Vector& pos);

  void draw (EditorView * view);
  std::string status_line ();

private:
  TeleporterObj (const TeleporterObj&);
  TeleporterObj operator= (const TeleporterObj&);
};

}

#endif

/* EOF */

--- NEW FILE: teleporter_target_obj.cxx ---
//  $Id: teleporter_target_obj.cxx,v 1.1 2002/09/10 12:11:29 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 <ClanLib/Core/Math/cl_vector.h>
#include "teleporter_obj.hxx"
#include "teleporter_target_obj.hxx"

namespace EditorObjs {

TeleporterTargetObj::TeleporterTargetObj (TeleporterObj* arg_teleporter)
                                        : SpriteEditorObj ("teleporter2", 
                                                           "worldobjs",
                                                           
arg_teleporter->get_target_pos_ref()),
                                          teleporter(arg_teleporter)
{
  sprite.set_align_center();
}

EditorObj* 
TeleporterTargetObj::duplicate ()
{
  return teleporter->duplicate();
}

std::string
TeleporterTargetObj::status_line()
{
  const CL_Vector& pos_ref = teleporter->get_target_pos_ref();
  char str[128];
  snprintf(str, 128, "TeleporterTarget - %f %f %f", pos_ref.x, pos_ref.y, 
pos_ref.z);
  return str;
}

}

/* EOF */

--- NEW FILE: teleporter_target_obj.hxx ---
//  $Id: teleporter_target_obj.hxx,v 1.1 2002/09/10 12:11:29 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_EDITOROBJS_TELEPORTER_TARGET_OBJ_HXX
#define HEADER_PINGUS_EDITOROBJS_TELEPORTER_TARGET_OBJ_HXX

#include "../editor/sprite_editorobj.hxx"

namespace EditorObjs {

class TeleporterObj;

/** A pseudo object to represent the teleporter target; all the
    data itself is handled inside the EditorTeleporterObj, but we
    need this helper object to be able to show and move the
    teleporter target inside the editor */
class TeleporterTargetObj : public SpriteEditorObj
{
private:
  TeleporterObj* teleporter;

public:
  /// Basic constructor
  TeleporterTargetObj (TeleporterObj* obj);

  EditorObj* duplicate ();

  /// The saving will be done in EditorTeleporterObj::write_xml
  void write_xml (std::ostream&) { }
  std::string status_line ();

private:
  TeleporterTargetObj (const TeleporterTargetObj&);
  TeleporterTargetObj operator= (const TeleporterTargetObj&);
};

}

#endif

/* EOF */





reply via email to

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