Disable automatic redraw

Posted by Zahan on Sat 12 Nov 2016 12:08 AM — 5 posts, 17,476 views.

#0
Quote:

In practice, MUSHclient calls Redraw internally when new output arrives from the MUD (and is placed on the screen), and you do a WindowShow, and at various other spots.


Is there a way to disable the internal redraw on new output?
Australia Forum Administrator #1
New output to where? When text arrives from the MUD you want to see it don't you?
#2
New output to the world.


I do want to still see the output, yes. I didn't realize that removing that redraw would stop the mud output from showing up. Perhaps I don't want to stop the redraw afterall.


Maybe it would help if I explain my issue. I find that I have an unreasonable amount of miniwindows, and it was slowing down mush's processing of output from the mud. I managed to recreate a noticeable slowdown by having as few as 10 miniwindows, completely blank, with no functions firing to fill them. Anything over 5, you start to see the process time climbing.

My thought was to stop the automatic redraw and then just call for which specific miniwindows needed to be redrawn at that moment by using the windowcreate/show combination. That would, in theory, allow me to keep my unreasonable amount of windows.

That all falls apart though, if it's connected to showing the mud output. I need the mud output still.

Hrm.
Australia Forum Administrator #3
10 windows with nothing in them shouldn't slow things down. When you draw inside a miniwindow it draws to an offscreen bitmap. Then when the main window is drawn it copies these bitmaps onto the output window in the desired spot.

The only reason I can think of for 10 to slow it down is if you have made them ridiculously large and/or turned on transparency.

Can you post code to reproduce this? I would like to look at how you set up the windows and what size they are.
#4
I sized them 300x300.

I'd post the basic for-loop I used to test but it feels pointless since you just nailed it - they were flagged for transparency.

I turned off the transparency, redrew 30 of them, and no lag whatsoever to processing.

Very enlightening. Thank you.


Edit: here's the code anyway, for curiosity's sake.


-- function
function CreateTestWindow (win, z_order)
	WindowCreate (win, 10, 10, 300, 300, 1, 6, 0)
	WindowSetZOrder(win, z_order)
	WindowFont(win, "8", "Lucida Console", 8, false, false, false, false)
	WindowFont(win, "8b", "Lucida Console", 8, true, false, false, false)
	WindowFont(win, "9", "Lucida Console", 9, false, false, false, false)
	WindowFont(win, "9b", "Lucida Console", 9, true, false, false, false)
	WindowShow(win, true)
end

-- clear any existing
for i = 1, 50 do
	local win = "test"..i
	WindowShow(win, false)
end

-- draw test windows
for i = 1, 15 do
	local win = "test"..i
	CreateTestWindow(win, i)
	print("loading", win)
end