Use brushes by name instead of number.

You can post your code snippets here for others to use and learn from

Use brushes by name instead of number.

Postby 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)
Bugala
 
Posts: 627
Joined: Sun Feb 14, 2010 8:11 pm

Re: Use brushes by name instead of number.

Postby 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
djrikki
 
Posts: 645
Joined: Wed Apr 06, 2011 12:26 am

Re: Use brushes by name instead of number.

Postby airsoftsoftwair » Tue Jul 07, 2015 12:27 am

@djrikki: You could file a feature request for enum in Hollywood :)
User avatar
airsoftsoftwair
 
Posts: 2098
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Use brushes by name instead of number.

Postby 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
djrikki
 
Posts: 645
Joined: Wed Apr 06, 2011 12:26 am


Return to Code snippets area

Who is online

Users browsing this forum: No registered users and 1 guest