Skip to content

Commit

Permalink
Fixed some minor issues with repro
Browse files Browse the repository at this point in the history
  • Loading branch information
playmer committed Apr 27, 2018
1 parent 4220908 commit e908c30
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 7 deletions.
11 changes: 6 additions & 5 deletions Reflection/Function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,15 +276,13 @@ namespace YTE
static Any Caller(std::vector<Any>& aArguments)
{
auto self = aArguments.at(0).As<ObjectType*>();

size_t i = 1;

// We get a warning for functions that don't have arguments and thus don't use these.
YTEUnusedArgument(aArguments);
YTEUnusedArgument(i);

(self->*BoundFunc)(aArguments.at(i++).As<Arguments>()...);


if constexpr(std::is_void<Return>::value)
{
(self->*BoundFunc)(aArguments.at(i++).As<Arguments>()...);
Expand All @@ -296,6 +294,9 @@ namespace YTE
Any toReturn{ capture, TypeId<Return>(), false == std::is_reference<Return>::value };
return toReturn;
}

(void)aArguments;
return Any{};
}

static std::unique_ptr<Function> BindPassedFunction(const char *name, CallingType aCaller)
Expand Down
40 changes: 38 additions & 2 deletions Reflection/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@

namespace YTE
{
class XboxController;
class XboxController
{
public:
YTEDeclareType(XboxController);
};

YTEDefineType(XboxController)
{
YTERegisterType(XboxController);
}

enum class ControllerId : uint32_t
{
Expand All @@ -18,8 +27,35 @@ namespace YTE
class GamepadSystem
{
public:
XboxController* GetXboxController(ControllerId aId);
YTEDeclareType(GamepadSystem);
XboxController* GetXboxController(ControllerId aId)
{
return nullptr;
}
};

YTEDefineType(GamepadSystem)
{
YTERegisterType(GamepadSystem);
//auto size = CountFunctionArguments<decltype(&GamepadSystem::GetXboxController)>::template Size();

//YTEBindFunction(&GamepadSystem::GetXboxController, YTENoOverload, "GetXboxController", YTEParameterNames("aController")).Description()
// = "Gets you the given controller. Warning: Controller may not be plugged in/active.";
}
}

YTEDeclareExternalType(YTE::ControllerId);

YTEDefineExternalType(YTE::ControllerId)
{
YTERegisterType(YTE::ControllerId);

// YTEBindEnumValue(ControllerId::Xbox_P1, "Xbox_P1");
// YTEBindEnumValue(ControllerId::Xbox_P2, "Xbox_P2");
// YTEBindEnumValue(ControllerId::Xbox_P3, "Xbox_P3");
// YTEBindEnumValue(ControllerId::Xbox_P4, "Xbox_P4");
// YTEBindEnumValue(ControllerId::Xbox_Controllers_Number, "Xbox_Controllers_Number");
// YTEBindEnumValue(ControllerId::Unknown, "Unknown");
}

int main()
Expand Down

0 comments on commit e908c30

Please sign in to comment.