source: trunk/src/debugsprite.cpp @ 132

Last change on this file since 132 was 132, checked in by sam, 11 years ago

Add a debug sprite to the scene.

  • 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 <cstdio>
11
12#include "debugsprite.h"
13#include "game.h"
14#include "tiler.h"
15
16/*
17 * DebugSprite implementation class
18 */
19
20class DebugSpriteData
21{
22    friend class DebugSprite;
23
24private:
25    Game *game;
26    int tiler;
27    int frame;
28};
29
30/*
31 * Public DebugSprite class
32 */
33
34DebugSprite::DebugSprite(Game *game)
35{
36    data = new DebugSpriteData();
37    data->game = game;
38    data->tiler = Tiler::Register("art/test/character-dress.png");
39}
40
41Asset::Group DebugSprite::GetGroup()
42{
43    return GROUP_DEFAULT;
44}
45
46void DebugSprite::TickGame(float delta_time)
47{
48    Asset::TickGame(delta_time);
49}
50
51void DebugSprite::TickRender(float delta_time)
52{
53    Asset::TickRender(delta_time);
54
55    data->game->GetScene()->AddTile((data->tiler << 16) | 15, 300, 200, 200);
56    data->game->GetScene()->AddTile((data->tiler << 16) | 31, 300, 232, 200);
57}
58
59DebugSprite::~DebugSprite()
60{
61    Tiler::Deregister(data->tiler);
62    delete data;
63}
64
Note: See TracBrowser for help on using the repository browser.