This time, it’s about UI. And console. As the two subjects are nested, i make one post.
(ohh noooo, another post long like a month of sundays!)
Here is my code for a basic console display, with Lua and Urho3DPlayer:
require "scripts/common/keys" function console_traitement() print("traitement") end function console_create() local style="UI/DefaultStyle.xml" local uiStyle = cache:GetResource("XMLFile", style) engine:CreateConsole() console.background.opacity = 0.8 console.defaultStyle = uiStyle console:SetVisible(true) end Start = function() SubscribeToEvent("KeyDown", "handle_keys") --for handling ESCaping console_create() end
Now, i’ve some questions.
About UI itself
Defining an UI seems rather complex.
For getting the console window to display, i need to include:
- UI/DefaultStyle.xml define the window displayed, i guess.
- Fonts/Anonymous Pro.ttf included by DefaultStyle.xml.
- Textures/UI.png included by DefaultStyle.xml.
- Textures/UI.xml i put it in the path, perhaps optional
And the shaders.
- Shaders/GLSL : Basic.glsl console won’t work without this one.
(Basic.glsl needs Samplers.glsl, Transform.glsl, Uniforms.glsl)
I didn’t find which part of UI/DefaultStyle.xml ask for Basic.glsl. Is the glsl file always needed, whatever Urho display subsystem we will use ?
I guess that UI parts won’t be defined with a text editor. So I’ve launched Urho Editor, and try to load .xml files from UI directory.
I can see on screen some of them (for example, UI/MessageBox.xml , i can open it with with ?open UI layout? submenu). But i cannot ?open UI layout? the file UI/DefaultStyle.xml (i can only ?open? it, does it means it has no ?viewable? format ? Only definitions of elements, may be ?).
About the console
Excepting for displaying errors messages and output on stdout, what is the interest of console ?
I thought i could use my own functions for dealing with console keyboard input.
I mean, it would be nice to define a function in the script as a callback of console. For debugging, changing variables on the fly, choosing a level…
It seems that we can only choose our shell interpreter. And even this, i couldn’t do:
I tried to change at least interpreter:
If i type in console echo $SHELL, i still get /bin/bash
Another last question, just for the sake of curiosity:
print(console.commandInterpreter) – returns: ?FileSystem?
print(console:GetCommandInterpreter()) – returns: ?FileSystem?
What does ?FileSystem? means ? Ok i know what a FS is, but here ?
Thank you for reading all this.