mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
36 lines
927 B
C++
36 lines
927 B
C++
#ifndef XNA_PLATFORM_INIT_HPP
|
|
#define XNA_PLATFORM_INIT_HPP
|
|
|
|
#include "../default.hpp"
|
|
#include "../csharp/type.hpp"
|
|
#include "../content/typereadermanager.hpp"
|
|
|
|
namespace xna {
|
|
struct InitPlatform {
|
|
static void Init() {
|
|
InitRegisteredTypes();
|
|
InitActivadors();
|
|
}
|
|
|
|
static void InitRegisteredTypes();
|
|
static void InitActivadors();
|
|
|
|
private:
|
|
template <typename T>
|
|
static void insertRegisteredReader(String const& readerName) {
|
|
const auto reader = typeof<T>();
|
|
Type::NameOfRegisteredTypes.insert({ "xna::" + readerName, reader });
|
|
Type::NameOfRegisteredTypes.insert({ "Microsoft.Xna.Framework.Content." + readerName, reader });
|
|
}
|
|
|
|
template <typename T>
|
|
static void insertActivadorReader() {
|
|
ContentTypeReaderActivador::SetActivador(typeof<T>(), []() -> sptr<ContentTypeReader> {
|
|
auto obj = New <T>();
|
|
return reinterpret_pointer_cast<ContentTypeReader>(obj);
|
|
});
|
|
}
|
|
};
|
|
}
|
|
|
|
#endif |