Skip to main content
gamedev.net
🔒 Locked

GUI Windows ..

Started by Zern Mar 22, 2003 at 1:33 AM 2 replies 400+ views
Original Post
Zern
Zern
Hello, Before anyone lashs out and says read the article presented here on this site, I already have. My question comes in regards to these "stretching" windows mentioned in his series. I find it a bit redudant and crazy to have so many textures(even if all in one texture and offsets used) (perhaps this is the only way as I am seeking an alternative) just to make up *one* window. My concern comes into play when I have several window nested inside a parent window, which could contain up to (four textures for corners, one texture for 'the middle' between the corners and a background texture) which could add/and would add up very quickly. To get back to my question is there an alternative way than doing this? Tonight I tried to create a simple texture for the "boarder" and background but once I sized my control up a little, the edges started to blur (Using DX9) and the image is not as crisp as I would like it to be. Thanks in advance, ~ [Edit: seeing -> seeking] [edited by - zern on March 22, 2003 2:35:06 AM]
cheez_keeper
cheez_keeper
actually, i solved this very same problem not too long ago. if you are very creative you can make a vertex buffer with 21 verts what will allow you to create the entire "edge" to a window.


VERTEXNT2D messageBoxVerts[] =
{
{SCREEN_WIDTH/2-0.5f, SCREEN_HEIGHT/2-0.5f, 0.0f, 1.0f, 0xffffffff, 0.0390625f, 0.5390625f}, //0
{SCREEN_WIDTH/2-5.5f, SCREEN_HEIGHT/2-0.5f, 0.0f, 1.0f, 0xffffffff, 0.0f, 0.5390625f}, //1
{SCREEN_WIDTH/2-5.5f, SCREEN_HEIGHT/2-5.5f, 0.0f, 1.0f, 0xffffffff, 0.0f, 0.5f }, //2
{SCREEN_WIDTH/2-0.5f, SCREEN_HEIGHT/2-0.5f, 0.0f, 1.0f, 0xffffffff, 0.0390625f, 0.5390625f}, //3
{SCREEN_WIDTH/2-0.5f, SCREEN_HEIGHT/2-5.5f, 0.0f, 1.0f, 0xffffffff, 0.0390625f, 0.5f }, //4
{SCREEN_WIDTH/2+0.5f, SCREEN_HEIGHT/2-0.5f, 0.0f, 1.0f, 0xffffffff, 0.09375f, 0.5390625f}, //5
{SCREEN_WIDTH/2+0.5f, SCREEN_HEIGHT/2-5.5f, 0.0f, 1.0f, 0xffffffff, 0.09375f, 0.5f }, //6
{SCREEN_WIDTH/2+5.5f, SCREEN_HEIGHT/2-5.5f, 0.0f, 1.0f, 0xffffffff, 0.1328125f, 0.5f }, //7
{SCREEN_WIDTH/2+0.5f, SCREEN_HEIGHT/2-0.5f, 0.0f, 1.0f, 0xffffffff, 0.09375f, 0.5390625f}, //8
{SCREEN_WIDTH/2+5.5f, SCREEN_HEIGHT/2-0.5f, 0.0f, 1.0f, 0xffffffff, 0.1328125f, 0.5390625f}, //9
{SCREEN_WIDTH/2+0.5f, SCREEN_HEIGHT/2+0.5f, 0.0f, 1.0f, 0xffffffff, 0.09375f, 0.59375f }, //10
{SCREEN_WIDTH/2+5.5f, SCREEN_HEIGHT/2+0.5f, 0.0f, 1.0f, 0xffffffff, 0.1328125f, 0.59375f }, //11
{SCREEN_WIDTH/2+5.5f, SCREEN_HEIGHT/2+5.5f, 0.0f, 1.0f, 0xffffffff, 0.1328125f, 0.6328125f}, //12
{SCREEN_WIDTH/2+0.5f, SCREEN_HEIGHT/2+0.5f, 0.0f, 1.0f, 0xffffffff, 0.09375f, 0.59375f }, //13
{SCREEN_WIDTH/2+0.5f, SCREEN_HEIGHT/2+5.5f, 0.0f, 1.0f, 0xffffffff, 0.09375f, 0.6328125f}, //14
{SCREEN_WIDTH/2-0.5f, SCREEN_HEIGHT/2+0.5f, 0.0f, 1.0f, 0xffffffff, 0.0390625f, 0.59375f }, //15
{SCREEN_WIDTH/2-0.5f, SCREEN_HEIGHT/2+5.5f, 0.0f, 1.0f, 0xffffffff, 0.0390625f, 0.6328125f}, //16
{SCREEN_WIDTH/2-5.5f, SCREEN_HEIGHT/2+5.5f, 0.0f, 1.0f, 0xffffffff, 0.0f, 0.6328125f}, //17
{SCREEN_WIDTH/2-0.5f, SCREEN_HEIGHT/2+0.5f, 0.0f, 1.0f, 0xffffffff, 0.0390625f, 0.59375f }, //18
{SCREEN_WIDTH/2-5.5f, SCREEN_HEIGHT/2+0.5f, 0.0f, 1.0f, 0xffffffff, 0.0f, 0.59375f }, //19
{SCREEN_WIDTH/2-0.5f, SCREEN_HEIGHT/2-0.5f, 0.0f, 1.0f, 0xffffffff, 0.0390625f, 0.5390625f}, //20
{SCREEN_WIDTH/2-5.5f, SCREEN_HEIGHT/2-0.5f, 0.0f, 1.0f, 0xffffffff, 0.0f, 0.5390625f}, //21
};



This box is only one pixel across in the middle... you just add and subtract from the corners to expand it... and of course the last 2 FLOATS need to be the UV of your frame texture (my frame texture is only 6 pixels wide if i remember correctly) hope it helps a bit.

Brett Lynnes
cheez_keeper@hotmail.com
Brett Lynnescheez_keeper@hotmail.com
Zern
Zern
Ah thanks Gave me new idea, thank you. Play with the TU/TV coords should be interesting thanks again Cheez.
Holy Fuzz
Holy Fuzz
What''s wrong with having lots of pointers to textures for each window? In my gui, I have:

IDirect3DTexture9 * gui_image[9][4];

That''s [9] for the corners, sides, and middle, plus [4] for the four different states that my window may be in. I still use only two actual textures.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.