OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4PXS.h
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 1998-2000, Matthes Bender
5  * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
6  * Copyright (c) 2013-2016, The OpenClonk Team and contributors
7  *
8  * Distributed under the terms of the ISC license; see accompanying file
9  * "COPYING" for details.
10  *
11  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
12  * See accompanying file "TRADEMARK" for details.
13  *
14  * To redistribute this file separately, substitute the full license texts
15  * for the above references.
16  */
17 
18 /* Pixel Sprite system for tiny bits of moving material */
19 
20 #ifndef INC_C4PXS
21 #define INC_C4PXS
22 
23 #include "landscape/C4Material.h"
24 
25 class C4PXS
26 {
27  friend class C4PXSSystem;
28 protected:
29  int32_t Mat{MNone};
31 protected:
32  bool Execute();
33  void Deactivate();
34 };
35 
36 const size_t PXSMax = 10000;
37 
39 {
40 public:
41  C4PXSSystem();
42  ~C4PXSSystem();
43 public:
44  size_t Count;
45 protected:
47 public:
48  void Default();
49  void Clear();
50  void Execute();
51  void Draw(C4TargetFacet &cgo);
52  void Cast(int32_t mat, int32_t num, int32_t tx, int32_t ty, int32_t level);
53  bool Create(int32_t mat, C4Real ix, C4Real iy, C4Real ixdir=Fix0, C4Real iydir=Fix0);
54  bool Load(C4Group &hGroup);
55  bool Save(C4Group &hGroup);
56  int32_t GetCount() const { return Count; } // count all PXS
57  int32_t GetCount(int32_t mat) const; // count PXS of given material
58  int32_t GetCount(int32_t mat, int32_t x, int32_t y, int32_t wdt, int32_t hgt) const; // count PXS of given material in given area. mat==-1 for all materials.
59 protected:
60  C4PXS *New();
61 };
62 
63 extern C4PXSSystem PXS;
64 #endif
C4PXS * New()
Definition: C4PXS.cpp:168
void Cast(int32_t mat, int32_t num, int32_t tx, int32_t ty, int32_t level)
Definition: C4PXS.cpp:309
const size_t PXSMax
Definition: C4PXS.h:36
C4PXSSystem PXS
Definition: C4PXS.cpp:423
void Default()
Definition: C4PXS.cpp:158
Definition: C4PXS.h:25
bool Create(int32_t mat, C4Real ix, C4Real iy, C4Real ixdir=Fix0, C4Real iydir=Fix0)
Definition: C4PXS.cpp:175
C4Real y
Definition: C4PXS.h:30
bool Save(C4Group &hGroup)
Definition: C4PXS.cpp:325
Definition: C4Real.h:58
size_t Count
Definition: C4PXS.h:44
C4Real ydir
Definition: C4PXS.h:30
C4PXSSystem()
Definition: C4PXS.cpp:148
void Deactivate()
Definition: C4PXS.cpp:136
const int32_t MNone
Definition: C4Constants.h:177
bool Execute()
Definition: C4PXS.cpp:33
void Clear()
Definition: C4PXS.cpp:163
bool Load(C4Group &hGroup)
Definition: C4PXS.cpp:358
C4PXS PXS[PXSMax]
Definition: C4PXS.h:46
void Draw(C4TargetFacet &cgo)
Definition: C4PXS.cpp:198
int32_t Mat
Definition: C4PXS.h:29
~C4PXSSystem()
Definition: C4PXS.cpp:153
C4Real xdir
Definition: C4PXS.h:30
int32_t GetCount() const
Definition: C4PXS.h:56
C4Real x
Definition: C4PXS.h:30
void Execute()
Definition: C4PXS.cpp:186
const C4Real Fix0
Definition: C4Real.h:312