MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Element_Empty.h
Go to the documentation of this file.
1 /* -*- mode:C++ -*-
2  Element_Empty.h MFM representation of empty space
3  Copyright (C) 2014 The Regents of the University of New Mexico. All rights reserved.
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
28 #ifndef ELEMENT_EMPTY_H
29 #define ELEMENT_EMPTY_H
30 
31 #include "Element.h"
32 #include "EventWindow.h"
33 #include "itype.h"
34 
35 namespace MFM
36 {
37 
38 #define EMPTY_VERSION 0
39 
40  template <class CC>
41  class Element_Empty : public Element<CC>
42  {
43  // Extract short names for parameter types
44  typedef typename CC::ATOM_TYPE T;
45 
46  public:
47  static Element_Empty THE_INSTANCE;
48 
49  Element_Empty() : Element<CC>(MFM_UUID_FOR("Empty", EMPTY_VERSION))
50  {
51  Element<CC>::AllocateType(); // For empty only, allocate type immediately
53  Element<CC>::SetName("Empty");
54  }
55 
56  virtual u32 PercentMovable(const T& you,
57  const T& me, const SPoint& offset) const
58  {
59  return 100;
60  }
61 
62  virtual const char* GetDescription() const
63  {
64  return "The Element which represents empty space. Events do not occur for this Element.";
65  }
66 
67  virtual u32 DefaultPhysicsColor() const
68  {
69  return 0x00000000; // Not black.. transparent
70  }
71 
72  virtual u32 DefaultLowlightColor() const
73  {
74  return 0x00000000;
75  }
76 
77  virtual void Behavior(EventWindow<CC>& window) const
78  { }
79  };
80 
81  template <class CC>
82  Element_Empty<CC> Element_Empty<CC>::THE_INSTANCE;
83 }
84 
85 #endif /* ELEMENT_EMPTY_H */
virtual u32 DefaultLowlightColor() const
Definition: Element_Empty.h:72
Definition: Element_Empty.h:41
virtual void Behavior(EventWindow< CC > &window) const
Definition: Element_Empty.h:77
void AllocateType()
Definition: Element.h:273
virtual u32 DefaultPhysicsColor() const
Definition: Element_Empty.h:67
void SetName(const char *name)
Definition: Element.h:209
void SetAtomicSymbol(const char *symbol)
Definition: Element.h:193
Definition: ElementTable.h:43
virtual const char * GetDescription() const
Definition: Element_Empty.h:62
Definition: Atom.h:43
virtual u32 PercentMovable(const T &you, const T &me, const SPoint &offset) const
Definition: Element_Empty.h:56