frontend/gui refactor
This commit is contained in:
@@ -160,22 +160,23 @@ SlotView::SlotView(
|
||||
content(content),
|
||||
stack(stack),
|
||||
layout(layout) {
|
||||
color(glm::vec4(0, 0, 0, 0.2f));
|
||||
setColor(glm::vec4(0, 0, 0, 0.2f));
|
||||
}
|
||||
|
||||
// performance disaster
|
||||
void SlotView::draw(Batch2D* batch, Assets* assets) {
|
||||
void SlotView::draw(const GfxContext* pctx, Assets* assets) {
|
||||
glm::vec2 coord = calcCoord();
|
||||
|
||||
int slotSize = InventoryView::SLOT_SIZE;
|
||||
|
||||
glm::vec4 tint(1.0f);
|
||||
glm::vec4 color = color_;
|
||||
if (hover_ || highlighted) {
|
||||
glm::vec4 color = getColor();
|
||||
if (hover || highlighted) {
|
||||
tint *= 1.333f;
|
||||
color = glm::vec4(1, 1, 1, 0.2f);
|
||||
}
|
||||
|
||||
auto batch = pctx->getBatch2D();
|
||||
batch->color = color;
|
||||
if (color.a > 0.0) {
|
||||
batch->texture(nullptr);
|
||||
@@ -313,8 +314,8 @@ InventoryView::InventoryView(
|
||||
layout(std::move(layout)),
|
||||
frontend(frontend),
|
||||
interaction(interaction) {
|
||||
size(this->layout->getSize());
|
||||
color(glm::vec4(0, 0, 0, 0.0f));
|
||||
setSize(this->layout->getSize());
|
||||
setColor(glm::vec4(0, 0, 0, 0.0f));
|
||||
}
|
||||
|
||||
InventoryView::~InventoryView() {}
|
||||
@@ -331,7 +332,7 @@ void InventoryView::build() {
|
||||
item, frontend, interaction, content, slot
|
||||
);
|
||||
if (!slot.background) {
|
||||
view->color(glm::vec4());
|
||||
view->setColor(glm::vec4());
|
||||
}
|
||||
slots.push_back(view.get());
|
||||
add(view, slot.position);
|
||||
@@ -358,8 +359,9 @@ InventoryLayout* InventoryView::getLayout() const {
|
||||
return layout.get();
|
||||
}
|
||||
|
||||
void InventoryView::drawBackground(Batch2D* batch, Assets* assets) {
|
||||
void InventoryView::drawBackground(const GfxContext* pctx, Assets* assets) {
|
||||
glm::vec2 coord = calcCoord();
|
||||
auto batch = pctx->getBatch2D();
|
||||
|
||||
batch->texture(nullptr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user