Split up a screen into regions
- by nexen
My task: I want to split up a screen into 3 regions for buffs-bar (with picked items), score-info and a game-map. It doesn't matter are regions intersect with each other or not.
For example: I have a screen with width=1; height=1 and the origin of coordinates (0;0) is the left bottom point. I have 3 functions: draw items, draw info, draw map. If I use it without any matrix transformations, it draws fullscreen, because it's vertex coordinates are from 0;0 to 1;1.
(pseudo-code)
drawItems();
drawInfo();
drawMap();
And after that I see only map onto info onto items.
My goal: I have some matrixes for transformation vertexes with 0;0-1;1 coordinates to strict regions. There is only one thing, what I need to do - set matrix before drawing. So my call of drawItems-function is like:
(pseudo-code)
adjustViewMatrixes_andSomethingElse(items.position_of_the_region_there_it_should_be_drawn, items.sizes_of_region_to_draw);
setItemsMatrix();
drawItems(); //the same function with vertex coordinates 0;0->1;1,
//but it draws in other coordinates,
//because I have just set the matrix for region
I know only some people will understand me, so there is a picture with regions which I need to make. Every region has 0;0 - 1;1 inner coordinates.