67706

Libgdx - Making a drop-down menu/settings screen

Question:

I'm looking to make a drop-down menu and drop-down settings screen but I couldn't find any resources for making these in Libgdx. Would like some pointers to good resources for this specific type of interface or a quick example.

Thanks!

Answer1:

<a href="https://github.com/libgdx/libgdx/wiki/Scene2d.ui#selectbox" rel="nofollow">SelectBox</a> is in LibGDX can be used for drop-down list, it allows one of a number of values to be chosen from a list. And for pop-up window you can use Dialog.

stage=new Stage(); Skin skin=new Skin(Gdx.files.internal("skin/glassy-ui.json")); dialog=new Dialog("Setting",skin); dialog.setSize(200,200); dialog.setPosition(Gdx.graphics.getWidth()/2-100,Gdx.graphics.getHeight()/2-100); final SelectBox<String> selectBox=new SelectBox<String>(skin); selectBox.setItems("XYZ","ABC","PQR","LMN"); dialog.getContentTable().defaults().pad(10); dialog.getContentTable().add(selectBox); stage.addActor(dialog); Gdx.input.setInputProcessor(stage);

Output

<a href="https://i.stack.imgur.com/orlfm.gif" rel="nofollow"><img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/orlfm.gif" data-original="https://i.stack.imgur.com/orlfm.gif" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

Recommend

  • Blank black screen while shifting between activities android
  • How can I import the kryonet library without “compile: ” from gradle?
  • 3D libgdx rotation
  • Invoke object constructor when deserializing json using libgdx
  • libgdx TiledMap Rendering Performance Issue
  • LibGDX scale a slider, HOW?
  • PHPUnit: continue after die, expect “die” or somehow handle die()? [duplicate]
  • How can I fix the unsecure_base_url on my Magento installation?
  • How to FindResource (pinvoke) a string resource in C#?
  • Magento - FishPig Integration - Not getting correct template for /blog
  • HTTPS + gzip: Is it a security vulnerability if I only gzip non-sensitive files?
  • How to produce a Code 39 that can be reliably read after faxing
  • libgdx clickable image not working
  • Save and retrieve an image file in LibGDX
  • What is wrong with this emulation of CMPXCHG16B instruction?
  • Pandas: merge_asof() sum multiple rows / don't duplicate
  • How do I translate LR(1) Parse into a Abstract syntax tree?
  • How to specify input and output paths from cmd.exe for a PowerShell script?
  • Ajax Upload File: $_FILES is empty but files exists in request header
  • Alert pop up with LWUIT
  • Disabling Alt-F4 on a Win Forms NotifyIcon
  • Is there a javascript serializer for JSON.Net?
  • Where to put my custom functions in Wordpress?
  • Convert array of 8 bytes to signed long in C++
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • How do I rollback to a specific git commit
  • Is there a mandatory requirement to switch app.yaml?
  • Buffer size for converting unsigned long to string
  • AngularJs get employee from factory
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Understanding cpu registers
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Turn off referential integrity in Derby? is it possible?
  • Add sale price programmatically to product variations
  • Busy indicator not showing up in wpf window [duplicate]
  • Recursive/Hierarchical Query Using Postgres
  • Running Map reduces the dimensions of the matrices
  • Binding checkboxes to object values in AngularJs
  • Unable to use reactive element in my shiny app
  • How do I use LINQ to get all the Items that have a particular SubItem?