source: trunk/src/sprite.cpp @ 866

Last change on this file since 866 was 866, checked in by sam, 8 years ago

core: more vec?i -> ?veci renames.

File size: 1.1 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#if defined HAVE_CONFIG_H
12#   include "config.h"
13#endif
14
15#include "core.h"
16
17namespace lol
18{
19
20/*
21 * Sprite implementation class
22 */
23
24class SpriteData
25{
26    friend class Sprite;
27
28private:
29    TileSet *tileset;
30    vec3 pos;
31    int id;
32};
33
34/*
35 * Public Sprite class
36 */
37
38Sprite::Sprite(TileSet *tileset, int id)
39  : data(new SpriteData())
40{
41    data->tileset = tileset;
42    data->pos = vec3(0);
43    data->id = id;
44}
45
46void Sprite::TickGame(float deltams)
47{
48    Entity::TickGame(deltams);
49}
50
51void Sprite::TickDraw(float deltams)
52{
53    Entity::TickDraw(deltams);
54
55    Scene::GetDefault()->AddTile(data->tileset, data->id, data->pos, 0);
56}
57
58Sprite::~Sprite()
59{
60    Tiler::Deregister(data->tileset);
61    delete data;
62}
63
64} /* namespace lol */
65
Note: See TracBrowser for help on using the repository browser.