mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
Whitespace consistency
This commit is contained in:
parent
1048b7d535
commit
1c2b096a72
11 changed files with 887 additions and 887 deletions
|
|
@ -95,8 +95,8 @@ struct ConsoleLogEntry
|
||||||
Script,
|
Script,
|
||||||
GUI,
|
GUI,
|
||||||
Network,
|
Network,
|
||||||
GGConnect,
|
GGConnect,
|
||||||
NUM_TYPE
|
NUM_TYPE
|
||||||
} mType;
|
} mType;
|
||||||
|
|
||||||
/// Indicates the actual log entry.
|
/// Indicates the actual log entry.
|
||||||
|
|
@ -897,28 +897,28 @@ template<typename P1> struct _EngineConsoleExecCallbackHelper;
|
||||||
|
|
||||||
namespace Con
|
namespace Con
|
||||||
{
|
{
|
||||||
/// @name Console Execution - executef
|
/// @name Console Execution - executef
|
||||||
/// {
|
/// {
|
||||||
///
|
///
|
||||||
/// Implements a script function thunk which automatically converts parameters to relevant console types.
|
/// Implements a script function thunk which automatically converts parameters to relevant console types.
|
||||||
/// Can be used as follows:
|
/// Can be used as follows:
|
||||||
/// - Con::executef("functionName", ...);
|
/// - Con::executef("functionName", ...);
|
||||||
/// - Con::executef(mySimObject, "functionName", ...);
|
/// - Con::executef(mySimObject, "functionName", ...);
|
||||||
///
|
///
|
||||||
/// NOTE: if you get a rather cryptic template error coming through here, most likely you are trying to
|
/// NOTE: if you get a rather cryptic template error coming through here, most likely you are trying to
|
||||||
/// convert a parameter which EngineMarshallType does not have a specialization for.
|
/// convert a parameter which EngineMarshallType does not have a specialization for.
|
||||||
/// Another problem can occur if you do not include "console/simBase.h" and "console/engineAPI.h"
|
/// Another problem can occur if you do not include "console/simBase.h" and "console/engineAPI.h"
|
||||||
/// since _EngineConsoleExecCallbackHelper and SimConsoleThreadExecCallback are required.
|
/// since _EngineConsoleExecCallbackHelper and SimConsoleThreadExecCallback are required.
|
||||||
///
|
///
|
||||||
/// @see _EngineConsoleExecCallbackHelper
|
/// @see _EngineConsoleExecCallbackHelper
|
||||||
///
|
///
|
||||||
template<typename R, typename ...ArgTs>
|
template<typename R, typename ...ArgTs>
|
||||||
ConsoleValueRef executef(R r, ArgTs ...argTs)
|
ConsoleValueRef executef(R r, ArgTs ...argTs)
|
||||||
{
|
{
|
||||||
_EngineConsoleExecCallbackHelper<R> callback( r );
|
_EngineConsoleExecCallbackHelper<R> callback( r );
|
||||||
return callback.template call<ConsoleValueRef>(argTs...);
|
return callback.template call<ConsoleValueRef>(argTs...);
|
||||||
}
|
}
|
||||||
/// }
|
/// }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void expandEscape(char *dest, const char *src);
|
extern void expandEscape(char *dest, const char *src);
|
||||||
|
|
@ -1143,19 +1143,19 @@ class ConsoleStackFrameSaver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
bool mSaved;
|
bool mSaved;
|
||||||
|
|
||||||
ConsoleStackFrameSaver() : mSaved(false)
|
ConsoleStackFrameSaver() : mSaved(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
~ConsoleStackFrameSaver()
|
~ConsoleStackFrameSaver()
|
||||||
{
|
{
|
||||||
restore();
|
restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void save();
|
void save();
|
||||||
void restore();
|
void restore();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -339,14 +339,14 @@ struct EngineUnmarshallData< ConsoleValueRef >
|
||||||
|
|
||||||
|
|
||||||
template<typename T> struct _EngineTrampoline {
|
template<typename T> struct _EngineTrampoline {
|
||||||
struct Args {};
|
struct Args {};
|
||||||
};
|
};
|
||||||
|
|
||||||
template< typename R, typename ...ArgTs >
|
template< typename R, typename ...ArgTs >
|
||||||
struct _EngineTrampoline< R( ArgTs ... ) >
|
struct _EngineTrampoline< R( ArgTs ... ) >
|
||||||
{
|
{
|
||||||
typedef std::tuple<ArgTs ...> Args;
|
typedef std::tuple<ArgTs ...> Args;
|
||||||
std::tuple<ArgTs ...> argT;
|
std::tuple<ArgTs ...> argT;
|
||||||
};
|
};
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
|
|
@ -363,21 +363,21 @@ template< typename R, typename ...ArgTs >
|
||||||
struct _EngineFunctionTrampoline< R(ArgTs...) > : public _EngineFunctionTrampolineBase< R(ArgTs...) >
|
struct _EngineFunctionTrampoline< R(ArgTs...) > : public _EngineFunctionTrampolineBase< R(ArgTs...) >
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using Super = _EngineFunctionTrampolineBase< R(ArgTs...) >;
|
using Super = _EngineFunctionTrampolineBase< R(ArgTs...) >;
|
||||||
using ArgsType = typename Super::Args;
|
using ArgsType = typename Super::Args;
|
||||||
|
|
||||||
template<size_t ...> struct Seq {};
|
template<size_t ...> struct Seq {};
|
||||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||||
|
|
||||||
template<size_t ...I>
|
template<size_t ...I>
|
||||||
static R dispatchHelper(typename Super::FunctionType fn, const ArgsType& args, Seq<I...>) {
|
static R dispatchHelper(typename Super::FunctionType fn, const ArgsType& args, Seq<I...>) {
|
||||||
return R( fn(std::get<I>(args) ...) );
|
return R( fn(std::get<I>(args) ...) );
|
||||||
}
|
}
|
||||||
|
|
||||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||||
public:
|
public:
|
||||||
static R jmp(typename Super::FunctionType fn, const ArgsType& args )
|
static R jmp(typename Super::FunctionType fn, const ArgsType& args )
|
||||||
{
|
{
|
||||||
return dispatchHelper(fn, args, SeqType());
|
return dispatchHelper(fn, args, SeqType());
|
||||||
}
|
}
|
||||||
|
|
@ -394,21 +394,21 @@ struct _EngineMethodTrampoline {};
|
||||||
template< typename Frame, typename R, typename ...ArgTs >
|
template< typename Frame, typename R, typename ...ArgTs >
|
||||||
struct _EngineMethodTrampoline< Frame, R(ArgTs ...) > : public _EngineMethodTrampolineBase< R(ArgTs ...) >
|
struct _EngineMethodTrampoline< Frame, R(ArgTs ...) > : public _EngineMethodTrampolineBase< R(ArgTs ...) >
|
||||||
{
|
{
|
||||||
using FunctionType = R( typename Frame::ObjectType*, ArgTs ...);
|
using FunctionType = R( typename Frame::ObjectType*, ArgTs ...);
|
||||||
private:
|
private:
|
||||||
using Super = _EngineMethodTrampolineBase< R(ArgTs ...) >;
|
using Super = _EngineMethodTrampolineBase< R(ArgTs ...) >;
|
||||||
using ArgsType = typename _EngineFunctionTrampolineBase< R(ArgTs ...) >::Args;
|
using ArgsType = typename _EngineFunctionTrampolineBase< R(ArgTs ...) >::Args;
|
||||||
|
|
||||||
template<size_t ...> struct Seq {};
|
template<size_t ...> struct Seq {};
|
||||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||||
|
|
||||||
template<size_t ...I>
|
template<size_t ...I>
|
||||||
static R dispatchHelper(Frame f, const ArgsType& args, Seq<I...>) {
|
static R dispatchHelper(Frame f, const ArgsType& args, Seq<I...>) {
|
||||||
return R( f._exec(std::get<I>(args) ...) );
|
return R( f._exec(std::get<I>(args) ...) );
|
||||||
}
|
}
|
||||||
|
|
||||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||||
public:
|
public:
|
||||||
static R jmp( typename Frame::ObjectType* object, const ArgsType& args )
|
static R jmp( typename Frame::ObjectType* object, const ArgsType& args )
|
||||||
{
|
{
|
||||||
|
|
@ -515,13 +515,13 @@ struct _EngineConsoleThunkType< void >
|
||||||
struct _EngineConsoleThunkCountArgs
|
struct _EngineConsoleThunkCountArgs
|
||||||
{
|
{
|
||||||
|
|
||||||
template<typename ...ArgTs> U32 operator()(ArgTs... args){
|
template<typename ...ArgTs> U32 operator()(ArgTs... args){
|
||||||
return sizeof...(ArgTs);
|
return sizeof...(ArgTs);
|
||||||
}
|
}
|
||||||
|
|
||||||
operator U32() const{ // FIXME: WHAT IS THIS?? I'm pretty sure it's incorrect, and it's the version that is invoked by all the macros
|
operator U32() const{ // FIXME: WHAT IS THIS?? I'm pretty sure it's incorrect, and it's the version that is invoked by all the macros
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -529,61 +529,61 @@ struct _EngineConsoleThunkCountArgs
|
||||||
|
|
||||||
// Encapsulation of a legacy console function invocation.
|
// Encapsulation of a legacy console function invocation.
|
||||||
namespace engineAPI{
|
namespace engineAPI{
|
||||||
namespace detail{
|
namespace detail{
|
||||||
template<S32 startArgc, typename R, typename ...ArgTs>
|
template<S32 startArgc, typename R, typename ...ArgTs>
|
||||||
struct ThunkHelpers {
|
struct ThunkHelpers {
|
||||||
using SelfType = ThunkHelpers<startArgc, R, ArgTs...>;
|
using SelfType = ThunkHelpers<startArgc, R, ArgTs...>;
|
||||||
using FunctionType = R(*)(ArgTs...);
|
using FunctionType = R(*)(ArgTs...);
|
||||||
template<typename Frame> using MethodType = R(Frame::*)(ArgTs ...) const;
|
template<typename Frame> using MethodType = R(Frame::*)(ArgTs ...) const;
|
||||||
template<size_t I> using IthArgType = typename std::tuple_element<I, std::tuple<ArgTs ...> >::type;
|
template<size_t I> using IthArgType = typename std::tuple_element<I, std::tuple<ArgTs ...> >::type;
|
||||||
|
|
||||||
template<size_t ...> struct Seq {};
|
template<size_t ...> struct Seq {};
|
||||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||||
|
|
||||||
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
|
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
|
||||||
static constexpr S32 NUM_ARGS = sizeof...(ArgTs) + startArgc;
|
static constexpr S32 NUM_ARGS = sizeof...(ArgTs) + startArgc;
|
||||||
|
|
||||||
template<size_t index, size_t method_offset = 0, typename ...RealArgTs>
|
template<size_t index, size_t method_offset = 0, typename ...RealArgTs>
|
||||||
static IthArgType<index> getRealArgValue(S32 argc, ConsoleValueRef *argv, const _EngineFunctionDefaultArguments< void(RealArgTs...) >& defaultArgs)
|
static IthArgType<index> getRealArgValue(S32 argc, ConsoleValueRef *argv, const _EngineFunctionDefaultArguments< void(RealArgTs...) >& defaultArgs)
|
||||||
{
|
{
|
||||||
if((startArgc + index) < argc)
|
if((startArgc + index) < argc)
|
||||||
{
|
{
|
||||||
return EngineUnmarshallData< IthArgType<index> >()( argv[ startArgc + index ] );
|
return EngineUnmarshallData< IthArgType<index> >()( argv[ startArgc + index ] );
|
||||||
} else {
|
} else {
|
||||||
return std::get<index + method_offset>(defaultArgs.mArgs);
|
return std::get<index + method_offset>(defaultArgs.mArgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<size_t ...I>
|
template<size_t ...I>
|
||||||
static R dispatchHelper(S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs, Seq<I...>){
|
static R dispatchHelper(S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs, Seq<I...>){
|
||||||
return fn(SelfType::getRealArgValue<I>(argc, argv, defaultArgs) ...);
|
return fn(SelfType::getRealArgValue<I>(argc, argv, defaultArgs) ...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Frame, size_t ...I>
|
template<typename Frame, size_t ...I>
|
||||||
static R dispatchHelper(S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs, Seq<I...>){
|
static R dispatchHelper(S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs, Seq<I...>){
|
||||||
return (frame->*fn)(SelfType::getRealArgValue<I,1>(argc, argv, defaultArgs) ...);
|
return (frame->*fn)(SelfType::getRealArgValue<I,1>(argc, argv, defaultArgs) ...);
|
||||||
}
|
}
|
||||||
|
|
||||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename ArgVT> struct MarshallHelpers {
|
template<typename ArgVT> struct MarshallHelpers {
|
||||||
template<typename ...ArgTs> static void marshallEach(S32 &argc, ArgVT *argv, const ArgTs& ...args){}
|
template<typename ...ArgTs> static void marshallEach(S32 &argc, ArgVT *argv, const ArgTs& ...args){}
|
||||||
template<typename H, typename ...Tail> static void marshallEach(S32 &argc, ArgVT *argv, const H& head, const Tail& ...tail){
|
template<typename H, typename ...Tail> static void marshallEach(S32 &argc, ArgVT *argv, const H& head, const Tail& ...tail){
|
||||||
argv[argc++] = EngineMarshallData(head);
|
argv[argc++] = EngineMarshallData(head);
|
||||||
marshallEach(argc, argv, tail...);
|
marshallEach(argc, argv, tail...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> struct MarshallHelpers<ConsoleValueRef> {
|
template<> struct MarshallHelpers<ConsoleValueRef> {
|
||||||
template<typename ...ArgTs> static void marshallEach(S32 &argc, ConsoleValueRef *argv, const ArgTs& ...args){}
|
template<typename ...ArgTs> static void marshallEach(S32 &argc, ConsoleValueRef *argv, const ArgTs& ...args){}
|
||||||
template<typename H, typename ...Tail> static void marshallEach(S32 &argc, ConsoleValueRef *argv, const H& head, const Tail& ...tail){
|
template<typename H, typename ...Tail> static void marshallEach(S32 &argc, ConsoleValueRef *argv, const H& head, const Tail& ...tail){
|
||||||
EngineMarshallData(head, argc, argv);
|
EngineMarshallData(head, argc, argv);
|
||||||
marshallEach(argc, argv, tail...);
|
marshallEach(argc, argv, tail...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template< S32 startArgc, typename T >
|
template< S32 startArgc, typename T >
|
||||||
|
|
@ -593,22 +593,22 @@ template< S32 startArgc, typename R, typename ...ArgTs >
|
||||||
struct _EngineConsoleThunk< startArgc, R(ArgTs...) >
|
struct _EngineConsoleThunk< startArgc, R(ArgTs...) >
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using Helper = engineAPI::detail::ThunkHelpers<startArgc, R, ArgTs...>;
|
using Helper = engineAPI::detail::ThunkHelpers<startArgc, R, ArgTs...>;
|
||||||
using SeqType = typename Helper::SeqType;
|
using SeqType = typename Helper::SeqType;
|
||||||
public:
|
public:
|
||||||
typedef typename Helper::FunctionType FunctionType;
|
typedef typename Helper::FunctionType FunctionType;
|
||||||
typedef typename Helper::ReturnType ReturnType;
|
typedef typename Helper::ReturnType ReturnType;
|
||||||
template<typename Frame> using MethodType = typename Helper::template MethodType<Frame>;
|
template<typename Frame> using MethodType = typename Helper::template MethodType<Frame>;
|
||||||
static constexpr S32 NUM_ARGS = Helper::NUM_ARGS;
|
static constexpr S32 NUM_ARGS = Helper::NUM_ARGS;
|
||||||
|
|
||||||
static ReturnType thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs)
|
static ReturnType thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs)
|
||||||
{
|
{
|
||||||
return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType()));
|
return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType()));
|
||||||
}
|
}
|
||||||
template< typename Frame >
|
template< typename Frame >
|
||||||
static ReturnType thunk( S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs)
|
static ReturnType thunk( S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs)
|
||||||
{
|
{
|
||||||
return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType()));
|
return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -616,23 +616,23 @@ public:
|
||||||
template<S32 startArgc, typename ...ArgTs>
|
template<S32 startArgc, typename ...ArgTs>
|
||||||
struct _EngineConsoleThunk<startArgc, void(ArgTs...)> {
|
struct _EngineConsoleThunk<startArgc, void(ArgTs...)> {
|
||||||
private:
|
private:
|
||||||
using Helper = engineAPI::detail::ThunkHelpers<startArgc, void, ArgTs...>;
|
using Helper = engineAPI::detail::ThunkHelpers<startArgc, void, ArgTs...>;
|
||||||
using SeqType = typename Helper::SeqType;
|
using SeqType = typename Helper::SeqType;
|
||||||
public:
|
public:
|
||||||
typedef typename Helper::FunctionType FunctionType;
|
typedef typename Helper::FunctionType FunctionType;
|
||||||
typedef typename Helper::ReturnType ReturnType;
|
typedef typename Helper::ReturnType ReturnType;
|
||||||
template<typename Frame> using MethodType = typename Helper::template MethodType<Frame>;
|
template<typename Frame> using MethodType = typename Helper::template MethodType<Frame>;
|
||||||
static constexpr S32 NUM_ARGS = Helper::NUM_ARGS;
|
static constexpr S32 NUM_ARGS = Helper::NUM_ARGS;
|
||||||
|
|
||||||
static void thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs)
|
static void thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs)
|
||||||
{
|
{
|
||||||
Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType());
|
Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType());
|
||||||
}
|
}
|
||||||
template< typename Frame >
|
template< typename Frame >
|
||||||
static void thunk( S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs)
|
static void thunk( S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs)
|
||||||
{
|
{
|
||||||
Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType());
|
Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1182,7 +1182,7 @@ public:
|
||||||
struct _EngineConsoleCallbackHelper : public _BaseEngineConsoleCallbackHelper
|
struct _EngineConsoleCallbackHelper : public _BaseEngineConsoleCallbackHelper
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
_EngineConsoleCallbackHelper( StringTableEntry callbackName, SimObject* pThis )
|
_EngineConsoleCallbackHelper( StringTableEntry callbackName, SimObject* pThis )
|
||||||
|
|
@ -1201,7 +1201,7 @@ public:
|
||||||
CSTK.reserveValues(mArgc + sizeof...(ArgTs), mArgv);
|
CSTK.reserveValues(mArgc + sizeof...(ArgTs), mArgv);
|
||||||
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
||||||
|
|
||||||
Helper::marshallEach(mArgc, mArgv, args...);
|
Helper::marshallEach(mArgc, mArgv, args...);
|
||||||
|
|
||||||
return R( EngineUnmarshallData< R >()( _exec() ) );
|
return R( EngineUnmarshallData< R >()( _exec() ) );
|
||||||
}
|
}
|
||||||
|
|
@ -1212,7 +1212,7 @@ public:
|
||||||
evt->populateArgs(mArgv);
|
evt->populateArgs(mArgv);
|
||||||
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
||||||
|
|
||||||
Helper::marshallEach(mArgc, mArgv, args...);
|
Helper::marshallEach(mArgc, mArgv, args...);
|
||||||
|
|
||||||
Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime());
|
Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime());
|
||||||
|
|
||||||
|
|
@ -1227,7 +1227,7 @@ public:
|
||||||
template<typename P1> struct _EngineConsoleExecCallbackHelper : public _BaseEngineConsoleCallbackHelper
|
template<typename P1> struct _EngineConsoleExecCallbackHelper : public _BaseEngineConsoleCallbackHelper
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
_EngineConsoleExecCallbackHelper( SimObject* pThis )
|
_EngineConsoleExecCallbackHelper( SimObject* pThis )
|
||||||
|
|
@ -1247,7 +1247,7 @@ public:
|
||||||
CSTK.reserveValues(mArgc+sizeof...(ArgTs), mArgv);
|
CSTK.reserveValues(mArgc+sizeof...(ArgTs), mArgv);
|
||||||
mArgv[ 0 ].value->setStackStringValue(simCB);
|
mArgv[ 0 ].value->setStackStringValue(simCB);
|
||||||
|
|
||||||
Helper::marshallEach(mArgc, mArgv, args...);
|
Helper::marshallEach(mArgc, mArgv, args...);
|
||||||
|
|
||||||
return R( EngineUnmarshallData< R >()( _exec() ) );
|
return R( EngineUnmarshallData< R >()( _exec() ) );
|
||||||
}
|
}
|
||||||
|
|
@ -1258,7 +1258,7 @@ public:
|
||||||
evt->populateArgs(mArgv);
|
evt->populateArgs(mArgv);
|
||||||
mArgv[ 0 ].value->setStackStringValue(simCB);
|
mArgv[ 0 ].value->setStackStringValue(simCB);
|
||||||
|
|
||||||
Helper::marshallEach(mArgc, mArgv, args...);
|
Helper::marshallEach(mArgc, mArgv, args...);
|
||||||
|
|
||||||
Sim::postEvent(mThis, evt, Sim::getCurrentTime());
|
Sim::postEvent(mThis, evt, Sim::getCurrentTime());
|
||||||
|
|
||||||
|
|
@ -1271,7 +1271,7 @@ public:
|
||||||
template<> struct _EngineConsoleExecCallbackHelper<const char*> : public _BaseEngineConsoleCallbackHelper
|
template<> struct _EngineConsoleExecCallbackHelper<const char*> : public _BaseEngineConsoleCallbackHelper
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
||||||
public:
|
public:
|
||||||
_EngineConsoleExecCallbackHelper( const char *callbackName )
|
_EngineConsoleExecCallbackHelper( const char *callbackName )
|
||||||
{
|
{
|
||||||
|
|
@ -1289,7 +1289,7 @@ public:
|
||||||
CSTK.reserveValues(mArgc+sizeof...(ArgTs), mArgv);
|
CSTK.reserveValues(mArgc+sizeof...(ArgTs), mArgv);
|
||||||
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
||||||
|
|
||||||
Helper::marshallEach(mArgc, mArgv, args...);
|
Helper::marshallEach(mArgc, mArgv, args...);
|
||||||
|
|
||||||
return R( EngineUnmarshallData< R >()( _exec() ) );
|
return R( EngineUnmarshallData< R >()( _exec() ) );
|
||||||
}
|
}
|
||||||
|
|
@ -1300,7 +1300,7 @@ public:
|
||||||
evt->populateArgs(mArgv);
|
evt->populateArgs(mArgv);
|
||||||
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
||||||
|
|
||||||
Helper::marshallEach(mArgc, mArgv, args...);
|
Helper::marshallEach(mArgc, mArgv, args...);
|
||||||
|
|
||||||
Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime());
|
Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime());
|
||||||
return R( EngineUnmarshallData< R >()( cb.waitForResult() ) );
|
return R( EngineUnmarshallData< R >()( cb.waitForResult() ) );
|
||||||
|
|
|
||||||
|
|
@ -93,35 +93,35 @@ struct _EngineFunctionDefaultArguments {};
|
||||||
template<typename ...ArgTs>
|
template<typename ...ArgTs>
|
||||||
struct _EngineFunctionDefaultArguments< void(ArgTs...) > : public EngineFunctionDefaultArguments
|
struct _EngineFunctionDefaultArguments< void(ArgTs...) > : public EngineFunctionDefaultArguments
|
||||||
{
|
{
|
||||||
template<typename T> using DefVST = typename EngineTypeTraits<T>::DefaultArgumentValueStoreType;
|
template<typename T> using DefVST = typename EngineTypeTraits<T>::DefaultArgumentValueStoreType;
|
||||||
std::tuple<DefVST<ArgTs> ...> mArgs;
|
std::tuple<DefVST<ArgTs> ...> mArgs;
|
||||||
private:
|
private:
|
||||||
using SelfType = _EngineFunctionDefaultArguments< void(ArgTs...) >;
|
using SelfType = _EngineFunctionDefaultArguments< void(ArgTs...) >;
|
||||||
|
|
||||||
template<size_t ...> struct Seq {};
|
template<size_t ...> struct Seq {};
|
||||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||||
|
|
||||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||||
|
|
||||||
template<typename ...TailTs, size_t ...I>
|
template<typename ...TailTs, size_t ...I>
|
||||||
static void copyHelper(std::tuple<DefVST<ArgTs> ...> &args, std::tuple<DefVST<TailTs> ...> &defaultArgs, Seq<I...>) {
|
static void copyHelper(std::tuple<DefVST<ArgTs> ...> &args, std::tuple<DefVST<TailTs> ...> &defaultArgs, Seq<I...>) {
|
||||||
constexpr size_t offset = (sizeof...(ArgTs) - sizeof...(TailTs));
|
constexpr size_t offset = (sizeof...(ArgTs) - sizeof...(TailTs));
|
||||||
std::tie(std::get<I + offset>(args)...) = defaultArgs;
|
std::tie(std::get<I + offset>(args)...) = defaultArgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ...TailTs> using MaybeSelfEnabled = typename std::enable_if<sizeof...(TailTs) <= sizeof...(ArgTs), decltype(mArgs)>::type;
|
template<typename ...TailTs> using MaybeSelfEnabled = typename std::enable_if<sizeof...(TailTs) <= sizeof...(ArgTs), decltype(mArgs)>::type;
|
||||||
|
|
||||||
template<typename ...TailTs> static MaybeSelfEnabled<TailTs...> tailInit(TailTs ...tail) {
|
template<typename ...TailTs> static MaybeSelfEnabled<TailTs...> tailInit(TailTs ...tail) {
|
||||||
std::tuple<DefVST<ArgTs>...> argsT;
|
std::tuple<DefVST<ArgTs>...> argsT;
|
||||||
std::tuple<DefVST<TailTs>...> tailT = std::make_tuple(tail...);
|
std::tuple<DefVST<TailTs>...> tailT = std::make_tuple(tail...);
|
||||||
SelfType::copyHelper<TailTs...>(argsT, tailT, typename Gens<sizeof...(TailTs)>::type());
|
SelfType::copyHelper<TailTs...>(argsT, tailT, typename Gens<sizeof...(TailTs)>::type());
|
||||||
return argsT;
|
return argsT;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template<typename ...TailTs> _EngineFunctionDefaultArguments(TailTs ...tail)
|
template<typename ...TailTs> _EngineFunctionDefaultArguments(TailTs ...tail)
|
||||||
: EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(SelfType::tailInit(tail...))
|
: EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(SelfType::tailInit(tail...))
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack( pop )
|
#pragma pack( pop )
|
||||||
|
|
|
||||||
|
|
@ -340,7 +340,7 @@ DefineEngineFunction( stopVideoCapture, void, (),,
|
||||||
|
|
||||||
DefineEngineFunction( playJournalToVideo, void,
|
DefineEngineFunction( playJournalToVideo, void,
|
||||||
( const char *journalFile, const char *videoFile, const char *encoder, F32 framerate, Point2I resolution ),
|
( const char *journalFile, const char *videoFile, const char *encoder, F32 framerate, Point2I resolution ),
|
||||||
( nullAsType<const char*>(), "THEORA", 30.0f, Point2I::Zero ),
|
( nullAsType<const char*>(), "THEORA", 30.0f, Point2I::Zero ),
|
||||||
"Load a journal file and capture it video.\n"
|
"Load a journal file and capture it video.\n"
|
||||||
"@ingroup Rendering\n" )
|
"@ingroup Rendering\n" )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -52,42 +52,42 @@
|
||||||
IMPLEMENT_CONOBJECT(GuiCanvas);
|
IMPLEMENT_CONOBJECT(GuiCanvas);
|
||||||
|
|
||||||
ConsoleDocClass( GuiCanvas,
|
ConsoleDocClass( GuiCanvas,
|
||||||
"@brief A canvas on which rendering occurs.\n\n"
|
"@brief A canvas on which rendering occurs.\n\n"
|
||||||
|
|
||||||
"@section GuiCanvas_contents What a GUICanvas Can Contain...\n\n"
|
"@section GuiCanvas_contents What a GUICanvas Can Contain...\n\n"
|
||||||
|
|
||||||
"@subsection GuiCanvas_content_contentcontrol Content Control\n"
|
"@subsection GuiCanvas_content_contentcontrol Content Control\n"
|
||||||
"A content control is the top level GuiControl for a screen. This GuiControl "
|
"A content control is the top level GuiControl for a screen. This GuiControl "
|
||||||
"will be the parent control for all other GuiControls on that particular "
|
"will be the parent control for all other GuiControls on that particular "
|
||||||
"screen.\n\n"
|
"screen.\n\n"
|
||||||
|
|
||||||
"@subsection GuiCanvas_content_dialogs Dialogs\n\n"
|
"@subsection GuiCanvas_content_dialogs Dialogs\n\n"
|
||||||
|
|
||||||
"A dialog is essentially another screen, only it gets overlaid on top of the "
|
"A dialog is essentially another screen, only it gets overlaid on top of the "
|
||||||
"current content control, and all input goes to the dialog. This is most akin "
|
"current content control, and all input goes to the dialog. This is most akin "
|
||||||
"to the \"Open File\" dialog box found in most operating systems. When you "
|
"to the \"Open File\" dialog box found in most operating systems. When you "
|
||||||
"choose to open a file, and the \"Open File\" dialog pops up, you can no longer "
|
"choose to open a file, and the \"Open File\" dialog pops up, you can no longer "
|
||||||
"send input to the application, and must complete or cancel the open file "
|
"send input to the application, and must complete or cancel the open file "
|
||||||
"request. Torque keeps track of layers of dialogs. The dialog with the highest "
|
"request. Torque keeps track of layers of dialogs. The dialog with the highest "
|
||||||
"layer is on top and will get all the input, unless the dialog is "
|
"layer is on top and will get all the input, unless the dialog is "
|
||||||
"modeless, which is a profile option.\n\n"
|
"modeless, which is a profile option.\n\n"
|
||||||
|
|
||||||
"@see GuiControlProfile\n\n"
|
"@see GuiControlProfile\n\n"
|
||||||
|
|
||||||
"@section GuiCanvas_dirty Dirty Rectangles\n\n"
|
"@section GuiCanvas_dirty Dirty Rectangles\n\n"
|
||||||
|
|
||||||
"The GuiCanvas is based on dirty regions. "
|
"The GuiCanvas is based on dirty regions. "
|
||||||
"Every frame the canvas paints only the areas of the canvas that are 'dirty' "
|
"Every frame the canvas paints only the areas of the canvas that are 'dirty' "
|
||||||
"or need updating. In most cases, this only is the area under the mouse cursor. "
|
"or need updating. In most cases, this only is the area under the mouse cursor. "
|
||||||
"This is why if you look in guiCanvas.cc the call to glClear is commented out. "
|
"This is why if you look in guiCanvas.cc the call to glClear is commented out. "
|
||||||
|
|
||||||
"What you will see is a black screen, except in the dirty regions, where the "
|
"What you will see is a black screen, except in the dirty regions, where the "
|
||||||
"screen will be painted normally. If you are making an animated GuiControl "
|
"screen will be painted normally. If you are making an animated GuiControl "
|
||||||
"you need to add your control to the dirty areas of the canvas.\n\n"
|
"you need to add your control to the dirty areas of the canvas.\n\n"
|
||||||
|
|
||||||
"@see GuiControl\n\n"
|
"@see GuiControl\n\n"
|
||||||
|
|
||||||
"@ingroup GuiCore\n");
|
"@ingroup GuiCore\n");
|
||||||
|
|
||||||
ColorI gCanvasClearColor( 255, 0, 255 ); ///< For GFX->clear
|
ColorI gCanvasClearColor( 255, 0, 255 ); ///< For GFX->clear
|
||||||
|
|
||||||
|
|
@ -209,29 +209,29 @@ bool GuiCanvas::onAdd()
|
||||||
//If we're recording, store the intial video resolution
|
//If we're recording, store the intial video resolution
|
||||||
if (Journal::IsRecording())
|
if (Journal::IsRecording())
|
||||||
{
|
{
|
||||||
Journal::Write(vm.resolution.x);
|
Journal::Write(vm.resolution.x);
|
||||||
Journal::Write(vm.resolution.y);
|
Journal::Write(vm.resolution.y);
|
||||||
Journal::Write(vm.fullScreen);
|
Journal::Write(vm.fullScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
//If we're playing, read the intial video resolution from the journal
|
//If we're playing, read the intial video resolution from the journal
|
||||||
if (Journal::IsPlaying())
|
if (Journal::IsPlaying())
|
||||||
{
|
{
|
||||||
Journal::Read(&vm.resolution.x);
|
Journal::Read(&vm.resolution.x);
|
||||||
Journal::Read(&vm.resolution.y);
|
Journal::Read(&vm.resolution.y);
|
||||||
Journal::Read(&vm.fullScreen);
|
Journal::Read(&vm.fullScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a && a->mType != NullDevice)
|
if (a && a->mType != NullDevice)
|
||||||
{
|
{
|
||||||
mPlatformWindow = WindowManager->createWindow(newDevice, vm);
|
mPlatformWindow = WindowManager->createWindow(newDevice, vm);
|
||||||
|
|
||||||
//Disable window resizing if recording ir playing a journal
|
//Disable window resizing if recording ir playing a journal
|
||||||
if (Journal::IsRecording() || Journal::IsPlaying())
|
if (Journal::IsRecording() || Journal::IsPlaying())
|
||||||
mPlatformWindow->lockSize(true);
|
mPlatformWindow->lockSize(true);
|
||||||
|
|
||||||
// Set a minimum on the window size so people can't break us by resizing tiny.
|
// Set a minimum on the window size so people can't break us by resizing tiny.
|
||||||
mPlatformWindow->setMinimumWindowSize(Point2I(640,480));
|
mPlatformWindow->setMinimumWindowSize(Point2I(640,480));
|
||||||
|
|
||||||
// Now, we have to hook in our event callbacks so we'll get
|
// Now, we have to hook in our event callbacks so we'll get
|
||||||
// appropriate events from the window.
|
// appropriate events from the window.
|
||||||
|
|
@ -326,12 +326,12 @@ CanvasSizeChangeSignal GuiCanvas::smCanvasSizeChangeSignal;
|
||||||
void GuiCanvas::handleResize( WindowId did, S32 width, S32 height )
|
void GuiCanvas::handleResize( WindowId did, S32 width, S32 height )
|
||||||
{
|
{
|
||||||
getCanvasSizeChangeSignal().trigger(this);
|
getCanvasSizeChangeSignal().trigger(this);
|
||||||
if (Journal::IsPlaying() && mPlatformWindow)
|
if (Journal::IsPlaying() && mPlatformWindow)
|
||||||
{
|
{
|
||||||
mPlatformWindow->lockSize(false);
|
mPlatformWindow->lockSize(false);
|
||||||
mPlatformWindow->setSize(Point2I(width, height));
|
mPlatformWindow->setSize(Point2I(width, height));
|
||||||
mPlatformWindow->lockSize(true);
|
mPlatformWindow->lockSize(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify the scripts
|
// Notify the scripts
|
||||||
if ( isMethod( "onResize" ) )
|
if ( isMethod( "onResize" ) )
|
||||||
|
|
@ -342,9 +342,9 @@ void GuiCanvas::handlePaintEvent(WindowId did)
|
||||||
{
|
{
|
||||||
bool canRender = mPlatformWindow->isVisible() && GFX->allowRender() && !GFX->canCurrentlyRender();
|
bool canRender = mPlatformWindow->isVisible() && GFX->allowRender() && !GFX->canCurrentlyRender();
|
||||||
|
|
||||||
// Do the screenshot first.
|
// Do the screenshot first.
|
||||||
if ( gScreenShot != NULL && gScreenShot->isPending() && canRender )
|
if ( gScreenShot != NULL && gScreenShot->isPending() && canRender )
|
||||||
gScreenShot->capture( this );
|
gScreenShot->capture( this );
|
||||||
|
|
||||||
// If the video capture is waiting for a canvas, start the capture
|
// If the video capture is waiting for a canvas, start the capture
|
||||||
if ( VIDCAP->isWaitingForCanvas() && canRender )
|
if ( VIDCAP->isWaitingForCanvas() && canRender )
|
||||||
|
|
@ -560,19 +560,19 @@ bool GuiCanvas::tabNext(void)
|
||||||
//save the old
|
//save the old
|
||||||
GuiControl *oldResponder = mFirstResponder;
|
GuiControl *oldResponder = mFirstResponder;
|
||||||
|
|
||||||
GuiControl* newResponder = ctrl->findNextTabable(mFirstResponder);
|
GuiControl* newResponder = ctrl->findNextTabable(mFirstResponder);
|
||||||
if ( !newResponder )
|
if ( !newResponder )
|
||||||
newResponder = ctrl->findFirstTabable();
|
newResponder = ctrl->findFirstTabable();
|
||||||
|
|
||||||
if ( newResponder && newResponder != oldResponder )
|
if ( newResponder && newResponder != oldResponder )
|
||||||
{
|
{
|
||||||
newResponder->setFirstResponder();
|
newResponder->setFirstResponder();
|
||||||
|
|
||||||
// CodeReview Can this get killed? Note tabPrev code. BJG - 3/25/07
|
// CodeReview Can this get killed? Note tabPrev code. BJG - 3/25/07
|
||||||
// if ( oldResponder )
|
// if ( oldResponder )
|
||||||
// oldResponder->onLoseFirstResponder();
|
// oldResponder->onLoseFirstResponder();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -585,30 +585,30 @@ bool GuiCanvas::tabPrev(void)
|
||||||
//save the old
|
//save the old
|
||||||
GuiControl *oldResponder = mFirstResponder;
|
GuiControl *oldResponder = mFirstResponder;
|
||||||
|
|
||||||
GuiControl* newResponder = ctrl->findPrevTabable(mFirstResponder);
|
GuiControl* newResponder = ctrl->findPrevTabable(mFirstResponder);
|
||||||
if ( !newResponder )
|
if ( !newResponder )
|
||||||
newResponder = ctrl->findLastTabable();
|
newResponder = ctrl->findLastTabable();
|
||||||
|
|
||||||
if ( newResponder && newResponder != oldResponder )
|
if ( newResponder && newResponder != oldResponder )
|
||||||
{
|
{
|
||||||
newResponder->setFirstResponder();
|
newResponder->setFirstResponder();
|
||||||
|
|
||||||
// CodeReview As with tabNext() above, looks like this can now go. DAW - 7/05/09
|
// CodeReview As with tabNext() above, looks like this can now go. DAW - 7/05/09
|
||||||
//if ( oldResponder )
|
//if ( oldResponder )
|
||||||
// oldResponder->onLoseFirstResponder();
|
// oldResponder->onLoseFirstResponder();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GuiCanvas::processInputEvent(InputEventInfo &inputEvent)
|
bool GuiCanvas::processInputEvent(InputEventInfo &inputEvent)
|
||||||
{
|
{
|
||||||
// First call the general input handler (on the extremely off-chance that it will be handled):
|
// First call the general input handler (on the extremely off-chance that it will be handled):
|
||||||
if (mFirstResponder && mFirstResponder->onInputEvent(inputEvent))
|
if (mFirstResponder && mFirstResponder->onInputEvent(inputEvent))
|
||||||
{
|
{
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (inputEvent.deviceType)
|
switch (inputEvent.deviceType)
|
||||||
|
|
@ -1786,9 +1786,9 @@ void GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */)
|
||||||
addUpdateRegion(pos - Point2I(2, 2), Point2I(cext.x + 4, cext.y + 4));
|
addUpdateRegion(pos - Point2I(2, 2), Point2I(cext.x + 4, cext.y + 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
mLastCursorEnabled = cursorVisible;
|
mLastCursorEnabled = cursorVisible;
|
||||||
mLastCursor = mouseCursor;
|
mLastCursor = mouseCursor;
|
||||||
mLastCursorPt = cursorPos;
|
mLastCursorPt = cursorPos;
|
||||||
|
|
||||||
// Begin GFX
|
// Begin GFX
|
||||||
PROFILE_START(GFXBeginScene);
|
PROFILE_START(GFXBeginScene);
|
||||||
|
|
@ -1830,7 +1830,7 @@ void GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */)
|
||||||
|
|
||||||
resetUpdateRegions();
|
resetUpdateRegions();
|
||||||
|
|
||||||
// Make sure we have a clean matrix state
|
// Make sure we have a clean matrix state
|
||||||
// before we start rendering anything!
|
// before we start rendering anything!
|
||||||
GFX->setWorldMatrix( MatrixF::Identity );
|
GFX->setWorldMatrix( MatrixF::Identity );
|
||||||
GFX->setViewMatrix( MatrixF::Identity );
|
GFX->setViewMatrix( MatrixF::Identity );
|
||||||
|
|
@ -2039,46 +2039,46 @@ void GuiCanvas::resetUpdateRegions()
|
||||||
|
|
||||||
void GuiCanvas::setFirstResponder( GuiControl* newResponder )
|
void GuiCanvas::setFirstResponder( GuiControl* newResponder )
|
||||||
{
|
{
|
||||||
GuiControl* oldResponder = mFirstResponder;
|
GuiControl* oldResponder = mFirstResponder;
|
||||||
Parent::setFirstResponder( newResponder );
|
Parent::setFirstResponder( newResponder );
|
||||||
|
|
||||||
if( oldResponder == mFirstResponder )
|
if( oldResponder == mFirstResponder )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( oldResponder && ( oldResponder != newResponder ) )
|
if( oldResponder && ( oldResponder != newResponder ) )
|
||||||
oldResponder->onLoseFirstResponder();
|
oldResponder->onLoseFirstResponder();
|
||||||
|
|
||||||
if( newResponder && ( newResponder != oldResponder ) )
|
if( newResponder && ( newResponder != oldResponder ) )
|
||||||
newResponder->onGainFirstResponder();
|
newResponder->onGainFirstResponder();
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, getContent, S32, (),,
|
DefineEngineMethod( GuiCanvas, getContent, S32, (),,
|
||||||
"@brief Get the GuiControl which is being used as the content.\n\n"
|
"@brief Get the GuiControl which is being used as the content.\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"Canvas.getContent();\n"
|
"Canvas.getContent();\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
|
|
||||||
"@return ID of current content control")
|
"@return ID of current content control")
|
||||||
{
|
{
|
||||||
GuiControl *ctrl = object->getContentControl();
|
GuiControl *ctrl = object->getContentControl();
|
||||||
if(ctrl)
|
if(ctrl)
|
||||||
return ctrl->getId();
|
return ctrl->getId();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, setContent, void, (GuiControl* ctrl),,
|
DefineEngineMethod( GuiCanvas, setContent, void, (GuiControl* ctrl),,
|
||||||
"@brief Set the content of the canvas to a specified control.\n\n"
|
"@brief Set the content of the canvas to a specified control.\n\n"
|
||||||
|
|
||||||
"@param ctrl ID or name of GuiControl to set content to\n\n"
|
"@param ctrl ID or name of GuiControl to set content to\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"Canvas.setContent(PlayGui);\n"
|
"Canvas.setContent(PlayGui);\n"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
// Not using old error reporting until we modify the engineAPI - mperry
|
// Not using old error reporting until we modify the engineAPI - mperry
|
||||||
|
|
||||||
//GuiControl *gui = NULL;
|
//GuiControl *gui = NULL;
|
||||||
// if(argv[2][0])
|
// if(argv[2][0])
|
||||||
// {
|
// {
|
||||||
// if (!Sim::findObject(argv[2], gui))
|
// if (!Sim::findObject(argv[2], gui))
|
||||||
|
|
@ -2088,11 +2088,11 @@ DefineEngineMethod( GuiCanvas, setContent, void, (GuiControl* ctrl),,
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if(!ctrl)
|
if(!ctrl)
|
||||||
{
|
{
|
||||||
Con::errorf("GuiCanvas::setContent - Invalid control specified')");
|
Con::errorf("GuiCanvas::setContent - Invalid control specified')");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the new content control
|
//set the new content control
|
||||||
object->setContentControl(ctrl);
|
object->setContentControl(ctrl);
|
||||||
|
|
@ -2111,11 +2111,11 @@ ConsoleDocFragment _pushDialog(
|
||||||
);
|
);
|
||||||
|
|
||||||
DefineConsoleMethod( GuiCanvas, pushDialog, void, (const char * ctrlName, S32 layer, bool center), ( 0, false), "(GuiControl ctrl, int layer=0, bool center=false)"
|
DefineConsoleMethod( GuiCanvas, pushDialog, void, (const char * ctrlName, S32 layer, bool center), ( 0, false), "(GuiControl ctrl, int layer=0, bool center=false)"
|
||||||
"@hide")
|
"@hide")
|
||||||
{
|
{
|
||||||
GuiControl *gui;
|
GuiControl *gui;
|
||||||
|
|
||||||
if (! Sim::findObject(ctrlName, gui))
|
if (! Sim::findObject(ctrlName, gui))
|
||||||
{
|
{
|
||||||
Con::printf("pushDialog(): Invalid control: %s", ctrlName);
|
Con::printf("pushDialog(): Invalid control: %s", ctrlName);
|
||||||
return;
|
return;
|
||||||
|
|
@ -2148,7 +2148,7 @@ ConsoleDocFragment _popDialog2(
|
||||||
);
|
);
|
||||||
|
|
||||||
DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (nullAsType<GuiControl*>()), "(GuiControl ctrl=NULL)"
|
DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (nullAsType<GuiControl*>()), "(GuiControl ctrl=NULL)"
|
||||||
"@hide")
|
"@hide")
|
||||||
{
|
{
|
||||||
if (gui)
|
if (gui)
|
||||||
object->popDialogControl(gui);
|
object->popDialogControl(gui);
|
||||||
|
|
@ -2157,160 +2157,160 @@ DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (nullAsType
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleDocFragment _popLayer1(
|
ConsoleDocFragment _popLayer1(
|
||||||
"@brief Removes the top most layer of dialogs\n\n"
|
"@brief Removes the top most layer of dialogs\n\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"Canvas.popLayer();\n"
|
"Canvas.popLayer();\n"
|
||||||
"@endtsexample\n\n",
|
"@endtsexample\n\n",
|
||||||
"GuiCanvas",
|
"GuiCanvas",
|
||||||
"void popLayer();"
|
"void popLayer();"
|
||||||
);
|
);
|
||||||
|
|
||||||
ConsoleDocFragment _popLayer2(
|
ConsoleDocFragment _popLayer2(
|
||||||
"@brief Removes a specified layer of dialogs\n\n"
|
"@brief Removes a specified layer of dialogs\n\n"
|
||||||
"@param layer Number of the layer to pop\n\n"
|
"@param layer Number of the layer to pop\n\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"Canvas.popLayer(1);\n"
|
"Canvas.popLayer(1);\n"
|
||||||
"@endtsexample\n\n",
|
"@endtsexample\n\n",
|
||||||
"GuiCanvas",
|
"GuiCanvas",
|
||||||
"void popLayer(S32 layer);"
|
"void popLayer(S32 layer);"
|
||||||
);
|
);
|
||||||
|
|
||||||
DefineConsoleMethod( GuiCanvas, popLayer, void, (S32 layer), (0), "(int layer)"
|
DefineConsoleMethod( GuiCanvas, popLayer, void, (S32 layer), (0), "(int layer)"
|
||||||
"@hide")
|
"@hide")
|
||||||
{
|
{
|
||||||
|
|
||||||
object->popDialogControl(layer);
|
object->popDialogControl(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, cursorOn, void, (),,
|
DefineEngineMethod( GuiCanvas, cursorOn, void, (),,
|
||||||
"@brief Turns on the mouse cursor.\n\n"
|
"@brief Turns on the mouse cursor.\n\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"Canvas.cursorOn();\n"
|
"Canvas.cursorOn();\n"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
object->setCursorON(true);
|
object->setCursorON(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, cursorOff, void, (),,
|
DefineEngineMethod( GuiCanvas, cursorOff, void, (),,
|
||||||
"@brief Turns on the mouse off.\n\n"
|
"@brief Turns on the mouse off.\n\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"Canvas.cursorOff();\n"
|
"Canvas.cursorOff();\n"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
object->setCursorON(false);
|
object->setCursorON(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, setCursor, void, (GuiCursor* cursor),,
|
DefineEngineMethod( GuiCanvas, setCursor, void, (GuiCursor* cursor),,
|
||||||
"@brief Sets the cursor for the canvas.\n\n"
|
"@brief Sets the cursor for the canvas.\n\n"
|
||||||
|
|
||||||
"@param cursor Name of the GuiCursor to use\n\n"
|
"@param cursor Name of the GuiCursor to use\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"Canvas.setCursor(\"DefaultCursor\");\n"
|
"Canvas.setCursor(\"DefaultCursor\");\n"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
if(!cursor)
|
if(!cursor)
|
||||||
{
|
{
|
||||||
Con::errorf("GuiCanvas::setCursor - Invalid GuiCursor name or ID");
|
Con::errorf("GuiCanvas::setCursor - Invalid GuiCursor name or ID");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
object->setCursor(cursor);
|
object->setCursor(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, renderFront, void, ( bool enable ),,
|
DefineEngineMethod( GuiCanvas, renderFront, void, ( bool enable ),,
|
||||||
"@brief This turns on/off front-buffer rendering.\n\n"
|
"@brief This turns on/off front-buffer rendering.\n\n"
|
||||||
|
|
||||||
"@param enable True if all rendering should be done to the front buffer\n\n"
|
"@param enable True if all rendering should be done to the front buffer\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"Canvas.renderFront(false);\n"
|
"Canvas.renderFront(false);\n"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
object->setRenderFront(enable);
|
object->setRenderFront(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, showCursor, void, (),,
|
DefineEngineMethod( GuiCanvas, showCursor, void, (),,
|
||||||
"@brief Enable rendering of the cursor.\n\n"
|
"@brief Enable rendering of the cursor.\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"Canvas.showCursor();\n"
|
"Canvas.showCursor();\n"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
object->showCursor(true);
|
object->showCursor(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, hideCursor, void, (),,
|
DefineEngineMethod( GuiCanvas, hideCursor, void, (),,
|
||||||
"@brief Disable rendering of the cursor.\n\n"
|
"@brief Disable rendering of the cursor.\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"Canvas.hideCursor();\n"
|
"Canvas.hideCursor();\n"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
object->showCursor(false);
|
object->showCursor(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, isCursorOn, bool, (),,
|
DefineEngineMethod( GuiCanvas, isCursorOn, bool, (),,
|
||||||
"@brief Determines if mouse cursor is enabled.\n\n"
|
"@brief Determines if mouse cursor is enabled.\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Is cursor on?\n"
|
"// Is cursor on?\n"
|
||||||
"if(Canvas.isCursorOn())\n"
|
"if(Canvas.isCursorOn())\n"
|
||||||
" echo(\"Canvas cursor is on\");\n"
|
" echo(\"Canvas cursor is on\");\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
"@return Returns true if the cursor is on.\n\n")
|
"@return Returns true if the cursor is on.\n\n")
|
||||||
{
|
{
|
||||||
return object->isCursorON();
|
return object->isCursorON();
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, isCursorShown, bool, (),,
|
DefineEngineMethod( GuiCanvas, isCursorShown, bool, (),,
|
||||||
"@brief Determines if mouse cursor is rendering.\n\n"
|
"@brief Determines if mouse cursor is rendering.\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Is cursor rendering?\n"
|
"// Is cursor rendering?\n"
|
||||||
"if(Canvas.isCursorShown())\n"
|
"if(Canvas.isCursorShown())\n"
|
||||||
" echo(\"Canvas cursor is rendering\");\n"
|
" echo(\"Canvas cursor is rendering\");\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
"@return Returns true if the cursor is rendering.\n\n")
|
"@return Returns true if the cursor is rendering.\n\n")
|
||||||
{
|
{
|
||||||
return object->isCursorShown();
|
return object->isCursorShown();
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, repaint, void, ( S32 elapsedMS ), (0),
|
DefineEngineMethod( GuiCanvas, repaint, void, ( S32 elapsedMS ), (0),
|
||||||
"@brief Force canvas to redraw.\n"
|
"@brief Force canvas to redraw.\n"
|
||||||
"If the elapsed time is greater than the time since the last paint "
|
"If the elapsed time is greater than the time since the last paint "
|
||||||
"then the repaint will be skipped.\n"
|
"then the repaint will be skipped.\n"
|
||||||
"@param elapsedMS The optional elapsed time in milliseconds.\n\n"
|
"@param elapsedMS The optional elapsed time in milliseconds.\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"Canvas.repaint();\n"
|
"Canvas.repaint();\n"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
object->repaint(elapsedMS < 0 ? 0 : elapsedMS);
|
object->repaint(elapsedMS < 0 ? 0 : elapsedMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, reset, void, (),,
|
DefineEngineMethod( GuiCanvas, reset, void, (),,
|
||||||
"@brief Reset the update regions for the canvas.\n\n"
|
"@brief Reset the update regions for the canvas.\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"Canvas.reset();\n"
|
"Canvas.reset();\n"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
object->resetUpdateRegions();
|
object->resetUpdateRegions();
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, getCursorPos, Point2I, (),,
|
DefineEngineMethod( GuiCanvas, getCursorPos, Point2I, (),,
|
||||||
"@brief Get the current position of the cursor in screen-space. Note that this position"
|
"@brief Get the current position of the cursor in screen-space. Note that this position"
|
||||||
" might be outside the Torque window. If you want to get the position within the Canvas,"
|
" might be outside the Torque window. If you want to get the position within the Canvas,"
|
||||||
" call screenToClient on the result.\n\n"
|
" call screenToClient on the result.\n\n"
|
||||||
"@see Canvas::screenToClient()\n\n"
|
"@see Canvas::screenToClient()\n\n"
|
||||||
"@param param Description\n\n"
|
"@param param Description\n\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"%cursorPos = Canvas.getCursorPos();\n"
|
"%cursorPos = Canvas.getCursorPos();\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
"@return Screen coordinates of mouse cursor, in format \"X Y\"")
|
"@return Screen coordinates of mouse cursor, in format \"X Y\"")
|
||||||
{
|
{
|
||||||
return object->getCursorPos();
|
return object->getCursorPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleDocFragment _setCursorPos1(
|
ConsoleDocFragment _setCursorPos1(
|
||||||
|
|
@ -2334,21 +2334,21 @@ ConsoleDocFragment _setCursorPos2(
|
||||||
);
|
);
|
||||||
|
|
||||||
DefineConsoleMethod( GuiCanvas, setCursorPos, void, (Point2I pos), , "(Point2I pos)"
|
DefineConsoleMethod( GuiCanvas, setCursorPos, void, (Point2I pos), , "(Point2I pos)"
|
||||||
"@hide")
|
"@hide")
|
||||||
{
|
{
|
||||||
|
|
||||||
object->setCursorPos(pos);
|
object->setCursorPos(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, getMouseControl, S32, (),,
|
DefineEngineMethod( GuiCanvas, getMouseControl, S32, (),,
|
||||||
"@brief Gets the gui control under the mouse.\n\n"
|
"@brief Gets the gui control under the mouse.\n\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"%underMouse = Canvas.getMouseControl();\n"
|
"%underMouse = Canvas.getMouseControl();\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
|
|
||||||
"@return ID of the gui control, if one was found. NULL otherwise")
|
"@return ID of the gui control, if one was found. NULL otherwise")
|
||||||
{
|
{
|
||||||
GuiControl* control = object->getMouseControl();
|
GuiControl* control = object->getMouseControl();
|
||||||
if (control)
|
if (control)
|
||||||
return control->getId();
|
return control->getId();
|
||||||
|
|
||||||
|
|
@ -2356,18 +2356,18 @@ DefineEngineMethod( GuiCanvas, getMouseControl, S32, (),,
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineFunction(excludeOtherInstance, bool, (const char* appIdentifer),,
|
DefineEngineFunction(excludeOtherInstance, bool, (const char* appIdentifer),,
|
||||||
"@brief Used to exclude/prevent all other instances using the same identifier specified\n\n"
|
"@brief Used to exclude/prevent all other instances using the same identifier specified\n\n"
|
||||||
|
|
||||||
"@note Not used on OSX, Xbox, or in Win debug builds\n\n"
|
"@note Not used on OSX, Xbox, or in Win debug builds\n\n"
|
||||||
|
|
||||||
"@param appIdentifier Name of the app set up for exclusive use.\n"
|
"@param appIdentifier Name of the app set up for exclusive use.\n"
|
||||||
|
|
||||||
"@return False if another app is running that specified the same appIdentifier\n\n"
|
"@return False if another app is running that specified the same appIdentifier\n\n"
|
||||||
|
|
||||||
"@ingroup Platform\n"
|
"@ingroup Platform\n"
|
||||||
"@ingroup GuiCore")
|
"@ingroup GuiCore")
|
||||||
{
|
{
|
||||||
// mac/360 can only run one instance in general.
|
// mac/360 can only run one instance in general.
|
||||||
#if !defined(TORQUE_OS_MAC) && !defined(TORQUE_OS_XENON) && !defined(TORQUE_DEBUG) && !defined(TORQUE_OS_LINUX)
|
#if !defined(TORQUE_OS_MAC) && !defined(TORQUE_OS_XENON) && !defined(TORQUE_DEBUG) && !defined(TORQUE_OS_LINUX)
|
||||||
return Platform::excludeOtherInstances(appIdentifer);
|
return Platform::excludeOtherInstances(appIdentifer);
|
||||||
#else
|
#else
|
||||||
|
|
@ -2377,82 +2377,82 @@ DefineEngineFunction(excludeOtherInstance, bool, (const char* appIdentifer),,
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, getExtent, Point2I, (),,
|
DefineEngineMethod( GuiCanvas, getExtent, Point2I, (),,
|
||||||
"@brief Returns the dimensions of the canvas\n\n"
|
"@brief Returns the dimensions of the canvas\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"%extent = Canvas.getExtent();\n"
|
"%extent = Canvas.getExtent();\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
|
|
||||||
"@return Width and height of canvas. Formatted as numerical values in a single string \"# #\"")
|
"@return Width and height of canvas. Formatted as numerical values in a single string \"# #\"")
|
||||||
{
|
{
|
||||||
return object->getExtent();
|
return object->getExtent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, setWindowTitle, void, ( const char* newTitle),,
|
DefineEngineMethod( GuiCanvas, setWindowTitle, void, ( const char* newTitle),,
|
||||||
"@brief Change the title of the OS window.\n\n"
|
"@brief Change the title of the OS window.\n\n"
|
||||||
|
|
||||||
"@param newTitle String containing the new name\n\n"
|
"@param newTitle String containing the new name\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"Canvas.setWindowTitle(\"Documentation Rocks!\");\n"
|
"Canvas.setWindowTitle(\"Documentation Rocks!\");\n"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
object->setWindowTitle(newTitle);
|
object->setWindowTitle(newTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, findFirstMatchingMonitor, S32, (const char* name),,
|
DefineEngineMethod( GuiCanvas, findFirstMatchingMonitor, S32, (const char* name),,
|
||||||
"@brief Find the first monitor index that matches the given name.\n\n"
|
"@brief Find the first monitor index that matches the given name.\n\n"
|
||||||
"The actual match algorithm depends on the implementation.\n"
|
"The actual match algorithm depends on the implementation.\n"
|
||||||
"@param name The name to search for.\n\n"
|
"@param name The name to search for.\n\n"
|
||||||
"@return The number of monitors attached to the system, including the default monoitor.")
|
"@return The number of monitors attached to the system, including the default monoitor.")
|
||||||
{
|
{
|
||||||
return PlatformWindowManager::get()->findFirstMatchingMonitor(name);
|
return PlatformWindowManager::get()->findFirstMatchingMonitor(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, getMonitorCount, S32, (),,
|
DefineEngineMethod( GuiCanvas, getMonitorCount, S32, (),,
|
||||||
"@brief Gets the number of monitors attached to the system.\n\n"
|
"@brief Gets the number of monitors attached to the system.\n\n"
|
||||||
|
|
||||||
"@return The number of monitors attached to the system, including the default monoitor.")
|
"@return The number of monitors attached to the system, including the default monoitor.")
|
||||||
{
|
{
|
||||||
return PlatformWindowManager::get()->getMonitorCount();
|
return PlatformWindowManager::get()->getMonitorCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, getMonitorName, const char*, (S32 index),,
|
DefineEngineMethod( GuiCanvas, getMonitorName, const char*, (S32 index),,
|
||||||
"@brief Gets the name of the requested monitor.\n\n"
|
"@brief Gets the name of the requested monitor.\n\n"
|
||||||
"@param index The monitor index.\n\n"
|
"@param index The monitor index.\n\n"
|
||||||
"@return The name of the requested monitor.")
|
"@return The name of the requested monitor.")
|
||||||
{
|
{
|
||||||
return PlatformWindowManager::get()->getMonitorName(index);
|
return PlatformWindowManager::get()->getMonitorName(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, getMonitorRect, RectI, (S32 index),,
|
DefineEngineMethod( GuiCanvas, getMonitorRect, RectI, (S32 index),,
|
||||||
"@brief Gets the region of the requested monitor.\n\n"
|
"@brief Gets the region of the requested monitor.\n\n"
|
||||||
"@param index The monitor index.\n\n"
|
"@param index The monitor index.\n\n"
|
||||||
"@return The rectangular region of the requested monitor.")
|
"@return The rectangular region of the requested monitor.")
|
||||||
{
|
{
|
||||||
return PlatformWindowManager::get()->getMonitorRect(index);
|
return PlatformWindowManager::get()->getMonitorRect(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, getVideoMode, const char*, (),,
|
DefineEngineMethod( GuiCanvas, getVideoMode, const char*, (),,
|
||||||
"@brief Gets the current screen mode as a string.\n\n"
|
"@brief Gets the current screen mode as a string.\n\n"
|
||||||
|
|
||||||
"The return string will contain 5 values (width, height, fullscreen, bitdepth, refreshRate). "
|
"The return string will contain 5 values (width, height, fullscreen, bitdepth, refreshRate). "
|
||||||
"You will need to parse out each one for individual use.\n\n"
|
"You will need to parse out each one for individual use.\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"%screenWidth = getWord(Canvas.getVideoMode(), 0);\n"
|
"%screenWidth = getWord(Canvas.getVideoMode(), 0);\n"
|
||||||
"%screenHeight = getWord(Canvas.getVideoMode(), 1);\n"
|
"%screenHeight = getWord(Canvas.getVideoMode(), 1);\n"
|
||||||
"%isFullscreen = getWord(Canvas.getVideoMode(), 2);\n"
|
"%isFullscreen = getWord(Canvas.getVideoMode(), 2);\n"
|
||||||
"%bitdepth = getWord(Canvas.getVideoMode(), 3);\n"
|
"%bitdepth = getWord(Canvas.getVideoMode(), 3);\n"
|
||||||
"%refreshRate = getWord(Canvas.getVideoMode(), 4);\n"
|
"%refreshRate = getWord(Canvas.getVideoMode(), 4);\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
|
|
||||||
"@return String formatted with screen width, screen height, screen mode, bit depth, and refresh rate.")
|
"@return String formatted with screen width, screen height, screen mode, bit depth, and refresh rate.")
|
||||||
{
|
{
|
||||||
// Grab the video mode.
|
// Grab the video mode.
|
||||||
if (!object->getPlatformWindow())
|
if (!object->getPlatformWindow())
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
|
@ -2463,17 +2463,17 @@ DefineEngineMethod( GuiCanvas, getVideoMode, const char*, (),,
|
||||||
|
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, getModeCount, S32, (),,
|
DefineEngineMethod( GuiCanvas, getModeCount, S32, (),,
|
||||||
"@brief Gets the number of modes available on this device.\n\n"
|
"@brief Gets the number of modes available on this device.\n\n"
|
||||||
|
|
||||||
"@param param Description\n\n"
|
"@param param Description\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"%modeCount = Canvas.getModeCount()\n"
|
"%modeCount = Canvas.getModeCount()\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
|
|
||||||
"@return The number of video modes supported by the device")
|
"@return The number of video modes supported by the device")
|
||||||
{
|
{
|
||||||
if (!object->getPlatformWindow())
|
if (!object->getPlatformWindow())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Grab the available mode list from the device.
|
// Grab the available mode list from the device.
|
||||||
|
|
@ -2485,12 +2485,12 @@ DefineEngineMethod( GuiCanvas, getModeCount, S32, (),,
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, getMode, const char*, (S32 modeId),,
|
DefineEngineMethod( GuiCanvas, getMode, const char*, (S32 modeId),,
|
||||||
"@brief Gets information on the specified mode of this device.\n\n"
|
"@brief Gets information on the specified mode of this device.\n\n"
|
||||||
"@param modeId Index of the mode to get data from.\n"
|
"@param modeId Index of the mode to get data from.\n"
|
||||||
"@return A video mode string given an adapter and mode index.\n\n"
|
"@return A video mode string given an adapter and mode index.\n\n"
|
||||||
"@see GuiCanvas::getVideoMode()")
|
"@see GuiCanvas::getVideoMode()")
|
||||||
{
|
{
|
||||||
if (!object->getPlatformWindow())
|
if (!object->getPlatformWindow())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Grab the available mode list from the device.
|
// Grab the available mode list from the device.
|
||||||
|
|
@ -2515,14 +2515,14 @@ DefineEngineMethod( GuiCanvas, getMode, const char*, (S32 modeId),,
|
||||||
|
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, toggleFullscreen, void, (),,
|
DefineEngineMethod( GuiCanvas, toggleFullscreen, void, (),,
|
||||||
"@brief toggle canvas from fullscreen to windowed mode or back.\n\n"
|
"@brief toggle canvas from fullscreen to windowed mode or back.\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// If we are in windowed mode, the following will put is in fullscreen\n"
|
"// If we are in windowed mode, the following will put is in fullscreen\n"
|
||||||
"Canvas.toggleFullscreen();"
|
"Canvas.toggleFullscreen();"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
if (Platform::getWebDeployment())
|
if (Platform::getWebDeployment())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!object->getPlatformWindow())
|
if (!object->getPlatformWindow())
|
||||||
|
|
@ -2693,7 +2693,7 @@ DefineConsoleMethod( GuiCanvas, setVideoMode, void,
|
||||||
"\\param fullscreen Specify true to run fullscreen or false to run in a window\n"
|
"\\param fullscreen Specify true to run fullscreen or false to run in a window\n"
|
||||||
"\\param bitDepth [optional] The desired bit-depth. Defaults to the current setting. This parameter is ignored if you are running in a window.\n"
|
"\\param bitDepth [optional] The desired bit-depth. Defaults to the current setting. This parameter is ignored if you are running in a window.\n"
|
||||||
"\\param refreshRate [optional] The desired refresh rate. Defaults to the current setting. This parameter is ignored if you are running in a window"
|
"\\param refreshRate [optional] The desired refresh rate. Defaults to the current setting. This parameter is ignored if you are running in a window"
|
||||||
"\\param antialiasLevel [optional] The level of anti-aliasing to apply 0 = none" )
|
"\\param antialiasLevel [optional] The level of anti-aliasing to apply 0 = none" )
|
||||||
{
|
{
|
||||||
if (!object->getPlatformWindow())
|
if (!object->getPlatformWindow())
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -716,16 +716,16 @@ void GuiEditCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
ctOffset = getCurrentAddSet()->localToGlobalCoord(Point2I(0,0));
|
ctOffset = getCurrentAddSet()->localToGlobalCoord(Point2I(0,0));
|
||||||
RectI box(ctOffset.x, ctOffset.y, cext.x, cext.y);
|
RectI box(ctOffset.x, ctOffset.y, cext.x, cext.y);
|
||||||
|
|
||||||
box.inset( -5, -5 );
|
box.inset( -5, -5 );
|
||||||
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
||||||
box.inset( 1, 1 );
|
box.inset( 1, 1 );
|
||||||
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
||||||
box.inset( 1, 1 );
|
box.inset( 1, 1 );
|
||||||
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
||||||
box.inset( 1, 1 );
|
box.inset( 1, 1 );
|
||||||
|
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
||||||
|
box.inset( 1, 1 );
|
||||||
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
||||||
box.inset( 1, 1 );
|
|
||||||
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
|
||||||
}
|
}
|
||||||
Vector<GuiControl *>::iterator i;
|
Vector<GuiControl *>::iterator i;
|
||||||
bool multisel = mSelectedControls.size() > 1;
|
bool multisel = mSelectedControls.size() > 1;
|
||||||
|
|
@ -2481,16 +2481,16 @@ DefineConsoleMethod( GuiEditCtrl, getContentControl, S32, (), , "() - Return the
|
||||||
|
|
||||||
DefineConsoleMethod( GuiEditCtrl, setContentControl, void, (GuiControl *ctrl ), , "( GuiControl ctrl ) - Set the toplevel control to edit in the GUI editor." )
|
DefineConsoleMethod( GuiEditCtrl, setContentControl, void, (GuiControl *ctrl ), , "( GuiControl ctrl ) - Set the toplevel control to edit in the GUI editor." )
|
||||||
{
|
{
|
||||||
if (ctrl)
|
if (ctrl)
|
||||||
object->setContentControl(ctrl);
|
object->setContentControl(ctrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
DefineConsoleMethod( GuiEditCtrl, addNewCtrl, void, (GuiControl *ctrl), , "(GuiControl ctrl)")
|
DefineConsoleMethod( GuiEditCtrl, addNewCtrl, void, (GuiControl *ctrl), , "(GuiControl ctrl)")
|
||||||
{
|
{
|
||||||
if (ctrl)
|
if (ctrl)
|
||||||
object->addNewControl(ctrl);
|
object->addNewControl(ctrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -2518,7 +2518,7 @@ DefineConsoleMethod( GuiEditCtrl, clearSelection, void, (), , "Clear selected co
|
||||||
|
|
||||||
DefineConsoleMethod( GuiEditCtrl, select, void, (GuiControl *ctrl), , "(GuiControl ctrl)")
|
DefineConsoleMethod( GuiEditCtrl, select, void, (GuiControl *ctrl), , "(GuiControl ctrl)")
|
||||||
{
|
{
|
||||||
if (ctrl)
|
if (ctrl)
|
||||||
object->setSelection(ctrl, false);
|
object->setSelection(ctrl, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2526,7 +2526,7 @@ DefineConsoleMethod( GuiEditCtrl, select, void, (GuiControl *ctrl), , "(GuiContr
|
||||||
|
|
||||||
DefineConsoleMethod( GuiEditCtrl, setCurrentAddSet, void, (GuiControl *addSet), , "(GuiControl ctrl)")
|
DefineConsoleMethod( GuiEditCtrl, setCurrentAddSet, void, (GuiControl *addSet), , "(GuiControl ctrl)")
|
||||||
{
|
{
|
||||||
if (addSet)
|
if (addSet)
|
||||||
object->setCurrentAddSet(addSet);
|
object->setCurrentAddSet(addSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,8 @@ ConsoleDocClass( GuiMenuBar,
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"new GuiMenuBar(newMenuBar)\n"
|
"new GuiMenuBar(newMenuBar)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" Padding = \"0\";\n"
|
" Padding = \"0\";\n"
|
||||||
" //Properties not specific to this control have been omitted from this example.\n"
|
" //Properties not specific to this control have been omitted from this example.\n"
|
||||||
"};\n\n"
|
"};\n\n"
|
||||||
"// Add a menu to the menu bar\n"
|
"// Add a menu to the menu bar\n"
|
||||||
"newMenuBar.addMenu(0,\"New Menu\");\n\n"
|
"newMenuBar.addMenu(0,\"New Menu\");\n\n"
|
||||||
|
|
@ -105,7 +105,7 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onMouseInMenu, void, (bool isInMenu),( isInMenu
|
||||||
"// Mouse enters or persists within the menu, causing the callback to occur.\n"
|
"// Mouse enters or persists within the menu, causing the callback to occur.\n"
|
||||||
"GuiMenuBar::onMouseInMenu(%this,%hasLeftMenu)\n"
|
"GuiMenuBar::onMouseInMenu(%this,%hasLeftMenu)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" // Code to run when the callback occurs\n"
|
" // Code to run when the callback occurs\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
"@see GuiTickCtrl\n\n"
|
"@see GuiTickCtrl\n\n"
|
||||||
|
|
@ -119,14 +119,14 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onMenuSelect, void, ( S32 menuId, const char* me
|
||||||
"// A menu has been selected, causing the callback to occur.\n"
|
"// A menu has been selected, causing the callback to occur.\n"
|
||||||
"GuiMenuBar::onMenuSelect(%this,%menuId,%menuText)\n"
|
"GuiMenuBar::onMenuSelect(%this,%menuId,%menuText)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" // Code to run when the callback occurs\n"
|
" // Code to run when the callback occurs\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
"@see GuiTickCtrl\n\n"
|
"@see GuiTickCtrl\n\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
IMPLEMENT_CALLBACK( GuiMenuBar, onMenuItemSelect, void, ( S32 menuId, const char* menuText, S32 menuItemId, const char* menuItemText ),
|
IMPLEMENT_CALLBACK( GuiMenuBar, onMenuItemSelect, void, ( S32 menuId, const char* menuText, S32 menuItemId, const char* menuItemText ),
|
||||||
( menuId, menuText, menuItemId, menuItemText ),
|
( menuId, menuText, menuItemId, menuItemText ),
|
||||||
"@brief Called whenever an item in a menu is selected.\n\n"
|
"@brief Called whenever an item in a menu is selected.\n\n"
|
||||||
"@param menuId Index id of the menu which contains the selected menu item\n"
|
"@param menuId Index id of the menu which contains the selected menu item\n"
|
||||||
"@param menuText Text of the menu which contains the selected menu item\n\n"
|
"@param menuText Text of the menu which contains the selected menu item\n\n"
|
||||||
|
|
@ -136,7 +136,7 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onMenuItemSelect, void, ( S32 menuId, const char
|
||||||
"// A menu item has been selected, causing the callback to occur.\n"
|
"// A menu item has been selected, causing the callback to occur.\n"
|
||||||
"GuiMenuBar::onMenuItemSelect(%this,%menuId,%menuText,%menuItemId,%menuItemText)\n"
|
"GuiMenuBar::onMenuItemSelect(%this,%menuId,%menuText,%menuItemId,%menuItemText)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" // Code to run when the callback occurs\n"
|
" // Code to run when the callback occurs\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
"@see GuiTickCtrl\n\n"
|
"@see GuiTickCtrl\n\n"
|
||||||
|
|
@ -149,7 +149,7 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onSubmenuSelect, void, ( S32 submenuId, const ch
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"GuiMenuBar::onSubmenuSelect(%this,%submenuId,%submenuText)\n"
|
"GuiMenuBar::onSubmenuSelect(%this,%submenuId,%submenuText)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" // Code to run when the callback occurs\n"
|
" // Code to run when the callback occurs\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
"@see GuiTickCtrl\n\n"
|
"@see GuiTickCtrl\n\n"
|
||||||
|
|
@ -216,7 +216,7 @@ DefineEngineMethod(GuiMenuBar, addMenu, void, (const char* menuText, S32 menuId)
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod(GuiMenuBar, addMenuItem, void, (const char* targetMenu, const char* menuItemText, S32 menuItemId, const char* accelerator, int checkGroup, const char *cmd),
|
DefineEngineMethod(GuiMenuBar, addMenuItem, void, (const char* targetMenu, const char* menuItemText, S32 menuItemId, const char* accelerator, int checkGroup, const char *cmd),
|
||||||
("","",0,nullAsType<const char*>(),-1,""),
|
("","",0,nullAsType<const char*>(),-1,""),
|
||||||
"@brief Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.\n\n"
|
"@brief Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.\n\n"
|
||||||
"@param menu Menu name or menu Id to add the new item to.\n"
|
"@param menu Menu name or menu Id to add the new item to.\n"
|
||||||
"@param menuItemText Text for the new menu item.\n"
|
"@param menuItemText Text for the new menu item.\n"
|
||||||
|
|
@ -637,7 +637,7 @@ DefineEngineMethod(GuiMenuBar, setMenuItemSubmenuState, void, (const char* menuT
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod(GuiMenuBar, addSubmenuItem, void, (const char* menuTarget, const char* menuItem, const char* submenuItemText,
|
DefineEngineMethod(GuiMenuBar, addSubmenuItem, void, (const char* menuTarget, const char* menuItem, const char* submenuItemText,
|
||||||
int submenuItemId, const char* accelerator, int checkGroup),,
|
int submenuItemId, const char* accelerator, int checkGroup),,
|
||||||
"@brief Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.\n\n"
|
"@brief Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.\n\n"
|
||||||
"@param menuTarget Menu to affect a submenu in\n"
|
"@param menuTarget Menu to affect a submenu in\n"
|
||||||
"@param menuItem Menu item to affect\n"
|
"@param menuItem Menu item to affect\n"
|
||||||
|
|
@ -814,21 +814,21 @@ void GuiMenuBar::addMenu(const char *menuText, U32 menuId)
|
||||||
|
|
||||||
GuiMenuBar::Menu *GuiMenuBar::findMenu(const char *menu)
|
GuiMenuBar::Menu *GuiMenuBar::findMenu(const char *menu)
|
||||||
{
|
{
|
||||||
if(dIsdigit(menu[0]))
|
if(dIsdigit(menu[0]))
|
||||||
{
|
{
|
||||||
U32 id = dAtoi(menu);
|
U32 id = dAtoi(menu);
|
||||||
for (U32 i = 0; i < mMenuList.size(); ++i)
|
for (U32 i = 0; i < mMenuList.size(); ++i)
|
||||||
if (id == mMenuList[i]->id)
|
if (id == mMenuList[i]->id)
|
||||||
return mMenuList[i];
|
return mMenuList[i];
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (U32 i = 0; i < mMenuList.size(); ++i)
|
for (U32 i = 0; i < mMenuList.size(); ++i)
|
||||||
if (!dStricmp(menu, mMenuList[i]->text))
|
if (!dStricmp(menu, mMenuList[i]->text))
|
||||||
return mMenuList[i];
|
return mMenuList[i];
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiMenuBar::MenuItem *GuiMenuBar::findMenuItem(Menu *menu, const char *menuItem)
|
GuiMenuBar::MenuItem *GuiMenuBar::findMenuItem(Menu *menu, const char *menuItem)
|
||||||
|
|
@ -981,13 +981,13 @@ GuiMenuBar::MenuItem *GuiMenuBar::findSubmenuItem(Menu *menu, const char *menuIt
|
||||||
U32 id = dAtoi(menuItem);
|
U32 id = dAtoi(menuItem);
|
||||||
for(MenuItem *walk = menu->firstMenuItem; walk; walk = walk->nextMenuItem)
|
for(MenuItem *walk = menu->firstMenuItem; walk; walk = walk->nextMenuItem)
|
||||||
if(id == walk->id)
|
if(id == walk->id)
|
||||||
{
|
{
|
||||||
if(walk->isSubmenu && walk->submenu)
|
if(walk->isSubmenu && walk->submenu)
|
||||||
{
|
{
|
||||||
return GuiMenuBar::findMenuItem(walk->submenu, submenuItem);
|
return GuiMenuBar::findMenuItem(walk->submenu, submenuItem);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -995,13 +995,13 @@ GuiMenuBar::MenuItem *GuiMenuBar::findSubmenuItem(Menu *menu, const char *menuIt
|
||||||
// Search by name
|
// Search by name
|
||||||
for(MenuItem *walk = menu->firstMenuItem; walk; walk = walk->nextMenuItem)
|
for(MenuItem *walk = menu->firstMenuItem; walk; walk = walk->nextMenuItem)
|
||||||
if(!dStricmp(menuItem, walk->text))
|
if(!dStricmp(menuItem, walk->text))
|
||||||
{
|
{
|
||||||
if(walk->isSubmenu && walk->submenu)
|
if(walk->isSubmenu && walk->submenu)
|
||||||
{
|
{
|
||||||
return GuiMenuBar::findMenuItem(walk->submenu, submenuItem);
|
return GuiMenuBar::findMenuItem(walk->submenu, submenuItem);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1021,7 +1021,7 @@ void GuiMenuBar::addSubmenuItem(Menu *menu, MenuItem *submenu, const char *text,
|
||||||
if(submenu && !submenu->isSubmenu)
|
if(submenu && !submenu->isSubmenu)
|
||||||
{
|
{
|
||||||
Con::errorf("GuiMenuBar::addSubmenuItem: Attempting to add menuitem '%s' to an invalid submenu",text);
|
Con::errorf("GuiMenuBar::addSubmenuItem: Attempting to add menuitem '%s' to an invalid submenu",text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate the new menu item
|
// allocate the new menu item
|
||||||
|
|
@ -1074,7 +1074,7 @@ void GuiMenuBar::removeSubmenuItem(MenuItem *menuItem, MenuItem *submenuItem)
|
||||||
if(menuItem && !menuItem->isSubmenu)
|
if(menuItem && !menuItem->isSubmenu)
|
||||||
{
|
{
|
||||||
Con::errorf("GuiMenuBar::removeSubmenuItem: Attempting to remove submenuitem '%s' from an invalid submenu",submenuItem->text);
|
Con::errorf("GuiMenuBar::removeSubmenuItem: Attempting to remove submenuitem '%s' from an invalid submenu",submenuItem->text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiMenuBar::removeMenuItem(menuItem->submenu, submenuItem);
|
GuiMenuBar::removeMenuItem(menuItem->submenu, submenuItem);
|
||||||
|
|
@ -1087,7 +1087,7 @@ void GuiMenuBar::clearSubmenuItems(MenuItem *menuitem)
|
||||||
if(menuitem && !menuitem->isSubmenu)
|
if(menuitem && !menuitem->isSubmenu)
|
||||||
{
|
{
|
||||||
Con::errorf("GuiMenuBar::clearSubmenuItems: Attempting to clear an invalid submenu");
|
Con::errorf("GuiMenuBar::clearSubmenuItems: Attempting to clear an invalid submenu");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(menuitem->submenu->firstMenuItem)
|
while(menuitem->submenu->firstMenuItem)
|
||||||
|
|
@ -1175,33 +1175,33 @@ void GuiMenuBar::onPreRender()
|
||||||
if (!mMenuList[i]->visible)
|
if (!mMenuList[i]->visible)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Bounds depends on if there is a bitmap to be drawn or not
|
// Bounds depends on if there is a bitmap to be drawn or not
|
||||||
if (mMenuList[i]->bitmapIndex == -1)
|
if (mMenuList[i]->bitmapIndex == -1)
|
||||||
{
|
{
|
||||||
// Text only
|
// Text only
|
||||||
mMenuList[i]->bounds.set(curX, 0, mProfile->mFont->getStrWidth(mMenuList[i]->text) + (mHorizontalMargin * 2), getHeight() - (mVerticalMargin * 2));
|
mMenuList[i]->bounds.set(curX, 0, mProfile->mFont->getStrWidth(mMenuList[i]->text) + (mHorizontalMargin * 2), getHeight() - (mVerticalMargin * 2));
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// Will the bitmap and text be draw?
|
// Will the bitmap and text be draw?
|
||||||
if (!mMenuList[i]->drawBitmapOnly)
|
if (!mMenuList[i]->drawBitmapOnly)
|
||||||
{
|
{
|
||||||
// Draw the bitmap and the text
|
// Draw the bitmap and the text
|
||||||
RectI *bitmapBounds = mProfile->mBitmapArrayRects.address();
|
RectI *bitmapBounds = mProfile->mBitmapArrayRects.address();
|
||||||
mMenuList[i]->bounds.set(curX, 0, bitmapBounds[mMenuList[i]->bitmapIndex].extent.x + mProfile->mFont->getStrWidth(mMenuList[i]->text) + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2));
|
mMenuList[i]->bounds.set(curX, 0, bitmapBounds[mMenuList[i]->bitmapIndex].extent.x + mProfile->mFont->getStrWidth(mMenuList[i]->text) + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2));
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// Only the bitmap will be drawn
|
// Only the bitmap will be drawn
|
||||||
RectI *bitmapBounds = mProfile->mBitmapArrayRects.address();
|
RectI *bitmapBounds = mProfile->mBitmapArrayRects.address();
|
||||||
mMenuList[i]->bounds.set(curX, 0, bitmapBounds[mMenuList[i]->bitmapIndex].extent.x + mBitmapMargin + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2));
|
mMenuList[i]->bounds.set(curX, 0, bitmapBounds[mMenuList[i]->bitmapIndex].extent.x + mBitmapMargin + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
curX += mMenuList[i]->bounds.extent.x;
|
curX += mMenuList[i]->bounds.extent.x;
|
||||||
}
|
}
|
||||||
mouseOverMenu = NULL;
|
mouseOverMenu = NULL;
|
||||||
mouseDownMenu = NULL;
|
mouseDownMenu = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1222,35 +1222,35 @@ void GuiMenuBar::checkMenuMouseMove(const GuiEvent &event)
|
||||||
void GuiMenuBar::onMouseMove(const GuiEvent &event)
|
void GuiMenuBar::onMouseMove(const GuiEvent &event)
|
||||||
{
|
{
|
||||||
Menu *hit = findHitMenu(event.mousePoint);
|
Menu *hit = findHitMenu(event.mousePoint);
|
||||||
if(hit != mouseOverMenu)
|
if(hit != mouseOverMenu)
|
||||||
{
|
{
|
||||||
// If we need to, reset the mouse over menu counter and indicate
|
// If we need to, reset the mouse over menu counter and indicate
|
||||||
// that we should track it.
|
// that we should track it.
|
||||||
if(hit)
|
if(hit)
|
||||||
mMouseOverCounter = 0;
|
mMouseOverCounter = 0;
|
||||||
if(!mCountMouseOver)
|
if(!mCountMouseOver)
|
||||||
{
|
{
|
||||||
// We've never started the counter, so start it.
|
// We've never started the counter, so start it.
|
||||||
if(hit)
|
if(hit)
|
||||||
mCountMouseOver = true;
|
mCountMouseOver = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mouseOverMenu = hit;
|
mouseOverMenu = hit;
|
||||||
setUpdate();
|
setUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiMenuBar::onMouseLeave(const GuiEvent &event)
|
void GuiMenuBar::onMouseLeave(const GuiEvent &event)
|
||||||
{
|
{
|
||||||
if(mouseOverMenu)
|
if(mouseOverMenu)
|
||||||
setUpdate();
|
setUpdate();
|
||||||
mouseOverMenu = NULL;
|
mouseOverMenu = NULL;
|
||||||
|
|
||||||
// As we've left the control, don't track how long the mouse has been
|
// As we've left the control, don't track how long the mouse has been
|
||||||
// within it.
|
// within it.
|
||||||
if(mCountMouseOver && mMouseOverCounter >= mMouseHoverAmount)
|
if(mCountMouseOver && mMouseOverCounter >= mMouseHoverAmount)
|
||||||
{
|
{
|
||||||
onMouseInMenu_callback(false); // Last parameter indicates if we've entered or left the menu
|
onMouseInMenu_callback(false); // Last parameter indicates if we've entered or left the menu
|
||||||
}
|
}
|
||||||
mCountMouseOver = false;
|
mCountMouseOver = false;
|
||||||
mMouseOverCounter = 0;
|
mMouseOverCounter = 0;
|
||||||
|
|
@ -1260,37 +1260,37 @@ void GuiMenuBar::onMouseDragged(const GuiEvent &event)
|
||||||
{
|
{
|
||||||
Menu *hit = findHitMenu(event.mousePoint);
|
Menu *hit = findHitMenu(event.mousePoint);
|
||||||
|
|
||||||
if(hit != mouseOverMenu)
|
if(hit != mouseOverMenu)
|
||||||
{
|
{
|
||||||
// If we need to, reset the mouse over menu counter and indicate
|
// If we need to, reset the mouse over menu counter and indicate
|
||||||
// that we should track it.
|
// that we should track it.
|
||||||
if(hit)
|
if(hit)
|
||||||
mMouseOverCounter = 0;
|
mMouseOverCounter = 0;
|
||||||
if(!mCountMouseOver)
|
if(!mCountMouseOver)
|
||||||
{
|
{
|
||||||
// We've never started the counter, so start it.
|
// We've never started the counter, so start it.
|
||||||
if(hit)
|
if(hit)
|
||||||
mCountMouseOver = true;
|
mCountMouseOver = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mouseOverMenu = hit;
|
mouseOverMenu = hit;
|
||||||
mouseDownMenu = hit;
|
mouseDownMenu = hit;
|
||||||
setUpdate();
|
setUpdate();
|
||||||
onAction();
|
onAction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiMenuBar::onMouseDown(const GuiEvent &event)
|
void GuiMenuBar::onMouseDown(const GuiEvent &event)
|
||||||
{
|
{
|
||||||
mouseDownMenu = mouseOverMenu = findHitMenu(event.mousePoint);
|
mouseDownMenu = mouseOverMenu = findHitMenu(event.mousePoint);
|
||||||
setUpdate();
|
setUpdate();
|
||||||
onAction();
|
onAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiMenuBar::onMouseUp(const GuiEvent &event)
|
void GuiMenuBar::onMouseUp(const GuiEvent &event)
|
||||||
{
|
{
|
||||||
mouseDownMenu = NULL;
|
mouseDownMenu = NULL;
|
||||||
setUpdate();
|
setUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
|
void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
|
||||||
|
|
@ -1320,20 +1320,20 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
|
||||||
start.x = mMenuList[i]->bounds.point.x + mHorizontalMargin;
|
start.x = mMenuList[i]->bounds.point.x + mHorizontalMargin;
|
||||||
start.y = mMenuList[i]->bounds.point.y + (mMenuList[i]->bounds.extent.y - mProfile->mFont->getHeight()) / 2;
|
start.y = mMenuList[i]->bounds.point.y + (mMenuList[i]->bounds.extent.y - mProfile->mFont->getHeight()) / 2;
|
||||||
|
|
||||||
// Draw the border
|
// Draw the border
|
||||||
if (mMenuList[i]->drawBorder)
|
if (mMenuList[i]->drawBorder)
|
||||||
{
|
{
|
||||||
RectI highlightBounds = bounds;
|
RectI highlightBounds = bounds;
|
||||||
highlightBounds.inset(1,1);
|
highlightBounds.inset(1,1);
|
||||||
if (mMenuList[i] == mouseDownMenu)
|
if (mMenuList[i] == mouseDownMenu)
|
||||||
renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL );
|
renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL );
|
||||||
else if (mMenuList[i] == mouseOverMenu && mouseDownMenu == NULL)
|
else if (mMenuList[i] == mouseOverMenu && mouseDownMenu == NULL)
|
||||||
renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL);
|
renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we draw a bitmap?
|
// Do we draw a bitmap?
|
||||||
if (mMenuList[i]->bitmapIndex != -1)
|
if (mMenuList[i]->bitmapIndex != -1)
|
||||||
{
|
{
|
||||||
S32 index = mMenuList[i]->bitmapIndex * 3;
|
S32 index = mMenuList[i]->bitmapIndex * 3;
|
||||||
if (mMenuList[i] == mouseDownMenu)
|
if (mMenuList[i] == mouseDownMenu)
|
||||||
++index;
|
++index;
|
||||||
|
|
@ -1342,24 +1342,24 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
|
||||||
|
|
||||||
RectI rect = mProfile->mBitmapArrayRects[index];
|
RectI rect = mProfile->mBitmapArrayRects[index];
|
||||||
|
|
||||||
Point2I bitmapstart(start);
|
Point2I bitmapstart(start);
|
||||||
bitmapstart.y = mMenuList[i]->bounds.point.y + (mMenuList[i]->bounds.extent.y - rect.extent.y) / 2;
|
bitmapstart.y = mMenuList[i]->bounds.point.y + (mMenuList[i]->bounds.extent.y - rect.extent.y) / 2;
|
||||||
|
|
||||||
drawUtil->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
drawUtil->drawBitmapSR( mProfile->mTextureObject, offset + bitmapstart, rect);
|
drawUtil->drawBitmapSR( mProfile->mTextureObject, offset + bitmapstart, rect);
|
||||||
|
|
||||||
// Should we also draw the text?
|
// Should we also draw the text?
|
||||||
if (!mMenuList[i]->drawBitmapOnly)
|
if (!mMenuList[i]->drawBitmapOnly)
|
||||||
{
|
{
|
||||||
start.x += mBitmapMargin;
|
start.x += mBitmapMargin;
|
||||||
drawUtil->setBitmapModulation( fontColor );
|
drawUtil->setBitmapModulation( fontColor );
|
||||||
drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i]->text, mProfile->mFontColors);
|
drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i]->text, mProfile->mFontColors);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
drawUtil->setBitmapModulation( fontColor );
|
drawUtil->setBitmapModulation( fontColor );
|
||||||
drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i]->text, mProfile->mFontColors);
|
drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i]->text, mProfile->mFontColors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderChildControls( offset, updateRect );
|
renderChildControls( offset, updateRect );
|
||||||
|
|
@ -1381,7 +1381,7 @@ void GuiMenuBar::buildWindowAcceleratorMap( WindowInputGenerator &inputGenerator
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
EventDescriptor accelEvent;
|
EventDescriptor accelEvent;
|
||||||
ActionMap::createEventDescriptor(item->accelerator, &accelEvent);
|
ActionMap::createEventDescriptor(item->accelerator, &accelEvent);
|
||||||
|
|
||||||
//now we have a modifier, and a key, add them to the canvas
|
//now we have a modifier, and a key, add them to the canvas
|
||||||
inputGenerator.addAcceleratorKey( this, item->cmd, accelEvent.eventCode, accelEvent.flags);
|
inputGenerator.addAcceleratorKey( this, item->cmd, accelEvent.eventCode, accelEvent.flags);
|
||||||
|
|
@ -1551,15 +1551,15 @@ void GuiMenuTextListCtrl::onMouseUp(const GuiEvent &event)
|
||||||
|
|
||||||
void GuiMenuTextListCtrl::onCellHighlighted(Point2I cell)
|
void GuiMenuTextListCtrl::onCellHighlighted(Point2I cell)
|
||||||
{
|
{
|
||||||
// If this text list control is part of a submenu, then don't worry about
|
// If this text list control is part of a submenu, then don't worry about
|
||||||
// passing this along
|
// passing this along
|
||||||
if(!isSubMenu)
|
if(!isSubMenu)
|
||||||
{
|
{
|
||||||
RectI globalbounds(getBounds());
|
RectI globalbounds(getBounds());
|
||||||
Point2I globalpoint = localToGlobalCoord(globalbounds.point);
|
Point2I globalpoint = localToGlobalCoord(globalbounds.point);
|
||||||
globalbounds.point = globalpoint;
|
globalbounds.point = globalpoint;
|
||||||
mMenuBarCtrl->highlightedMenuItem(cell.y, globalbounds, mCellSize);
|
mMenuBarCtrl->highlightedMenuItem(cell.y, globalbounds, mCellSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
@ -1582,9 +1582,9 @@ bool GuiSubmenuBackgroundCtrl::pointInControl(const Point2I& parentCoordPoint)
|
||||||
S32 yt = parentCoordPoint.y - getTop();
|
S32 yt = parentCoordPoint.y - getTop();
|
||||||
|
|
||||||
if(findHitControl(Point2I(xt,yt)) == this)
|
if(findHitControl(Point2I(xt,yt)) == this)
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
// return xt >= 0 && yt >= 0 && xt < getWidth() && yt < getHeight();
|
// return xt >= 0 && yt >= 0 && xt < getWidth() && yt < getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1609,7 +1609,7 @@ void GuiMenuBar::onSleep()
|
||||||
void GuiMenuBar::closeMenu()
|
void GuiMenuBar::closeMenu()
|
||||||
{
|
{
|
||||||
// First close any open submenu
|
// First close any open submenu
|
||||||
closeSubmenu();
|
closeSubmenu();
|
||||||
|
|
||||||
// Get the selection from the text list:
|
// Get the selection from the text list:
|
||||||
S32 selectionIndex = mTextList->getSelectedCell().y;
|
S32 selectionIndex = mTextList->getSelectedCell().y;
|
||||||
|
|
@ -1657,25 +1657,25 @@ void GuiMenuBar::highlightedMenuItem(S32 selectionIndex, const RectI& bounds, Po
|
||||||
}
|
}
|
||||||
|
|
||||||
if(list)
|
if(list)
|
||||||
{
|
{
|
||||||
// If the highlighted item has changed...
|
// If the highlighted item has changed...
|
||||||
if(mouseOverSubmenu != list)
|
if(mouseOverSubmenu != list)
|
||||||
{
|
{
|
||||||
closeSubmenu();
|
closeSubmenu();
|
||||||
mouseOverSubmenu = NULL;
|
mouseOverSubmenu = NULL;
|
||||||
|
|
||||||
// Check if this is a submenu. If so, open the submenu.
|
// Check if this is a submenu. If so, open the submenu.
|
||||||
if(list->isSubmenu)
|
if(list->isSubmenu)
|
||||||
{
|
{
|
||||||
// If there are submenu items, then open the submenu
|
// If there are submenu items, then open the submenu
|
||||||
if(list->submenu->firstMenuItem)
|
if(list->submenu->firstMenuItem)
|
||||||
{
|
{
|
||||||
mouseOverSubmenu = list;
|
mouseOverSubmenu = list;
|
||||||
onSubmenuAction(selstore, bounds, cellSize);
|
onSubmenuAction(selstore, bounds, cellSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1745,11 +1745,11 @@ void GuiMenuBar::onAction()
|
||||||
|
|
||||||
char buf[512];
|
char buf[512];
|
||||||
|
|
||||||
// If this menu item is a submenu, then set the isSubmenu to 2 to indicate
|
// If this menu item is a submenu, then set the isSubmenu to 2 to indicate
|
||||||
// an arrow should be drawn. Otherwise set the isSubmenu normally.
|
// an arrow should be drawn. Otherwise set the isSubmenu normally.
|
||||||
char isSubmenu = 1;
|
char isSubmenu = 1;
|
||||||
if(walk->isSubmenu)
|
if(walk->isSubmenu)
|
||||||
isSubmenu = 2;
|
isSubmenu = 2;
|
||||||
|
|
||||||
char bitmapIndex = 1;
|
char bitmapIndex = 1;
|
||||||
if(walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= mProfile->mBitmapArrayRects.size()))
|
if(walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= mProfile->mBitmapArrayRects.size()))
|
||||||
|
|
@ -1861,8 +1861,8 @@ void GuiMenuBar::onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2
|
||||||
|
|
||||||
char buf[512];
|
char buf[512];
|
||||||
|
|
||||||
// Can't have submenus within submenus.
|
// Can't have submenus within submenus.
|
||||||
char isSubmenu = 1;
|
char isSubmenu = 1;
|
||||||
|
|
||||||
char bitmapIndex = 1;
|
char bitmapIndex = 1;
|
||||||
if(walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= mProfile->mBitmapArrayRects.size()))
|
if(walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= mProfile->mBitmapArrayRects.size()))
|
||||||
|
|
@ -1916,7 +1916,7 @@ void GuiMenuBar::onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2
|
||||||
void GuiMenuBar::closeSubmenu()
|
void GuiMenuBar::closeSubmenu()
|
||||||
{
|
{
|
||||||
if(!mSubmenuBackground || !mSubmenuTextList)
|
if(!mSubmenuBackground || !mSubmenuTextList)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get the selection from the text list:
|
// Get the selection from the text list:
|
||||||
S32 selectionIndex = mSubmenuTextList->getSelectedCell().y;
|
S32 selectionIndex = mSubmenuTextList->getSelectedCell().y;
|
||||||
|
|
@ -1934,8 +1934,8 @@ void GuiMenuBar::closeSubmenu()
|
||||||
if ( selectionIndex != -1 )
|
if ( selectionIndex != -1 )
|
||||||
{
|
{
|
||||||
MenuItem *list = NULL;
|
MenuItem *list = NULL;
|
||||||
if(mouseOverSubmenu)
|
if(mouseOverSubmenu)
|
||||||
{
|
{
|
||||||
list = mouseOverSubmenu->submenu->firstMenuItem;
|
list = mouseOverSubmenu->submenu->firstMenuItem;
|
||||||
|
|
||||||
while(selectionIndex && list)
|
while(selectionIndex && list)
|
||||||
|
|
@ -1943,7 +1943,7 @@ void GuiMenuBar::closeSubmenu()
|
||||||
list = list->nextMenuItem;
|
list = list->nextMenuItem;
|
||||||
selectionIndex--;
|
selectionIndex--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(list)
|
if(list)
|
||||||
menuItemSelected(list->submenuParentMenu, list);
|
menuItemSelected(list->submenuParentMenu, list);
|
||||||
}
|
}
|
||||||
|
|
@ -1981,13 +1981,13 @@ void GuiMenuBar::processTick()
|
||||||
{
|
{
|
||||||
// If we're at a particular number of ticks, notify the script function
|
// If we're at a particular number of ticks, notify the script function
|
||||||
if(mMouseOverCounter < mMouseHoverAmount)
|
if(mMouseOverCounter < mMouseHoverAmount)
|
||||||
{
|
{
|
||||||
++mMouseOverCounter;
|
++mMouseOverCounter;
|
||||||
|
|
||||||
} else if(mMouseOverCounter == mMouseHoverAmount)
|
} else if(mMouseOverCounter == mMouseHoverAmount)
|
||||||
{
|
{
|
||||||
++mMouseOverCounter;
|
++mMouseOverCounter;
|
||||||
onMouseInMenu_callback(true); // Last parameter indicates if we've entered or left the menu
|
onMouseInMenu_callback(true); // Last parameter indicates if we've entered or left the menu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
||||||
GFXShaderConstHandle *lightInvRadiusSqSC,
|
GFXShaderConstHandle *lightInvRadiusSqSC,
|
||||||
GFXShaderConstHandle *lightSpotDirSC,
|
GFXShaderConstHandle *lightSpotDirSC,
|
||||||
GFXShaderConstHandle *lightSpotAngleSC,
|
GFXShaderConstHandle *lightSpotAngleSC,
|
||||||
GFXShaderConstHandle *lightSpotFalloffSC,
|
GFXShaderConstHandle *lightSpotFalloffSC,
|
||||||
GFXShaderConstBuffer *shaderConsts )
|
GFXShaderConstBuffer *shaderConsts )
|
||||||
{
|
{
|
||||||
PROFILE_SCOPE( LightManager_Update4LightConsts );
|
PROFILE_SCOPE( LightManager_Update4LightConsts );
|
||||||
|
|
@ -317,7 +317,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
||||||
lightInvRadiusSqSC->isValid() ||
|
lightInvRadiusSqSC->isValid() ||
|
||||||
lightSpotDirSC->isValid() ||
|
lightSpotDirSC->isValid() ||
|
||||||
lightSpotAngleSC->isValid() ||
|
lightSpotAngleSC->isValid() ||
|
||||||
lightSpotFalloffSC->isValid() )
|
lightSpotFalloffSC->isValid() )
|
||||||
{
|
{
|
||||||
PROFILE_SCOPE( LightManager_Update4LightConsts_setLights );
|
PROFILE_SCOPE( LightManager_Update4LightConsts_setLights );
|
||||||
|
|
||||||
|
|
@ -326,7 +326,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
||||||
static AlignedArray<Point4F> lightColors( 4, sizeof( Point4F ) );
|
static AlignedArray<Point4F> lightColors( 4, sizeof( Point4F ) );
|
||||||
static Point4F lightInvRadiusSq;
|
static Point4F lightInvRadiusSq;
|
||||||
static Point4F lightSpotAngle;
|
static Point4F lightSpotAngle;
|
||||||
static Point4F lightSpotFalloff;
|
static Point4F lightSpotFalloff;
|
||||||
F32 range;
|
F32 range;
|
||||||
|
|
||||||
// Need to clear the buffers so that we don't leak
|
// Need to clear the buffers so that we don't leak
|
||||||
|
|
@ -359,10 +359,10 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
||||||
lightSpotDirs[2][i] = lightDir.z;
|
lightSpotDirs[2][i] = lightDir.z;
|
||||||
|
|
||||||
if ( light->getType() == LightInfo::Spot )
|
if ( light->getType() == LightInfo::Spot )
|
||||||
{
|
{
|
||||||
lightSpotAngle[i] = mCos( mDegToRad( light->getOuterConeAngle() / 2.0f ) );
|
lightSpotAngle[i] = mCos( mDegToRad( light->getOuterConeAngle() / 2.0f ) );
|
||||||
lightSpotFalloff[i] = 1.0f / getMax( F32_MIN, mCos( mDegToRad( light->getInnerConeAngle() / 2.0f ) ) - lightSpotAngle[i] );
|
lightSpotFalloff[i] = 1.0f / getMax( F32_MIN, mCos( mDegToRad( light->getInnerConeAngle() / 2.0f ) ) - lightSpotAngle[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prescale the light color by the brightness to
|
// Prescale the light color by the brightness to
|
||||||
// avoid doing this in the shader.
|
// avoid doing this in the shader.
|
||||||
|
|
@ -379,7 +379,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
||||||
|
|
||||||
shaderConsts->setSafe( lightSpotDirSC, lightSpotDirs );
|
shaderConsts->setSafe( lightSpotDirSC, lightSpotDirs );
|
||||||
shaderConsts->setSafe( lightSpotAngleSC, lightSpotAngle );
|
shaderConsts->setSafe( lightSpotAngleSC, lightSpotAngle );
|
||||||
shaderConsts->setSafe( lightSpotFalloffSC, lightSpotFalloff );
|
shaderConsts->setSafe( lightSpotFalloffSC, lightSpotFalloff );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -892,7 +892,7 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en
|
||||||
*info = ri;
|
*info = ri;
|
||||||
info->point.interpolate(start, end, info->t);
|
info->point.interpolate(start, end, info->t);
|
||||||
currentT = ri.t;
|
currentT = ri.t;
|
||||||
info->distance = (start - info->point).len();
|
info->distance = (start - info->point).len();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -991,7 +991,7 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en
|
||||||
*info = ri;
|
*info = ri;
|
||||||
info->point.interpolate(start, end, info->t);
|
info->point.interpolate(start, end, info->t);
|
||||||
currentT = ri.t;
|
currentT = ri.t;
|
||||||
info->distance = (start - info->point).len();
|
info->distance = (start - info->point).len();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1088,7 +1088,7 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en
|
||||||
*info = ri;
|
*info = ri;
|
||||||
info->point.interpolate(start, end, info->t);
|
info->point.interpolate(start, end, info->t);
|
||||||
currentT = ri.t;
|
currentT = ri.t;
|
||||||
info->distance = (start - info->point).len();
|
info->distance = (start - info->point).len();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,137 +36,137 @@
|
||||||
IMPLEMENT_CONOBJECT(ActionMap);
|
IMPLEMENT_CONOBJECT(ActionMap);
|
||||||
|
|
||||||
ConsoleDocClass( ActionMap,
|
ConsoleDocClass( ActionMap,
|
||||||
"@brief ActionMaps assign platform input events to console commands.\n\n"
|
"@brief ActionMaps assign platform input events to console commands.\n\n"
|
||||||
|
|
||||||
"Any platform input event can be bound in a single, generic way. In theory, the game doesn't need to know if the event came from the keyboard, mouse, joystick "
|
"Any platform input event can be bound in a single, generic way. In theory, the game doesn't need to know if the event came from the keyboard, mouse, joystick "
|
||||||
"or some other input device. This allows users of the game to map keys and actions according to their own preferences. "
|
"or some other input device. This allows users of the game to map keys and actions according to their own preferences. "
|
||||||
"Game action maps are arranged in a stack for processing so individual parts of the game can define specific "
|
"Game action maps are arranged in a stack for processing so individual parts of the game can define specific "
|
||||||
"actions. For example, when the player jumps into a vehicle it could push a vehicle action map and pop the default player action map.\n\n"
|
"actions. For example, when the player jumps into a vehicle it could push a vehicle action map and pop the default player action map.\n\n"
|
||||||
|
|
||||||
"@section ActionMap_creation Creating an ActionMap\n"
|
"@section ActionMap_creation Creating an ActionMap\n"
|
||||||
|
|
||||||
"The input system allows for the creation of multiple ActionMaps, so long as they have unique names and do not already exist. It's a simple "
|
"The input system allows for the creation of multiple ActionMaps, so long as they have unique names and do not already exist. It's a simple "
|
||||||
"three step process.\n\n"
|
"three step process.\n\n"
|
||||||
"1. Check to see if the ActionMap exists\n"
|
"1. Check to see if the ActionMap exists\n"
|
||||||
"2. Delete it if it exists\n"
|
"2. Delete it if it exists\n"
|
||||||
"3. Instantiate the ActionMap\n\n"
|
"3. Instantiate the ActionMap\n\n"
|
||||||
|
|
||||||
"The following is an example of how to create a new ActionMap:\n"
|
"The following is an example of how to create a new ActionMap:\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"if ( isObject( moveMap ) )\n"
|
"if ( isObject( moveMap ) )\n"
|
||||||
" moveMap.delete();\n"
|
" moveMap.delete();\n"
|
||||||
"new ActionMap(moveMap);"
|
"new ActionMap(moveMap);"
|
||||||
"@endtsexample\n\n\n"
|
"@endtsexample\n\n\n"
|
||||||
|
|
||||||
"@section ActionMap_binding Binding Functions\n"
|
"@section ActionMap_binding Binding Functions\n"
|
||||||
"Once you have created an ActionMap, you can start binding functionality to events. Currently, Torque 3D supports the following devices out of the box\n\n"
|
"Once you have created an ActionMap, you can start binding functionality to events. Currently, Torque 3D supports the following devices out of the box\n\n"
|
||||||
"* Mouse\n\n"
|
"* Mouse\n\n"
|
||||||
"* Keyboard\n\n"
|
"* Keyboard\n\n"
|
||||||
"* Joystick/Gamepad\n\n"
|
"* Joystick/Gamepad\n\n"
|
||||||
"* Xbox 360 Controller\n\n"
|
"* Xbox 360 Controller\n\n"
|
||||||
|
|
||||||
"The two most commonly used binding methods are bind() and bindCmd(). Both are similar in that they will bind functionality to a device and event, "
|
"The two most commonly used binding methods are bind() and bindCmd(). Both are similar in that they will bind functionality to a device and event, "
|
||||||
"but different in how the event is interpreted. With bind(), "
|
"but different in how the event is interpreted. With bind(), "
|
||||||
"you specify a device, action to bind, then a function to be called when the event happens.\n\n"
|
"you specify a device, action to bind, then a function to be called when the event happens.\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Simple function that prints to console\n"
|
"// Simple function that prints to console\n"
|
||||||
"// %val - Sent by the device letting the user know\n"
|
"// %val - Sent by the device letting the user know\n"
|
||||||
"// if an input was pressed (true) or released (false)\n"
|
"// if an input was pressed (true) or released (false)\n"
|
||||||
"function testInput(%val)\n"
|
"function testInput(%val)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" if(%val)\n"
|
" if(%val)\n"
|
||||||
" echo(\"Key is down\");\n"
|
" echo(\"Key is down\");\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
" echo(\"Key was released\");\n"
|
" echo(\"Key was released\");\n"
|
||||||
"}\n\n"
|
"}\n\n"
|
||||||
"// Bind the \'K\' key to the testInput function\n"
|
"// Bind the \'K\' key to the testInput function\n"
|
||||||
"moveMap.bind(keyboard, \"k\", testInput);\n\n"
|
"moveMap.bind(keyboard, \"k\", testInput);\n\n"
|
||||||
"@endtsexample\n\n\n"
|
"@endtsexample\n\n\n"
|
||||||
|
|
||||||
"bindCmd is an alternative method for binding commands. This function is similar to bind(), "
|
"bindCmd is an alternative method for binding commands. This function is similar to bind(), "
|
||||||
"except two functions are set to be called when the event is processed.\n\n"
|
"except two functions are set to be called when the event is processed.\n\n"
|
||||||
"One will be called when the event is activated (input down), while the other is activated when the event is broken (input release). "
|
"One will be called when the event is activated (input down), while the other is activated when the event is broken (input release). "
|
||||||
"When using bindCmd(), pass the functions as strings rather than the function names.\n\n"
|
"When using bindCmd(), pass the functions as strings rather than the function names.\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Print to the console when the spacebar is pressed\n"
|
"// Print to the console when the spacebar is pressed\n"
|
||||||
"function onSpaceDown()\n"
|
"function onSpaceDown()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" echo(\"Space bar down!\");\n"
|
" echo(\"Space bar down!\");\n"
|
||||||
"}\n\n"
|
"}\n\n"
|
||||||
|
|
||||||
"// Print to the console when the spacebar is released\n"
|
"// Print to the console when the spacebar is released\n"
|
||||||
"function onSpaceUp()\n"
|
"function onSpaceUp()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" echo(\"Space bar up!\");\n"
|
" echo(\"Space bar up!\");\n"
|
||||||
"}\n\n"
|
"}\n\n"
|
||||||
|
|
||||||
"// Bind the commands onSpaceDown and onSpaceUp to spacebar events\n"
|
"// Bind the commands onSpaceDown and onSpaceUp to spacebar events\n"
|
||||||
"moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n"
|
"moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
|
|
||||||
"@section ActionMap_switching Switching ActionMaps\n"
|
"@section ActionMap_switching Switching ActionMaps\n"
|
||||||
"Let's say you want to have different ActionMaps activated based on game play situations. A classic example would be first person shooter controls and racing controls "
|
"Let's say you want to have different ActionMaps activated based on game play situations. A classic example would be first person shooter controls and racing controls "
|
||||||
"in the same game. On foot, spacebar may cause your player to jump. In a vehicle, it may cause some kind of \"turbo charge\". You simply need to push/pop the ActionMaps appropriately:\n\n"
|
"in the same game. On foot, spacebar may cause your player to jump. In a vehicle, it may cause some kind of \"turbo charge\". You simply need to push/pop the ActionMaps appropriately:\n\n"
|
||||||
|
|
||||||
"First, create two separate ActionMaps:\n\n"
|
"First, create two separate ActionMaps:\n\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Create the two ActionMaps\n"
|
"// Create the two ActionMaps\n"
|
||||||
"if ( isObject( moveMap ) )\n"
|
"if ( isObject( moveMap ) )\n"
|
||||||
" moveMap.delete();\n"
|
" moveMap.delete();\n"
|
||||||
"new ActionMap(moveMap);\n\n"
|
"new ActionMap(moveMap);\n\n"
|
||||||
"if ( isObject( carMap ) )\n"
|
"if ( isObject( carMap ) )\n"
|
||||||
" carMap.delete();\n"
|
" carMap.delete();\n"
|
||||||
"new ActionMap(carMap);\n\n"
|
"new ActionMap(carMap);\n\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
|
|
||||||
"Next, create the two separate functions. Both will be bound to spacebar, but not the same ActionMap:\n\n"
|
"Next, create the two separate functions. Both will be bound to spacebar, but not the same ActionMap:\n\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Print to the console the player is jumping\n"
|
"// Print to the console the player is jumping\n"
|
||||||
"function playerJump(%val)\n"
|
"function playerJump(%val)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" if(%val)\n"
|
" if(%val)\n"
|
||||||
" echo(\"Player jumping!\");\n"
|
" echo(\"Player jumping!\");\n"
|
||||||
"}\n\n"
|
"}\n\n"
|
||||||
"// Print to the console the vehicle is charging\n"
|
"// Print to the console the vehicle is charging\n"
|
||||||
"function turboCharge()\n"
|
"function turboCharge()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" if(%val)\n"
|
" if(%val)\n"
|
||||||
" echo(\"Vehicle turbo charging!\");\n"
|
" echo(\"Vehicle turbo charging!\");\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
|
|
||||||
"You are now ready to bind functions to your ActionMaps' devices:\n\n"
|
"You are now ready to bind functions to your ActionMaps' devices:\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Bind the spacebar to the playerJump function\n"
|
"// Bind the spacebar to the playerJump function\n"
|
||||||
"// when moveMap is the active ActionMap\n"
|
"// when moveMap is the active ActionMap\n"
|
||||||
"moveMap.bind(keyboard, \"space\", playerJump);\n\n"
|
"moveMap.bind(keyboard, \"space\", playerJump);\n\n"
|
||||||
"// Bind the spacebar to the turboCharge function\n"
|
"// Bind the spacebar to the turboCharge function\n"
|
||||||
"// when carMap is the active ActionMap\n"
|
"// when carMap is the active ActionMap\n"
|
||||||
"carMap.bind(keyboard, \"space\", turboCharge);\n"
|
"carMap.bind(keyboard, \"space\", turboCharge);\n"
|
||||||
"@endtsexample\n"
|
"@endtsexample\n"
|
||||||
|
|
||||||
"Finally, you can use the push() and pop() commands on each ActionMap to toggle activation. To activate an ActionMap, use push():\n\n"
|
"Finally, you can use the push() and pop() commands on each ActionMap to toggle activation. To activate an ActionMap, use push():\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Make moveMap the active action map\n"
|
"// Make moveMap the active action map\n"
|
||||||
"// You should now be able to activate playerJump with spacebar\n"
|
"// You should now be able to activate playerJump with spacebar\n"
|
||||||
"moveMap.push();\n"
|
"moveMap.push();\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
|
|
||||||
"To switch ActionMaps, first pop() the old one. Then you can push() the new one:\n\n"
|
"To switch ActionMaps, first pop() the old one. Then you can push() the new one:\n\n"
|
||||||
|
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Deactivate moveMap\n"
|
"// Deactivate moveMap\n"
|
||||||
"moveMap.pop();\n\n"
|
"moveMap.pop();\n\n"
|
||||||
"// Activate carMap\n"
|
"// Activate carMap\n"
|
||||||
"carMap.push();\n\n"
|
"carMap.push();\n\n"
|
||||||
"@endtsexample\n\n\n"
|
"@endtsexample\n\n\n"
|
||||||
|
|
||||||
"@ingroup Input"
|
"@ingroup Input"
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -775,32 +775,32 @@ const char* ActionMap::getBinding( const char* command )
|
||||||
//
|
//
|
||||||
const char* ActionMap::getCommand( const char* device, const char* action )
|
const char* ActionMap::getCommand( const char* device, const char* action )
|
||||||
{
|
{
|
||||||
U32 deviceType;
|
U32 deviceType;
|
||||||
U32 deviceInst;
|
U32 deviceInst;
|
||||||
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
||||||
{
|
{
|
||||||
EventDescriptor eventDescriptor;
|
EventDescriptor eventDescriptor;
|
||||||
if ( createEventDescriptor( action, &eventDescriptor ) )
|
if ( createEventDescriptor( action, &eventDescriptor ) )
|
||||||
{
|
{
|
||||||
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
||||||
if ( mapNode )
|
if ( mapNode )
|
||||||
{
|
{
|
||||||
if ( mapNode->flags & Node::BindCmd )
|
if ( mapNode->flags & Node::BindCmd )
|
||||||
{
|
{
|
||||||
S32 bufferLen = dStrlen( mapNode->makeConsoleCommand ) + dStrlen( mapNode->breakConsoleCommand ) + 2;
|
S32 bufferLen = dStrlen( mapNode->makeConsoleCommand ) + dStrlen( mapNode->breakConsoleCommand ) + 2;
|
||||||
char* returnString = Con::getReturnBuffer( bufferLen );
|
char* returnString = Con::getReturnBuffer( bufferLen );
|
||||||
dSprintf( returnString, bufferLen, "%s\t%s",
|
dSprintf( returnString, bufferLen, "%s\t%s",
|
||||||
( mapNode->makeConsoleCommand ? mapNode->makeConsoleCommand : "" ),
|
( mapNode->makeConsoleCommand ? mapNode->makeConsoleCommand : "" ),
|
||||||
( mapNode->breakConsoleCommand ? mapNode->breakConsoleCommand : "" ) );
|
( mapNode->breakConsoleCommand ? mapNode->breakConsoleCommand : "" ) );
|
||||||
return( returnString );
|
return( returnString );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return( mapNode->consoleFunction );
|
return( mapNode->consoleFunction );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return( "" );
|
return( "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
@ -808,92 +808,92 @@ const char* ActionMap::getCommand( const char* device, const char* action )
|
||||||
// Obviously, this should only be used for axes.
|
// Obviously, this should only be used for axes.
|
||||||
bool ActionMap::isInverted( const char* device, const char* action )
|
bool ActionMap::isInverted( const char* device, const char* action )
|
||||||
{
|
{
|
||||||
U32 deviceType;
|
U32 deviceType;
|
||||||
U32 deviceInst;
|
U32 deviceInst;
|
||||||
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
||||||
{
|
{
|
||||||
EventDescriptor eventDescriptor;
|
EventDescriptor eventDescriptor;
|
||||||
if ( createEventDescriptor( action, &eventDescriptor ) )
|
if ( createEventDescriptor( action, &eventDescriptor ) )
|
||||||
{
|
{
|
||||||
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
||||||
if ( mapNode )
|
if ( mapNode )
|
||||||
return( mapNode->flags & Node::Inverted );
|
return( mapNode->flags & Node::Inverted );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Con::errorf( "The input event specified by %s %s is not in this action map!", device, action );
|
Con::errorf( "The input event specified by %s %s is not in this action map!", device, action );
|
||||||
return( false );
|
return( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
F32 ActionMap::getScale( const char* device, const char* action )
|
F32 ActionMap::getScale( const char* device, const char* action )
|
||||||
{
|
{
|
||||||
U32 deviceType;
|
U32 deviceType;
|
||||||
U32 deviceInst;
|
U32 deviceInst;
|
||||||
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
||||||
{
|
{
|
||||||
EventDescriptor eventDescriptor;
|
EventDescriptor eventDescriptor;
|
||||||
if ( createEventDescriptor( action, &eventDescriptor ) )
|
if ( createEventDescriptor( action, &eventDescriptor ) )
|
||||||
{
|
{
|
||||||
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
||||||
if ( mapNode )
|
if ( mapNode )
|
||||||
{
|
{
|
||||||
if ( mapNode->flags & Node::HasScale )
|
if ( mapNode->flags & Node::HasScale )
|
||||||
return( mapNode->scaleFactor );
|
return( mapNode->scaleFactor );
|
||||||
else
|
else
|
||||||
return( 1.0f );
|
return( 1.0f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Con::errorf( "The input event specified by %s %s is not in this action map!", device, action );
|
Con::errorf( "The input event specified by %s %s is not in this action map!", device, action );
|
||||||
return( 1.0f );
|
return( 1.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
const char* ActionMap::getDeadZone( const char* device, const char* action )
|
const char* ActionMap::getDeadZone( const char* device, const char* action )
|
||||||
{
|
{
|
||||||
U32 deviceType;
|
U32 deviceType;
|
||||||
U32 deviceInst;
|
U32 deviceInst;
|
||||||
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
||||||
{
|
{
|
||||||
EventDescriptor eventDescriptor;
|
EventDescriptor eventDescriptor;
|
||||||
if ( createEventDescriptor( action, &eventDescriptor ) )
|
if ( createEventDescriptor( action, &eventDescriptor ) )
|
||||||
{
|
{
|
||||||
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
||||||
if ( mapNode )
|
if ( mapNode )
|
||||||
{
|
{
|
||||||
if ( mapNode->flags & Node::HasDeadZone )
|
if ( mapNode->flags & Node::HasDeadZone )
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
dSprintf( buf, sizeof( buf ), "%g %g", mapNode->deadZoneBegin, mapNode->deadZoneEnd );
|
dSprintf( buf, sizeof( buf ), "%g %g", mapNode->deadZoneBegin, mapNode->deadZoneEnd );
|
||||||
char* returnString = Con::getReturnBuffer( dStrlen( buf ) + 1 );
|
char* returnString = Con::getReturnBuffer( dStrlen( buf ) + 1 );
|
||||||
dStrcpy( returnString, buf );
|
dStrcpy( returnString, buf );
|
||||||
return( returnString );
|
return( returnString );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return( "0 0" );
|
return( "0 0" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Con::errorf( "The input event specified by %s %s is not in this action map!", device, action );
|
Con::errorf( "The input event specified by %s %s is not in this action map!", device, action );
|
||||||
return( "" );
|
return( "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
const char* ActionMap::buildActionString( const InputEventInfo* event )
|
const char* ActionMap::buildActionString( const InputEventInfo* event )
|
||||||
{
|
{
|
||||||
const char* modifierString = getModifierString( event->modifier );
|
const char* modifierString = getModifierString( event->modifier );
|
||||||
|
|
||||||
char objectBuffer[64];
|
char objectBuffer[64];
|
||||||
if ( !getKeyString( event->objInst, objectBuffer ) )
|
if ( !getKeyString( event->objInst, objectBuffer ) )
|
||||||
return( "" );
|
return( "" );
|
||||||
|
|
||||||
U32 returnLen = dStrlen( modifierString ) + dStrlen( objectBuffer ) + 2;
|
U32 returnLen = dStrlen( modifierString ) + dStrlen( objectBuffer ) + 2;
|
||||||
char* returnString = Con::getReturnBuffer( returnLen );
|
char* returnString = Con::getReturnBuffer( returnLen );
|
||||||
dSprintf( returnString, returnLen - 1, "%s%s", modifierString, objectBuffer );
|
dSprintf( returnString, returnLen - 1, "%s%s", modifierString, objectBuffer );
|
||||||
return( returnString );
|
return( returnString );
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
@ -989,15 +989,15 @@ bool ActionMap::getDeviceName(const U32 deviceType, const U32 deviceInstance, ch
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
const char* ActionMap::getModifierString(const U32 modifiers)
|
const char* ActionMap::getModifierString(const U32 modifiers)
|
||||||
{
|
{
|
||||||
U32 realModifiers = modifiers;
|
U32 realModifiers = modifiers;
|
||||||
if ( modifiers & SI_LSHIFT || modifiers & SI_RSHIFT )
|
if ( modifiers & SI_LSHIFT || modifiers & SI_RSHIFT )
|
||||||
realModifiers |= SI_SHIFT;
|
realModifiers |= SI_SHIFT;
|
||||||
if ( modifiers & SI_LCTRL || modifiers & SI_RCTRL )
|
if ( modifiers & SI_LCTRL || modifiers & SI_RCTRL )
|
||||||
realModifiers |= SI_CTRL;
|
realModifiers |= SI_CTRL;
|
||||||
if ( modifiers & SI_LALT || modifiers & SI_RALT )
|
if ( modifiers & SI_LALT || modifiers & SI_RALT )
|
||||||
realModifiers |= SI_ALT;
|
realModifiers |= SI_ALT;
|
||||||
if ( modifiers & SI_MAC_LOPT || modifiers & SI_MAC_ROPT )
|
if ( modifiers & SI_MAC_LOPT || modifiers & SI_MAC_ROPT )
|
||||||
realModifiers |= SI_MAC_OPT;
|
realModifiers |= SI_MAC_OPT;
|
||||||
|
|
||||||
switch (realModifiers & (SI_SHIFT|SI_CTRL|SI_ALT|SI_MAC_OPT))
|
switch (realModifiers & (SI_SHIFT|SI_CTRL|SI_ALT|SI_MAC_OPT))
|
||||||
{
|
{
|
||||||
|
|
@ -1820,19 +1820,19 @@ static ConsoleDocFragment _ActionMapbind1(
|
||||||
"@param command The function to bind to the action. Function must have a single boolean argument.\n"
|
"@param command The function to bind to the action. Function must have a single boolean argument.\n"
|
||||||
"@return True if the binding was successful, false if the device was unknown or description failed.\n\n"
|
"@return True if the binding was successful, false if the device was unknown or description failed.\n\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Simple function that prints to console\n"
|
"// Simple function that prints to console\n"
|
||||||
"// %val - Sent by the device letting the user know\n"
|
"// %val - Sent by the device letting the user know\n"
|
||||||
"// if an input was pressed (true) or released (false)\n"
|
"// if an input was pressed (true) or released (false)\n"
|
||||||
"function testInput(%val)\n"
|
"function testInput(%val)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" if(%val)\n"
|
" if(%val)\n"
|
||||||
" echo(\"Key is down\");\n"
|
" echo(\"Key is down\");\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
" echo(\"Key was released\");\n"
|
" echo(\"Key was released\");\n"
|
||||||
"}\n\n"
|
"}\n\n"
|
||||||
"// Bind the \'K\' key to the testInput function\n"
|
"// Bind the \'K\' key to the testInput function\n"
|
||||||
"moveMap.bind(keyboard, k, testInput);\n\n"
|
"moveMap.bind(keyboard, k, testInput);\n\n"
|
||||||
"@endtsexample\n\n\n",
|
"@endtsexample\n\n\n",
|
||||||
"ActionMap",
|
"ActionMap",
|
||||||
"bool bind( string device, string action, string command );");
|
"bool bind( string device, string action, string command );");
|
||||||
|
|
||||||
|
|
@ -1854,22 +1854,22 @@ static ConsoleDocFragment _ActionMapbind2(
|
||||||
"@param command The function bound to the action. Must take in a single argument.\n"
|
"@param command The function bound to the action. Must take in a single argument.\n"
|
||||||
"@return True if the binding was successful, false if the device was unknown or description failed.\n\n"
|
"@return True if the binding was successful, false if the device was unknown or description failed.\n\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Simple function that adjusts the pitch of the camera based on the "
|
"// Simple function that adjusts the pitch of the camera based on the "
|
||||||
"mouse's movement along the X axis.\n"
|
"mouse's movement along the X axis.\n"
|
||||||
"function testPitch(%val)\n"
|
"function testPitch(%val)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" %pitchAdj = getMouseAdjustAmount(%val);\n"
|
" %pitchAdj = getMouseAdjustAmount(%val);\n"
|
||||||
" $mvPitch += %pitchAdj;\n"
|
" $mvPitch += %pitchAdj;\n"
|
||||||
"}\n\n"
|
"}\n\n"
|
||||||
"// Bind the mouse's X axis to the testPitch function\n"
|
"// Bind the mouse's X axis to the testPitch function\n"
|
||||||
"// DI is flagged, meaning input is inverted and has a deadzone\n"
|
"// DI is flagged, meaning input is inverted and has a deadzone\n"
|
||||||
"%this.bind( mouse, \"xaxis\", \"DI\", \"-0.23 0.23\", testPitch );\n"
|
"%this.bind( mouse, \"xaxis\", \"DI\", \"-0.23 0.23\", testPitch );\n"
|
||||||
"@endtsexample\n\n\n",
|
"@endtsexample\n\n\n",
|
||||||
"ActionMap",
|
"ActionMap",
|
||||||
"bool bind( string device, string action, string flag, string deadZone, string scale, string command );");
|
"bool bind( string device, string action, string flag, string deadZone, string scale, string command );");
|
||||||
|
|
||||||
ConsoleMethod( ActionMap, bind, bool, 5, 10, "actionMap.bind( device, action, [modifier spec, mod...], command )"
|
ConsoleMethod( ActionMap, bind, bool, 5, 10, "actionMap.bind( device, action, [modifier spec, mod...], command )"
|
||||||
"@hide")
|
"@hide")
|
||||||
{
|
{
|
||||||
StringStackWrapper args(argc - 2, argv + 2);
|
StringStackWrapper args(argc - 2, argv + 2);
|
||||||
return object->processBind( args.count(), args, NULL );
|
return object->processBind( args.count(), args, NULL );
|
||||||
|
|
@ -1918,7 +1918,7 @@ static ConsoleDocFragment _ActionMapbindObj2(
|
||||||
"bool bindObj( string device, string action, string flag, string deadZone, string scale, string command, SimObjectID object );");
|
"bool bindObj( string device, string action, string flag, string deadZone, string scale, string command, SimObjectID object );");
|
||||||
|
|
||||||
ConsoleMethod( ActionMap, bindObj, bool, 6, 11, "(device, action, [modifier spec, mod...], command, object)"
|
ConsoleMethod( ActionMap, bindObj, bool, 6, 11, "(device, action, [modifier spec, mod...], command, object)"
|
||||||
"@hide")
|
"@hide")
|
||||||
{
|
{
|
||||||
SimObject* simObject = Sim::findObject(argv[argc - 1]);
|
SimObject* simObject = Sim::findObject(argv[argc - 1]);
|
||||||
if ( simObject == NULL )
|
if ( simObject == NULL )
|
||||||
|
|
@ -1941,20 +1941,20 @@ DefineEngineMethod( ActionMap, bindCmd, bool, ( const char* device, const char*
|
||||||
"@param makeCmd The command to execute when the device/action is made.\n"
|
"@param makeCmd The command to execute when the device/action is made.\n"
|
||||||
"@param breakCmd [optional] The command to execute when the device or action is unmade.\n"
|
"@param breakCmd [optional] The command to execute when the device or action is unmade.\n"
|
||||||
"@return True the bind was successful, false if the device was unknown or description failed.\n"
|
"@return True the bind was successful, false if the device was unknown or description failed.\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Print to the console when the spacebar is pressed\n"
|
"// Print to the console when the spacebar is pressed\n"
|
||||||
"function onSpaceDown()\n"
|
"function onSpaceDown()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" echo(\"Space bar down!\");\n"
|
" echo(\"Space bar down!\");\n"
|
||||||
"}\n\n"
|
"}\n\n"
|
||||||
"// Print to the console when the spacebar is released\n"
|
"// Print to the console when the spacebar is released\n"
|
||||||
"function onSpaceUp()\n"
|
"function onSpaceUp()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" echo(\"Space bar up!\");\n"
|
" echo(\"Space bar up!\");\n"
|
||||||
"}\n\n"
|
"}\n\n"
|
||||||
"// Bind the commands onSpaceDown() and onSpaceUp() to spacebar events\n\n"
|
"// Bind the commands onSpaceDown() and onSpaceUp() to spacebar events\n\n"
|
||||||
"moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n"
|
"moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
return object->processBindCmd( device, action, makeCmd, breakCmd );
|
return object->processBindCmd( device, action, makeCmd, breakCmd );
|
||||||
}
|
}
|
||||||
|
|
@ -1964,9 +1964,9 @@ DefineEngineMethod( ActionMap, unbind, bool, ( const char* device, const char* a
|
||||||
"@param device The device to unbind from. Can be a keyboard, mouse, joystick or a gamepad.\n"
|
"@param device The device to unbind from. Can be a keyboard, mouse, joystick or a gamepad.\n"
|
||||||
"@param action The device action to unbind from. The action is dependant upon the device. Specify a key for keyboards.\n"
|
"@param action The device action to unbind from. The action is dependant upon the device. Specify a key for keyboards.\n"
|
||||||
"@return True if the unbind was successful, false if the device was unknown or description failed.\n\n"
|
"@return True if the unbind was successful, false if the device was unknown or description failed.\n\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"moveMap.unbind(\"keyboard\", \"space\");\n"
|
"moveMap.unbind(\"keyboard\", \"space\");\n"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
return object->processUnbind( device, action );
|
return object->processUnbind( device, action );
|
||||||
}
|
}
|
||||||
|
|
@ -1977,7 +1977,7 @@ DefineEngineMethod( ActionMap, unbindObj, bool, ( const char* device, const char
|
||||||
"@param action The device action to unbind from. The action is dependant upon the device. Specify a key for keyboards.\n"
|
"@param action The device action to unbind from. The action is dependant upon the device. Specify a key for keyboards.\n"
|
||||||
"@param obj The object to perform unbind against.\n"
|
"@param obj The object to perform unbind against.\n"
|
||||||
"@return True if the unbind was successful, false if the device was unknown or description failed.\n"
|
"@return True if the unbind was successful, false if the device was unknown or description failed.\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"moveMap.unbindObj(\"keyboard\", \"numpad1\", \"rangeChange\", %player);"
|
"moveMap.unbindObj(\"keyboard\", \"numpad1\", \"rangeChange\", %player);"
|
||||||
"@endtsexample\n\n\n")
|
"@endtsexample\n\n\n")
|
||||||
{
|
{
|
||||||
|
|
@ -1996,10 +1996,10 @@ DefineEngineMethod( ActionMap, save, void, ( const char* fileName, bool append )
|
||||||
"@param fileName The file path to save the ActionMap to. If a filename is not specified "
|
"@param fileName The file path to save the ActionMap to. If a filename is not specified "
|
||||||
" the ActionMap will be dumped to the console.\n"
|
" the ActionMap will be dumped to the console.\n"
|
||||||
"@param append Whether to write the ActionMap at the end of the file or overwrite it.\n"
|
"@param append Whether to write the ActionMap at the end of the file or overwrite it.\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Write out the actionmap into the config.cs file\n"
|
"// Write out the actionmap into the config.cs file\n"
|
||||||
"moveMap.save( \"scripts/client/config.cs\" );"
|
"moveMap.save( \"scripts/client/config.cs\" );"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
|
|
||||||
|
|
@ -2015,7 +2015,7 @@ DefineEngineMethod( ActionMap, save, void, ( const char* fileName, bool append )
|
||||||
DefineEngineFunction( getCurrentActionMap, ActionMap*, (),,
|
DefineEngineFunction( getCurrentActionMap, ActionMap*, (),,
|
||||||
"@brief Returns the current %ActionMap.\n"
|
"@brief Returns the current %ActionMap.\n"
|
||||||
"@see ActionMap"
|
"@see ActionMap"
|
||||||
"@ingroup Input")
|
"@ingroup Input")
|
||||||
{
|
{
|
||||||
SimSet* pActionMapSet = Sim::getActiveActionMapSet();
|
SimSet* pActionMapSet = Sim::getActiveActionMapSet();
|
||||||
return dynamic_cast< ActionMap* >( pActionMapSet->last() );
|
return dynamic_cast< ActionMap* >( pActionMapSet->last() );
|
||||||
|
|
@ -2024,10 +2024,10 @@ DefineEngineFunction( getCurrentActionMap, ActionMap*, (),,
|
||||||
DefineEngineMethod( ActionMap, push, void, (),,
|
DefineEngineMethod( ActionMap, push, void, (),,
|
||||||
"@brief Push the ActionMap onto the %ActionMap stack.\n\n"
|
"@brief Push the ActionMap onto the %ActionMap stack.\n\n"
|
||||||
"Activates an ActionMap and placees it at the top of the ActionMap stack.\n\n"
|
"Activates an ActionMap and placees it at the top of the ActionMap stack.\n\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Make moveMap the active action map\n"
|
"// Make moveMap the active action map\n"
|
||||||
"moveMap.push();\n"
|
"moveMap.push();\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
"@see ActionMap")
|
"@see ActionMap")
|
||||||
{
|
{
|
||||||
SimSet* pActionMapSet = Sim::getActiveActionMapSet();
|
SimSet* pActionMapSet = Sim::getActiveActionMapSet();
|
||||||
|
|
@ -2037,10 +2037,10 @@ DefineEngineMethod( ActionMap, push, void, (),,
|
||||||
DefineEngineMethod( ActionMap, pop, void, (),,
|
DefineEngineMethod( ActionMap, pop, void, (),,
|
||||||
"@brief Pop the ActionMap off the %ActionMap stack.\n\n"
|
"@brief Pop the ActionMap off the %ActionMap stack.\n\n"
|
||||||
"Deactivates an %ActionMap and removes it from the @ActionMap stack.\n"
|
"Deactivates an %ActionMap and removes it from the @ActionMap stack.\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Deactivate moveMap\n"
|
"// Deactivate moveMap\n"
|
||||||
"moveMap.pop();\n"
|
"moveMap.pop();\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
"@see ActionMap")
|
"@see ActionMap")
|
||||||
{
|
{
|
||||||
SimSet* pActionMapSet = Sim::getActiveActionMapSet();
|
SimSet* pActionMapSet = Sim::getActiveActionMapSet();
|
||||||
|
|
@ -2053,20 +2053,20 @@ DefineEngineMethod( ActionMap, getBinding, const char*, ( const char* command ),
|
||||||
"@param command The function to search bindings for.\n"
|
"@param command The function to search bindings for.\n"
|
||||||
"@return The binding against the specified command. Returns an empty string(\"\") "
|
"@return The binding against the specified command. Returns an empty string(\"\") "
|
||||||
"if a binding wasn't found.\n"
|
"if a binding wasn't found.\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Find what the function \"jump()\" is bound to in moveMap\n"
|
"// Find what the function \"jump()\" is bound to in moveMap\n"
|
||||||
"%bind = moveMap.getBinding( \"jump\" );\n\n"
|
"%bind = moveMap.getBinding( \"jump\" );\n\n"
|
||||||
"if ( %bind !$= \"\" )\n"
|
"if ( %bind !$= \"\" )\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
"// Find out what device is used in the binding\n"
|
"// Find out what device is used in the binding\n"
|
||||||
" %device = getField( %bind, 0 );\n\n"
|
" %device = getField( %bind, 0 );\n\n"
|
||||||
"// Find out what action (such as a key) is used in the binding\n"
|
"// Find out what action (such as a key) is used in the binding\n"
|
||||||
" %action = getField( %bind, 1 );\n"
|
" %action = getField( %bind, 1 );\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"@endtsexample\n\n"
|
"@endtsexample\n\n"
|
||||||
"@see getField")
|
"@see getField")
|
||||||
{
|
{
|
||||||
return object->getBinding( command );
|
return object->getBinding( command );
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( ActionMap, getCommand, const char*, ( const char* device, const char* action ),,
|
DefineEngineMethod( ActionMap, getCommand, const char*, ( const char* device, const char* action ),,
|
||||||
|
|
@ -2074,15 +2074,15 @@ DefineEngineMethod( ActionMap, getCommand, const char*, ( const char* device, co
|
||||||
"@param device The device that was bound. Can be a keyboard, mouse, joystick or a gamepad.\n"
|
"@param device The device that was bound. Can be a keyboard, mouse, joystick or a gamepad.\n"
|
||||||
"@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n"
|
"@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n"
|
||||||
"@return The command against the specified device and action.\n"
|
"@return The command against the specified device and action.\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"// Find what function is bound to a device\'s action\n"
|
"// Find what function is bound to a device\'s action\n"
|
||||||
"// In this example, \"jump()\" was assigned to the space key in another script\n"
|
"// In this example, \"jump()\" was assigned to the space key in another script\n"
|
||||||
"%command = moveMap.getCommand(\"keyboard\", \"space\");\n\n"
|
"%command = moveMap.getCommand(\"keyboard\", \"space\");\n\n"
|
||||||
"// Should print \"jump\" in the console\n"
|
"// Should print \"jump\" in the console\n"
|
||||||
"echo(%command)\n"
|
"echo(%command)\n"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
return object->getCommand( device, action );
|
return object->getCommand( device, action );
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( ActionMap, isInverted, bool, ( const char* device, const char* action ),,
|
DefineEngineMethod( ActionMap, isInverted, bool, ( const char* device, const char* action ),,
|
||||||
|
|
@ -2091,12 +2091,12 @@ DefineEngineMethod( ActionMap, isInverted, bool, ( const char* device, const cha
|
||||||
"@param device The device that was bound. Can be a keyboard, mouse, joystick or a gamepad.\n"
|
"@param device The device that was bound. Can be a keyboard, mouse, joystick or a gamepad.\n"
|
||||||
"@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n"
|
"@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n"
|
||||||
"@return True if the specified device and action is inverted.\n"
|
"@return True if the specified device and action is inverted.\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"%if ( moveMap.isInverted( \"mouse\", \"xaxis\"))\n"
|
"%if ( moveMap.isInverted( \"mouse\", \"xaxis\"))\n"
|
||||||
" echo(\"Mouse's xAxis is inverted\");"
|
" echo(\"Mouse's xAxis is inverted\");"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
return object->isInverted( device, action );
|
return object->isInverted( device, action );
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( ActionMap, getScale, F32, ( const char* device, const char* action ),,
|
DefineEngineMethod( ActionMap, getScale, F32, ( const char* device, const char* action ),,
|
||||||
|
|
@ -2104,11 +2104,11 @@ DefineEngineMethod( ActionMap, getScale, F32, ( const char* device, const char*
|
||||||
"@param device The device that was bound. Can be keyboard, mouse, joystick or gamepad.\n"
|
"@param device The device that was bound. Can be keyboard, mouse, joystick or gamepad.\n"
|
||||||
"@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n"
|
"@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n"
|
||||||
"@return Any scaling applied to the specified device and action.\n"
|
"@return Any scaling applied to the specified device and action.\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"%scale = %moveMap.getScale( \"gamepad\", \"thumbrx\");\n"
|
"%scale = %moveMap.getScale( \"gamepad\", \"thumbrx\");\n"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
return object->getScale( device, action );
|
return object->getScale( device, action );
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( ActionMap, getDeadZone, const char*, ( const char* device, const char* action ),,
|
DefineEngineMethod( ActionMap, getDeadZone, const char*, ( const char* device, const char* action ),,
|
||||||
|
|
@ -2117,11 +2117,11 @@ DefineEngineMethod( ActionMap, getDeadZone, const char*, ( const char* device, c
|
||||||
"@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n"
|
"@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n"
|
||||||
"@return The dead zone for the specified device and action. Returns \"0 0\" if there is no dead zone "
|
"@return The dead zone for the specified device and action. Returns \"0 0\" if there is no dead zone "
|
||||||
"or an empty string(\"\") if the mapping was not found.\n"
|
"or an empty string(\"\") if the mapping was not found.\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"%deadZone = moveMap.getDeadZone( \"gamepad\", \"thumbrx\");\n"
|
"%deadZone = moveMap.getDeadZone( \"gamepad\", \"thumbrx\");\n"
|
||||||
"@endtsexample\n\n")
|
"@endtsexample\n\n")
|
||||||
{
|
{
|
||||||
return object->getDeadZone( device, action );
|
return object->getDeadZone( device, action );
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ public:
|
||||||
{
|
{
|
||||||
eCommandType type; // Command type
|
eCommandType type; // Command type
|
||||||
StringTableEntry name; // Command name
|
StringTableEntry name; // Command name
|
||||||
static constexpr U32 MAX_ARGS = 10;
|
static constexpr U32 MAX_ARGS = 10;
|
||||||
String argv[MAX_ARGS]; // Command arguments
|
String argv[MAX_ARGS]; // Command arguments
|
||||||
S32 argc; // Number of arguments
|
S32 argc; // Number of arguments
|
||||||
Command() : type(CmdInvalid), name(0), argc(0) { }
|
Command() : type(CmdInvalid), name(0), argc(0) { }
|
||||||
|
|
@ -107,11 +107,11 @@ public:
|
||||||
name = StringTable->insert( _name );
|
name = StringTable->insert( _name );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper functions to fill in the command arguments
|
// Helper functions to fill in the command arguments
|
||||||
template<typename ...ArgTs> inline void addArgs(ArgTs ...args){
|
template<typename ...ArgTs> inline void addArgs(ArgTs ...args){
|
||||||
using Helper = engineAPI::detail::MarshallHelpers<String>;
|
using Helper = engineAPI::detail::MarshallHelpers<String>;
|
||||||
Helper::marshallEach(argc, argv, args...);
|
Helper::marshallEach(argc, argv, args...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector<Command> mCommands;
|
Vector<Command> mCommands;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue