mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 07:28:22 -10:00
This refactors FontManager to improve it in several ways: 1. Change all the dynamic memory management to use `new`, rather than mixing `new` and `vm_malloc` 2. Change the current font to use an index rather than a pointer 3. Take advantage of more C++11 features to avoid redundant lookups 4. Use case-insensitive name comparison 5. Avoid overflowing the `fnt->filename` field 6. Use `Warning` rather than `Error` in a non-critical error situation
31 lines
362 B
C++
31 lines
362 B
C++
|
|
#pragma once
|
|
#ifndef FS2_OPEN_FONT_H
|
|
#define FS2_OPEN_FONT_H
|
|
|
|
#include "scripting/ade_api.h"
|
|
#include "graphics/font.h"
|
|
|
|
namespace scripting {
|
|
namespace api {
|
|
|
|
class font_h
|
|
{
|
|
int _fontIndex;
|
|
|
|
public:
|
|
font_h(int fontIndex);
|
|
font_h();
|
|
|
|
font::FSFont* Get() const;
|
|
int GetIndex() const;
|
|
|
|
bool isValid() const;
|
|
};
|
|
|
|
DECLARE_ADE_OBJ(l_Font, font_h);
|
|
|
|
}
|
|
}
|
|
|
|
#endif |