Log Display clipping at certain resolutions

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Log Display clipping at certain resolutions

#1 Post by yufra »

I usually run T-Engine at 1024x768, and the log display clipping shown in the attached (cropped) screenshot has always bothered me. I tested at 800x600 and the clipping disappeared, and after source diving I managed to come up with a fix but don't understand exactly why it works. The trick is to introduce a "buffer" variable that collects any leftover pixels from non-even division of the font height into the log display height and add that to the top and bottom of the log display. I haven't checked it at higher resolutions (cannot run at them).

Code: Select all

diff -u LogDisplay.lua.old LogDisplay.lua
--- LogDisplay.lua.old	2010-08-07 12:19:31.000000000 -0400
+++ LogDisplay.lua	2010-08-15 01:17:43.000000000 -0400
@@ -89,9 +89,10 @@
 	self.surface:erase(self.bgcolor[1], self.bgcolor[2], self.bgcolor[3])
 	local i, dh = 1, 0
 	local r, g, b = self.color[1], self.color[2], self.color[3]
+	local buffer = (self.h % self.font_h) / 2
 	for i = math.floor(self.h / self.font_h), 1, -1 do
 		if self.log[self.scroll + i] then
-			r, g, b = self.surface:drawColorStringBlended(self.font, self.log[self.scroll + i][1], 0, self.h - (i) * self.font_h, r, g, b)
+			r, g, b = self.surface:drawColorStringBlended(self.font, self.log[self.scroll + i][1], 0, self.h - buffer - (i) * self.font_h, r, g, b)
 			if self.log[self.scroll + i].reset then r, g, b = self.color[1], self.color[2], self.color[3] end
 		end
 	end
Attachments
LogDisplay.png
LogDisplay.png (34.16 KiB) Viewed 609 times
<DarkGod> lets say it's intended

Post Reply