Quick question about the Repaint function

Posted by Wuggly on Sat 09 Apr 2016 08:37 PM — 2 posts, 12,912 views.

USA #0
Hello again,

Recently, I've been working on building a sidebar that you can close and pull back out with it animated when it closes/opens.

My question is, is it possible to specify which windows to Repaint instead of it repainting all the windows?

Here's an animated gif of what I've got so far.
http://i.imgur.com/WEtrMZa.gifv

It's not smooth as I have it moving in counts of fives to make it move faster.

If I could specify which windows to repaint, I could possibly change it to moving one X position at a time instead of five, and I believe it would move faster since it wouldn't be repainting all the windows at once, which would give it a smoother look.

Also it moves a bit smoother than it does in the animated gif, as the screen recorder was lagging me a bit.
Amended on Sat 09 Apr 2016 08:44 PM by Wuggly
Australia Forum Administrator #1
No, you can't. Miniwindows are set up in an off-screen buffer, and Repaint causes that to be copied to the screen. There is no provision for a partial copy.

You could add some timing to your code (see utils.timer). It may be that redrawing your miniwindow with the image shifted is actually the part taking most of the time.

You could set up some off-screen miniwindows with the scrolling pre-prepared, and quickly copy them into position.

However I usually have found that when you try to animate one thing (eg. a box) on its own, and you are staring at it, it looks less smooth than most animations. For example in a game you might have your eyes on the enemy firing at you, and don't notice that in the background things aren't moving perfectly smoothly.

Modern operating systems manage quite smooth scrolling of things by leveraging off the capabilities of 3D graphics cards (which can be told to move a bitmap by merely re-specifying its coordinates directly to the card. You can't do that in MUSHclient.

It's really supposed to be a text game client. Things like the mapper look pretty smooth because it updates in a chunky way by its nature.