Last change
on this file since 1687 was
1198,
checked in by sam, 9 years ago
|
core: allow each blitted tile to be stretched differently.
|
-
Property svn:keywords set to
Id
|
File size:
1.1 KB
|
Line | |
---|
1 | // |
---|
2 | // Lol Engine |
---|
3 | // |
---|
4 | // Copyright: (c) 2010-2012 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 | |
---|
17 | namespace lol |
---|
18 | { |
---|
19 | |
---|
20 | /* |
---|
21 | * Tiler implementation class |
---|
22 | */ |
---|
23 | |
---|
24 | static class TilerData |
---|
25 | { |
---|
26 | friend class Tiler; |
---|
27 | |
---|
28 | public: |
---|
29 | TilerData() |
---|
30 | { } |
---|
31 | |
---|
32 | private: |
---|
33 | Dict tilesets; |
---|
34 | } |
---|
35 | tilerdata; |
---|
36 | |
---|
37 | static TilerData * const data = &tilerdata; |
---|
38 | |
---|
39 | /* |
---|
40 | * Public Tiler class |
---|
41 | */ |
---|
42 | |
---|
43 | TileSet *Tiler::Register(char const *path, ivec2 size, ivec2 count) |
---|
44 | { |
---|
45 | int id = data->tilesets.MakeSlot(path); |
---|
46 | TileSet *tileset = (TileSet *)data->tilesets.GetEntity(id); |
---|
47 | |
---|
48 | if (!tileset) |
---|
49 | { |
---|
50 | tileset = new TileSet(path, size, count); |
---|
51 | data->tilesets.SetEntity(id, tileset); |
---|
52 | } |
---|
53 | |
---|
54 | return tileset; |
---|
55 | } |
---|
56 | |
---|
57 | void Tiler::Deregister(TileSet *tileset) |
---|
58 | { |
---|
59 | data->tilesets.RemoveSlot(tileset); |
---|
60 | } |
---|
61 | |
---|
62 | } /* namespace lol */ |
---|
63 | |
---|
Note: See
TracBrowser
for help on using the repository browser.