source: trunk/src/forge.cpp @ 221

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

Complete Lol Engine / Deus Hax / Monsterz split.

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