Giter Site home page Giter Site logo

Comments (2)

PunchablePlushie avatar PunchablePlushie commented on May 19, 2024 1

Is there a way to make the settings menu navigable with just the keyboard? So users can use either the mouse or the keyboard.

I know GGS isn't responsible for the configuration of the Settings-Menu, so maybe setting Focus on those items isn't an issue for this package?

The menu should be keyboard navigatable already, thanks to Godot itself. You just gotta handle the focus.
If you want your menu to be navigatable by keyboard, first, you gotta make sure that you have keys assigned to ui_left/right/top/bottom actions in the Input Map. After that, you just need a script that handles focusing on a node when the player enters the settings menu.
For example, let's say you want the focus to be on a node called "FullscreenToggleButton" when someone enters the options menu. So:

extends Control

onready var FirstFocus = $FullscreenToggleButton

func _onready():
    FirstFocus.grab_focus()

That allows the users to navigate the menu using the keyboard. Without doing that, they won't be able to do it because no node has focus to begin with. From there on, you can handle focus targets using the "Focus" section in the Inspector (Neighbour Left, Neighbour Right, etc.).

If you want the nodes to be controllable only with the keyboard, you can set their mouse_filter property to Ignore. Check the "Mouse" section in the Inspector.

Maybe I could add functionality to the components' scripts to handle is_focus() cases. The ggs_arrow_list would definitely need to handle that implicitly in order to call "press" on its children buttons

The components do require a simple change to handle the focus properly when the mouse is hovered over them. Right now, when you hover over a component with a mouse, it doesn't technically gain focus.

connect("mouse_entered", self, "_on_mouse_entered")

func _on_mouse_entered():
   grab_focus()

That's basically all there is to it. I'll go ahead and push the fix in a moment.

Hopefully that helped you achieve what you wanted to do.

from godot-game-settings.

kingoftheconnors avatar kingoftheconnors commented on May 19, 2024

Maybe I could add functionality to the components' scripts to handle is_focus() cases. The ggs_arrow_list would definitely need to handle that implicitly in order to call "press" on its children buttons

from godot-game-settings.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.