source: trunk/src/sprite.cpp @ 1031

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

sprite: remove spurious property that caused sprites to be always displayed
at (0,0).

File size: 1.0 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    int id;
31};
32
33/*
34 * Public Sprite class
35 */
36
37Sprite::Sprite(TileSet *tileset, int id)
38  : data(new SpriteData())
39{
40    data->tileset = tileset;
41    data->id = id;
42}
43
44void Sprite::TickGame(float deltams)
45{
46    Entity::TickGame(deltams);
47}
48
49void Sprite::TickDraw(float deltams)
50{
51    Entity::TickDraw(deltams);
52
53    Scene::GetDefault()->AddTile(data->tileset, data->id, position, 0);
54}
55
56Sprite::~Sprite()
57{
58    Tiler::Deregister(data->tileset);
59    delete data;
60}
61
62} /* namespace lol */
63
Note: See TracBrowser for help on using the repository browser.