🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Borders

Published July 30, 2006
Advertisement
Spent about two hours this morning writing up a class for border rendering. I'd been avoiding it for some time, since I couldn't think of an elegant system to allow for both inner and outer controlled borders (and because I'd not implemented rotation yet). That is, some will need to be "fit within this space" sort of borders, and some will be "wrap around this stuff" sort of borders. Both should render similarly, and both should allow for other rectangles to reference both the 'inner' and 'outer' rectangles in the auto-arrangement system.

Anyways, once I thought about the requirements and put them into phrasing like above, it was pretty simple to knock up a dummy renderable system where a border is represented by two objects in the auto-arrangement system. The object takes two resources (a corner texture and a bar texture), a width, and an enumerated behavior (wether the inner rect depends on the outer, or vice versa). It then generates and arranges/rotates 4 corners, 4 bars, and 10 interlinked rectangles representing the border.

I am quite pleased with it so far.

[edit:]

Hah! I have made a slightly clever mechanism to allow borders to decorate other renderables, while not requiring the user to update references too much upon decoration. Much nicer:
        BorderedBackground testAround = BorderedBackground.Around(kanji, "solid", "solid", "solid", 1);        testAround.BGColor = System.Drawing.Color.Crimson.ToArgb();        testAround.Color = System.Drawing.Color.SkyBlue.ToArgb();


Previous Entry Progress? Pff!
Next Entry Sigh.
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement