2017-12-09 9 views
0

私はlibGDXを使ってアプリケーションを開発しました。 Androidアプリはプレイストアに公開されています。デスクトップアプリケーションは正常に動作しますが、libGDXを使用して開発されたデスクトップアプリケーションの上部にメニューバーとメニュー項目を追加できるかどうかを理解する必要があります。以下は私のDesktopLauncherクラスのコードです。私はウィンドウの高さ、幅、タイトル、アイコンなどを設定するなどのいくつかの機能を使用することができます。libGDXを使用して開発されたデスクトップアプリケーションにメニューバーとトップメニューを追加できますか

public class DesktopLauncher { 
public static void main (String[] arg) { 
    LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); 
    new LwjglApplication(new awesomeApp(), config); 
    config.width = awesomeApp.WIDTH ; 
    config.height = awesomeApp.HEIGHT; 
    config.title = awesomeApp.TITLE; 
    config.resizable = false; 
    config.addIcon("awesomeAppIcon.png", Files.FileType.Internal); 

} 
} 

私は基本的にヘルプのようないくつかのオプション、音楽ボリューム設定、一時停止設定などのためにトップメニューが必要です。

Googleで検索してみましたが、回答が見つかりませんでした。

ありがとうございます!

答えて

0

libgdxにはScene2d.ui api linkがあります。ボタンを含む基本的なメニューバーの例:

float pad = 1/100f * stage.getWidth(); 

ImageButton pause = new ImageButton(skin, "menu-button-pause"); 
ImageButton volume = new ImageButton(skin, "menu-button-volume"); 
TextButton about = new TextButton("about", skin, "menu-button"); 
TextButton help = new TextButton("help", skin, "menu-button"); 

Table menu = new Table(skin); 
menu.setBackground("background"); 
menu.add(pause).padRight(pad); 
menu.add(volume).padRight(pad); 
menu.add(about).fill().padRight(pad); 
menu.add(help).fill(); 

// align all actors to the top of the screen 
Table table = new Table(); 
table.setFillParent(true); 
table.top(); 
table.add(menu).width(stage.getWidth()); // set to screen width 

stage.addActor(table); 
関連する問題