This commit is contained in:
Timerix 2024-09-10 16:00:16 +05:00
parent 9eef21df1b
commit 42b233e6a4
4 changed files with 7 additions and 11 deletions

View File

@ -1,9 +1,8 @@
#pragma once #pragma once
#include "../std.hpp" #include "../std.hpp"
#include "../UsefulException.hpp" #include "../UsefulException.hpp"
#include "../format.hpp" #include "../format.hpp"
#include <memory>
#include <string>
#include <functional> #include <functional>
#include <vector> #include <vector>
#include <map> #include <map>
@ -29,6 +28,7 @@ typedef MonoString* String;
typedef MonoObject* Object; typedef MonoObject* Object;
typedef void Void; typedef void Void;
template<typename PrimitiveT> template<typename PrimitiveT>
MonoClass* getClass(); MonoClass* getClass();
@ -55,10 +55,7 @@ void getMethodSignatureTypes(MonoMethod* mono_method,
MonoType** return_type, MonoType** return_type,
std::vector<MonoType*>& argument_types); std::vector<MonoType*>& argument_types);
/// @brief all types must have template implementation of getClass<T>() /// all types must implement getClass<T>()
/// @tparam ReturnT return type
/// @tparam ...ArgTypes argument types
/// @return function which takes arguments and returns value of ReturnT
template<typename ReturnT, typename... ArgTypes> template<typename ReturnT, typename... ArgTypes>
std::shared_ptr<std::function<ReturnT(MonoObject*, ArgTypes...)>> getMethod( std::shared_ptr<std::function<ReturnT(MonoObject*, ArgTypes...)>> getMethod(
MonoClass* target_class, MonoClass* target_class,
@ -114,6 +111,7 @@ std::shared_ptr<std::function<ReturnT(MonoObject*, ArgTypes...)>> getMethod(
); );
} }
class Assembly { class Assembly {
MonoAssembly* ptr; MonoAssembly* ptr;
MonoImage* image; MonoImage* image;
@ -125,6 +123,7 @@ public:
MonoClass* getClass(const std::string& name_space, const std::string& name); MonoClass* getClass(const std::string& name_space, const std::string& name);
}; };
///LINUX: `config.xml`, `mscorelib.dll`, `libmono-native.so` in `mono-libs` directory ///LINUX: `config.xml`, `mscorelib.dll`, `libmono-native.so` in `mono-libs` directory
/// ///
///WINDOWS: `config.xml`, `mscorelib.dll` in `mono-libs` directory ///WINDOWS: `config.xml`, `mscorelib.dll` in `mono-libs` directory
@ -138,4 +137,4 @@ public:
std::shared_ptr<Assembly> loadAssembly(const std::string& name); std::shared_ptr<Assembly> loadAssembly(const std::string& name);
}; };
} // namespace Mono }

View File

@ -2,9 +2,7 @@
#include "../std.hpp" #include "../std.hpp"
#include <iostream> #include <iostream>
#include <memory>
#include <functional> #include <functional>
#include <optional>
#include <unordered_map> #include <unordered_map>
namespace ougge::Resources { namespace ougge::Resources {

View File

@ -1,9 +1,7 @@
#pragma once #pragma once
#include <string>
#include <iostream> #include <iostream>
#include <optional> #include <optional>
#include <memory>
#include <SDL.h> #include <SDL.h>
#include "Resources.hpp" #include "Resources.hpp"
#include "../math.hpp" #include "../math.hpp"

View File

@ -2,6 +2,7 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#include <memory>
typedef int8_t i8; typedef int8_t i8;
typedef uint8_t u8; typedef uint8_t u8;