~ubuntu-branches/ubuntu/precise/pingus/precise

« back to all changes in this revision

Viewing changes to src/editorobjs/bumper_obj.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Raphael Goulais
  • Date: 2004-08-09 10:26:00 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040809102600-lg2q9lfars0q1p42
Tags: 0.6.0-8
Applied patch from Andreas Jochens (Closes: #263992)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  $Id: bumper_obj.cxx,v 1.9 2002/09/28 11:52:24 torangan Exp $
 
2
//
 
3
//  Pingus - A free Lemmings clone
 
4
//  Copyright (C) 1999 Ingo Ruhnke <grumbel@gmx.de>
 
5
//
 
6
//  This program is free software; you can redistribute it and/or
 
7
//  modify it under the terms of the GNU General Public License
 
8
//  as published by the Free Software Foundation; either version 2
 
9
//  of the License, or (at your option) any later version.
 
10
//
 
11
//  This program is distributed in the hope that it will be useful,
 
12
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
//  GNU General Public License for more details.
 
15
//
 
16
//  You should have received a copy of the GNU General Public License
 
17
//  along with this program; if not, write to the Free Software
 
18
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
19
 
 
20
#include <stdio.h>
 
21
#include "bumper_obj.hxx"
 
22
#include "../editor/editor_view.hxx"
 
23
#include "../worldobjsdata/bumper_data.hxx"
 
24
 
 
25
namespace EditorObjs {
 
26
 
 
27
BumperObj::BumperObj (const WorldObjsData::BumperData& data_)
 
28
  : data(new WorldObjsData::BumperData(data_)),
 
29
    frame(0)
 
30
{
 
31
  data->pos.z = -100;
 
32
  sprite = Sprite("Traps/bumper", "traps");
 
33
  sprite.set_align_center_bottom();
 
34
 
 
35
  pos_ref = &data->pos;
 
36
}
 
37
 
 
38
BumperObj::~BumperObj ()
 
39
{
 
40
  delete data;
 
41
}
 
42
 
 
43
EditorObjLst
 
44
BumperObj::create (const Vector& pos)
 
45
{
 
46
  WorldObjsData::BumperData newdata;
 
47
  newdata.pos = pos;
 
48
  return EditorObjLst(1, new BumperObj(newdata));
 
49
}
 
50
 
 
51
EditorObj*
 
52
BumperObj::duplicate ()
 
53
{
 
54
  return new BumperObj(*data);
 
55
}
 
56
 
 
57
void
 
58
BumperObj::write_xml (std::ostream& xml)
 
59
{
 
60
  data->write_xml(xml);
 
61
}
 
62
 
 
63
void
 
64
BumperObj::draw (EditorNS::EditorView* view)
 
65
{
 
66
  view->draw(sprite, data->pos, frame);
 
67
}
 
68
 
 
69
std::string  
 
70
BumperObj::status_line ()
 
71
{
 
72
  char str[64];
 
73
  snprintf (str, 64, "BumperObj: %4.2fx%4.2fx%4.2f", data->pos.x, data->pos.y, data->pos.z);
 
74
  return str;
 
75
}
 
76
  
 
77
} // namespace EditorObjs
 
78
 
 
79
/* EOF */