source: trunk/src/entity.cpp @ 150

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

Replace mouse scrolling with a joystick simulated by the e/s/d/f keys.

  • Property svn:keywords set to Id
File size: 1.0 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 "core.h"
14
15/*
16 * Public Entity class
17 */
18
19Entity::Entity() :
20    next(0),
21    ref(0),
22    destroy(0)
23{
24#if !FINAL_RELEASE
25    state = STATE_IDLE;
26#endif
27    Ticker::Register(this);
28}
29
30Entity::~Entity()
31{
32#if !FINAL_RELEASE
33    if (!destroy)
34        fprintf(stderr, "ERROR: entity destructor called directly\n");
35#endif
36}
37
38Entity::Group Entity::GetGroup()
39{
40    return GROUP_DEFAULT;
41}
42
43void Entity::TickGame(float deltams)
44{
45#if !FINAL_RELEASE
46    if (state != STATE_PRETICK_GAME)
47        fprintf(stderr, "ERROR: invalid entity game tick\n");
48    state = STATE_POSTTICK_GAME;
49#endif
50}
51
52void Entity::TickRender(float deltams)
53{
54#if !FINAL_RELEASE
55    if (state != STATE_PRETICK_RENDER)
56        fprintf(stderr, "ERROR: invalid entity render tick\n");
57    state = STATE_POSTTICK_RENDER;
58#endif
59}
60
61void Entity::Ref()
62{
63    ref++;
64}
65
66int Entity::Unref()
67{
68    return --ref;
69}
70
Note: See TracBrowser for help on using the repository browser.