What is Sushi?
Sushi is a GUI framework for the game World of Warcraft, designed to be:
- Versatile and easily extendable.
- Completely object oriented.
- Similar to Blizzard's API and hence, easy to learn.
- Wrapped in seaweed for extra flavor.
Why not? While there are some popular GUI frameworks out there, they tend to share one large problem: instead of being object driven, has it was to expect from a GUI framework, they are data driven.
While it may appear to be an interesting idea, this makes the libraries hardly flexible: they force the developer to follow a given layout. The inexistence of inherence turns the creation of new widget classes into a burdening process. On top of that, they tend to have an incredible high amount of memory, cpu usage and code complexity for how little they achieve.
They become good at just one thing: building configuration menus. Commonly, improperly designed configuration menus, as they are incapable to react to the application needs. Sushi, on the other hand, is good for everything. And even better with soy sauce.
What's in the Box?
Basically, Sushi is composed of a collection of frame classes. Here is the complete list as of January 2012:
How to Use
For instance, imagine you wish to create a Dropdown. After properly including Sushi in your addon (see below), simply call the
local myDropdown = SushiDropdown() myDropdown:SetPoint('CENTER') myDropdown:SetLabel('My Awesome Dropdown') myDropdown:AddLine('Salmon') myDropdown:AddLine('Grouper') myDropdown:AddLine('None') myDropdown:SetCall('OnInput', function(self, v) if v == 'None' then print('Not hungry?') else print('You cannot have it.') end end)
- All classes are named as in the graph above, but preceded by
- All functionality is available as methods, never as attributes.
SetCallwork exactly alike the native
SetScript, except it is a method defined by Sushi.
Sushi is installed exactly has any other library for World of Warcraft:
- Download Sushi, Poncho and LibStub.
- Include the three folders in the directory of your add-on.
- Add these three lines to your .toc file, before any other loading line: