source: trunk/src/entity.h @ 658

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

Get rid of the SHADER_CRAP macro and use LOL_EXPERIMENTAL instead,
together with the --enable-experimental flag. Use LOL_DEBUG and
LOL_RELEASE instead of the previous values.

  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://sam.zoy.org/projects/COPYING.WTFPL for more details.
9//
10
11//
12// The Entity class
13// ---------------
14// Entities are objects that can be ticked by the game loop and/or the render
15// loop. Entities are implemented as one or several linked lists. See the
16// Ticker class for the ticking logic and the linked list implementation.
17//
18
19#if !defined __DH_ENTITY_H__
20#define __DH_ENTITY_H__
21
22#include <stdint.h>
23
24class Entity
25{
26    friend class Ticker;
27    friend class TickerData;
28    friend class Dict;
29
30protected:
31    Entity();
32    virtual ~Entity();
33
34    virtual char const *GetName();
35    inline int IsDestroying() { return destroy; }
36
37    virtual void TickGame(float deltams);
38    virtual void TickDraw(float deltams);
39
40    enum
41    {
42        GAMEGROUP_BEFORE = 0,
43        GAMEGROUP_DEFAULT,
44        GAMEGROUP_AFTER,
45        // Must be the last element
46        GAMEGROUP_END
47    }
48    gamegroup;
49
50    enum
51    {
52        DRAWGROUP_BEFORE = GAMEGROUP_END,
53        DRAWGROUP_DEFAULT,
54        DRAWGROUP_HUD,
55        DRAWGROUP_CAPTURE,
56        // Must be the last element
57        DRAWGROUP_END
58    }
59    drawgroup;
60
61    static int const GAMEGROUP_BEGIN = 0;
62    static int const DRAWGROUP_BEGIN = GAMEGROUP_END;
63    static int const ALLGROUP_END = DRAWGROUP_END;
64
65#if !LOL_RELEASE
66    enum
67    {
68        STATE_IDLE = 0,
69        STATE_PRETICK_GAME,
70        STATE_POSTTICK_GAME,
71        STATE_PRETICK_DRAW,
72        STATE_POSTTICK_DRAW,
73    }
74    state;
75#endif
76
77private:
78    Entity *gamenext, *drawnext, *autonext;
79    int ref, autorelease, destroy;
80};
81
82#endif // __DH_ENTITY_H__
83
Note: See TracBrowser for help on using the repository browser.