# Changes 0.2.4-2
- Document the rest of th elibs - remove sound.hpp header
This commit is contained in:
parent
7d3f619169
commit
e6495d70b1
@ -27,9 +27,14 @@ SOFTWARE.
|
|||||||
#include <pd/external/json.hpp>
|
#include <pd/external/json.hpp>
|
||||||
|
|
||||||
namespace PD {
|
namespace PD {
|
||||||
|
/**
|
||||||
|
* Download manager class
|
||||||
|
*/
|
||||||
class DownloadManager : public SmartCtor<DownloadManager> {
|
class DownloadManager : public SmartCtor<DownloadManager> {
|
||||||
public:
|
public:
|
||||||
|
/** Alias to contain Error Cdoe and for some Errors a Status Code */
|
||||||
using Error = u64;
|
using Error = u64;
|
||||||
|
/** Error Codes of DL Manager */
|
||||||
enum Error_ {
|
enum Error_ {
|
||||||
Error_None, ///< Function Executed Successfully
|
Error_None, ///< Function Executed Successfully
|
||||||
Error_Memory, ///< Memory Allocation Error
|
Error_Memory, ///< Memory Allocation Error
|
||||||
@ -42,12 +47,22 @@ class DownloadManager : public SmartCtor<DownloadManager> {
|
|||||||
Error_Invalid, ///< Invalid Json struct
|
Error_Invalid, ///< Invalid Json struct
|
||||||
Error_NoWifi, ///< Console not connected to wifi
|
Error_NoWifi, ///< Console not connected to wifi
|
||||||
};
|
};
|
||||||
DownloadManager() {}
|
DownloadManager() = default;
|
||||||
~DownloadManager() {}
|
~DownloadManager() = default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract the DL Manager Error code of a Error
|
||||||
|
* @param err Error
|
||||||
|
* @return Downloadmanager Error code
|
||||||
|
*/
|
||||||
static Error_ GetErrorCode(Error err) {
|
static Error_ GetErrorCode(Error err) {
|
||||||
return (Error_)u32(err & 0xffffffff);
|
return (Error_)u32(err & 0xffffffff);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Extract the DL Manager Status code of a Error
|
||||||
|
* @param err Error
|
||||||
|
* @return Status code
|
||||||
|
*/
|
||||||
static int GetStatusCode(Error err) {
|
static int GetStatusCode(Error err) {
|
||||||
Error_ c = GetErrorCode(err);
|
Error_ c = GetErrorCode(err);
|
||||||
if (c != Error_StatusCode && c != Error_CtrStatus && c != Error_Curl) {
|
if (c != Error_StatusCode && c != Error_CtrStatus && c != Error_Curl) {
|
||||||
@ -56,17 +71,45 @@ class DownloadManager : public SmartCtor<DownloadManager> {
|
|||||||
return u32(err >> 32);
|
return u32(err >> 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download from URL inro a String Buffer
|
||||||
|
* @param url URL to download from
|
||||||
|
* @param res result buffer
|
||||||
|
* @return Error Code
|
||||||
|
*/
|
||||||
Error Get(const std::string& url, std::string& res);
|
Error Get(const std::string& url, std::string& res);
|
||||||
|
/**
|
||||||
|
* Download from URL into a File
|
||||||
|
* @param url URL to download from
|
||||||
|
* @param res_path Path to write file to
|
||||||
|
* @return Error Code
|
||||||
|
*/
|
||||||
Error GetFile(const std::string& url, const std::string& res_path);
|
Error GetFile(const std::string& url, const std::string& res_path);
|
||||||
|
/**
|
||||||
|
* Download a File from a Git Release
|
||||||
|
* @param url URL of the repo
|
||||||
|
* @param asset Asset to download
|
||||||
|
* @param path Path to write file into
|
||||||
|
* @param pre download from Prerelease
|
||||||
|
* @return Error Code
|
||||||
|
*/
|
||||||
Error GetGitRelease(const std::string& url, const std::string& asset,
|
Error GetGitRelease(const std::string& url, const std::string& asset,
|
||||||
const std::string& path, bool pre);
|
const std::string& path, bool pre);
|
||||||
|
/**
|
||||||
|
* Get a json API request as nlohmann json object
|
||||||
|
* @param url URL to request
|
||||||
|
* @param res result json object
|
||||||
|
* @return Error Code
|
||||||
|
*/
|
||||||
Error GetAsJson(const std::string& url, nlohmann::json& res);
|
Error GetAsJson(const std::string& url, nlohmann::json& res);
|
||||||
|
|
||||||
|
/** Get Current Progress in Bytes */
|
||||||
u64 ProgressCurrent() const { return current; }
|
u64 ProgressCurrent() const { return current; }
|
||||||
|
/** Get Total number in bytes */
|
||||||
u64 ProgressTotal() const { return total; }
|
u64 ProgressTotal() const { return total; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u64 current;
|
u64 current; ///< Current Progress
|
||||||
u64 total;
|
u64 total; ///< Total Bytes tp Download
|
||||||
};
|
};
|
||||||
} // namespace PD
|
} // namespace PD
|
@ -23,50 +23,71 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <pd/drivers/hid.hpp>
|
|
||||||
#include <pd/core/tween.hpp>
|
#include <pd/core/tween.hpp>
|
||||||
|
#include <pd/drivers/hid.hpp>
|
||||||
#include <pd/overlays/overlay.hpp>
|
#include <pd/overlays/overlay.hpp>
|
||||||
|
|
||||||
namespace PD {
|
namespace PD {
|
||||||
|
/**
|
||||||
|
* Development Function to dump Keyboard Layout into a Json File
|
||||||
|
* @param path Path to write into
|
||||||
|
*/
|
||||||
void DumpLayout(const std::string& path);
|
void DumpLayout(const std::string& path);
|
||||||
/// Keyboard class
|
/**
|
||||||
/// @brief needs to be pushed with text and State reference as Overlay
|
* Keyboard class
|
||||||
/// to communicate with it
|
*
|
||||||
/// @note Hardcoded Rendering to get maximum Rendering Performance
|
* - needs to be pushed with text and State reference as Overlay
|
||||||
|
* to communicate with it
|
||||||
|
* @note Hardcoded Rendering to get maximum Rendering Performance
|
||||||
|
*/
|
||||||
class Keyboard : public Overlay {
|
class Keyboard : public Overlay {
|
||||||
public:
|
public:
|
||||||
|
/** Key Operations */
|
||||||
enum KeyOperation {
|
enum KeyOperation {
|
||||||
AppendSelf = 0,
|
AppendSelf = 0, ///< Append Keyname to res string
|
||||||
Shift = 1,
|
Shift = 1, ///< Shift
|
||||||
Backspace = 2,
|
Backspace = 2, ///< Backspace
|
||||||
Enter = 3,
|
Enter = 3, ///< Enter
|
||||||
OpCancel = 4,
|
OpCancel = 4, ///< Cancel
|
||||||
OpConfirm = 5,
|
OpConfirm = 5, ///< Confirm
|
||||||
Tab = 6,
|
Tab = 6, ///< Tab
|
||||||
Caps = 7,
|
Caps = 7, ///< Caps
|
||||||
Space = 8,
|
Space = 8, ///< Space
|
||||||
Op1 = 9,
|
Op1 = 9, ///< Unnset Op 1
|
||||||
Op2 = 10,
|
Op2 = 10, ///< Unset Op 2
|
||||||
};
|
};
|
||||||
|
/** Keyboard Type */
|
||||||
enum Type {
|
enum Type {
|
||||||
Default,
|
Default, ///< Default Keyboard
|
||||||
Numpad,
|
Numpad, ///< Numpad
|
||||||
Password,
|
Password, ///< Password Input
|
||||||
};
|
};
|
||||||
|
/** State */
|
||||||
enum State {
|
enum State {
|
||||||
None,
|
None, ///< Doing nothing
|
||||||
Cancel,
|
Cancel, ///< Cancelled
|
||||||
Confirm,
|
Confirm, ///< Confirmed
|
||||||
};
|
};
|
||||||
|
/** Alias for Keyboard Flags */
|
||||||
using Flags = u32;
|
using Flags = u32;
|
||||||
|
/** Flags */
|
||||||
enum Flags_ {
|
enum Flags_ {
|
||||||
Flags_None = 0,
|
Flags_None = 0, ///< Nothing
|
||||||
Flags_BlendTop = 1 << 0,
|
Flags_BlendTop = 1 << 0, ///< Blend Top Screen
|
||||||
Flags_BlendBottom = 1 << 1,
|
Flags_BlendBottom = 1 << 1, ///< Blend Bottom
|
||||||
Flags_LockControls = 1 << 2,
|
Flags_LockControls = 1 << 2, ///< Lock Contols (Input Driver)
|
||||||
Flags_Transparency = 1 << 3,
|
Flags_Transparency = 1 << 3, ///< Transparant Keyboard Colors
|
||||||
|
// Default Flags
|
||||||
Flags_Default = Flags_BlendBottom | Flags_BlendTop | Flags_LockControls,
|
Flags_Default = Flags_BlendBottom | Flags_BlendTop | Flags_LockControls,
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* Keyboard Constructor
|
||||||
|
* @param text Result Text
|
||||||
|
* @param state Result State
|
||||||
|
* @param hint Hint to display if result is empty
|
||||||
|
* @param type Keyboard type
|
||||||
|
* @param flags Keyboard flags to use
|
||||||
|
*/
|
||||||
Keyboard(std::string& text, State& state, const std::string& hint = "",
|
Keyboard(std::string& text, State& state, const std::string& hint = "",
|
||||||
Type type = Default, Flags flags = Flags_Default) {
|
Type type = Default, Flags flags = Flags_Default) {
|
||||||
too++;
|
too++;
|
||||||
@ -84,46 +105,74 @@ class Keyboard : public Overlay {
|
|||||||
flymgr.From(vec2(0, 240)).To(vec2(0, 115)).In(0.3f).As(flymgr.EaseInQuad);
|
flymgr.From(vec2(0, 240)).To(vec2(0, 115)).In(0.3f).As(flymgr.EaseInQuad);
|
||||||
chflymgr.From(vec2(-320, 0)).To(vec2(-320, 0)).In(0.1f).As(chflymgr.Linear);
|
chflymgr.From(vec2(-320, 0)).To(vec2(-320, 0)).In(0.1f).As(chflymgr.Linear);
|
||||||
}
|
}
|
||||||
|
/** Deconstructor */
|
||||||
~Keyboard() { too--; }
|
~Keyboard() { too--; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rendering and Input Handler
|
||||||
|
* @param delta Deltatime for Animations
|
||||||
|
* @param ren Renderer Reference
|
||||||
|
* @param inp Input Driver reference
|
||||||
|
*/
|
||||||
void Update(float delta, LI::Renderer::Ref ren, Hid::Ref inp) override;
|
void Update(float delta, LI::Renderer::Ref ren, Hid::Ref inp) override;
|
||||||
|
|
||||||
|
/** Remove Keyboard */
|
||||||
void Rem() {
|
void Rem() {
|
||||||
rem = true;
|
rem = true;
|
||||||
flymgr.From(vec2(0, 115)).To(vec2(0, 240)).In(0.2f).As(flymgr.EaseOutQuad);
|
flymgr.From(vec2(0, 115)).To(vec2(0, 240)).In(0.2f).As(flymgr.EaseOutQuad);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/** Prerender Keys */
|
||||||
void LoadTheKeys(LI::Renderer::Ref ren);
|
void LoadTheKeys(LI::Renderer::Ref ren);
|
||||||
|
/** Controller Movement */
|
||||||
void Movement(Hid::Ref inp);
|
void Movement(Hid::Ref inp);
|
||||||
|
/** Trigger Move from to Animation */
|
||||||
void MoveSelector();
|
void MoveSelector();
|
||||||
|
/** Execute a Key operation */
|
||||||
void DoOperation(KeyOperation op, const std::string& kname);
|
void DoOperation(KeyOperation op, const std::string& kname);
|
||||||
|
/** Recolor all Keys with the same operation */
|
||||||
void RecolorBy(KeyOperation op, u32 color, int cm);
|
void RecolorBy(KeyOperation op, u32 color, int cm);
|
||||||
|
/** Bind an operation */
|
||||||
void InputOpBind(Hid::Key k, KeyOperation op, Hid::Ref inp, int cm);
|
void InputOpBind(Hid::Key k, KeyOperation op, Hid::Ref inp, int cm);
|
||||||
|
// Result Text reference
|
||||||
std::string* text;
|
std::string* text;
|
||||||
|
// Copy of the Text
|
||||||
std::string copy;
|
std::string copy;
|
||||||
|
// Hint
|
||||||
std::string hint;
|
std::string hint;
|
||||||
|
// Result State reference
|
||||||
State* state;
|
State* state;
|
||||||
|
// Keyboard Type
|
||||||
Type type;
|
Type type;
|
||||||
|
// Keyboard flags
|
||||||
Flags flags;
|
Flags flags;
|
||||||
int mode = 0; // def, caps, shift
|
// def, caps, shift
|
||||||
|
int mode = 0;
|
||||||
// Stands for The Only One
|
// Stands for The Only One
|
||||||
static int too;
|
static int too;
|
||||||
|
|
||||||
|
// Tween for selector Movement
|
||||||
Tween<vec2> selector;
|
Tween<vec2> selector;
|
||||||
|
// Tween for Selector Size
|
||||||
Tween<vec2> sel_szs;
|
Tween<vec2> sel_szs;
|
||||||
|
// Current Cell size
|
||||||
vec2 cselszs;
|
vec2 cselszs;
|
||||||
|
// selector index
|
||||||
int raw_sel;
|
int raw_sel;
|
||||||
|
|
||||||
// Performance Optimisation
|
// Prerendered Keytables
|
||||||
LI::StaticObject::Ref keys[3];
|
LI::StaticObject::Ref keys[3];
|
||||||
|
// Value to check if table is loadet
|
||||||
bool keys_loadet = false;
|
bool keys_loadet = false;
|
||||||
|
|
||||||
// Some Animation
|
// Remove Animation
|
||||||
bool rem = false;
|
bool rem = false;
|
||||||
/// Probably a float would've done the job as well ;)
|
/// Probably a float would've done the job as well ;)
|
||||||
Tween<vec2> flymgr;
|
Tween<vec2> flymgr;
|
||||||
|
// Secode Flymanager
|
||||||
Tween<vec2> chflymgr;
|
Tween<vec2> chflymgr;
|
||||||
|
// Show Help
|
||||||
bool show_help = true;
|
bool show_help = true;
|
||||||
};
|
};
|
||||||
} // namespace PD
|
} // namespace PD
|
@ -23,24 +23,45 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <pd/lithium/renderer.hpp>
|
|
||||||
#include <pd/core/color.hpp>
|
#include <pd/core/color.hpp>
|
||||||
#include <pd/core/tween.hpp>
|
#include <pd/core/tween.hpp>
|
||||||
|
#include <pd/lithium/renderer.hpp>
|
||||||
|
|
||||||
namespace PD {
|
namespace PD {
|
||||||
|
/**
|
||||||
|
* Message Manager
|
||||||
|
*/
|
||||||
class MessageMgr : public PD::SmartCtor<MessageMgr> {
|
class MessageMgr : public PD::SmartCtor<MessageMgr> {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Message Container
|
||||||
|
*/
|
||||||
class Container : public PD::SmartCtor<Container> {
|
class Container : public PD::SmartCtor<Container> {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Message Constructor
|
||||||
|
* @param title Title
|
||||||
|
* @param msg Message
|
||||||
|
*/
|
||||||
Container(const std::string& title, const std::string& msg);
|
Container(const std::string& title, const std::string& msg);
|
||||||
~Container() {}
|
~Container() = default;
|
||||||
|
|
||||||
|
/** Render the Container */
|
||||||
void Render(PD::LI::Renderer::Ref ren);
|
void Render(PD::LI::Renderer::Ref ren);
|
||||||
|
/**
|
||||||
|
* Update Animations by slot and delta
|
||||||
|
* @param slot Slot
|
||||||
|
* @param delta Deltatime
|
||||||
|
*/
|
||||||
void Update(int slot, float delta);
|
void Update(int slot, float delta);
|
||||||
|
/** Trigger Fly in Animation */
|
||||||
void FlyIn();
|
void FlyIn();
|
||||||
|
/** Trigger Change Position Animation */
|
||||||
void ToBeMoved(int slot);
|
void ToBeMoved(int slot);
|
||||||
|
/** Trigger Removed Animation */
|
||||||
void ToBeRemoved();
|
void ToBeRemoved();
|
||||||
|
|
||||||
|
/** Check if Message can be removed from list */
|
||||||
bool ShouldBeRemoved() const { return (tbr && pos.IsFinished()) || kill; }
|
bool ShouldBeRemoved() const { return (tbr && pos.IsFinished()) || kill; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -55,14 +76,24 @@ class MessageMgr : public PD::SmartCtor<MessageMgr> {
|
|||||||
bool kill = false; // Instant Kill
|
bool kill = false; // Instant Kill
|
||||||
int s = 0; // Slot
|
int s = 0; // Slot
|
||||||
};
|
};
|
||||||
|
/** Constructor to Link a Renderer reference */
|
||||||
MessageMgr(PD::LI::Renderer::Ref r) { ren = r; }
|
MessageMgr(PD::LI::Renderer::Ref r) { ren = r; }
|
||||||
~MessageMgr() {}
|
~MessageMgr() = default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a New Message
|
||||||
|
* @param title Message Title
|
||||||
|
* @param text Message Text
|
||||||
|
*/
|
||||||
void Push(const std::string& title, const std::string& text);
|
void Push(const std::string& title, const std::string& text);
|
||||||
|
/**
|
||||||
|
* Update Messages
|
||||||
|
* @param delta Deltatime
|
||||||
|
*/
|
||||||
void Update(float delta);
|
void Update(float delta);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Container::Ref> msgs;
|
std::vector<Container::Ref> msgs; // List of Messages
|
||||||
PD::LI::Renderer::Ref ren;
|
PD::LI::Renderer::Ref ren; // Renderer Reference
|
||||||
};
|
};
|
||||||
} // namespace PD
|
} // namespace PD
|
@ -28,19 +28,30 @@ SOFTWARE.
|
|||||||
#include <pd/lithium/renderer.hpp>
|
#include <pd/lithium/renderer.hpp>
|
||||||
|
|
||||||
namespace PD {
|
namespace PD {
|
||||||
|
/**
|
||||||
|
* Overlay Template class
|
||||||
|
*/
|
||||||
class Overlay : public SmartCtor<Overlay> {
|
class Overlay : public SmartCtor<Overlay> {
|
||||||
public:
|
public:
|
||||||
Overlay() {}
|
Overlay() = default;
|
||||||
virtual ~Overlay() {}
|
virtual ~Overlay() = default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update Function for Overlay input and rendering
|
||||||
|
* @param delta Deltatime
|
||||||
|
* @param ren Renderer reference
|
||||||
|
* @param inp Input Driver
|
||||||
|
*/
|
||||||
virtual void Update(float delta, LI::Renderer::Ref ren, Hid::Ref inp) = 0;
|
virtual void Update(float delta, LI::Renderer::Ref ren, Hid::Ref inp) = 0;
|
||||||
|
|
||||||
|
/** Check if killed to remove from Overlay Manager */
|
||||||
bool IsKilled() const { return kill; }
|
bool IsKilled() const { return kill; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/** Internall Kill function to call from your Overlay */
|
||||||
void Kill() { kill = true; }
|
void Kill() { kill = true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool kill = false;
|
bool kill = false; ///< Should be killed or not
|
||||||
};
|
};
|
||||||
} // namespace PD
|
} // namespace PD
|
@ -28,20 +28,37 @@ SOFTWARE.
|
|||||||
#include <pd/overlays/overlay.hpp>
|
#include <pd/overlays/overlay.hpp>
|
||||||
|
|
||||||
namespace PD {
|
namespace PD {
|
||||||
|
/**
|
||||||
|
* Overlay Manager Class
|
||||||
|
*/
|
||||||
class OverlayMgr : public SmartCtor<OverlayMgr> {
|
class OverlayMgr : public SmartCtor<OverlayMgr> {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param ren Renderer
|
||||||
|
* @param inp Input Driver reference
|
||||||
|
*/
|
||||||
OverlayMgr(LI::Renderer::Ref ren, Hid::Ref inp) {
|
OverlayMgr(LI::Renderer::Ref ren, Hid::Ref inp) {
|
||||||
this->ren = ren;
|
this->ren = ren;
|
||||||
this->inp = inp;
|
this->inp = inp;
|
||||||
}
|
}
|
||||||
|
/** Deconstructor */
|
||||||
~OverlayMgr() { overlays.clear(); }
|
~OverlayMgr() { overlays.clear(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append a New Overlay
|
||||||
|
* @param overlay Overlay reference to push
|
||||||
|
*/
|
||||||
void Push(Overlay::Ref overlay);
|
void Push(Overlay::Ref overlay);
|
||||||
|
/**
|
||||||
|
* Update Overlays
|
||||||
|
* @paran delta Deltatime
|
||||||
|
*/
|
||||||
void Update(float delta);
|
void Update(float delta);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Overlay::Ref> overlays;
|
std::vector<Overlay::Ref> overlays; ///< Overlay List
|
||||||
LI::Renderer::Ref ren;
|
LI::Renderer::Ref ren; ///< Renderer reference
|
||||||
Hid::Ref inp;
|
Hid::Ref inp; ///< Input Driver reference
|
||||||
};
|
};
|
||||||
} // namespace PD
|
} // namespace PD
|
@ -27,8 +27,25 @@ SOFTWARE.
|
|||||||
#include <pd/overlays/overlay.hpp>
|
#include <pd/overlays/overlay.hpp>
|
||||||
|
|
||||||
namespace PD {
|
namespace PD {
|
||||||
|
/**
|
||||||
|
* Performance Overlay
|
||||||
|
*
|
||||||
|
* - Framerate / Frametime
|
||||||
|
* - Renderer Avarage Time
|
||||||
|
* - Overlays Avarage Time
|
||||||
|
* - UserApp Average Time
|
||||||
|
* - **V**ertices and **I**ndices
|
||||||
|
* - **D**Draw Commands and Draw **C**alls
|
||||||
|
* - Text Map System Texts
|
||||||
|
* - Auto static Text Texts
|
||||||
|
*/
|
||||||
class Performance : public Overlay {
|
class Performance : public Overlay {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param skill (if set to true the Overlay self kills)
|
||||||
|
* @param screen Bottom or Top Screen
|
||||||
|
*/
|
||||||
Performance(bool& skill, bool& screen) {
|
Performance(bool& skill, bool& screen) {
|
||||||
too++;
|
too++;
|
||||||
if (too > 1) {
|
if (too > 1) {
|
||||||
@ -39,11 +56,24 @@ class Performance : public Overlay {
|
|||||||
*this->skill = false; // Make sure its false
|
*this->skill = false; // Make sure its false
|
||||||
this->screen = &screen;
|
this->screen = &screen;
|
||||||
}
|
}
|
||||||
|
/** Deconstructor */
|
||||||
~Performance() { too--; }
|
~Performance() { too--; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rendering Function
|
||||||
|
* @param delta Deltatime
|
||||||
|
* @param ren Renderer Reference
|
||||||
|
* @param inp Input Driver Reference
|
||||||
|
*/
|
||||||
void Update(float delta, LI::Renderer::Ref ren, Hid::Ref inp) override;
|
void Update(float delta, LI::Renderer::Ref ren, Hid::Ref inp) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* Render an Info line
|
||||||
|
* @param pos Position reference (gets updated for next line)
|
||||||
|
* @param text Text to Show
|
||||||
|
* @param ren Renderer Reference
|
||||||
|
*/
|
||||||
void Line(vec2& pos, const std::string& text, LI::Renderer::Ref ren);
|
void Line(vec2& pos, const std::string& text, LI::Renderer::Ref ren);
|
||||||
// Trace String Average
|
// Trace String Average
|
||||||
std::string TSA(const std::string& id);
|
std::string TSA(const std::string& id);
|
||||||
|
@ -23,14 +23,20 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <pd/drivers/hid.hpp>
|
|
||||||
#include <pd/core/tween.hpp>
|
#include <pd/core/tween.hpp>
|
||||||
|
#include <pd/drivers/hid.hpp>
|
||||||
#include <pd/overlays/overlay.hpp>
|
#include <pd/overlays/overlay.hpp>
|
||||||
#include <pd/ui7/ui7.hpp>
|
#include <pd/ui7/ui7.hpp>
|
||||||
|
|
||||||
namespace PD {
|
namespace PD {
|
||||||
|
/**
|
||||||
|
* Settings Menu Overlay
|
||||||
|
*/
|
||||||
class SettingsMenu : public Overlay {
|
class SettingsMenu : public Overlay {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor to setup Overlay
|
||||||
|
*/
|
||||||
SettingsMenu() {
|
SettingsMenu() {
|
||||||
too++;
|
too++;
|
||||||
if (too > 1) {
|
if (too > 1) {
|
||||||
@ -39,10 +45,15 @@ class SettingsMenu : public Overlay {
|
|||||||
}
|
}
|
||||||
flymgr.From(vec2(0, 240)).To(vec2(0, 115)).In(0.3f).As(flymgr.EaseInQuad);
|
flymgr.From(vec2(0, 240)).To(vec2(0, 115)).In(0.3f).As(flymgr.EaseInQuad);
|
||||||
}
|
}
|
||||||
|
/** Deconstructor */
|
||||||
~SettingsMenu() { too--; }
|
~SettingsMenu() { too--; }
|
||||||
|
|
||||||
|
/** Rendering and Input Handler */
|
||||||
void Update(float delta, LI::Renderer::Ref ren, Hid::Ref inp) override;
|
void Update(float delta, LI::Renderer::Ref ren, Hid::Ref inp) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to Trigger remove animation
|
||||||
|
*/
|
||||||
void Rem() {
|
void Rem() {
|
||||||
rem = true;
|
rem = true;
|
||||||
flymgr.From(vec2(0, 115)).To(vec2(0, 240)).In(0.2f).As(flymgr.EaseOutQuad);
|
flymgr.From(vec2(0, 115)).To(vec2(0, 240)).In(0.2f).As(flymgr.EaseOutQuad);
|
||||||
|
@ -27,17 +27,27 @@ SOFTWARE.
|
|||||||
|
|
||||||
namespace PD {
|
namespace PD {
|
||||||
namespace Music {
|
namespace Music {
|
||||||
|
/**
|
||||||
|
* Decoder Template class
|
||||||
|
*/
|
||||||
class Decoder : public SmartCtor<Decoder> {
|
class Decoder : public SmartCtor<Decoder> {
|
||||||
public:
|
public:
|
||||||
Decoder() {}
|
Decoder() = default;
|
||||||
virtual ~Decoder() {}
|
virtual ~Decoder() = default;
|
||||||
|
|
||||||
|
/** Template Init function */
|
||||||
virtual int Init(const std::string& path) = 0;
|
virtual int Init(const std::string& path) = 0;
|
||||||
|
/** Template deinit function */
|
||||||
virtual void Deinit() = 0;
|
virtual void Deinit() = 0;
|
||||||
|
/** Template function to get sample rate */
|
||||||
virtual u32 GetSampleRate() = 0;
|
virtual u32 GetSampleRate() = 0;
|
||||||
|
/** template function to get number of channels */
|
||||||
virtual u8 GetChannels() = 0;
|
virtual u8 GetChannels() = 0;
|
||||||
|
/** template function to get buffer size */
|
||||||
virtual size_t GetBufSize() = 0;
|
virtual size_t GetBufSize() = 0;
|
||||||
|
/** template decode function */
|
||||||
virtual u64 Decode(u16* buf_address) = 0;
|
virtual u64 Decode(u16* buf_address) = 0;
|
||||||
|
/** template function to get file sanples if exist */
|
||||||
virtual size_t GetFileSamples() = 0;
|
virtual size_t GetFileSamples() = 0;
|
||||||
};
|
};
|
||||||
} // namespace Music
|
} // namespace Music
|
||||||
|
@ -27,25 +27,42 @@ SOFTWARE.
|
|||||||
|
|
||||||
namespace PD {
|
namespace PD {
|
||||||
namespace Music {
|
namespace Music {
|
||||||
|
/**
|
||||||
|
* Music Metadata Data Holder
|
||||||
|
*/
|
||||||
class MetaData {
|
class MetaData {
|
||||||
public:
|
public:
|
||||||
MetaData() {}
|
MetaData() = default;
|
||||||
~MetaData() {}
|
~MetaData() = default;
|
||||||
|
|
||||||
|
/** Getter for name */
|
||||||
std::string Name() const { return name; }
|
std::string Name() const { return name; }
|
||||||
|
/** Getter for album */
|
||||||
std::string Album() const { return album; }
|
std::string Album() const { return album; }
|
||||||
|
/** Getter for year */
|
||||||
std::string Year() const { return year; }
|
std::string Year() const { return year; }
|
||||||
|
/** Getter for Title */
|
||||||
std::string Title() const { return title; }
|
std::string Title() const { return title; }
|
||||||
|
/** Getter for Artist */
|
||||||
std::string Artist() const { return artist; }
|
std::string Artist() const { return artist; }
|
||||||
|
/** Getter for [what is this] */
|
||||||
std::string Mdt() const { return mdt; }
|
std::string Mdt() const { return mdt; }
|
||||||
|
/** Gettr for file path */
|
||||||
std::string Path() const { return path; }
|
std::string Path() const { return path; }
|
||||||
|
|
||||||
|
/** Setter for Name */
|
||||||
void Name(const std::string &v) { name = v; }
|
void Name(const std::string &v) { name = v; }
|
||||||
|
/** Setter for Album */
|
||||||
void Album(const std::string &v) { album = v; }
|
void Album(const std::string &v) { album = v; }
|
||||||
|
/** Settr for Year */
|
||||||
void Year(const std::string &v) { year = v; }
|
void Year(const std::string &v) { year = v; }
|
||||||
|
/** Settr for Title */
|
||||||
void Title(const std::string &v) { title = v; }
|
void Title(const std::string &v) { title = v; }
|
||||||
|
/** Settr for Artist */
|
||||||
void Artist(const std::string &v) { artist = v; }
|
void Artist(const std::string &v) { artist = v; }
|
||||||
|
/** Settr for [what is this] */
|
||||||
void Mdt(const std::string &v) { mdt = v; }
|
void Mdt(const std::string &v) { mdt = v; }
|
||||||
|
/** Settr for Path */
|
||||||
void Path(const std::string &v) { path = v; }
|
void Path(const std::string &v) { path = v; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -29,17 +29,27 @@ SOFTWARE.
|
|||||||
|
|
||||||
namespace PD {
|
namespace PD {
|
||||||
namespace Music {
|
namespace Music {
|
||||||
|
/**
|
||||||
|
* MP3 Decoder
|
||||||
|
*/
|
||||||
class Mp3Decoder : public Decoder {
|
class Mp3Decoder : public Decoder {
|
||||||
public:
|
public:
|
||||||
Mp3Decoder() {}
|
Mp3Decoder() = default;
|
||||||
~Mp3Decoder() {}
|
~Mp3Decoder() = default;
|
||||||
|
|
||||||
|
/** Init Funciton to load file and Init decoder */
|
||||||
int Init(const std::string& path) override;
|
int Init(const std::string& path) override;
|
||||||
|
/** Unload Decoder */
|
||||||
void Deinit() override;
|
void Deinit() override;
|
||||||
|
/** Get Sample Rate */
|
||||||
u32 GetSampleRate() override;
|
u32 GetSampleRate() override;
|
||||||
|
/** Get Channels */
|
||||||
u8 GetChannels() override;
|
u8 GetChannels() override;
|
||||||
|
/** Get Buffer Size */
|
||||||
size_t GetBufSize() override;
|
size_t GetBufSize() override;
|
||||||
|
/** Decode next data */
|
||||||
u64 Decode(u16* buf_address) override;
|
u64 Decode(u16* buf_address) override;
|
||||||
|
/** Get File Samples if exist */
|
||||||
size_t GetFileSamples() override;
|
size_t GetFileSamples() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -29,6 +29,9 @@ SOFTWARE.
|
|||||||
|
|
||||||
namespace PD {
|
namespace PD {
|
||||||
namespace Music {
|
namespace Music {
|
||||||
|
/**
|
||||||
|
* Music Player
|
||||||
|
*/
|
||||||
class Player : public SmartCtor<Player> {
|
class Player : public SmartCtor<Player> {
|
||||||
public:
|
public:
|
||||||
Player() {}
|
Player() {}
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
/*
|
|
||||||
MIT License
|
|
||||||
Copyright (c) 2024 - 2025 René Amthor (tobid7)
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <3ds.h>
|
|
||||||
|
|
||||||
#include <pd/common/common.hpp>
|
|
||||||
#include <pd/common/memory.hpp>
|
|
||||||
|
|
||||||
namespace PD {
|
|
||||||
class Sound : public SmartCtor<Sound> {
|
|
||||||
public:
|
|
||||||
Sound();
|
|
||||||
~Sound();
|
|
||||||
|
|
||||||
void Play();
|
|
||||||
void Stop();
|
|
||||||
|
|
||||||
private:
|
|
||||||
u32 dataSize;
|
|
||||||
ndspWaveBuf wavBuf;
|
|
||||||
std::vector<u8, LinearAllocator<u8>> dat;
|
|
||||||
int channel;
|
|
||||||
};
|
|
||||||
} // namespace PD
|
|
Loading…
Reference in New Issue
Block a user