source: trunk/src/forge.cpp @ 2370

Last change on this file since 2370 was 2183, checked in by sam, 7 years ago

build: fix the WTFPL site URL in all code comments.

  • Property svn:keywords set to Id
File size: 1018 bytes
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://www.wtfpl.net/ 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 * Forge implementation class
22 */
23
24static class ForgeData
25{
26    friend class Forge;
27
28public:
29    Dict fonts;
30}
31forgedata;
32
33static ForgeData * const data = &forgedata;
34
35/*
36 * Public Forge class
37 */
38
39int Forge::Register(char const *path)
40{
41    int id = data->fonts.MakeSlot(path);
42
43    if (!data->fonts.GetEntity(id))
44    {
45        Font *font = new Font(path);
46        data->fonts.SetEntity(id, font);
47    }
48
49    return id;
50}
51
52void Forge::Deregister(int id)
53{
54    data->fonts.RemoveSlot(id);
55}
56
57Font *Forge::GetFont(int id)
58{
59    return (Font *)data->fonts.GetEntity(id);
60}
61
62} /* namespace lol */
63
Note: See TracBrowser for help on using the repository browser.