|
|
|
|
@ -39,6 +39,8 @@ namespace lunarium
|
|
|
|
|
OpRes CoreAPI::Initialize(WrenState& sman)
|
|
|
|
|
{
|
|
|
|
|
mCat = sman.GetLogCat();
|
|
|
|
|
// Initialize Foreign methods
|
|
|
|
|
mForeignMethods.push_back({"CoreAPI", "Core", true, "IsKeyDown(_)", (ForeignMethod)&CoreAPI::IsKeyDown});
|
|
|
|
|
|
|
|
|
|
// Register callbacks
|
|
|
|
|
sman.RegisterForeignMethodBinder((FMBinder*)&CoreAPI::ForeignMethodBinder);
|
|
|
|
|
@ -55,8 +57,9 @@ namespace lunarium
|
|
|
|
|
mScript.SetModuleName("CoreAPI");
|
|
|
|
|
std::string code = File::ReadTextFile("core_api.wren"); // This will eventually move to internal data
|
|
|
|
|
mScript.SetScriptCode(code);
|
|
|
|
|
sman.RunScript(&mScript);
|
|
|
|
|
|
|
|
|
|
// Register methods
|
|
|
|
|
// Get Method Handles
|
|
|
|
|
|
|
|
|
|
// return OpRes::Fail("CoreAPI::Initialize not implemented yet!");
|
|
|
|
|
return OpRes::OK();
|
|
|
|
|
@ -70,7 +73,7 @@ namespace lunarium
|
|
|
|
|
{
|
|
|
|
|
if (FMID == (*iter))
|
|
|
|
|
{
|
|
|
|
|
iter->FM;
|
|
|
|
|
return iter->FM;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -118,8 +121,10 @@ namespace lunarium
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CoreAPI::IsKeyDown(WrenVM* vm)
|
|
|
|
|
void CoreAPI::IsKeyDown(WrenVM* vm)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
u32 key_code = (u32)wrenGetSlotDouble(vm, 1);
|
|
|
|
|
bool result = Core::Input().IsKeyDown((KeyCode)key_code, true);
|
|
|
|
|
wrenSetSlotBool(vm, 0, result);
|
|
|
|
|
}
|
|
|
|
|
}
|