2020-03-02 19:07:49 +01:00
|
|
|
#include "View.h"
|
2021-09-29 22:12:56 +02:00
|
|
|
#include "Graphics/Graphics.h"
|
2024-06-09 12:20:04 +02:00
|
|
|
#include "Window.h"
|
2020-03-02 19:07:49 +01:00
|
|
|
|
2021-10-01 19:55:04 +02:00
|
|
|
using namespace Seele;
|
|
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
View::View(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& viewportInfo, std::string name)
|
|
|
|
|
: graphics(graphics), createInfo(viewportInfo), owner(window), name(name) {
|
|
|
|
|
viewport = graphics->createViewport(owner->getGfxHandle(), viewportInfo);
|
|
|
|
|
owner->addView(this);
|
|
|
|
|
setFocused();
|
2020-03-02 19:07:49 +01:00
|
|
|
}
|
|
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
View::~View() {}
|
|
|
|
|
|
|
|
|
|
void View::resize(URect area) {
|
|
|
|
|
createInfo.dimensions = area;
|
2025-04-11 21:02:52 +02:00
|
|
|
viewport->resize(area.size.x, area.size.y);
|
2024-06-09 12:20:04 +02:00
|
|
|
applyArea(area);
|
2020-03-02 19:07:49 +01:00
|
|
|
}
|
2020-03-05 11:43:38 +01:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
void View::setFocused() { owner->setFocused(this); }
|
2023-12-28 21:42:18 +01:00
|
|
|
|
2024-06-09 12:20:04 +02:00
|
|
|
const std::string& View::getName() { return name; }
|