source: trunk/src/forge.cpp @ 153

Last change on this file since 153 was 153, checked in by sam, 9 years ago

Factor Forge and Tiler using the new Dict class.

  • Property svn:keywords set to Id
File size: 796 bytes
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 "core.h"
11
12#if defined WIN32
13#   define strcasecmp _stricmp
14#endif
15
16/*
17 * Forge implementation class
18 */
19
20static class ForgeData
21{
22    friend class Forge;
23
24public:
25    Dict fonts;
26}
27forgedata;
28
29static ForgeData * const data = &forgedata;
30
31/*
32 * Public Forge class
33 */
34
35int Forge::Register(char const *path)
36{
37    int id = data->fonts.MakeSlot(path);
38
39    if (!data->fonts.GetEntity(id))
40    {
41        Font *font = new Font(path);
42        data->fonts.SetEntity(id, font);
43    }
44
45    return id;
46}
47
48void Forge::Deregister(int id)
49{
50    data->fonts.RemoveSlot(id);
51}
52
53Font *Forge::GetFont(int id)
54{
55    return (Font *)data->fonts.GetEntity(id);
56}
57
Note: See TracBrowser for help on using the repository browser.