source: trunk/src/entity.cpp @ 149

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

Get the timer to talk milliseconds instead of seconds.

  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
1//
2// Deus Hax (working title)
3// Copyright (c) 2010 Sam Hocevar <sam@hocevar.net>
4//
5
6#if defined HAVE_CONFIG_H
7#   include "config.h"
8#endif
9
10#include <cstdlib>
11#include <cstdio>
12
13#include "entity.h"
14#include "ticker.h"
15
16/*
17 * Public Entity class
18 */
19
20Entity::Entity() :
21    next(0),
22    ref(0),
23    destroy(0)
24{
25#if !FINAL_RELEASE
26    state = STATE_IDLE;
27#endif
28    Ticker::Register(this);
29}
30
31Entity::~Entity()
32{
33#if !FINAL_RELEASE
34    if (!destroy)
35        fprintf(stderr, "ERROR: entity destructor called directly\n");
36#endif
37}
38
39Entity::Group Entity::GetGroup()
40{
41    return GROUP_DEFAULT;
42}
43
44void Entity::TickGame(float deltams)
45{
46#if !FINAL_RELEASE
47    if (state != STATE_PRETICK_GAME)
48        fprintf(stderr, "ERROR: invalid entity game tick\n");
49    state = STATE_POSTTICK_GAME;
50#endif
51}
52
53void Entity::TickRender(float deltams)
54{
55#if !FINAL_RELEASE
56    if (state != STATE_PRETICK_RENDER)
57        fprintf(stderr, "ERROR: invalid entity render tick\n");
58    state = STATE_POSTTICK_RENDER;
59#endif
60}
61
62void Entity::Ref()
63{
64    ref++;
65}
66
67int Entity::Unref()
68{
69    return --ref;
70}
71
Note: See TracBrowser for help on using the repository browser.