36

New Theme System for 7.0

 5 years ago
source link: https://www.tuicool.com/articles/hit/VnY3mqa
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

The last two weeks have been pretty busy, but I’ve been slowly banging around on the controls redesign for SadConsole. One thing that I didn’t with how the controls worked was that each control controls its drawing. This means that if you have a button control, and you wanted it to draw a border around it all of the time, you had to create a new button class. This meant adding whole new types of controls just to tweak the drawing.

The new system for 7.0 decouples the drawing from the control. The drawing is now moved to the theme object. Now all you need to do is create a new button theme type and implement the draw method, and set it to the ButtonVariable.Theme property. This new system also controls the drawing for the ControlsConsole and the Window types.

To test this out I create 3 types of themes for the button type. The normal button from v7, a 3d button, and a new bordered button which uses the SadConsole extended character sheet.

7R3Ijqe.gif

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK