new UI system
This commit is contained in:
parent
d840a81448
commit
216972e73a
82 changed files with 4837 additions and 3243 deletions
|
|
@ -1,40 +0,0 @@
|
|||
import Crafter.Event;
|
||||
import Crafter.Graphics;
|
||||
import std;
|
||||
using namespace Crafter;
|
||||
|
||||
int main() {
|
||||
Device::Initialize();
|
||||
Window window(1280, 720, "Hello Drawing!");
|
||||
|
||||
RenderingElement2D<true, true, false> element(
|
||||
{
|
||||
0.5, //anchorX: relative position where this elements x anchor (top-left) is placed to its parent x anchor
|
||||
0.5, //anchorY: relative position where this elements y anchor (top-left) is placed to its parent y anchor
|
||||
0.5, //relativeSizeX: the relative x size this element should be scaled to compared to its parent
|
||||
0.5, //relativeSizeY: the relative y size this element should be scaled to compared to its parent
|
||||
0.5, //anchorOffsetX: the amount this element's anchor should be offset from the top left corner (0.5 to in the middle)
|
||||
0.5, //anchorOffsetY: the amount this element's anchor should be offset from the top left corner (0.5 to place it in the middle)
|
||||
0 //z: this elements Z position
|
||||
},
|
||||
OpaqueType::FullyOpaque,
|
||||
2,
|
||||
1
|
||||
);
|
||||
|
||||
MouseElement mouse(window);
|
||||
element.children.push_back(&mouse);
|
||||
window.renderer.elements.push_back(&element);
|
||||
|
||||
element.scalingBuffer = {{255, 0, 0 ,255}, {0, 255, 0 ,255}};
|
||||
element.UpdatePosition(window.renderer);
|
||||
|
||||
EventListener<void> clickListener(&mouse.onMouseLeftClick, [&window]() {
|
||||
std::println("Clicked on X:{} Y:{}!",
|
||||
window.currentMousePos.x, window.currentMousePos.y
|
||||
);
|
||||
});
|
||||
|
||||
window.Render();
|
||||
window.StartSync();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue