Logger Window Test!!

This commit is contained in:
2025-02-07 02:40:13 -05:00
parent c78f9a045c
commit c44e5c830c
3 changed files with 21 additions and 17 deletions

View File

@@ -45,7 +45,7 @@ public:
void Draw() override;
void Update(float delta) override
{
scroll += delta*5;
//scroll += delta*5;
canvas->Resize(Vector2i(GetAbsoluteSize().x, GetAbsoluteSize().y));
Rect::Update(delta);

View File

@@ -31,6 +31,7 @@
JUI::Scene* scene;
JGL::Texture* sample_texture;
JGL::Texture* slicer;
JUI::VerticalListLayout* list;
JUI::Scene* CreateScene() {
using namespace JUI;
@@ -136,14 +137,10 @@ JUI::Scene* CreateScene() {
scroller->BGColor(Colors::Reds::LightCoral);
auto* layout = new JUI::VerticalListLayout(scroller);
list = new JUI::VerticalListLayout(scroller);
list->LayoutOrder(JUI::LayoutOrder::V::BOTTOM);
for (int i = 0; i < 10; i++)
{
auto* text = new JUI::TextRect(layout);
text->Size({50_percent, 20_px});
text->SetContent("This Dick");
}
//nineslice_demo_window->Padding(1_px);
// End Window //
@@ -211,7 +208,13 @@ public:
void Update(float elapsed)
{
using namespace JUI::UDimLiterals;
scene->Update(elapsed);
auto* text = new JUI::TextRect(list);
text->Size({50_percent, 20_px});
text->SetContent(std::format("Elapsed: {}ms", Math::Floor(elapsed*1000.f)));
}
void Draw()

View File

@@ -18,7 +18,7 @@ void ScrollingRect::Draw() {
//J2D::DrawRenderTarget(canvas, CanvasPosition());
// TODO sub_texture_size would be the size of the visible area.
J2D::DrawPartialRenderTarget(canvas, GetAbsolutePosition(), {0, scroll}, {256, 256});//Vector2(canvas_size.x, canvas_size.y));
J2D::DrawPartialRenderTarget(canvas, GetAbsolutePosition(), {0, scroll}, Vector2(canvas->GetDimensions()));
//J2D::End();
}
@@ -29,9 +29,6 @@ Vector2 ScrollingRect::CanvasPosition() const {
// Wouldn't inner draw actually render everything onto the RenderTarget?
void ScrollingRect::InnerDraw() {
//
J2D::Begin(canvas, true);
auto saved_pos = position;
@@ -39,17 +36,21 @@ void ScrollingRect::InnerDraw() {
auto saved_size = size;
// OH MY GOD
Parent(nullptr);
Position({0_px, 0_px});
Size({256_px, 256_px});
//Parent(nullptr);
Position(UDim2::FromPixels(-GetAbsolutePosition().x, -GetAbsolutePosition().y));
//Size({512_px, 512_px});
//std::cout << canvas.Get << std::endl;
std::cout << GetAbsolutePosition() << std::endl;
Rect::InnerDraw();
DrawChildWidgets();
Parent(saved_parent);
J2D::DrawPoint(Colors::Red, {1,1});
J2D::DrawPoint(Colors::Red, Vector2(canvas_size));
//Parent(saved_parent);
Size(saved_size);
Position(saved_pos);