2024-05-06 09:58:40 -03:00
|
|
|
#ifndef XNA_PLATFORM_INIT_HPP
|
|
|
|
#define XNA_PLATFORM_INIT_HPP
|
|
|
|
|
|
|
|
#include "../default.hpp"
|
2024-05-08 20:42:15 -03:00
|
|
|
#include "../csharp/type.hpp"
|
|
|
|
#include "../content/typereadermanager.hpp"
|
2024-05-23 16:50:41 -03:00
|
|
|
#include "../platforminit.hpp"
|
2024-05-06 09:58:40 -03:00
|
|
|
|
|
|
|
namespace xna {
|
2024-05-23 16:50:41 -03:00
|
|
|
struct PlatformInit {
|
2024-05-06 09:58:40 -03:00
|
|
|
static void Init() {
|
|
|
|
InitRegisteredTypes();
|
|
|
|
InitActivadors();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void InitRegisteredTypes();
|
|
|
|
static void InitActivadors();
|
2024-05-08 20:42:15 -03:00
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
}
|
2024-05-23 16:50:41 -03:00
|
|
|
};
|
2024-05-06 09:58:40 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|