Replace Toasts

Replace Toasts with ToastsV2
(MessageHandler)
This commit is contained in:
2023-08-28 18:43:59 +02:00
parent 566485ccd6
commit a671631dde
12 changed files with 145 additions and 138 deletions

View File

@ -3,4 +3,5 @@
#include <renderd7/StealConsole.hpp>
#include <renderd7/bmp.hpp>
#include <renderd7/renderd7.hpp>
#include <renderd7/sound.hpp>
#include <renderd7/sound.hpp>
#include <renderd7/ToastsV2.hpp>

View File

@ -24,7 +24,4 @@ private:
/// @brief Add an Overlay to the Screen
/// @param scene Overlay to push to Screen
void AddOvl(std::unique_ptr<RenderD7::Ovl> scene);
/// @brief Add an Overlay to the Toast Stack
/// @param scene Overlay to push to Toast Stack
void AddToast(std::unique_ptr<RenderD7::Ovl> scene);
} // namespace RenderD7

View File

@ -1,30 +0,0 @@
#pragma once
#include <renderd7/BitmapPrinter.hpp>
#include <renderd7/Color.hpp>
#include <renderd7/Image.hpp>
#include <renderd7/Ovl.hpp>
#include <renderd7/Screen.hpp>
namespace RenderD7 {
/// @brief Toast Class
class Toast : public RenderD7::Ovl {
public:
/// @brief Constructor
/// @param head Displayed String in Head
/// @param msg Displayed String in Message Box
Toast(std::string head, std::string msg);
/// @brief Override for Draw
void Draw(void) const override;
/// @brief Override for Logic
void Logic() override;
private:
/// @param head The Header Text
/// @param nsg The Message-Box Text
std::string head, msg;
/// @param msgposy Position Y of The Toast
int msgposy = 240;
/// @param delay Delay of the Toast
int delay = 0;
};
} // namespace RenderD7

View File

@ -0,0 +1,24 @@
#pragma once
#include <string>
namespace RenderD7 {
struct Message {
Message(std::string t, std::string m) {
title = t;
message = m;
animationframe = 0;
}
std::string title;
std::string message;
int animationframe;
};
void ProcessMessages();
void PushMessage(const Message& msg);
// Config
void SetIdleStartFrame(int frame);
void SetTotalAnimationFrames(int total_frames);
void SetFadeOutStartFrame(int frame);
}

View File

@ -40,7 +40,6 @@
#include <renderd7/SpriteAnimation.hpp>
#include <renderd7/Tasks.hpp>
#include <renderd7/Time.hpp>
#include <renderd7/Toast.hpp>
#include <renderd7/bmp.hpp>
#include <renderd7/bmpconverter.hpp>
#include <renderd7/external/lodepng.h>
@ -52,7 +51,8 @@
#define RENDERD7VSTRING "0.9.5"
#define CHANGELOG \
"0.9.5: Remove Npi Intro and NVID Api\n" \
"0.9.5: Remove Npi Intro and NVID Api\nReplace Toasts System with " \
"ToastsV2\n aka MessageHandler\nLots of Optimisations\n" \
"0.9.4: Implement new Security System\n To prevent from crashes\nImplement " \
"Functiontrace for better\nTiming Tests\nImplement MemAlloc Tracker (only " \
"size)\nAdd some new Overlays (not functional yet)\nComplete Rewrite of " \
@ -225,23 +225,6 @@ public:
/// @brief Show Up the RenderD7-Settings Menu
void LoadSettings();
/// @brief DspNotFound Error Toast (Deprectated)
class DSP_NF : public RenderD7::Ovl {
public:
/// @brief Constructor
DSP_NF();
/// @brief Override for Draw
void Draw(void) const override;
/// @brief Override for Logic
void Logic() override;
private:
/// @param msgposy Y Position of Toast
int msgposy = 240;
/// @param delay Delay of Toast
int delay = 0;
};
/// @brief Get A Rendom Int
/// @param b From
/// @param e To