move sprite and pad into sb namespace
This commit is contained in:
parent
7bbc0f851d
commit
d1fe6b927c
17
src/Pad.hpp
17
src/Pad.hpp
|
@ -16,7 +16,9 @@
|
|||
#include "Switch.hpp"
|
||||
#include "math.hpp"
|
||||
|
||||
/*!
|
||||
namespace sb
|
||||
{
|
||||
/*!
|
||||
* A Pad is an object containing an sb::Plane which can be clicked to launch an arbitrary user function. It can be sized and placed by setting its
|
||||
* translation and scale values.
|
||||
*
|
||||
|
@ -38,18 +40,18 @@
|
|||
* std::cout << p.transformation() << std::endl << final_position << std::endl;
|
||||
* assert(final_position == glm::vec4({w.x, w.y, 0, 1}));
|
||||
*/
|
||||
template<typename ReturnType = void, typename... Arguments>
|
||||
class Pad
|
||||
{
|
||||
template<typename ReturnType = void, typename... Arguments>
|
||||
class Pad
|
||||
{
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
using Reaction = std::function<ReturnType(bool, Arguments...)>;
|
||||
sb::Switch<ReturnType, Arguments...> connection;
|
||||
sb::Plane plane;
|
||||
Box box;
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Construct a Pad object with a default constructed sb::Plane.
|
||||
|
@ -238,4 +240,5 @@ public:
|
|||
{
|
||||
return plane.size();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -16,16 +16,18 @@
|
|||
#include "filesystem.hpp"
|
||||
#include "Model.hpp"
|
||||
|
||||
/*!
|
||||
namespace sb
|
||||
{
|
||||
/*!
|
||||
* A Sprite is a container for an sb::Plane object that resets and stores scale, translation, and rotation matrices every time they are set
|
||||
* and combines them automatically when getting the full transformation. This allows those transformations to be set repeatedly without having
|
||||
* to call sb::Plane::untransform() after each set. In the case of translation, there is also a move function that allows the translation to be
|
||||
* modified without resetting, so the sprite can move relative amounts.
|
||||
*/
|
||||
class Sprite
|
||||
{
|
||||
class Sprite
|
||||
{
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
/* The plane is included using composition instead of inheritance, allowing the user to define a custom plane. */
|
||||
sb::Plane plane;
|
||||
|
@ -34,7 +36,7 @@ private:
|
|||
* without having to set all the transformations every time one is changed. */
|
||||
glm::mat4 _scale {1.0f}, _translation {1.0f}, _rotation {1.0f};
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Construct an instance of Sprite using an existing plane object. The plane will be copied into the Sprite, so further edits will
|
||||
|
@ -297,4 +299,5 @@ public:
|
|||
{
|
||||
return plane.size();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue