# Rewrite 5
- Move Libraries Source into pd directory and give them all their own CMakeLists.txt - Partial rewrite core (color, autogenerated vec), lithium (now uses UNIQUE PTR for Commands), UI7 - Use MenuV2 as new standart in UI7 - Implementz ViewPort Pre alpha to UI7 - Add Line Drawing to DrawList (not Working) - Implement a Complete new drievrs API (static Drivers) - NO SUPPORT FOR SHARED LIBRARY BUILDS IN VERSION 5 YET - Add Tools to Autogenerate Headers and Stuff
This commit is contained in:
1
include/pd/ui7/container/button.hpp
Normal file → Executable file
1
include/pd/ui7/container/button.hpp
Normal file → Executable file
@ -48,6 +48,7 @@ class PD_UI7_API Button : public Container {
|
||||
this->tdim = io->Font->GetTextBounds(label, io->FontScale);
|
||||
}
|
||||
~Button() = default;
|
||||
PD_SHARED(Button);
|
||||
|
||||
/** Return true if butten is pressed*/
|
||||
bool IsPressed() { return pressed; }
|
||||
|
1
include/pd/ui7/container/checkbox.hpp
Normal file → Executable file
1
include/pd/ui7/container/checkbox.hpp
Normal file → Executable file
@ -47,6 +47,7 @@ class PD_UI7_API Checkbox : public Container {
|
||||
this->tdim = io->Font->GetTextBounds(label, io->FontScale);
|
||||
}
|
||||
~Checkbox() = default;
|
||||
PD_SHARED(Checkbox);
|
||||
/**
|
||||
* Override for the Input Handler
|
||||
* @note This function is usally called by Menu::Update
|
||||
|
5
include/pd/ui7/container/coloredit.hpp
Normal file → Executable file
5
include/pd/ui7/container/coloredit.hpp
Normal file → Executable file
@ -41,13 +41,14 @@ class PD_UI7_API ColorEdit : public Container {
|
||||
* @param lr Reference to the Renderer
|
||||
*/
|
||||
ColorEdit(const std::string& label, u32* color, UI7::IO::Ref io) {
|
||||
// PD::Assert(color != nullptr, "Input Color Address is null!");
|
||||
// PD::Assert(color != nullptr, "Input Color Address is null!");
|
||||
this->label = label;
|
||||
this->color_ref = color;
|
||||
this->initial_color = *color;
|
||||
this->tdim = io->Font->GetTextBounds(label, io->FontScale);
|
||||
}
|
||||
~ColorEdit() = default;
|
||||
PD_SHARED(ColorEdit);
|
||||
|
||||
/**
|
||||
* Override for the Input Handler
|
||||
@ -64,7 +65,7 @@ class PD_UI7_API ColorEdit : public Container {
|
||||
void Update() override;
|
||||
|
||||
private:
|
||||
fvec2 tdim; ///< Text size
|
||||
fvec2 tdim; ///< Text size
|
||||
u32* color_ref = nullptr; ///< Color Reference
|
||||
u32 initial_color; ///< Initial Color
|
||||
std::string label; ///< Label of the Button
|
||||
|
8
include/pd/ui7/container/container.hpp
Normal file → Executable file
8
include/pd/ui7/container/container.hpp
Normal file → Executable file
@ -24,7 +24,6 @@ SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <pd/core/core.hpp>
|
||||
#include <pd/ui7/drawlist.hpp>
|
||||
#include <pd/ui7/io.hpp>
|
||||
#include <pd/ui7/pd_p_api.hpp>
|
||||
|
||||
@ -34,7 +33,7 @@ namespace UI7 {
|
||||
* Container base class all Objects are based on
|
||||
* @note this class can be used to create custom Objects as well
|
||||
*/
|
||||
class PD_UI7_API Container : public SmartCtor<Container> {
|
||||
class PD_UI7_API Container {
|
||||
public:
|
||||
Container() = default;
|
||||
/**
|
||||
@ -51,13 +50,14 @@ class PD_UI7_API Container : public SmartCtor<Container> {
|
||||
: pos(fvec2(box.x, box.y)), size(fvec2(box.z - box.x, box.w - box.y)) {}
|
||||
~Container() = default;
|
||||
|
||||
PD_SHARED(Container);
|
||||
/**
|
||||
* Init Function Required by every Object that uses
|
||||
* Render or Input functions
|
||||
* @param io IO Reference
|
||||
* @param l DrawList Reference
|
||||
*/
|
||||
void Init(UI7::IO::Ref io, UI7::DrawList::Ref l) {
|
||||
void Init(UI7::IO::Ref io, Li::DrawList::Ref l) {
|
||||
list = l;
|
||||
this->io = io;
|
||||
// this->screen = io->Ren->CurrentScreen();
|
||||
@ -146,7 +146,7 @@ class PD_UI7_API Container : public SmartCtor<Container> {
|
||||
/** Container Size*/
|
||||
fvec2 size;
|
||||
/** Reference to the Drawlist to Draw to*/
|
||||
UI7::DrawList::Ref list;
|
||||
Li::DrawList::Ref list;
|
||||
/** IO Reference for Renderer and Theme */
|
||||
UI7::IO::Ref io;
|
||||
/** Reference to the parent container*/
|
||||
|
2
include/pd/ui7/container/dragdata.hpp
Normal file → Executable file
2
include/pd/ui7/container/dragdata.hpp
Normal file → Executable file
@ -62,6 +62,8 @@ class PD_UI7_API DragData : public Container {
|
||||
}
|
||||
~DragData() = default;
|
||||
|
||||
/** Als ob das funktioniert... */
|
||||
PD_SHARED(DragData<T>);
|
||||
/**
|
||||
* Override for the Input Handler
|
||||
* @note This function is usally called by Menu::Update
|
||||
|
6
include/pd/ui7/container/dynobj.hpp
Normal file → Executable file
6
include/pd/ui7/container/dynobj.hpp
Normal file → Executable file
@ -44,12 +44,14 @@ class PD_UI7_API DynObj : public Container {
|
||||
* @param pos Base Position
|
||||
* @param lr Reference to the Renderer
|
||||
*/
|
||||
DynObj(std::function<void(UI7::IO::Ref, UI7::DrawList::Ref, Container*)>
|
||||
DynObj(std::function<void(UI7::IO::Ref, Li::DrawList::Ref, Container*)>
|
||||
RenderFunc) {
|
||||
pRenFun = RenderFunc;
|
||||
}
|
||||
~DynObj() = default;
|
||||
|
||||
PD_SHARED(DynObj);
|
||||
|
||||
/** Return true if butten is pressed*/
|
||||
bool IsPressed() { return pressed; }
|
||||
/**
|
||||
@ -69,7 +71,7 @@ class PD_UI7_API DynObj : public Container {
|
||||
private:
|
||||
UI7Color color = UI7Color_Button; ///< current button color
|
||||
bool pressed = false; ///< ispressed value
|
||||
std::function<void(UI7::IO::Ref, UI7::DrawList::Ref, Container*)> pRenFun;
|
||||
std::function<void(UI7::IO::Ref, Li::DrawList::Ref, Container*)> pRenFun;
|
||||
};
|
||||
} // namespace UI7
|
||||
} // namespace PD
|
128
include/pd/ui7/container/image.hpp
Normal file → Executable file
128
include/pd/ui7/container/image.hpp
Normal file → Executable file
@ -1,64 +1,66 @@
|
||||
#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 <pd/ui7/container/container.hpp>
|
||||
|
||||
namespace PD {
|
||||
namespace UI7 {
|
||||
/**
|
||||
* Image Object
|
||||
*/
|
||||
class PD_UI7_API Image : public Container {
|
||||
public:
|
||||
/**
|
||||
* Constructor for the Image Object
|
||||
* @param img Image Texture Reference
|
||||
* @param size Custom Size of the Image
|
||||
*/
|
||||
Image(LI::Texture::Ref img, fvec2 size = 0.f, LI::Rect uv = vec4(0.f)) {
|
||||
this->img = img;
|
||||
this->newsize = size;
|
||||
this->cuv = uv;
|
||||
if (size.x != 0 || size.y != 0) {
|
||||
this->SetSize(size);
|
||||
} else {
|
||||
this->SetSize(fvec2(img->GetSize().x, img->GetSize().y));
|
||||
}
|
||||
}
|
||||
~Image() = default;
|
||||
|
||||
/**
|
||||
* Override for the Rendering Handler
|
||||
* @note This function is usally called by Menu::Update
|
||||
* */
|
||||
void Draw() override;
|
||||
|
||||
private:
|
||||
LI::Texture::Ref img; ///< Texture reference to the Image
|
||||
fvec2 newsize = 0.f; ///< New Size
|
||||
LI::Rect cuv; ///< Custom UV
|
||||
};
|
||||
} // namespace UI7
|
||||
#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 <pd/ui7/container/container.hpp>
|
||||
|
||||
namespace PD {
|
||||
namespace UI7 {
|
||||
/**
|
||||
* Image Object
|
||||
*/
|
||||
class PD_UI7_API Image : public Container {
|
||||
public:
|
||||
/**
|
||||
* Constructor for the Image Object
|
||||
* @param img Image Texture Reference
|
||||
* @param size Custom Size of the Image
|
||||
*/
|
||||
Image(Li::Texture::Ref img, fvec2 size = 0.f, Li::Rect uv = fvec4(0.f)) {
|
||||
this->img = img;
|
||||
this->newsize = size;
|
||||
this->cuv = uv;
|
||||
if (size.x != 0 || size.y != 0) {
|
||||
this->SetSize(size);
|
||||
} else {
|
||||
this->SetSize(fvec2(img->GetSize().x, img->GetSize().y));
|
||||
}
|
||||
}
|
||||
~Image() = default;
|
||||
|
||||
PD_SHARED(Image);
|
||||
|
||||
/**
|
||||
* Override for the Rendering Handler
|
||||
* @note This function is usally called by Menu::Update
|
||||
* */
|
||||
void Draw() override;
|
||||
|
||||
private:
|
||||
Li::Texture::Ref img; ///< Texture reference to the Image
|
||||
fvec2 newsize = 0.f; ///< New Size
|
||||
Li::Rect cuv; ///< Custom UV
|
||||
};
|
||||
} // namespace UI7
|
||||
} // namespace PD
|
118
include/pd/ui7/container/label.hpp
Normal file → Executable file
118
include/pd/ui7/container/label.hpp
Normal file → Executable file
@ -1,59 +1,61 @@
|
||||
#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 <pd/ui7/container/container.hpp>
|
||||
|
||||
namespace PD {
|
||||
namespace UI7 {
|
||||
/**
|
||||
* Label [Text] Object
|
||||
*/
|
||||
class PD_UI7_API Label : public Container {
|
||||
public:
|
||||
/**
|
||||
* Constructor for Label Object
|
||||
* @param label Label [Text] to Draw
|
||||
* @param lr Renderer Reference
|
||||
*/
|
||||
Label(const std::string& label, IO::Ref io) {
|
||||
this->label = label;
|
||||
this->tdim = io->Font->GetTextBounds(label, io->FontScale);
|
||||
this->SetSize(tdim);
|
||||
}
|
||||
~Label() = default;
|
||||
|
||||
/**
|
||||
* Override for the Rendering Handler
|
||||
* @note This function is usally called by Menu::Update
|
||||
* */
|
||||
void Draw() override;
|
||||
|
||||
private:
|
||||
fvec2 tdim; ///< Text Size
|
||||
UI7Color color = UI7Color_Text; ///< Color
|
||||
std::string label; ///< Text to Render
|
||||
};
|
||||
} // namespace UI7
|
||||
#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 <pd/ui7/container/container.hpp>
|
||||
|
||||
namespace PD {
|
||||
namespace UI7 {
|
||||
/**
|
||||
* Label [Text] Object
|
||||
*/
|
||||
class PD_UI7_API Label : public Container {
|
||||
public:
|
||||
/**
|
||||
* Constructor for Label Object
|
||||
* @param label Label [Text] to Draw
|
||||
* @param lr Renderer Reference
|
||||
*/
|
||||
Label(const std::string& label, IO::Ref io) {
|
||||
this->label = label;
|
||||
this->tdim = io->Font->GetTextBounds(label, io->FontScale);
|
||||
this->SetSize(tdim);
|
||||
}
|
||||
~Label() = default;
|
||||
|
||||
PD_SHARED(Label);
|
||||
|
||||
/**
|
||||
* Override for the Rendering Handler
|
||||
* @note This function is usally called by Menu::Update
|
||||
* */
|
||||
void Draw() override;
|
||||
|
||||
private:
|
||||
fvec2 tdim; ///< Text Size
|
||||
UI7Color color = UI7Color_Text; ///< Color
|
||||
std::string label; ///< Text to Render
|
||||
};
|
||||
} // namespace UI7
|
||||
} // namespace PD
|
Reference in New Issue
Block a user