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 solid_color_background_obj


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/editorobjs solid_color_background_obj.cxx,NONE,1.1 solid_color_background_obj.hxx,NONE,1.1 Makefile.am,1.5,1.6
Date: 15 Sep 2002 09:54:36 -0000

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

Modified Files:
        Makefile.am 
Added Files:
        solid_color_background_obj.cxx solid_color_background_obj.hxx 
Log Message:
splitted SolidColorBackground


--- NEW FILE: solid_color_background_obj.cxx ---
//  $Id: solid_color_background_obj.cxx,v 1.1 2002/09/15 09:54:34 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 <ostream>
#include "../string_converter.hxx"
#include "../xml_helper.hxx"
#include "../editor/editor_view.hxx"
#include "../worldobjsdata/solid_color_background_data.hxx"
#include "solid_color_background_obj.hxx"

namespace EditorObjs {

SolidColorBackgroundObj::SolidColorBackgroundObj 
(WorldObjsData::SolidColorBackgroundData* data_)
  : data(new WorldObjsData::SolidColorBackgroundData(*data_))
{
}

SolidColorBackgroundObj::~SolidColorBackgroundObj ()
{
  delete data;
}

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

EditorObj*
SolidColorBackgroundObj::duplicate ()
{
  return new SolidColorBackgroundObj(data);
}

float
SolidColorBackgroundObj::get_z_pos ()
{
  return data->pos.z;
}

CL_Vector
SolidColorBackgroundObj::get_upper_left_corner ()
{ 
  return data->pos; 
}

void
SolidColorBackgroundObj::draw (EditorNS::EditorView* view)
{
  view->draw_fillrect(static_cast<int>(data->pos.x),
                      static_cast<int>(data->pos.y),
                      static_cast<int>(data->pos.x + 256),
                      static_cast<int>(data->pos.y + 256),
                      data->color.red,
                      data->color.green,
                      data->color.blue,
                      data->color.alpha);
}

void
SolidColorBackgroundObj::set_position_offset (const CL_Vector& offset)
{
  data->pos += offset;
}  

std::string
SolidColorBackgroundObj::status_line ()
{
  return "SolidColorBackground: " 
         + to_string(data->pos.x) + ", "
         + to_string(data->pos.y) + ", "
         + to_string(data->pos.z);
}

} // namespace EditorObjs

/* EOF */

--- NEW FILE: solid_color_background_obj.hxx ---
//  $Id: solid_color_background_obj.hxx,v 1.1 2002/09/15 09:54:34 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_SOLID_COLOR_BACKGROUND_OBJ_HXX
#define HEADER_PINGUS_EDITOROBJS_SOLID_COLOR_BACKGROUND_OBJ_HXX

#include "../editor/rect_editorobj.hxx"

namespace WorldObjsData {
class SolidColorBackgroundData;
}

namespace EditorObjs {

class SolidColorBackgroundObj : public RectEditorObj
{
private:
  WorldObjsData::SolidColorBackgroundData* const data;
  
public:
  SolidColorBackgroundObj (WorldObjsData::SolidColorBackgroundData* data_);
 ~SolidColorBackgroundObj ();
 
  void write_xml (std::ostream& xml);

  /// Return the object width
  int get_width () { return 256; }
  
  /// Return the object height
  int get_height () { return 256; }

  EditorObj* duplicate ();

  float get_z_pos ();

  CL_Vector get_upper_left_corner ();

  void draw (EditorNS::EditorView* view);
  
  void set_position_offset (const CL_Vector& offset);  

  std::string status_line ();
         
private:
  SolidColorBackgroundObj (const SolidColorBackgroundObj&);
  SolidColorBackgroundObj operator= (const SolidColorBackgroundObj&);
};

} // namespace EditorObjs

#endif

/* EOF */

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editorobjs/Makefile.am,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Makefile.am 14 Sep 2002 19:06:34 -0000      1.5
+++ Makefile.am 15 Sep 2002 09:54:34 -0000      1.6
@@ -18,19 +18,20 @@
 noinst_LIBRARIES = libpingus_editorobjs.a
 
 libpingus_editorobjs_a_SOURCES = \
-       bumper_obj.cxx             bumper_obj.hxx \
-       conveyor_belt_obj.cxx      conveyer_belt_obj.hxx \
-       fake_exit_obj.cxx          fake_exit_obj.hxx \
-       guillotine_obj.cxx         guillotine_obj.hxx \
-       hammer_obj.cxx             hammer_obj.hxx \
-       ice_block_obj.cxx          ice_block_obj.hxx \
-       info_box_obj.cxx           info_box_obj.hxx \
-       laser_exit_obj.cxx         laser_exit_obj.hxx \
-       smasher_obj.cxx            smasher_obj.hxx \
-       spike_obj.cxx              spike_obj.hxx \
-       switch_door_obj.cxx        switch_door_obj.hxx \
-        switch_door_switch_obj.cxx switch_door_switch_obj.hxx \
-       teleporter_obj.cxx         teleporter_obj.hxx \
-       teleporter_target_obj.cxx  teleporter_target_obj.cxx
+       bumper_obj.cxx                 bumper_obj.hxx \
+       conveyor_belt_obj.cxx          conveyer_belt_obj.hxx \
+       fake_exit_obj.cxx              fake_exit_obj.hxx \
+       guillotine_obj.cxx             guillotine_obj.hxx \
+       hammer_obj.cxx                 hammer_obj.hxx \
+       ice_block_obj.cxx              ice_block_obj.hxx \
+       info_box_obj.cxx               info_box_obj.hxx \
+       laser_exit_obj.cxx             laser_exit_obj.hxx \
+       smasher_obj.cxx                smasher_obj.hxx \
+       solid_color_background_obj.cxx solid_color_background_obj.hxx \
+       spike_obj.cxx                  spike_obj.hxx \
+       switch_door_obj.cxx            switch_door_obj.hxx \
+        switch_door_switch_obj.cxx     switch_door_switch_obj.hxx \
+       teleporter_obj.cxx             teleporter_obj.hxx \
+       teleporter_target_obj.cxx      teleporter_target_obj.cxx
 
 # EOF #





reply via email to

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