source: trunk/src/forge.cpp @ 2183

Last change on this file since 2183 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
RevLine 
[111]1//
[221]2// Lol Engine
[111]3//
[221]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
[2183]8//   http://www.wtfpl.net/ for more details.
[221]9//
[111]10
11#if defined HAVE_CONFIG_H
12#   include "config.h"
13#endif
14
[150]15#include "core.h"
[111]16
[686]17namespace lol
18{
19
[111]20/*
21 * Forge implementation class
22 */
23
24static class ForgeData
25{
26    friend class Forge;
27
28public:
[153]29    Dict fonts;
[111]30}
31forgedata;
32
33static ForgeData * const data = &forgedata;
34
35/*
36 * Public Forge class
37 */
38
[153]39int Forge::Register(char const *path)
[111]40{
[153]41    int id = data->fonts.MakeSlot(path);
[111]42
[153]43    if (!data->fonts.GetEntity(id))
[111]44    {
[153]45        Font *font = new Font(path);
46        data->fonts.SetEntity(id, font);
[111]47    }
48
[153]49    return id;
50}
[111]51
[153]52void Forge::Deregister(int id)
53{
54    data->fonts.RemoveSlot(id);
[111]55}
56
[153]57Font *Forge::GetFont(int id)
[111]58{
[153]59    return (Font *)data->fonts.GetEntity(id);
[111]60}
61
[686]62} /* namespace lol */
63
Note: See TracBrowser for help on using the repository browser.