Skip to content
Snippets Groups Projects
Commit 5533fea9 authored by Odilitime's avatar Odilitime
Browse files

make resize recalculate vertices

parent 27160629
No related branches found
No related tags found
No related merge requests found
......@@ -158,20 +158,32 @@ void BoxComponent::resize(const int passedWindowWidth, const int passedWindowHei
//std::cout << "BoxComponent::resize" << std::endl;
windowWidth = passedWindowWidth;
windowHeight = passedWindowHeight;
/*
if (!boundToPage) {
// ok because box shader is anchored to the bottom of the screen
// if we resize Y (increase height), we need to rebind
int yDiff = windowHeight - lastRenderedWindowHeight;
//std::cout << "BoxComponent::resize - Adjusting y: " << y << " by " << yDiff << std::endl;
this->y += yDiff;
lastRenderedWindowHeight = windowHeight;
}
*/
//std::cout << "BoxComponent::resize - boundToPage " << boundToPage << std::endl;
// figure out new vertices
float vx = x;
float vy = y;
//std::cout << "placing box at " << (int)vx << "x" << (int)vy << " size: " << (int)rawWidth << "x" << (int)rawHeight << std::endl;
float vWidth = width;
float vHeight = height;
pointToViewport(vx, vy);
//std::cout << "vWidth before: " << (int)vWidth << std::endl;
distanceToViewport(vWidth, vHeight);
//std::cout << "vWidth after: " << (int)vWidth << std::endl;
//std::cout << "placing box at GL " << (int)vx << "x" << (int)vy << " size: " << (int)(vWidth*10000) << "x" << (int)(vHeight*10000) << std::endl;
vertices[(0 * 5) + 0] = vx;
vertices[(0 * 5) + 1] = vy + vHeight;
vertices[(1 * 5) + 0] = vx + vWidth;
vertices[(1 * 5) + 1] = vy + vHeight;
vertices[(2 * 5) + 0] = vx + vWidth;
vertices[(2 * 5) + 1] = vy;
vertices[(3 * 5) + 0] = vx;
vertices[(3 * 5) + 1] = vy;
verticesDirty = true;
}
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment