{"id":13529043,"url":"https://github.com/TomGrill/gdx-dialogs","last_synced_at":"2025-04-01T14:33:54.727Z","repository":{"id":33613675,"uuid":"37265894","full_name":"TomGrill/gdx-dialogs","owner":"TomGrill","description":"libGDX extension providing cross-platform support for native dialogs","archived":false,"fork":false,"pushed_at":"2019-12-31T16:47:25.000Z","size":15074,"stargazers_count":78,"open_issues_count":5,"forks_count":12,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-11-02T15:36:31.324Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/TomGrill/gdx-dialogs","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TomGrill.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-11T14:25:31.000Z","updated_at":"2024-05-08T01:50:48.000Z","dependencies_parsed_at":"2022-07-16T07:47:04.825Z","dependency_job_id":null,"html_url":"https://github.com/TomGrill/gdx-dialogs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomGrill%2Fgdx-dialogs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomGrill%2Fgdx-dialogs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomGrill%2Fgdx-dialogs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomGrill%2Fgdx-dialogs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TomGrill","download_url":"https://codeload.github.com/TomGrill/gdx-dialogs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246655534,"owners_count":20812650,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T07:00:32.133Z","updated_at":"2025-04-01T14:33:50.753Z","avatar_url":"https://github.com/TomGrill.png","language":"Java","funding_links":[],"categories":["Resources"],"sub_categories":["User Interface"],"readme":"# gdx-dialogs\r\nlibGDX extension providing cross-platform support for native dialogs\r\n\r\n![Alt text](/assets/dialogs.jpg?raw=true \"Examples\")\r\n\r\n## Updates \u0026 News\r\nFollow me to receive release updates about this and my other projects (Promise: No BS posts)\r\n\r\nhttps://twitter.com/TomGrillGames and https://www.facebook.com/tomgrillgames\r\n\r\nI will also stream sometimes when developing at https://www.twitch.tv/tomgrill and write a blog article from time to time at http://tomgrill.de \r\n\r\n## Version\r\n\r\nCurrent stable: **1.3.0**\r\n(Snapshot versions are no longer provided)\r\n\r\n##Supported Platforms\r\nAndroid, iOS, iOS-MOE, Desktop (kinda)\r\nDesktop show Java UI Dialogs which usually dont fit very well in desktop game. I added Desktop support mainly to make testing while developing easier.\r\n\r\n##Requirements\r\nlibGDX 1.9.3+, Android API 9+, ios 6+, ios-moe 9+\r\n\r\n##Currently available dialog types\r\n1. ButtonDialog: shows a dialog with 1-3 buttons for the user to click.\r\n2. ProgressDialog: Shows dialog with a progress wheel. Not cancelable by the user.\r\n3. TextPrompt: On screen display with text input.\r\n\r\n## Installation\r\n**Core**\r\n\r\nAdd this to your build.gradle core dependencies\r\n```gradle\r\ncompile \"de.tomgrill.gdxdialogs:gdx-dialogs-core:1.3.0\"\r\n```\r\n\r\n**Android**\r\n\r\nAdd this to your build.gradle android dependencies\r\n```gradle\r\ncompile \"de.tomgrill.gdxdialogs:gdx-dialogs-android:1.3.0\"\r\n```\r\n\r\nCopy the [/gdx-dialogs-android/res](/gdx-dialogs-android/res) folder from this project to your android project. Keep the directory structure.\r\n\r\nYou can edit the [/gdx-dialogs-android/res/values-v11/styles.xml](/gdx-dialogs-android/res/values-v11/styles.xml) if you want use another theme like Holo.Light\r\n\r\nIf your project already has styles.xml file make sure you merge what you need from both files.\r\n\r\n**iOS**\r\n\r\nAdd this to your robovm.xml\r\n```xml\r\n\u003cforceLinkClasses\u003e\r\n    ....\r\n    \u003cpattern\u003ede.tomgrill.gdxdialogs.ios.IOSGDXDialogs\u003c/pattern\u003e\r\n\u003c/forceLinkClasses\u003e\r\n```\r\n\r\nAdd this to your build.gradle ios dependencies\r\n```gradle\r\ncompile \"de.tomgrill.gdxdialogs:gdx-dialogs-ios:1.3.0\"\r\n```\r\n\r\n**iOS-MOE**\r\n\r\nAdd this to your build.gradle ios-moe dependencies\r\n```gradle\r\ncompile \"de.tomgrill.gdxdialogs:gdx-dialogs-ios-moe:1.3.0\"\r\n```\r\n\r\n**Desktop**\r\n\r\nAdd this to your build.gradle desktop dependencies\r\n```gradle\r\ncompile \"de.tomgrill.gdxdialogs:gdx-dialogs-desktop:1.3.0\"\r\n```\r\n\r\n**HTML(GWT)**\r\n\r\nAdd this to your build.gradle html dependencies\r\n```gradle\r\ncompile \"de.tomgrill.gdxdialogs:gdx-dialogs-html:1.3.0\"\r\ncompile \"de.tomgrill.gdxdialogs:gdx-dialogs-core:1.3.0:sources\"\r\ncompile \"de.tomgrill.gdxdialogs:gdx-dialogs-html:1.3.0:sources\"\r\n```\r\n\r\nAdd this to your GdxDefinition.gwt.xml\r\n```xml\r\n\u003cinherits name='de.tomgrill.gdxdialogs.html.gdx_dialogs_html' /\u003e\r\n\u003cinherits name=\"de.tomgrill.gdxdialogs.core.gdx_dialogs_core\" /\u003e\r\n```\r\n\r\n\r\n## Usage\r\n\r\n**View the gdx-dialogs sample app**\r\nhttps://github.com/TomGrill/gdx-dialogs-app\r\n\r\n**Enable**\r\n\r\n```\r\nGDXDialogs dialogs = GDXDialogsSystem.install();\r\n```\r\n\r\n**ButtonDialog**\r\n\r\n```java\r\nGDXButtonDialog bDialog = dialogs.newDialog(GDXButtonDialog.class);\r\nbDialog.setTitle(\"Buy a item\");\r\nbDialog.setMessage(\"Do you want to buy the mozarella?\");\r\n\r\nbDialog.setClickListener(new ButtonClickListener() {\r\n\r\n\t@Override\r\n\tpublic void click(int button) {\r\n\t\t// handle button click here\r\n\t}\r\n});\r\n\r\nbDialog.addButton(\"No\");\r\nbDialog.addButton(\"Never\");\r\nbDialog.addButton(\"Yes, nomnom!\");\r\n\r\nbDialog.build().show();\r\n```\r\n\r\n**ProgressDialog**\r\n```java\r\nGDXProgressDialog progressDialog = dialogs.newDialog(GDXProgressDialog.class);\r\n\r\nprogressDialog.setTitle(\"Download\");\r\nprogressDialog.setMessage(\"Loading new level from server...\");\r\n\r\nprogressDialog.build().show();\r\n```\r\n\r\n**TextPrompt**\r\n```java\r\nGDXTextPrompt textPrompt = dialogs.newDialog(GDXTextPrompt.class);\r\n\r\ntextPrompt.setTitle(\"Your name\");\r\ntextPrompt.setMessage(\"Please tell me your name.\");\r\n\r\ntextPrompt.setCancelButtonLabel(\"Cancel\");\r\ntextPrompt.setConfirmButtonLabel(\"Save name\");\r\n\r\ntextPrompt.setTextPromptListener(new TextPromptListener() {\r\n\r\n\t@Override\r\n\tpublic void confirm(String text) {\r\n\t  // do something with the user input\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void cancel() {\r\n\t  // handle input cancel\r\n\t}\r\n});\r\n\r\ntextPrompt.build().show();\r\n```\r\n\r\n**Open GL Context**\r\n\r\nSometimes you want to call a method within one of your listeners which requires OpenGL context from the libgdx main thread. Since all dialogs run in their own thread (without OpenGL context) you have to make sure your method runs in the main thread by wrapping as postRunnable:\r\n\r\n```java\r\ndialog.setClickListener(new ButtonClickListener() {\r\n    @Override\r\n    public void click(int button) {\r\n        Gdx.app.postRunnable(new Runnable() {\r\n            @Override\r\n            public void run() {\r\n                // call the a method which requires OpenGL context.\r\n            }\r\n        });\r\n    }\r\n});\r\n```\r\n\r\n## Create your own dialogs.\r\n\r\nIn case you require are certain dialog (F.e. DatePicker, ProgressBar, ....) which is not supported by gdx-dialogs yet you can write your own dialog.\r\n\r\n1. Create a interface like this (in core project): [GDXButtonDialog](gdx-dialogs-core/src/de/tomgrill/gdxdialogs/core/dialogs/GDXButtonDialog.java)\r\n2. Create the implementation for Android like this (in android project): [AndroidGDXButtonDialog](gdx-dialogs-android/src/de/tomgrill/gdxdialogs/android/dialogs/AndroidGDXButtonDialog.java)\r\n3. Create the implementation for Desktop like this (in desktop project): [DesktopGDXButtonDialog](gdx-dialogs-desktop/src/de/tomgrill/gdxdialogs/desktop/dialogs/DesktopGDXButtonDialog.java)\r\n4. Create the implementation for iOS like this (in ios project): [IOSGDXButtonDialog](gdx-dialogs-ios/src/de/tomgrill/gdxdialogs/ios/dialogs/IOSGDXButtonDialog.java)\r\n5. Create a fallback implementation with empty methods (in core project): [FallbackGDXButtonDialog](gdx-dialogs-core/src/de/tomgrill/gdxdialogs/core/dialogs/FallbackGDXButtonDialog.java)\r\n\r\nIf your dialog is written register it like this:\r\n\r\n```java\r\nif(Gdx.app.getType() == ApplicationType.Android) {\r\n\tdialogs.registerDialog(\"package.for.your.dialog.interface.GDXButtonDialog\", \"package.for.your.dialog.os.specific.implementation.AndroidGDXButtonDialog\");\r\n}\r\n\r\nelse if(Gdx.app.getType() == ApplicationType.Desktop) {\r\n\tdialogs.registerDialog(\"package.for.your.dialog.interface.GDXButtonDialog\", \"package.for.your.dialog.os.specific.implementation.DesktopGDXButtonDialog\");\r\n}\r\n\r\nelse if(Gdx.app.getType() == ApplicationType.iOS) {\r\n\tdialogs.registerDialog(\"package.for.your.dialog.interface.GDXButtonDialog\", \"package.for.your.dialog.os.specific.implementation.IOSGDXButtonDialog\");\r\n}\r\n\r\nelse {\r\n\tdialogs.registerDialog(\"package.for.your.dialog.interface.GDXButtonDialog\", \"package.for.your.dialog.os.specific.implementation.FallbackGDXButtonDialog\");\r\n}\r\n```\r\n\r\nUse your own dialog:\r\n\r\n```java\r\ndialogs.newDialog(GDXButtonDialog.class); // Use your dialog interface here\r\n```\r\n\r\n**Note:** Every platform specific implementation must have constructor even if it is empty. Android implementations must have a contructor accepting Activity parameter.\r\n\r\n**Increase your karma points :) Share your dialog with us, add it to this repository and make a Pull Request.**\r\n\r\n##Release History\r\n\r\nRelease history for major milestones (available via Maven):\r\n\r\n* Version 1.3.0: Bugfix: Submodules had dependency on SNAPSHOT versions\r\n* Version 1.2.5: Bugfix: DesktopTextPrompt;\r\n* Version 1.2.4: Bugfix: DesktopTextPrompt;\r\n* Version 1.2.3: Bugfix: DesktopTextPrompt not showing default value;\r\n* Version 1.2.2: TextPrompt can now be used as a password field. Use setInputType(...);\r\n* Version 1.2.1: TextPrompt dialogs have new setMaxLength() method.\r\n* Version 1.2.0: gwt/html support\r\n* Version 1.1.0: ios-moe support, ios support, Android proguard setup now out of the box\r\n* Version 1.0.0: no changes, just released 0.2.0 as first stable build\r\n* Version 0.2.0: API Changes. You can create own dialogs now.\r\n* Version 0.1.0: Initial Release\r\n\r\n##Reporting Issues\r\n\r\nSomething not working quite as expected? Do you need a feature that has not been implemented yet? Check the issue tracker and add a new one if your problem is not already listed. Please try to provide a detailed description of your problem, including the steps to reproduce it.\r\n\r\n##Contributing\r\n\r\nAwesome! If you would like to contribute with a new feature or a bugfix, fork this repo and submit a pull request.\r\n\r\n##License\r\n\r\nThe gdx-dialogs project is licensed under the Apache 2 License, meaning you can use it free of charge, without strings attached in commercial and non-commercial projects. We love to get (non-mandatory) credit in case you release a game or app using gdx-dialogs!\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTomGrill%2Fgdx-dialogs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTomGrill%2Fgdx-dialogs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTomGrill%2Fgdx-dialogs/lists"}