-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
146 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
local f = CreateFrame("Frame", nil, UIParent) | ||
f:RegisterEvent("PLAYER_ENTERING_WORLD") | ||
f:SetScript("OnEvent", function(self, event) | ||
|
||
local ENABLED = 1 | ||
local DEBUG = 0 | ||
local MAGIC_X = -0.25 | ||
local MAGIC_Y = 0.4 | ||
|
||
-- This draws some 1 pixel crosshairs on the screen to test the pixel alignment of UIParent | ||
if DEBUG >= 1 then | ||
AddCrosshairs("CENTER", 0, 0) | ||
AddCrosshairs("TOPLEFT", 10, -10) | ||
AddCrosshairs("TOPRIGHT", -10, -10) | ||
end | ||
|
||
-- Calculate pixel perfect UI scale for the current resolution | ||
local scale = 768.0 / string.match(({GetScreenResolutions()})[GetCurrentResolution()], "%d+x(%d+)") | ||
|
||
if DEBUG >= 2 then | ||
print("Detected Window Height = " .. string.match(({GetScreenResolutions()})[GetCurrentResolution()], "%d+x(%d+)")) | ||
print("Setting Scale = " .. scale) | ||
print("New Width = " .. GetScreenWidth()) | ||
print("New Height = " .. GetScreenHeight()) | ||
print("Effective Scale = " .. UIParent:GetEffectiveScale()) | ||
end | ||
|
||
-- Deactivate the UI scale option | ||
SetCVar("UseUIScale", 0) | ||
|
||
-- Apply calculated pixel perfect scale | ||
UIParent:SetScale(scale) | ||
|
||
if ENABLED > 0 then | ||
|
||
-- Apply "magic" offsets to the entire UI for pixel alignment | ||
UIParent:SetPoint("TOPLEFT", MAGIC_X, MAGIC_Y) | ||
UIParent:SetPoint("BOTTOMRIGHT", MAGIC_X+1, MAGIC_Y-1) | ||
|
||
-- Align other UI elements | ||
MainMenuExpBar:SetPoint("TOP", 0.5, 0) | ||
ReputationWatchStatusBar:SetPoint("TOP", 0.5, 0) | ||
CharacterMicroButton:SetPoint("BOTTOMLEFT", 554, 2.5) | ||
MainMenuBarBackpackButton:SetPoint("BOTTOMRIGHT", -6.5, 2) | ||
MainMenuBarArtFrame:SetPoint("TOPLEFT", -1.0, 0) | ||
ActionBarUpButton:SetPoint("CENTER", MainMenuBarArtFrame, "TOPLEFT", 521, -22) | ||
ActionBarDownButton:SetPoint("CENTER", MainMenuBarArtFrame, "TOPLEFT", 521, -42) | ||
MultiCastActionBarFrame:SetPoint("TOPLEFT", 30.5, 0) | ||
ShapeshiftBarFrame:SetPoint("TOPLEFT", 30.5, 0) | ||
end | ||
end) | ||
|
||
local function AddCrosshairs(relativeTo, offsetX, offsetY) | ||
|
||
local SIZE = 64 | ||
|
||
local bg = UIParent:CreateTexture() | ||
bg:SetTexture(0,0,0,1) | ||
bg:SetSize(SIZE,SIZE) | ||
bg:SetPoint(relativeTo, 0, 0) | ||
|
||
local line0 = UIParent:CreateTexture() | ||
line0:SetTexture(1,1,1,1) | ||
line0:SetSize(1,SIZE) | ||
line0:SetPoint(relativeTo, offsetX-1, offsetY) | ||
|
||
local line1 = UIParent:CreateTexture() | ||
line1:SetTexture(1,1,1,1) | ||
line1:SetSize(1,SIZE) | ||
line1:SetPoint(relativeTo, offsetX+1, offsetY) | ||
|
||
local line2 = UIParent:CreateTexture() | ||
line2:SetTexture(1,1,1,1) | ||
line2:SetSize(SIZE,1) | ||
line2:SetPoint(relativeTo, offsetX, offsetY-1) | ||
|
||
local line3 = UIParent:CreateTexture() | ||
line3:SetTexture(1,1,1,1) | ||
line3:SetSize(SIZE,1) | ||
line3:SetPoint(relativeTo, offsetX, offsetY+1) | ||
end | ||
|
||
-- // Other debugging stuff for reference | ||
-- local text = UIParent:CreateFontString(nil, UIParent, "GameFontHighlight") | ||
-- text:SetPoint("CENTER", 0, 20) | ||
-- text:SetText("Hello World") | ||
-- local MySlider = CreateFrame("Slider", "MySlider", UIParent, "OptionsSliderTemplate") | ||
-- MySlider:SetWidth(500) | ||
-- MySlider:SetHeight(20) | ||
-- MySlider:Show() | ||
-- MySlider:SetPoint("CENTER", 0, 0) | ||
-- MySlider:SetMinMaxValues(-2, 2) | ||
-- f:SetScript("OnUpdate", function(self, elapsed) | ||
-- | ||
-- local value = MySlider:GetValue() | ||
-- text:SetText(value) | ||
-- | ||
-- end) | ||
-- | ||
-- function PrintChildren(element) | ||
-- | ||
-- local children = { element:GetChildren() } | ||
-- for i, child in ipairs(children) do | ||
-- print(child:GetName()) | ||
-- end | ||
-- | ||
-- end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## Interface: 30300 | ||
## Author: Fell @ Rising-Gods | ||
## Version: 1.0 | ||
## Title: Fell's Pixel Perfect Interface | ||
## Notes: Ensures, that the default interface always looks sharp and pixel perfect. | ||
|
||
Fell_PixelPerfect.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,32 @@ | ||
# Fell_PixelPerfect | ||
Interface Addon for World of Warcraft 3.3.5a to improve sharpness of the default UI by pixel-aligning all elements | ||
# Fell's Pixel Perfect Interface | ||
Interface Addon for World of Warcraft 3.3.5a to improve sharpness of the default UI by pixel-aligning all elements. | ||
|
||
## What it does | ||
|
||
The UI elements of the stock interface in World of Warcraft 3.3.5a are blurred. Even when the correct UI scale is set, most elements are still positioned inbetween pixels causing the textures to appear less sharp than they actually are. | ||
|
||
While this problem has been fixed in the Cataclysm expansion, this addon provides a workaround to replicate the fix in the Wrath Of The Lich King expansion | ||
|
||
![Comparison Screenshot](img/preview.png) | ||
|
||
## How to install | ||
|
||
1. [Download the latest Release](). | ||
2. Extract `Fell_PixelPerfect` into your `World of Warcraft\Interface\AddOns` folder. | ||
3. That's it! No configuration needed. If you encounter issues, simply deactivate the addon on the character selection screen. | ||
|
||
## How it works | ||
|
||
1. This addon **deactivates the UI scale option**, and then applies the ideal scale based on the current resolution. | ||
2. It then moves the entire UI by less than one pixel, such that all pixels of the interface exactly line up with the screen. | ||
3. Lastly, it applies some 0.5 pixel offsets to elements which have not been fixed by the previous step. | ||
|
||
## Details | ||
|
||
The WoW interface has been designed for a resolution of 1024x768. The interface is automatically scaled at other resolutions. This can be changed through the UI scale setting, which applies a custom scale factor to the entire UI. When UI scale is equal to `768.0 / ScreenHeight`, all elements keep their true pixel size. You can learn more about this in [this thread](https://www.wowinterface.com/forums/showthread.php?t=55803). | ||
|
||
At this ideal scale, you would expect the interface to be pixel perfect, but it is not. Even at exactly 1024x768 pixels, the textures are blurrier than their original files. | ||
|
||
By trial and error, I fould out that the entire UI is offset by exactly (0.25, -0.4) pixels, causing all textures to be blurred. I don't really know where these numbers come from, but they seem to be correct at all resolutions. I assume it either has something to do with the display on CRT monitors or it's a bug caused by Windows 10. | ||
|
||
After applying an offset in the opposite direction (-0.25, 0.4) most of the interface looks crisp and clear, with the exeption of the main menu bar at the bottom. The game automatically centers it, placing it exactly inbetween pixels. I fixed this by shifting the affected elements manually until they looked sharp. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.