Skip to main content
GameDev.net gamedev.net
🔒 Locked

Edges on a window?

Started by QuinnJohns Aug 21, 2009 at 2:53 PM 0 replies 650+ views
Original Post
QuinnJohns
QuinnJohns
If I wanted to approach creating a movable game menu, inside my game, would I merely create a textured quad with whatever "custom" images as the content? As an example, think of a rounded square, with transparent edges. I've written a similar post before about a "Pause Menu", which was static. Now, I as I do realize there will be several textures involved, is there a simple way to stretch certain images without doing a scale via the D3DXTransform? does the integrity of the image stay pretty decent? or does it pixelate the image? or would it be preferable to just do a "for" loop and repeat the draw calls to the requested window size? Last question, how would I go about being able to drag the window around if the window per-se, was just a textured quad? Handle a WM_ call for mouse keypress in the window's range, and just do a translate based on location of the mouse? Thanks.
[size="2"][size="1"][size="2"]- Quinn
[size="2"][size="1"][size="2"]Software Developer, Mintrus
zyrolasting
zyrolasting
I'd look into minification and maxification filters under D3D (check doc for the D3DX_FILTER #defines), as well as making use of IDirect3DDevice9::StretchRect(). (Well, maybe not StretchRect(). Mip-Maps should work here if you are using texture objects.) You would likely suffer an ugly re sampling if you use a point filter, but billinear filtering shouldn't be a problem to make use of.

We can't reliably tell you how it would look without actually seeing anything, but it's a given if you use a fairly large texture (pref. compressed if it's too big) and make a mip-map chain, most of the work in choosing the best fit graphic is done for you with nice results.

As for dragging, you need to make sure your cursor position is in the space of the quad. (Of course, it is screen space so this is a snap.) and just do a point-in-rectangle test to see if the mouse is even on the sprite. If it is... Yeah, snap the quad to a position relative to where it was to where the mouse is using the sprite's center position. (Simple vector math)

You have some work to do, but it's pretty straight-forward.
I'd advise you take a piece of graph paper and draw out your problem. It comes in a lot of handy to place your problem on paper for you to evaluate.

Topic Locked

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

Sign in to reply to this topic.