Implement Tween class interface.
This commit is contained in:
@@ -20,31 +20,12 @@
|
||||
#include <Color4.hpp>
|
||||
#include <JGL/JGL.h>
|
||||
#include <ReWindow/types/Key.h>
|
||||
#include <JUI/Tween.hpp>
|
||||
#include <JUI/JUI.hpp>
|
||||
|
||||
using namespace JGL;
|
||||
|
||||
namespace JUI
|
||||
{
|
||||
|
||||
class Tween
|
||||
{
|
||||
public:
|
||||
|
||||
std::function<void(float)> tick;
|
||||
float lifetime = 5;
|
||||
float progress = 0;
|
||||
};
|
||||
|
||||
/// Support Lerp/Tween of the following types:
|
||||
/// int, float, UDim, UDim2, Color4, Vector2,
|
||||
|
||||
/// An enumeration for mouse buttons, used by JUI to decouple from external systems.
|
||||
/// Some boilerplate is required in order to get input mechanisms up and running. See the demo files for reference.
|
||||
enum class MouseButton {
|
||||
Left = 1,
|
||||
Middle = 2,
|
||||
Right = 3
|
||||
};
|
||||
namespace JUI {
|
||||
|
||||
using namespace J3ML::Math;
|
||||
using namespace J3ML::LinearAlgebra;
|
||||
|
@@ -5,4 +5,12 @@
|
||||
namespace JUI
|
||||
{
|
||||
extern jlog::GenericLogger UILogs;
|
||||
|
||||
/// An enumeration for mouse buttons, used by JUI to decouple from external systems.
|
||||
/// Some boilerplate is required in order to get input mechanisms up and running. See the demo files for reference.
|
||||
enum class MouseButton {
|
||||
Left = 1,
|
||||
Middle = 2,
|
||||
Right = 3
|
||||
};
|
||||
}
|
25
include/JUI/Tween.hpp
Normal file
25
include/JUI/Tween.hpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <functional>
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace JUI
|
||||
{
|
||||
|
||||
/// A class that represents an animation-in-action.
|
||||
class Tween {
|
||||
public:
|
||||
|
||||
std::function<void(float)> tick;
|
||||
float lifetime = 5;
|
||||
float progress = 0;
|
||||
bool alive = true;
|
||||
bool paused = false;
|
||||
bool completed = false;
|
||||
|
||||
void Pause() { paused = true; }
|
||||
void Resume() { paused = false; }
|
||||
|
||||
bool Paused() const { return paused; }
|
||||
bool Completed() const { return completed; }
|
||||
};
|
||||
}
|
7
src/JUI/Tween.cpp
Normal file
7
src/JUI/Tween.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <JUI/Tween.hpp>
|
||||
|
||||
|
||||
namespace JUI
|
||||
{
|
||||
|
||||
}
|
Reference in New Issue
Block a user