• entries
359
237
• views
189543

# Borders

82 views

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

There are no comments to display.

## Create an account

Register a new account