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: 687
Joined: Sun Feb 14, 2010 8:11 pm

Use brushes by name instead of number.

Post by Bugala » Sun Jul 05, 2015 2:01 pm

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 » Mon Jul 06, 2015 9:28 am

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: 2536
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Use brushes by name instead of number.

Post by airsoftsoftwair » Tue Jul 07, 2015 12:27 am

@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 » Tue Jul 07, 2015 2:13 pm

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