removed temporary code

This commit is contained in:
2024-09-10 20:28:11 +05:00
parent 71f77ce89c
commit e71a6b71fe
6 changed files with 83 additions and 18 deletions

View File

@@ -68,9 +68,10 @@ class Method<ReturnT(ArgTypes...)>
public:
ReturnT operator()(MonoObject* class_instance, ArgTypes... args) {
void* arg_array[] = { valueToVoidPtr(args)..., nullptr };
// TODO: exception catch
// MonoException* ex = nullptr;
MonoObject* result = mono_runtime_invoke(method_ptr, class_instance, arg_array, nullptr);
MonoObject* ex = nullptr;
MonoObject* result = mono_runtime_invoke(method_ptr, class_instance, arg_array, &ex);
if(ex) //TODO: call mono_trace_set_printerr_handler from mono/mono/utils/mono-logger.h
mono_print_unhandled_exception(ex);
return valueFromMonoObject<ReturnT>(result);
};

View File

@@ -9,30 +9,29 @@
using namespace ougge;
std::vector<GUI::UpdatingFunc> updateCallbacks;
void update(f64 deltaTime){
// std::cout<<"deltaTime: "<<deltaTime<<std::endl;
for(auto upd : updateCallbacks){
upd(deltaTime);
}
}
int main(int argc, const char** argv){
try {
// Resources::init();
// std::cout<<"initialized resource loader"<<std::endl;
Resources::init();
std::cout<<"initialized resource loader"<<std::endl;
Mono::RuntimeJIT mono;
auto a = mono.loadAssembly("app.exe");
auto c = a->getClass("", "A");
auto m = Mono::Method<Mono::Int(Mono::Byte, Mono::Float)>(c, "Method");
std::cout<<"method has been found"<<std::endl;
Mono::Int r = m(nullptr, 16, 0.32);
std::cout<<"result: "<<r<<std::endl;
return 0;
std::cout<<"initialized mono jit runtime"<<std::endl;
// GUI::MainWindow w;
// w.open("ougge", update);
// std::cout<<"created sdl window"<<std::endl;
// w.startUpdateLoop();
// std::cout<<"sdl window has been cosed"<<std::endl;
updateCallbacks.push_back([](f64 deltaTime) -> void { std::cout<<"deltaTime: "<<deltaTime<<std::endl; });
GUI::MainWindow w;
w.open("ougge", update);
std::cout<<"created sdl window"<<std::endl;
w.startUpdateLoop();
std::cout<<"sdl window has been cosed"<<std::endl;
}
catch(const std::exception& e){
std::cerr<<"Catched exception: "<<e.what()<<std::endl;