Thursday, September 3, 2009

Tweaker Tutorial: Modifying the Viewport

Many people change their viewport in WoW in order to give themselves some section of the screen where they can place buttons and damage meters and chat windows and whatever other blocky elements that would otherwise obstruct their view.

There have been a number of addons to do this in the past. My favorite one as of late has been Viewport. The settings are easy to work with, you can adjust things on the fly and watch the changes take effect.

However, all the ease of use and flexibility, all of those options, they cost something. At initial startup, with no settings, with no modification of the viewport, Viewport uses 40.3 KB of memory on my system. The addon itself is 325 KB of code.

To achieve the same exact effect with Tweaker uses virtually no memory and uses roughly 10 lines of code in your config.lua. Want to see it?

The WorldFrame is the UI element that renders the world. We're going to hook to that element and change it's anchors. Usually it's anchored to the TOPLEFT and BOTTOMRIGHT so it takes up the whole screen, but we'll anchor it to the TOPLEFT and TOPRIGHT so that it takes up the width of the screen (LEFT to RIGHT) and affixes itself to the top. Then I set the height to be half the width -- creating a panoramic view. This is the setting I was previously using in Viewport, and it gives me a nice bit of room at the bottom of my screen to place other things.

This may not work so well on a fullscreen monitor, but feel free to play around with the parameters all you want. You can anchor the WorldFrame wherever you'd like and adjust the height and width to whatever you'd like in order to create the viewport that's exactly right for you.

Update: It occurred to me that I forgot something important to go along with this. Starting in 3.2, I began noticing that once the viewport is modified, in certain areas, you'll get a bluish hue instead of a solid black in the "empty" space. To correct this, create a solid black panel over the area (or use an image or make a rainbow or whatever else you'd like, but I opted for a solid black panel).

No comments:

Post a Comment