source: trunk/src/forge.cpp @ 221

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

Complete Lol Engine / Deus Hax / Monsterz split.

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