Fix some Format stuff

This commit is contained in:
2024-05-03 15:51:06 +02:00
parent 6f658af674
commit 19450ba2c9
9 changed files with 64 additions and 46 deletions

View File

@ -7,6 +7,7 @@
#include <renderd7/Hid.hpp>
#include <renderd7/Image.hpp>
#include <renderd7/Message.hpp>
#include <renderd7/Overlays.hpp>
#include <renderd7/StealConsole.hpp>
#include <renderd7/Timer.hpp>
#include <renderd7/UI7.hpp>

View File

@ -1,41 +1,40 @@
#pragma once
#include <memory>
#include <3ds.h>
#include <memory>
#include <renderd7/Error.hpp>
// Write own LinearAllocator for learning
namespace RenderD7 {
template<typename T>
class LinearAllocator : public std::allocator<T> {
public:
typedef size_t size_type;
typedef T* pointer;
typedef const T* const_pointer;
template <typename T>
class LinearAllocator : public std::allocator<T> {
public:
typedef size_t size_type;
typedef T* pointer;
typedef const T* const_pointer;
template<typename T1>
struct rebind {typedef LinearAllocator<T1> other;};
template <typename T1>
struct rebind {
typedef LinearAllocator<T1> other;
};
pointer allocate(size_type n, const void* hint=nullptr) {
if(n > this->max_size()) {
RenderD7::Error("Linear Allocator: \nBad Alloc -> size is larger than free space!");
return nullptr;
}
return (pointer)linearAlloc(n*sizeof(T));
}
pointer allocate(size_type n, const void* hint = nullptr) {
if (n > this->max_size()) {
RenderD7::Error(
"Linear Allocator: \nBad Alloc -> size is larger than free space!");
return nullptr;
}
return (pointer)linearAlloc(n * sizeof(T));
}
void deallocate(pointer p, size_type) {
linearFree((void*)p);
}
void deallocate(pointer p, size_type) { linearFree((void*)p); }
size_type max_size() {
return linearSpaceFree();
}
size_type max_size() { return linearSpaceFree(); }
LinearAllocator() throw() {}
LinearAllocator(const LinearAllocator<T>& a) throw(): std::allocator<T>(a) {}
~LinearAllocator() throw() {}
};
}
LinearAllocator() throw() {}
LinearAllocator(const LinearAllocator<T>& a) throw() : std::allocator<T>(a) {}
~LinearAllocator() throw() {}
};
} // namespace RenderD7

View File

@ -3,6 +3,20 @@
#include <renderd7/Ovl.hpp>
#include <string>
typedef int RD7Keyboard;
enum RD7Keyboard_ {
RD7Keyboard_Default,
RD7Keyboard_Numpad,
RD7Keyboard_Password,
};
enum RD7KeyboardState {
RD7KeyboardState_None = 0,
RD7KeyboardState_Cancel = 1,
RD7KeyboardState_Confirm = 2,
};
namespace RenderD7 {
class Ovl_Ftrace : public RenderD7::Ovl {
public:
@ -44,20 +58,12 @@ class Ovl_Metrik : public RenderD7::Ovl {
float* i_txt_size;
};
typedef int RD7Keyboard;
enum RD7Keyboard_ {
RD7Keyboard_Default,
RD7Keyboard_Numpad,
RD7Keyboard_Password,
};
class Ovl_Keyboard : public RenderD7::Ovl {
public:
/// @brief Constructor
/// Keyboard Type not Supported for now
Ovl_Keyboard(std::string& ref, const std::string& hint = "",
RD7Keyboard type = 0);
Ovl_Keyboard(std::string& ref, RD7KeyboardState& state,
const std::string& hint = "", RD7Keyboard type = 0);
/// @brief Deconstructor
~Ovl_Keyboard();
/// @brief Override for Draw
@ -70,6 +76,7 @@ class Ovl_Keyboard : public RenderD7::Ovl {
// Pointer to useres String
std::string* typed_text = nullptr;
std::string str_bak;
RD7KeyboardState* state;
int mode = 0;
int ft3 = 0;
};

View File

@ -1,6 +1,7 @@
#pragma once
#include <algorithm>
#include <functional>
#include <renderd7/DrawV2.hpp>
#include <renderd7/R7Vec.hpp>
#include <string>

View File

@ -28,6 +28,7 @@
#include <renderd7/FunctionTrace.hpp>
#include <renderd7/Hardware.hpp>
#include <renderd7/Memory.hpp>
#include <renderd7/Overlays.hpp>
#include <renderd7/Ovl.hpp>
#include <renderd7/ResultDecoder.hpp>
#include <renderd7/Screen.hpp>
@ -112,6 +113,7 @@ class RSettings : public RenderD7::Scene {
/// @param mtscreenstate Screen the Overlay is Set to
std::string mtscreenstate = "Top";
std::string kbd_test;
RD7KeyboardState kbd_state;
bool statemtold = false;
bool stateftold = false;
float tmp_txt;