source: trunk/src/asset.h @ 101

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

Implement ticking groups.

  • Property svn:keywords set to Id
File size: 925 bytes
Line 
1//
2// Deus Hax (working title)
3// Copyright (c) 2010 Sam Hocevar <sam@hocevar.net>
4//
5
6//
7// The Asset class
8// ---------------
9// Assets are objects that can be ticked by the game loop and/or the render
10// loop. Assets 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_ASSET_H__
15#define __DH_ASSET_H__
16
17#include <stdint.h>
18
19class Asset
20{
21    friend class Ticker;
22    friend class TickerData;
23
24public:
25    Asset();
26    virtual ~Asset();
27
28    virtual void Ref();
29    virtual int Unref();
30
31protected:
32    typedef enum
33    {
34        GROUP_BEFORE = 0,
35        GROUP_DEFAULT,
36        GROUP_AFTER,
37        GROUP_COUNT
38    }
39    Group;
40
41    virtual Group GetGroup();
42
43    virtual void TickGame(float delta_time);
44    virtual void TickRender(float delta_time);
45
46    Asset *next;
47    int ref, destroy;
48};
49
50#endif // __DH_ASSET_H__
51
Note: See TracBrowser for help on using the repository browser.