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

« back to all changes in this revision

Viewing changes to src/editor/editorobj.hxx

  • 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: editorobj.hxx,v 1.18 2002/11/28 20:09:54 grumbel Exp $
 
2
// 
 
3
//  Pingus - A free Lemmings clone
 
4
//  Copyright (C) 2000 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
#ifndef HEADER_PINGUS_EDITOR_EDITOROBJ_HXX
 
21
#define HEADER_PINGUS_EDITOR_EDITOROBJ_HXX
 
22
 
 
23
#include "../pingus.hxx"
 
24
#include <string>
 
25
#include <iosfwd>
 
26
#include <vector>
 
27
 
 
28
class CL_Rect;
 
29
class Vector;
 
30
class CL_Component;
 
31
 
 
32
class EditorObj;
 
33
 
 
34
typedef std::vector<EditorObj*> EditorObjLst;
 
35
 
 
36
namespace EditorNS {
 
37
class PropertyFrame;
 
38
class Editor;
 
39
class EditorView;
 
40
} // namespace EditorNS
 
41
 
 
42
/** Interface for all objects which can be shown in the editor */
 
43
class EditorObj
 
44
{
 
45
private:
 
46
  static EditorNS::Editor* editor;
 
47
 
 
48
public:
 
49
  /** Set the parent editor of all objects */
 
50
  static void set_editor(EditorNS::Editor* e) { editor = e; }
 
51
 
 
52
  static EditorNS::Editor* get_editor () { return editor; }
 
53
 
 
54
  EditorObj ();
 
55
  virtual ~EditorObj ();
 
56
 
 
57
  /** Draw the object to the given view */
 
58
  virtual void draw (EditorNS::EditorView * view) =0;
 
59
 
 
60
  /** Called once a game loop, the delta is the time passed since the
 
61
      last update in seconds */
 
62
  virtual void update (float /*delta*/) {};
 
63
 
 
64
  /** Draw a rectangle or shape around the object to the given view */
 
65
  virtual void draw_mark (EditorNS::EditorView * view) =0;
 
66
 
 
67
  /** Return true when the object is under the given coordinates */
 
68
  virtual bool is_over(const Vector&) =0;
 
69
 
 
70
  /** Return true if the object is inside the given rectangle */
 
71
  virtual bool is_in_rect(const CL_Rect& rect) =0;
 
72
 
 
73
  /** Return the z-position of the object, the objects are sorted
 
74
      after this value */
 
75
  virtual float get_z_pos() =0;
 
76
 
 
77
  /** Move the object to the given offset */
 
78
  virtual void set_position_offset(const Vector& offset) =0;
 
79
 
 
80
  /** Generic operations that can make an object larger, what exactly
 
81
      happens is object dependend. Default is to do nothing */
 
82
  virtual void make_larger () {}
 
83
 
 
84
  /** Generic operations that can make an object smaller, what exactly
 
85
      happens is object dependend. Default is to do nothing */
 
86
  virtual void make_smaller () {}
 
87
 
 
88
  /** Flip the object vertical */
 
89
  virtual void vertical_flip () {}
 
90
 
 
91
  /** Flip the object horizontal */
 
92
  virtual void horizontal_flip () {}
 
93
 
 
94
  /** Rotate the object 90 degrees */
 
95
  virtual void rotate_90 () {}
 
96
 
 
97
  /** Rotate the object -90 degrees */
 
98
  virtual void rotate_270 () {}
 
99
 
 
100
  /** This function is called once at the start of an interactive move */
 
101
  virtual void drag () {}
 
102
 
 
103
  /** This function is called once at the end of an interactive move */
 
104
  virtual void drop () {}
 
105
 
 
106
  /** Write the given object down into a XML file */
 
107
  virtual void write_xml(std::ostream& xml) =0;
 
108
 
 
109
  /** Return a string that is shown in the status line */
 
110
  virtual std::string status_line();
 
111
 
 
112
  /** Duplicate the given editor object and return a the copied
 
113
      object */
 
114
  virtual EditorObj* duplicate() =0;
 
115
 
 
116
  /** Return a pointer to a CL_Component which can be used to
 
117
      manipulate the properties of this gameobject. The caller is
 
118
      responsible for deleting the object after usage. The
 
119
      CL_Component* should/must be a CL_Frame so that it can get
 
120
      embedded in the properties window */
 
121
  virtual EditorNS::PropertyFrame* get_gui_dialog (EditorNS::Editor* parent) =0;
 
122
  
 
123
protected:
 
124
  EditorObj (const EditorObj&) { }
 
125
  EditorObj& operator= (const EditorObj&) { return *this; }
 
126
};
 
127
 
 
128
#endif
 
129
 
 
130
/* EOF */