source: trunk/src/entity.h @ 154

Last change on this file since 154 was 154, checked in by sam, 10 years ago

Refactor stuff.

  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1//
2// Deus Hax (working title)
3// Copyright (c) 2010 Sam Hocevar <sam@hocevar.net>
4//
5
6//
7// The Entity class
8// ---------------
9// Entities are objects that can be ticked by the game loop and/or the render
10// loop. Entities are implemented as one or several linked lists. See the
11// Ticker class for the ticking logic and the linked list implementation.
12//
13
14#if !defined __DH_ENTITY_H__
15#define __DH_ENTITY_H__
16
17#include <stdint.h>
18
19class Entity
20{
21    friend class Ticker;
22    friend class TickerData;
23    friend class Dict;
24
25public:
26    virtual void Ref();
27    virtual int Unref();
28
29protected:
30    typedef enum
31    {
32        GROUP_BEFORE = 0,
33        GROUP_DEFAULT,
34        GROUP_AFTER,
35        GROUP_DRAW_CAPTURE,
36        // Must be the last element
37        GROUP_COUNT
38    }
39    Group;
40
41    Entity();
42    virtual ~Entity();
43
44    virtual char const *GetName();
45    virtual Group GetGroup();
46
47    virtual void TickGame(float deltams);
48    virtual void TickDraw(float deltams);
49
50    Entity *next;
51    int ref, destroy;
52
53#if !FINAL_RELEASE
54    enum
55    {
56        STATE_IDLE = 0,
57        STATE_PRETICK_GAME,
58        STATE_POSTTICK_GAME,
59        STATE_PRETICK_DRAW,
60        STATE_POSTTICK_DRAW,
61    }
62    state;
63#endif
64};
65
66#endif // __DH_ENTITY_H__
67
Note: See TracBrowser for help on using the repository browser.