Page 5 of 5

Re: Akayan UI

Posted: Wed Feb 12, 2014 4:27 pm
by Akaya
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?

Re: Akayan UI

Posted: Wed Feb 12, 2014 4:44 pm
by Jor'Mox
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.

Re: Akayan UI

Posted: Wed Feb 12, 2014 5:18 pm
by Akaya
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.

Re: Akayan UI

Posted: Wed Feb 12, 2014 5:54 pm
by Jor'Mox
Thanks. You will have to post the finished version so I can see how you go about it. :-)

Re: Akayan UI

Posted: Thu Sep 19, 2019 3:56 pm
by Opensky
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

Re: Akayan UI

Posted: Tue Jun 09, 2020 5:21 pm
by Tdmedia
Okay... Sorry to revive an old post. But, I am using the knight ui.... cause I like the style. And I want to resize the chat window so it is smaller and no longer cuts off my wilderness maps. How would I go about doing that?

Re: Akayan UI

Posted: Tue Jun 30, 2020 12:44 am
by Akaya
R.I.P. tinypic.com You served me well. I'll update the images on this thread because it's so depressing to see.

To answer your question!... Open Scripts > Akayan_UI_Knight > UI.Background
Alter line 1 to fit your needs. Should look like this by default:

Code: Select all

 Vyzor.Options.Borders = {Top = 0.5, Bottom = 0.1}

Re: Akayan UI

Posted: Thu Mar 31, 2022 4:34 am
by atari2600tim
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
I added gamepad functions to the Pong game. Left stick is analog and moves paddle straight to a spot. Direction pad lets you hold left and right. Start game with buttons A, start, or select.

It uses XInput for gamepads, so basically Xbox 360 or Xbox One controller on Windows will work but not many other setups.