Page 1 of 2
Get rid of default UI
Posted: 25 Feb 2015, 02:18
by Funkencool
Edit:
Here's a simple widget to disable all the apparent default UI elements.
Code: Select all
function widget:GetInfo()
return {
name = "Clean slate",
desc = "Get rid of default UI",
author = "Funk",
date = "Feb, 2015",
license = "Public Domain",
layer = 0,
enabled = true,
}
end
function widget:Initialize()
-- get rid of engine UI
Spring.SendCommands("resbar 0", "tooltip 0","fps 0","console 0","info 0")
-- leaves rendering duty to widget (we won't)
gl.SlaveMiniMap(true)
-- a hitbox remains for the minimap, unless you do this
gl.ConfigMiniMap(0,0,0,0)
end
-- sets status to ready; avoiding any pre-game UI
function widget:GameSetup()
return true, true
end
It seem's I've got everything now but let me know otherwise.
Re: How do I get rid of default UI?
Posted: 25 Feb 2015, 03:11
by jK
all you are missing is a callin GameSetup... or somehting
Re: How do I get rid of default UI?
Posted: 25 Feb 2015, 03:44
by Funkencool
addon.GameSetup(state, ready, playerStates)
return: bool success, bool newReady
???
That's all I found in the wiki.
I would guess this is an unsynced gadget callin from what I've seen elsewhere in the forum.
Does anyone have some example code? This makes no sense to me without context.
edit: found this works
Code: Select all
function widget:GameSetup()
return true, true
end
My best guess it it sets the state to ready and therefor skips the drawing
Re: Get rid of default UI
Posted: 25 Feb 2015, 08:02
by 8611
Spring.SendCommands ("hideinterface 1")
will also hide widgets...at least those that use IsGUIHidden()
Re: Get rid of default UI
Posted: 25 Feb 2015, 09:46
by Silentwings
Iirc the first returned argument from GameSetup controls whether or not the engine prints a coloured list of names showing players readyStates, and the second argument sets the readyState of the player.
Obviously your widget should avoid changing the readyState of the player, so you should want to return true,nil - but seems the widgetHandler is currently not clever enough to deal with that (
https://github.com/spring/spring/blob/d ... .lua#L1662).
So imo leave out GameSetup; the readyStates might get overruled/re-implemented by a gadget anyway.
Re: Get rid of default UI
Posted: 25 Feb 2015, 11:05
by Funkencool
Probably true in most cases but specifically this is for my in game menu; so a completely blank slate is really all I want.
Re: Get rid of default UI
Posted: 25 Feb 2015, 11:17
by gajop
Re: How do I get rid of default UI?
Posted: 25 Feb 2015, 12:47
by Jools
Funkencool wrote:addon.GameSetup(state, ready, playerStates)
return: bool success, bool newReady
???
That's all I found in the wiki.
I would guess this is an unsynced gadget callin from what I've seen elsewhere in the forum.
Does anyone have some example code? This makes no sense to me without context.
edit: found this works
Code: Select all
function widget:GameSetup()
return true, true
end
My best guess it it sets the state to ready and therefor skips the drawing
Look at
xta commander change widget for and example how it's used.
Widget can set the playerstate as ready, but once it's set as ready it can not reverse it.I don't really remember but I think the second return parameter is whether you want to implement your own ready button or not, at least it was possible to do that somewhere.
Re: Get rid of default UI
Posted: 25 Feb 2015, 18:08
by FLOZi
Please feed the wiki.

Re: Get rid of default UI
Posted: 25 Feb 2015, 18:16
by Funkencool
FLOZi wrote:Please feed the wiki.

Splendid idea
As an expert on the wiki, do you have any suggestions on where I should put it?
Re: Get rid of default UI
Posted: 25 Feb 2015, 18:32
by Jools
Re: Get rid of default UI
Posted: 25 Feb 2015, 18:42
by FLOZi
That is indeed the page that needs updating to fill in the details of how GameSetup works. You will find it is templated for your pleasure.
Re: Get rid of default UI
Posted: 25 Feb 2015, 18:48
by Funkencool
I guess I was thinking along the lines of a quick guide to springs default UIs but that could definitely use a little more info too.
Re: Get rid of default UI
Posted: 05 Mar 2015, 08:37
by gajop
I'm also using gl.SlaveMiniMap(true), but I've noticed that if I put the mouse cursor near the place where the map usually is, it will put that blue pointer on the map (representing where my mouse cursor is on the invisible minimap). It looks kinda weird, and even appears on those blank maps.
Is this a Spring bug or maybe we aren't turning off something?
PS: I'm invoking it once (initially) in the DrawWorld - I thought you need to do it in an opengl context like most gl. commands - am I wrong?
Re: Get rid of default UI
Posted: 05 Mar 2015, 11:58
by 8611
Re: Get rid of default UI
Posted: 05 Mar 2015, 17:16
by Funkencool
Now that you mention it, I've had that problem as well. I think the minimap geo has to be set with something like
Can anyone else confirm that?
Chili is hidden with the rest of the UI. Which is wanted behavior and why that won't work.
Re: Get rid of default UI
Posted: 05 Mar 2015, 18:31
by 8611
gl.ConfigMiniMap(0,0,0,0) will work but leave a small group of pixels, perhaps the minimap's frame. Maybe there is a setting to get rid of that too but imo that is all a bit cumbersome.
The original question is "Get rid of default UI" and Spring.SendCommands ("hideinterface 1") does excactly that without having to figure out dozen of small extra cases.
widgets do not automatically get hidden when engineGUI is disabled.
They use Spring.isGUIHidden() to stop drawing/reacting to user input.
If chiliGUI always hides each chili-widget once engineGUI is turned off then that is imo too restrictive and worth changing:
chili has functions Hide() / Show() so each widget could already implent anyway how it wants to handle the situation.
Or instead for more silly tricks: Spring.SendCommands ("minimap minimize 1") and to get rid of the maximize button include a transparent minimapbuttons.png
Re: Get rid of default UI
Posted: 06 Mar 2015, 00:53
by Funkencool
8611 wrote:gl.ConfigMiniMap(0,0,0,0) will work but leave a small group of pixels
If in slave mode the pixels could be drawn manually; otherwise nothing would be visible and it would prevent what gajop mentioned.
8611 wrote:The original question is "Get rid of default UI"
I'm completely aware of the original question I myself asked.
Spring.isGUIHidden() does not refer to "engine" but instead to the entire GUI, same goes for Spring.SendCommands ("hideinterface 1"). IMO those functions should be reserved to let widgets know and adjust when the user wants their GUI hidden.
8611 wrote:for more silly tricks
You're a silly trick

Re: Get rid of default UI
Posted: 06 Mar 2015, 01:30
by gajop
Just to confirm, using Spring.SendCommands("hideinterface 1") is something I also want to avoid. The way I see it, the semantic of that assumes the user wants to remove the entire interface, usually for screenshot taking purpose. This is also probably the intended behaviour by the people that implemented this and Spring.isGUIHidden().
Now on to gl.ConfigMiniMap(0,0,0,0), what does this do? Is it basically a configuration that says the minimap appears in the rectangle (0,0), (0,0)? It seems one can set it to (-1,-1), (-1, -1) as well, but both seem to do exactly what I wanted.
PS: Both commands can be started in widget:Initialize() it seems, don't need to be in OpenGL context.
Re: Get rid of default UI
Posted: 06 Mar 2015, 04:24
by Funkencool
I think you nailed what it does, but I'm not sure. I just I came across it in zk's minimap where it was in an if statement for showing/hiding the minimap. When toggled it would switch between values from a chili window and (0,0,0,0)
edit: Updated OP with some comments and this