Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Possibly stupid window idea.

This thread is locked; no one can reply to it. rss feed Print
Possibly stupid window idea.
julian_boolean
Member #8,201
January 2007

I've been trying to make a faux window that could stretch to any size without distorting its border. I figured if I made it out of 3 separate graphics (the main body, a vertical border, and a horizontal border), then all I need to do is give the two borders the x and y position of the main body, stretch them to fit, then poof! Is this a bad idea? Yes, no, cantaloupe?

kazzmir
Member #1,786
December 2001
avatar

Cantaloupe.

I'm not sure I follow you. Can you provide a picture?

julian_boolean
Member #8,201
January 2007

I didn't actually do anything yet. How do I post images? I'll try to throw something to together in paint.

kazzmir
Member #1,786
December 2001
avatar

Click on "attachments" in the post box and upload a picture. Then copy the picture location( right click, copy link location ) and use it in your post with .[.img http://whatever .]. without the .'s

julian_boolean
Member #8,201
January 2007

Thanks :)

Something like this I guess.

{"name":"591482 ","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/0\/d00ae92b6aaeea6bd0768f52db37ff9e.jpg","w":300,"h":250,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/0\/d00ae92b6aaeea6bd0768f52db37ff9e"}591482

if(bit_body != NULL
{
  stretch_sprite(buffer, bit_body, x_pos, y_pos, w_pos, h_pos);
}

if(bit_border_x != NULL)
{
  stretch_sprite(buffer, bit_border_x, x_pos, dunno, w_pos, dunno);
}

if(bit_border_y != NULL)
{
  stretch_sprite(buffer, bit_border_y, dunno, y_pos, dunno, y_pos);
}

Dustin Dettmer
Member #3,935
October 2003
avatar

Deleted.

Shesh at edit wars... :P

kazzmir
Member #1,786
December 2001
avatar

Oh, that looks ok to me. Depending on what your borders actually look like they might distort a little bit as you stretch them, but if they are just simple shapes then it would probably look ok.

julian_boolean
Member #8,201
January 2007

Sorry didn't do the attachment right, fixed now.

Rampage
Member #3,035
December 2002
avatar

You might want to add four more images for the corners. It will make the whole frame look like one piece.

-R

julian_boolean
Member #8,201
January 2007

It seems like a good way to avoid distortion when you try to stretch the graphic(s) to make a rectangle. Anyone else think this is okay, or have a better idea? :P

Oh those aren't what they actually look like. The real ones have their ends cut at an angle, sorta like a picture frame.

Rampage
Member #3,035
December 2002
avatar

That's the way some GUI's use to make their buttons and other controls resizable. However, the corners might get stretched, that's why they have other four images (as I suggested).

-R

julian_boolean
Member #8,201
January 2007

That's good to hear, I'll try it out. :) Thanks everyone.

Go to: