Akayan UI

Share your scripts and packages with other Mudlet users.
User avatar
Akaya
Posts: 412
Joined: Thu Apr 19, 2012 1:36 am

Re: Akayan UI

Post by Akaya » Wed Feb 12, 2014 4:27 pm

So each miniconsole would need its own buffer? Does this affect processing time with multiple miniconsoles?

How would you handle the new width/height? calcFontSize()?

Is this something specific to your Simple Window Manager or can it be applied to Geyser and Vyzor as well?

Jor'Mox
Posts: 1100
Joined: Wed Apr 03, 2013 2:19 am

Re: Akayan UI

Post by Jor'Mox » Wed Feb 12, 2014 4:44 pm

Since Geyser objects are interacted with via their own methods, it would actually be easier to use with Geyser (though you would need to modify the appropriate functions to also echo/append data to the relevant buffer). I don't honestly know about Vyzor, but it can be done with basic miniConsole objects, so it CAN be done, but I'm not sure the level of complexity involved.

Each miniConsole needs an independent buffer, yes, and while I would imagine it would affect processing time, I haven't noticed any overly large delays due to using it (but I only have 4 windows I'm applying it to). Basically, you clear the display window, change the window wrap length, and then copy over every line from the buffer associated with it. Here is the function that does the actual work for my Simple Window Manager:
Code: [show] | [select all] lua
local function rewrap_window(name)
	local info = windowManager.list[name]
	local buffer = name .. "_windowManager_buffer"
	local wrap = math.floor(windowManager.getValue(name,"width") / calcFontSize(info.font))
	local line, moved
	setWindowWrap(name,wrap)
	clearWindow(name)
	line = 0
	moved = moveCursor(buffer,1,line)
	while moved do
		selectCurrentLine(buffer)
		copy(buffer)
		line = line + 1
		moved = moveCursor(buffer,1,line)
		appendBuffer(name)
	end
end
Other than that, you just have to put in something to write to the buffer whenever you write to the console window by overwriting the Geyser.MiniConsole.appendBuffer and Geyser.MiniConsole.echo (and related) functions, and obviously have the buffer word wrap length be sufficiently large so as to not wrap any lines it is sent (I use 1000). I may or may not be using the most ideal approach here, but it seems fairly robust, especially if you put in some mechanism to delay the rewrapping until after a user is finished resizing a window (instead of doing it as they are changing the size, and so end up doing the same thing hundreds of times).

If there were a way to detect a soft wrap rather than a hard wrap, then I could do it with one buffer by unwrapping a window into a buffer and rewrapping it as I wrote it back in. But I haven't found a way to do that.

User avatar
Akaya
Posts: 412
Joined: Thu Apr 19, 2012 1:36 am

Re: Akayan UI

Post by Akaya » Wed Feb 12, 2014 5:18 pm

I'll need to set up a metatable for it to work dynamically with Geyser, but tried this out on a Geyser-made GUI with a tabbed window that has 20+ miniconsoles. Worked great.
Code: [show] | [select all] lua
local function rewrap_window(name)
        local info = GUI[name]
        local buffer = name .. "_windowManager_buffer"
        local t = GUI[name]:get_width() / calcFontSize(GUI[name.."CSS"]:get("font-size") )
        local wrap = math.floor(t:gsub("px","")
        local line, moved
        setWindowWrap(GUI[name],wrap)
        clearWindow(GUI[name])
        line = 0
        moved = moveCursor(buffer,1,line)
        while moved do
                selectCurrentLine(buffer)
                copy(buffer)
                line = line + 1
                moved = moveCursor(buffer,1,line)
                appendBuffer(GUI[name])
        end
end
This particular GUI confirms position and size with a user command. This prevented it from being run multiple times while I adjusted it.

Good work! Can't think of a better way myself.

Jor'Mox
Posts: 1100
Joined: Wed Apr 03, 2013 2:19 am

Re: Akayan UI

Post by Jor'Mox » Wed Feb 12, 2014 5:54 pm

Thanks. You will have to post the finished version so I can see how you go about it. :-)

Opensky
Posts: 2
Joined: Sat Sep 14, 2019 3:42 pm

Re: Akayan UI

Post by Opensky » Thu Sep 19, 2019 3:56 pm

Akaya wrote:
Thu May 09, 2013 9:06 am
Here are the Geyser and Vyzor gameboys! Both come with a simple pong game.

I feel this is a great example for both the Vyzor and Geyser frameworks as to what can be done with each.

These scripts are near identical. The only differences between the two are a result of their framework. So if you're looking to try the switch from one to the other, this a great opportunity. :)

Vyzor Gameboy
Image
Geyser Gameboy
Image
Here's a video of it in action: http://youtu.be/9jYgoVT_k48
Controls
These can be altered if you don't have a numpad
4: move paddle left
6: move paddle right
How to play
Try to get the ball going as fast as you can. Each bounce speeds it up. It *is* possible to win.

VyzorGameBoy.zip
GeyserGameBoy.zip
hi, i have played this pong game and i liked it. its an old game, i used to played similar video games in my childhood. these pictures remind me the old days, becoming emotional...haha

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests