Use brushes by name instead of number.

You can post your code snippets here for others to use and learn from
Post Reply
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Use brushes by name instead of number.

Post by Bugala »

If you have many brushes, it starts to become difficult to remember what exactly was the number of some specific brush, hence it is many times easier to refer to them by names, as example, instead of displaying brush 2, you would be displaying brush "dog".

small example:

Code: Select all

@BRUSH 1, "picture1.iff"
@BRUSH 2, "picture2.iff"
@BRUSH 3, "picture3.iff"

t_brushes = {
            [1] = "cat",
            [2] = "dog",
            [3] = "pig"
                 }

DisplayBrush(t_brushes["dog"], x, y)
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: Use brushes by name instead of number.

Post by djrikki »

Personally I prefer to use a list of Constants for this kind of convenience. Ideally I would like to use Enums so dont have to worry about sorting Numbers, but Hollywood doesn't have such a command.
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Use brushes by name instead of number.

Post by airsoftsoftwair »

@djrikki: You could file a feature request for enum in Hollywood :)
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: Use brushes by name instead of number.

Post by djrikki »

I thought about it... then I realised you would probably see my post above :lol:
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
Post Reply