mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-25 01:23:52 +00:00
Remove CInterface script hooks, superseded by console refactor
This commit is contained in:
parent
a4e3a000fb
commit
5615cc33d8
7 changed files with 0 additions and 219 deletions
|
|
@ -1,95 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "cinterface.h"
|
||||
|
||||
#include "windowManager/platformWindow.h"
|
||||
|
||||
CInterface& CInterface::GetCInterface()
|
||||
{
|
||||
static CInterface INSTANCE;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
bool CInterface::isMethod(const char* className, const char* methodName)
|
||||
{
|
||||
return GetCInterface()._isMethod(className, methodName);
|
||||
}
|
||||
|
||||
const char* CInterface::CallFunction(const char* nameSpace, const char* name, const char **argv, int argc, bool *result)
|
||||
{
|
||||
return GetCInterface()._CallFunction(nameSpace, name, argv, argc, result);
|
||||
}
|
||||
|
||||
const char* CInterface::CallMethod(SimObject* obj, const char* name, const char **argv, int argc, bool *res)
|
||||
{
|
||||
return GetCInterface()._CallMethod(obj->getClassName(), obj->getClassNamespace(), obj->getId(), name, argv, argc, res);
|
||||
}
|
||||
|
||||
void CInterface::CallMain(bool *res)
|
||||
{
|
||||
GetCInterface()._CallMain(res);
|
||||
}
|
||||
|
||||
bool CInterface::_isMethod(const char* className, const char* methodName) const
|
||||
{
|
||||
if (mIsMethodCallback)
|
||||
return mIsMethodCallback(className, methodName);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* CInterface::_CallFunction(const char* nameSpace, const char* name, const char **argv, int argc, bool *result) const
|
||||
{
|
||||
if (mFunctionCallback)
|
||||
return mFunctionCallback(nameSpace, name, argv, argc, result);
|
||||
|
||||
*result = false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* CInterface::_CallMethod(const char* className, const char* classNamespace, U32 object, const char* name, const char **argv, int argc, bool *res) const
|
||||
{
|
||||
if (mMethodCallback)
|
||||
return mMethodCallback(className, classNamespace, object, name, argv, argc, res);
|
||||
|
||||
*res = false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CInterface::_CallMain(bool *res) const
|
||||
{
|
||||
if (mMainCallback)
|
||||
{
|
||||
*res = true;
|
||||
mMainCallback();
|
||||
return;
|
||||
}
|
||||
|
||||
*res = false;
|
||||
}
|
||||
|
||||
TORQUE_API void SetCallbacks(void* ptr, void* methodPtr, void* isMethodPtr, void* mainPtr) {
|
||||
CInterface::GetCInterface().SetCallFunctionCallback(ptr);
|
||||
CInterface::GetCInterface().SetCallMethodCallback(methodPtr);
|
||||
CInterface::GetCInterface().SetCallIsMethodCallback(isMethodPtr);
|
||||
CInterface::GetCInterface().SetMainCallback(mainPtr);
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
#include "platform/platformDlibrary.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "console/simBase.h"
|
||||
|
||||
#define CALL_CINTERFACE_FUNCTION(name, ...){const char *v[] = { __VA_ARGS__ }; CInterface::CallFunction(name, v, sizeof(v) / sizeof(*v));}
|
||||
|
||||
class CInterface {
|
||||
typedef bool(*IsMethodCallback)(const char* className, const char* methodName);
|
||||
typedef void(*CallMainCallback)();
|
||||
typedef const char* (*CallFunctionCallback)(const char* nameSpace, const char* name, const char **argv, int argc, bool *result);
|
||||
typedef const char* (*CallMethodCallback)(const char* className, const char* classNamespace, U32 object, const char* name, const char **argv, int argc, bool *result);
|
||||
IsMethodCallback mIsMethodCallback;
|
||||
CallFunctionCallback mFunctionCallback;
|
||||
CallMethodCallback mMethodCallback;
|
||||
CallMainCallback mMainCallback;
|
||||
const char* _CallFunction(const char* nameSpace, const char* name, const char **argv, int argc, bool *result) const;
|
||||
const char* _CallMethod(const char* className, const char* classNamespace, U32 object, const char* name, const char **argv, int argc, bool *res) const;
|
||||
void _CallMain(bool *res) const;
|
||||
bool _isMethod(const char* className, const char* methodName) const;
|
||||
public:
|
||||
CInterface()
|
||||
{
|
||||
mFunctionCallback = NULL;
|
||||
mMethodCallback = NULL;
|
||||
mIsMethodCallback = NULL;
|
||||
mMainCallback = NULL;
|
||||
}
|
||||
|
||||
static const char* CallFunction(const char* nameSpace, const char* name, const char **argv, int argc, bool *result);
|
||||
static const char* CallMethod(SimObject* obj, const char* name, const char **argv, int argc, bool *res);
|
||||
static void CallMain(bool *res);
|
||||
static bool isMethod(const char* className, const char* methodName);
|
||||
static CInterface& GetCInterface();
|
||||
void SetCallFunctionCallback(void* ptr) { mFunctionCallback = (CallFunctionCallback)ptr; };
|
||||
void SetCallMethodCallback(void* ptr) { mMethodCallback = (CallMethodCallback)ptr; };
|
||||
void SetCallIsMethodCallback(void* ptr) { mIsMethodCallback = (IsMethodCallback)ptr; };
|
||||
void SetMainCallback(void* ptr) { mMainCallback = (CallMainCallback)ptr; };
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue