Jump to content
  • Advertisement
  • entries
  • comments
  • views


Sign in to follow this  


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.


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();

Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!