You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
{"payload":{"issueViewerRoute":{"data":{"repository":{"id":"MDEwOlJlcG9zaXRvcnk4MjM2MDU2","isOwnerEnterpriseManaged":false,"owner":{"__typename":"Organization","userNameDisplayConfiguration":"HANDLE","id":"MDEyOk9yZ2FuaXphdGlvbjgzMzc2ODc="},"issue":{"id":"I_kwDOAH2sGM6FkNQm","number":318,"repository":{"id":"MDEwOlJlcG9zaXRvcnk4MjM2MDU2","databaseId":8236056,"name":"mini2Dx","isArchived":false,"nameWithOwner":"mini2Dx/mini2Dx","viewerCanInteract":false,"viewerInteractionLimitReasonHTML":"","slashCommandsEnabled":false,"visibility":"PUBLIC","viewerCanPush":false,"issueFields":{"totalCount":0},"pinnedIssueFields":{"nodes":[]},"owner":{"__typename":"Organization","login":"mini2Dx","id":"MDEyOk9yZ2FuaXphdGlvbjgzMzc2ODc=","url":"https://github.com/mini2Dx","databaseId":8337687,"planningStatuses":null,"issueFields":{"totalCount":0},"pinnedIssueFields":{"nodes":[]}},"isPrivate":false,"isWritable":true,"isOwnerEnterpriseManaged":false,"viewerCanPinIssues":false,"isCopilotAgentEnabled":null,"issueTypes":{"edges":[{"node":{"id":"IT_kwDOAH85F84ADo1T"}},{"node":{"id":"IT_kwDOAH85F84ADo1X"}},{"node":{"id":"IT_kwDOAH85F84ADo1a"}}]},"viewerIssueCreationPermissions":{"triageable":false},"pinnedIssues":{"totalCount":0}},"viewerCanAssign":false,"viewerCanLabel":false,"viewerCanSetMilestone":false,"viewerCanSetFields":false,"viewerCanType":false,"viewerCanUpdateMetadata":false,"issueType":null,"assignedActors":{"nodes":[]},"labels":{"pageInfo":{"hasNextPage":false,"endCursor":null},"edges":[]},"milestone":null,"issueFieldValues":{"nodes":[]},"projectItems":{"edges":[],"pageInfo":{"endCursor":null,"hasNextPage":false}},"agentAssignments":[],"linkedPullRequests":{"nodes":[]},"closedByPullRequestsReferences":{"nodes":[]},"updatedAt":"2024-04-12T20:40:14Z","title":"Initial value of TextBox does not appear","titleHTML":"Initial value of TextBox does not appear","url":"https://github.com/mini2Dx/mini2Dx/issues/318","totalCommentsCount":0,"viewerCanUpdateNext":false,"viewerCanSetStatus":false,"subIssuesSummary":{"total":0,"completed":0},"state":"OPEN","stateReason":null,"status":null,"duplicateOf":null,"locked":false,"viewerCanComment":false,"databaseId":2240861222,"createdAt":"2024-04-12T20:30:04Z","viewerDidAuthor":false,"author":{"avatarUrl":"https://avatars.githubusercontent.com/u/6833155?v=4","login":"f3rn4nd0-c354r","id":"MDQ6VXNlcjY4MzMxNTU=","profileUrl":"https://github.com/f3rn4nd0-c354r","name":"Fernando César","__typename":"User"},"body":"Hello,\r\n\r\nI'm starting out with Mini2Dx.\r\nI'm creating this UI, where the player has to set some numbers, but I wanted to have a default value. So I set it. But it doesn't appear. It only appears in the TextBox if I insert another character (while the game is running).\r\n\r\n\r\n\r\n\r\nThis is what I'm trying:\r\n\r\n```\r\n // text box\r\n textBox = new TextBox(20, 50, 50, 20);\r\n textBox.setVisibility(Visibility.VISIBLE);\r\n textBox.setValue(\"5\");\r\n```\r\n\r\n\r\n\r\nFull example (this is the only file I changed from a generated game.\r\n\r\n\r\n\r\n**MyMini2DxGame.java**\r\n\r\n```\r\npackage com.mystudio.gamename;\r\n\r\nimport com.badlogic.gdx.Gdx;\r\nimport com.badlogic.gdx.assets.AssetManager;\r\nimport com.badlogic.gdx.assets.loaders.FileHandleResolver;\r\nimport com.badlogic.gdx.assets.loaders.resolvers.ClasspathFileHandleResolver;\r\nimport com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver;\r\nimport com.badlogic.gdx.graphics.Texture;\r\nimport org.mini2Dx.core.assets.FallbackFileHandleResolver;\r\nimport org.mini2Dx.core.game.BasicGame;\r\nimport org.mini2Dx.core.graphics.Graphics;\r\nimport org.mini2Dx.ui.UiContainer;\r\nimport org.mini2Dx.ui.UiThemeLoader;\r\nimport org.mini2Dx.ui.element.TextBox;\r\nimport org.mini2Dx.ui.element.Visibility;\r\nimport org.mini2Dx.ui.style.UiTheme;\r\n\r\npublic class MyMini2DxGame extends BasicGame {\r\n\tpublic static final String GAME_IDENTIFIER = \"com.mystudio.gamename\";\r\n\r\n private AssetManager assetManager;\r\n\tprivate Texture texture;\r\n private UiContainer uiContainer;\r\n private TextBox textBox;\r\n\t@Override\r\n public void initialise() {\r\n // UI\r\n //Create fallback file resolver, so we can use the default mini2Dx-ui theme\r\n FileHandleResolver fileHandleResolver = new FallbackFileHandleResolver(new ClasspathFileHandleResolver(),\r\n new InternalFileHandleResolver());\r\n //Create asset manager for loading resources\r\n assetManager = new AssetManager(fileHandleResolver);\r\n //Add mini2Dx-ui theme loader\r\n assetManager.setLoader(UiTheme.class, new UiThemeLoader(fileHandleResolver));\r\n //Load default theme\r\n assetManager.load(UiTheme.DEFAULT_THEME_FILENAME, UiTheme.class);\r\n uiContainer = new UiContainer(this, assetManager);\r\n Gdx.input.setInputProcessor(uiContainer);\r\n\r\n \ttexture = new Texture(\"mini2Dx.png\");\r\n // text box\r\n textBox = new TextBox(20, 50, 50, 20);\r\n textBox.setVisibility(Visibility.VISIBLE);\r\n textBox.setValue(\"5\");\r\n\r\n uiContainer.add(textBox);\r\n }\r\n \r\n @Override\r\n public void update(float delta) {\r\n // UI\r\n if(!assetManager.update()) {\r\n //Wait for asset manager to finish loading assets\r\n return;\r\n }\r\n if(!UiContainer.isThemeApplied()) {\r\n UiContainer.setTheme(assetManager.get(UiTheme.DEFAULT_THEME_FILENAME, UiTheme.class));\r\n }\r\n uiContainer.update(delta);\r\n }\r\n \r\n @Override\r\n public void interpolate(float alpha) {\r\n uiContainer.interpolate(alpha);\r\n }\r\n \r\n @Override\r\n public void render(Graphics g) {\r\n\t\tg.drawTexture(texture, 0f, 0f);\r\n uiContainer.render(g);\r\n }\r\n}\r\n```\r\n\r\nFull project: \r\n[mini2dxtest.zip](https://github.com/mini2Dx/mini2Dx/files/14963481/mini2dxtest.zip)\r\n\r\n\r\nThanks in advance for any help.\r\n","bodyHTML":"\u003cp dir=\"auto\"\u003eHello,\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eI'm starting out with Mini2Dx.\u003cbr\u003e\nI'm creating this UI, where the player has to set some numbers, but I wanted to have a default value. So I set it. But it doesn't appear. It only appears in the TextBox if I insert another character (while the game is running).\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://private-user-images.githubusercontent.com/6833155/322131731-e217ff50-df17-458c-aaa7-8ad1d0df967b.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTY1MjMzOTksIm5iZiI6MTc5NjUyMzA5OSwicGF0aCI6Ii82ODMzMTU1LzMyMjEzMTczMS1lMjE3ZmY1MC1kZjE3LTQ1OGMtYWFhNy04YWQxZDBkZjk2N2IucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MTIwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjEyMDZUMDIxMTM5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZjlkNzZlYmFiOTUwNzJhMjRhNWFiNDNlYTcyMWEzODk4MGM1YzA0YmI5NmJhNGMwNWQ2NzY0N2Y0NGEwYzI2OCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.2mtUBFn8ip1L-7SIXJsXcKEQoiYBO26-gX-XREF6rXE\"\u003e\u003cimg src=\"https://private-user-images.githubusercontent.com/6833155/322131731-e217ff50-df17-458c-aaa7-8ad1d0df967b.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTY1MjMzOTksIm5iZiI6MTc5NjUyMzA5OSwicGF0aCI6Ii82ODMzMTU1LzMyMjEzMTczMS1lMjE3ZmY1MC1kZjE3LTQ1OGMtYWFhNy04YWQxZDBkZjk2N2IucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MTIwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjEyMDZUMDIxMTM5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZjlkNzZlYmFiOTUwNzJhMjRhNWFiNDNlYTcyMWEzODk4MGM1YzA0YmI5NmJhNGMwNWQ2NzY0N2Y0NGEwYzI2OCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.2mtUBFn8ip1L-7SIXJsXcKEQoiYBO26-gX-XREF6rXE\" alt=\"image\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThis is what I'm trying:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\" // text box\n textBox = new TextBox(20, 50, 50, 20);\n textBox.setVisibility(Visibility.VISIBLE);\n textBox.setValue(\u0026quot;5\u0026quot;);\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode class=\"notranslate\"\u003e // text box\n textBox = new TextBox(20, 50, 50, 20);\n textBox.setVisibility(Visibility.VISIBLE);\n textBox.setValue(\"5\");\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFull example (this is the only file I changed from a generated game.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eMyMini2DxGame.java\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"package com.mystudio.gamename;\n\nimport com.badlogic.gdx.Gdx;\nimport com.badlogic.gdx.assets.AssetManager;\nimport com.badlogic.gdx.assets.loaders.FileHandleResolver;\nimport com.badlogic.gdx.assets.loaders.resolvers.ClasspathFileHandleResolver;\nimport com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver;\nimport com.badlogic.gdx.graphics.Texture;\nimport org.mini2Dx.core.assets.FallbackFileHandleResolver;\nimport org.mini2Dx.core.game.BasicGame;\nimport org.mini2Dx.core.graphics.Graphics;\nimport org.mini2Dx.ui.UiContainer;\nimport org.mini2Dx.ui.UiThemeLoader;\nimport org.mini2Dx.ui.element.TextBox;\nimport org.mini2Dx.ui.element.Visibility;\nimport org.mini2Dx.ui.style.UiTheme;\n\npublic class MyMini2DxGame extends BasicGame {\n\tpublic static final String GAME_IDENTIFIER = \u0026quot;com.mystudio.gamename\u0026quot;;\n\n private AssetManager assetManager;\n\tprivate Texture texture;\n private UiContainer uiContainer;\n private TextBox textBox;\n\t@Override\n public void initialise() {\n // UI\n //Create fallback file resolver, so we can use the default mini2Dx-ui theme\n FileHandleResolver fileHandleResolver = new FallbackFileHandleResolver(new ClasspathFileHandleResolver(),\n new InternalFileHandleResolver());\n //Create asset manager for loading resources\n assetManager = new AssetManager(fileHandleResolver);\n //Add mini2Dx-ui theme loader\n assetManager.setLoader(UiTheme.class, new UiThemeLoader(fileHandleResolver));\n //Load default theme\n assetManager.load(UiTheme.DEFAULT_THEME_FILENAME, UiTheme.class);\n uiContainer = new UiContainer(this, assetManager);\n Gdx.input.setInputProcessor(uiContainer);\n\n \ttexture = new Texture(\u0026quot;mini2Dx.png\u0026quot;);\n // text box\n textBox = new TextBox(20, 50, 50, 20);\n textBox.setVisibility(Visibility.VISIBLE);\n textBox.setValue(\u0026quot;5\u0026quot;);\n\n uiContainer.add(textBox);\n }\n \n @Override\n public void update(float delta) {\n // UI\n if(!assetManager.update()) {\n //Wait for asset manager to finish loading assets\n return;\n }\n if(!UiContainer.isThemeApplied()) {\n UiContainer.setTheme(assetManager.get(UiTheme.DEFAULT_THEME_FILENAME, UiTheme.class));\n }\n uiContainer.update(delta);\n }\n \n @Override\n public void interpolate(float alpha) {\n uiContainer.interpolate(alpha);\n }\n \n @Override\n public void render(Graphics g) {\n\t\tg.drawTexture(texture, 0f, 0f);\n uiContainer.render(g);\n }\n}\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode class=\"notranslate\"\u003epackage com.mystudio.gamename;\n\nimport com.badlogic.gdx.Gdx;\nimport com.badlogic.gdx.assets.AssetManager;\nimport com.badlogic.gdx.assets.loaders.FileHandleResolver;\nimport com.badlogic.gdx.assets.loaders.resolvers.ClasspathFileHandleResolver;\nimport com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver;\nimport com.badlogic.gdx.graphics.Texture;\nimport org.mini2Dx.core.assets.FallbackFileHandleResolver;\nimport org.mini2Dx.core.game.BasicGame;\nimport org.mini2Dx.core.graphics.Graphics;\nimport org.mini2Dx.ui.UiContainer;\nimport org.mini2Dx.ui.UiThemeLoader;\nimport org.mini2Dx.ui.element.TextBox;\nimport org.mini2Dx.ui.element.Visibility;\nimport org.mini2Dx.ui.style.UiTheme;\n\npublic class MyMini2DxGame extends BasicGame {\n\tpublic static final String GAME_IDENTIFIER = \"com.mystudio.gamename\";\n\n private AssetManager assetManager;\n\tprivate Texture texture;\n private UiContainer uiContainer;\n private TextBox textBox;\n\t@Override\n public void initialise() {\n // UI\n //Create fallback file resolver, so we can use the default mini2Dx-ui theme\n FileHandleResolver fileHandleResolver = new FallbackFileHandleResolver(new ClasspathFileHandleResolver(),\n new InternalFileHandleResolver());\n //Create asset manager for loading resources\n assetManager = new AssetManager(fileHandleResolver);\n //Add mini2Dx-ui theme loader\n assetManager.setLoader(UiTheme.class, new UiThemeLoader(fileHandleResolver));\n //Load default theme\n assetManager.load(UiTheme.DEFAULT_THEME_FILENAME, UiTheme.class);\n uiContainer = new UiContainer(this, assetManager);\n Gdx.input.setInputProcessor(uiContainer);\n\n \ttexture = new Texture(\"mini2Dx.png\");\n // text box\n textBox = new TextBox(20, 50, 50, 20);\n textBox.setVisibility(Visibility.VISIBLE);\n textBox.setValue(\"5\");\n\n uiContainer.add(textBox);\n }\n \n @Override\n public void update(float delta) {\n // UI\n if(!assetManager.update()) {\n //Wait for asset manager to finish loading assets\n return;\n }\n if(!UiContainer.isThemeApplied()) {\n UiContainer.setTheme(assetManager.get(UiTheme.DEFAULT_THEME_FILENAME, UiTheme.class));\n }\n uiContainer.update(delta);\n }\n \n @Override\n public void interpolate(float alpha) {\n uiContainer.interpolate(alpha);\n }\n \n @Override\n public void render(Graphics g) {\n\t\tg.drawTexture(texture, 0f, 0f);\n uiContainer.render(g);\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFull project:\u003cbr\u003e\n\u003ca href=\"https://github.com/mini2Dx/mini2Dx/files/14963481/mini2dxtest.zip\"\u003emini2dxtest.zip\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThanks in advance for any help.\u003c/p\u003e","bodyVersion":"afe50000f92c4e3d139f1ec74089361db8b155969f612db78dd2b1e913deecc4","reactionGroups":[{"content":"THUMBS_UP","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"THUMBS_DOWN","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"LAUGH","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"HOORAY","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"CONFUSED","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"HEART","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"ROCKET","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"EYES","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}}],"pinnedIssueComment":null,"__isIssueOrPullRequest":"Issue","isPinned":false,"viewerCanDelete":false,"viewerCanTransfer":false,"viewerCanConvertToDiscussion":false,"viewerCanLock":false,"timelineItems":{"totalCount":0,"beforeFocusCount":0,"afterFocusCount":0,"pageInfo":{"hasNextPage":false,"hasPreviousPage":false,"startCursor":null,"endCursor":null},"edges":[]},"backTimelineItems":{"totalCount":0,"beforeFocusCount":0,"afterFocusCount":0,"pageInfo":{"hasNextPage":false,"hasPreviousPage":false,"startCursor":null,"endCursor":null},"edges":[]},"pendingSuggestions":[]}},"safeViewer":null},"feed":"activity","activityTimeline":{"state":"UNAVAILABLE","canToggle":false},"queryOperation":{"name":"IssueViewerPage","id":"c66d034381cc264d626ac8cf9d35ff1bb35455489c4bdb61288e19b36b767678"}},"issuesLayoutRoute":{"has_projects_enabled":false,"has_labels_archiving_enabled":true,"current_user":null,"current_user_settings":{"preferred_emoji_skin_tone":null,"copilot_show_functionality":false},"sidebar_expanded":true,"pinned_views":[],"pinned_views_enabled":true,"best_match_sort_enabled":false,"issue_types_enabled":true,"issue_search_type":null,"show_issue_field_pills":false,"viewer_can_create_issues":false,"is_writable":false,"repository_id":"MDEwOlJlcG9zaXRvcnk4MjM2MDU2","can_bulk_update":false,"actions":{"new_issue":{"label":"New issue","url":"/mini2Dx/mini2Dx/issues/new","disabled_reason":null}},"compact_mode":false},"repoLayoutRoute":{"js":{"scanning":{"values":["https://github.githubassets.com/assets/scanning-b00af0acf3510233.js"]},"code-menu":{"values":["https://github.githubassets.com/assets/code-menu-58c850e4333353a3.js"]},"codespaces":{"values":["https://github.githubassets.com/assets/codespaces-e4356a9c1993bec6.js"]},"pull-requests":{"values":["https://github.githubassets.com/assets/app-runtime-fe654b95a55f1f96.js","https://github.githubassets.com/assets/primer-react-a8793df31d3bf19f.js","https://github.githubassets.com/assets/react-core-b259702d02974425.js","https://github.githubassets.com/assets/28372-16d49407eddff190.js","https://github.githubassets.com/assets/99405-72767a4e8fd2024d.js","https://github.githubassets.com/assets/34719-1311b9cdfd727258.js","https://github.githubassets.com/assets/68764-3093b2901f4f2896.js","https://github.githubassets.com/assets/35284-6b2d77a43bb3ac65.js","https://github.githubassets.com/assets/6184-c73106e8a98c68a7.js","https://github.githubassets.com/assets/77485-aba082c667f57f30.js","https://github.githubassets.com/assets/47669-43e09d7789eca28f.js","https://github.githubassets.com/assets/95184-46e988ac96e00403.js","https://github.githubassets.com/assets/81650-cad7e383a56a700d.js","https://github.githubassets.com/assets/5517-699eb971ed74942d.js","https://github.githubassets.com/assets/65475-4d313d4477a6e2e6.js","https://github.githubassets.com/assets/98259-dbae220a59956599.js","https://github.githubassets.com/assets/27379-e3609a018a819884.js","https://github.githubassets.com/assets/46782-dce6a612fa5d1ef4.js","https://github.githubassets.com/assets/26732-9636f114f3095070.js","https://github.githubassets.com/assets/1416-5480d76a1a3d4829.js","https://github.githubassets.com/assets/98713-7c849a229024c133.js","https://github.githubassets.com/assets/31170-6d931eeb334866f7.js","https://github.githubassets.com/assets/25005-9af2856f0d44fba4.js","https://github.githubassets.com/assets/4947-d4955ef6ab10267c.js","https://github.githubassets.com/assets/17043-3844c4c668619a55.js","https://github.githubassets.com/assets/15020-87a29233636c76a7.js","https://github.githubassets.com/assets/95223-cc69820b9007936b.js","https://github.githubassets.com/assets/16945-468221b02213e2dd.js","https://github.githubassets.com/assets/42498-e37653ca12cdb197.js","https://github.githubassets.com/assets/34406-7f9bd3df0e80681c.js","https://github.githubassets.com/assets/56287-fa789bac7dd12804.js","https://github.githubassets.com/assets/25706-6cc1c9e6169d9da2.js","https://github.githubassets.com/assets/60380-6d37f93bfd317e69.js","https://github.githubassets.com/assets/22005-b938a96aedd7b7a3.js","https://github.githubassets.com/assets/96314-7f5ac290645fae62.js","https://github.githubassets.com/assets/32087-81963c03d2460fd0.js","https://github.githubassets.com/assets/80614-7b95cfe25cfd916f.js","https://github.githubassets.com/assets/60097-84d11b55187cc95b.js","https://github.githubassets.com/assets/92999-7e7a0349e41f4630.js","https://github.githubassets.com/assets/95275-fc124b38c16dd921.js","https://github.githubassets.com/assets/40434-285b1519a313feb1.js","https://github.githubassets.com/assets/75233-4b6aabd5cd4d0121.js","https://github.githubassets.com/assets/68082-d2ca00d7b736a448.js","https://github.githubassets.com/assets/34207-367a749b938f69f5.js","https://github.githubassets.com/assets/88062-578441d85550f855.js","https://github.githubassets.com/assets/21914-4acec81a9cb9c462.js","https://github.githubassets.com/assets/84715-1a759f25ab523232.js","https://github.githubassets.com/assets/77296-07dbdfbc4488ad2f.js","https://github.githubassets.com/assets/51117-9d458fb2bbd149b7.js","https://github.githubassets.com/assets/72643-60d9f81a09ab2fc5.js","https://github.githubassets.com/assets/48938-788447fa9a14e622.js","https://github.githubassets.com/assets/54491-7cc2be5314825c13.js","https://github.githubassets.com/assets/35498-d1fcde4c26b4d29e.js","https://github.githubassets.com/assets/64854-f046f1d8fb12e591.js","https://github.githubassets.com/assets/65166-f64858366f223346.js","https://github.githubassets.com/assets/27455-573b9336909700f1.js","https://github.githubassets.com/assets/94048-97498366a042e466.js","https://github.githubassets.com/assets/38697-dec3e440a433d0f6.js","https://github.githubassets.com/assets/13982-b2dbfad536f6770c.js","https://github.githubassets.com/assets/35684-1fdf87867f783f0b.js","https://github.githubassets.com/assets/80352-c734109c30a83270.js","https://github.githubassets.com/assets/18468-da81aa31133b0a42.js","https://github.githubassets.com/assets/73097-52b8763a5a1fed12.js","https://github.githubassets.com/assets/18699-a575a5703ebfbab7.js","https://github.githubassets.com/assets/84151-625a43db679ab09d.js","https://github.githubassets.com/assets/59041-d978f40677c4e0a4.js","https://github.githubassets.com/assets/73594-70490966efc3dc3a.js","https://github.githubassets.com/assets/6787-696f233c38d50c02.js","https://github.githubassets.com/assets/77690-c321acb5864fafd4.js","https://github.githubassets.com/assets/46675-61fc5f18ee6dfa37.js","https://github.githubassets.com/assets/83411-21e3db04f21ff7d8.js","https://github.githubassets.com/assets/59166-e0792c06d2c0ef06.js","https://github.githubassets.com/assets/21045-2f1ba70267388d8e.js","https://github.githubassets.com/assets/11208-811dfa4379996974.js","https://github.githubassets.com/assets/2190-0dac0a0972d0c9a7.js","https://github.githubassets.com/assets/86289-950f3826389ea7d8.js","https://github.githubassets.com/assets/59904-da425ce3c98b1f76.js","https://github.githubassets.com/assets/52656-180cf2e4e4e307e1.js","https://github.githubassets.com/assets/57002-014d29f1a18bd124.js","https://github.githubassets.com/assets/38078-36b2ee5ba2349c08.js","https://github.githubassets.com/assets/2986-2d0c08e90fa4c87e.js","https://github.githubassets.com/assets/16666-e3c90f4b34303a13.js","https://github.githubassets.com/assets/35597-b8ba00c5542dc1ce.js","https://github.githubassets.com/assets/24614-1675c5e2b5377047.js","https://github.githubassets.com/assets/95153-d717e954c0396783.js","https://github.githubassets.com/assets/42900-b04f9edb1214bd20.js","https://github.githubassets.com/assets/42045-aee8c6ad3b166b60.js","https://github.githubassets.com/assets/38899-5227b073b97658c8.js","https://github.githubassets.com/assets/40777-4877662fb39ee691.js","https://github.githubassets.com/assets/93960-3595dfe6fcc180d5.js","https://github.githubassets.com/assets/9603-a4aed937f08303b8.js","https://github.githubassets.com/assets/55448-bfb26fd155adde60.js","https://github.githubassets.com/assets/63202-979ceb46224f5479.js","https://github.githubassets.com/assets/82542-8d07bad38865dcc5.js","https://github.githubassets.com/assets/75332-921b33ba45a3f8b9.js","https://github.githubassets.com/assets/27632-f4366f5d3547e36d.js","https://github.githubassets.com/assets/36061-452d7057a81c4187.js","https://github.githubassets.com/assets/14189-9d73fd58643a9d5b.js","https://github.githubassets.com/assets/73528-aa96c926a9825e09.js","https://github.githubassets.com/assets/75075-3580038996dc35fd.js","https://github.githubassets.com/assets/40238-f247a3d60f09a536.js","https://github.githubassets.com/assets/89543-ed1a4ff4fde272e1.js","https://github.githubassets.com/assets/21224-9b478ca9c4ac5b47.js","https://github.githubassets.com/assets/91175-599baa07940eac56.js","https://github.githubassets.com/assets/71807-283f63f7ba9af84a.js","https://github.githubassets.com/assets/27562-0cfbd213933c060b.js","https://github.githubassets.com/assets/73495-025b8dfd4d88db8c.js","https://github.githubassets.com/assets/66389-0daee5899199d848.js","https://github.githubassets.com/assets/57210-b19fa9c273c0d32a.js","https://github.githubassets.com/assets/43200-9a222e34ad0bafb2.js","https://github.githubassets.com/assets/14005-e535d02608055846.js","https://github.githubassets.com/assets/5701-4f8f8d192a60ecf1.js","https://github.githubassets.com/assets/92857-a2efb990d367f1a0.js","https://github.githubassets.com/assets/44622-8f84630d7132f12b.js","https://github.githubassets.com/assets/71875-f3857d1bab0fa40b.js","https://github.githubassets.com/assets/55238-d113e8f42518990b.js","https://github.githubassets.com/assets/458-6d6edbd03f650680.js","https://github.githubassets.com/assets/51238-1d21945497bc43a2.js","https://github.githubassets.com/assets/4000-5195e9a5835363e5.js","https://github.githubassets.com/assets/21458-9ef4c7ddb5780a5e.js","https://github.githubassets.com/assets/29378-240d8e0876b67db3.js","https://github.githubassets.com/assets/19790-c0387d179b5b4cac.js","https://github.githubassets.com/assets/71434-8678fdf7404c5708.js","https://github.githubassets.com/assets/70356-452e6d0ecd6b0098.js","https://github.githubassets.com/assets/41907-fc723c5bbbedd9cc.js","https://github.githubassets.com/assets/40213-b0e83366d943395b.js","https://github.githubassets.com/assets/15761-33254e38679f6932.js","https://github.githubassets.com/assets/90790-8049125ca1ec3490.js","https://github.githubassets.com/assets/87163-ce1ef84e89d89335.js","https://github.githubassets.com/assets/37778-204887e91a0d410f.js","https://github.githubassets.com/assets/2974-76913b641dd94ab6.js","https://github.githubassets.com/assets/4180-a05866fa00a4f787.js","https://github.githubassets.com/assets/47029-dd5295a216d25d13.js","https://github.githubassets.com/assets/pull-requests-27666f7dbdd7e2f0.js"]},"editor":{"values":["https://github.githubassets.com/assets/48326-6fd433aebd78c955.js","https://github.githubassets.com/assets/editor-40fd0f2707d1d65f.js"]},"repositories":{"values":["https://github.githubassets.com/assets/app-runtime-fe654b95a55f1f96.js","https://github.githubassets.com/assets/repositories-bd4a7f91aa68bb31.js"]},"actions":{"values":["https://github.githubassets.com/assets/actions-0bdb6c02464bfc59.js"]},"pull-requests-list":{"values":["https://github.githubassets.com/assets/pull-requests-list-1ead85d45f40a49c.js"]},"diffs":{"values":["https://github.githubassets.com/assets/99430-faf0b06699f8e90d.js","https://github.githubassets.com/assets/diffs-b6aaab94d268fa08.js"]}},"css":{"repositories":{"values":["https://github.githubassets.com/assets/app-runtime.ab82c7019c867706.module.css"]},"copilot-code-review":{"values":["https://github.githubassets.com/assets/copilot-code-review-42b75ef95db82a2c.css"]},"actions":{"values":["https://github.githubassets.com/assets/actions-812c5f76c57dce11.css"]},"pull-requests":{"values":["https://github.githubassets.com/assets/app-runtime.ab82c7019c867706.module.css","https://github.githubassets.com/assets/react-core.10107776413acc8b.module.css","https://github.githubassets.com/assets/75075.f2ea0781c8316695.module.css","https://github.githubassets.com/assets/92857.29f2787b1a266088.module.css","https://github.githubassets.com/assets/71875.ea2738f437501015.module.css","https://github.githubassets.com/assets/21458.9f7758b3754d6b18.module.css","https://github.githubassets.com/assets/41907.00bbb8b5d0c0f635.module.css","https://github.githubassets.com/assets/pull-requests.c0a6f7715065cfa6.module.css","https://github.githubassets.com/assets/pull-requests-496e57b90f37de3f.css"]},"releases":{"values":["https://github.githubassets.com/assets/releases-259c86dec689d9de.css"]},"code":{"values":["https://github.githubassets.com/assets/code-5fc5d14af880ef6c.css"]}}}},"title":"Initial value of TextBox does not appear · Issue #318 · mini2Dx/mini2Dx","appPayload":{"enabled_features":{"issues_bounded_conversation":false,"move_new_comments_ui":false,"cotd_derive_thread_previews":false,"prx_dynamic_split_pref":false,"prx_files":false,"pulls-files-skip-prefer-any-solo-entry":false,"generate_groups_on_files_view":false,"prx_robust_small_screen_support":false,"prs_contextual_comment_controls":true,"ci_analysis_check_runs_ui_enabled":false,"react_data_router_pull_request_files":false,"repo_pulls_dashboard_surface":true,"prs_overview_as_index_route":false,"pull_request_stacks":true,"cotd_ui":true,"pull_request_merge_status_button_opt_out":false,"authentic_contributions_frontend":false}},"meta":{"title":"Initial value of TextBox does not appear · Issue #318 · mini2Dx/mini2Dx","protoRoutes":["repoLayoutRoute"]}}
I'm starting out with Mini2Dx.
I'm creating this UI, where the player has to set some numbers, but I wanted to have a default value. So I set it. But it doesn't appear. It only appears in the TextBox if I insert another character (while the game is running).
This is what I'm trying:
// text box
textBox = new TextBox(20, 50, 50, 20);
textBox.setVisibility(Visibility.VISIBLE);
textBox.setValue("5");
Full example (this is the only file I changed from a generated game.
MyMini2DxGame.java
package com.mystudio.gamename;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.assets.loaders.FileHandleResolver;
import com.badlogic.gdx.assets.loaders.resolvers.ClasspathFileHandleResolver;
import com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver;
import com.badlogic.gdx.graphics.Texture;
import org.mini2Dx.core.assets.FallbackFileHandleResolver;
import org.mini2Dx.core.game.BasicGame;
import org.mini2Dx.core.graphics.Graphics;
import org.mini2Dx.ui.UiContainer;
import org.mini2Dx.ui.UiThemeLoader;
import org.mini2Dx.ui.element.TextBox;
import org.mini2Dx.ui.element.Visibility;
import org.mini2Dx.ui.style.UiTheme;
public class MyMini2DxGame extends BasicGame {
public static final String GAME_IDENTIFIER = "com.mystudio.gamename";
private AssetManager assetManager;
private Texture texture;
private UiContainer uiContainer;
private TextBox textBox;
@Override
public void initialise() {
// UI
//Create fallback file resolver, so we can use the default mini2Dx-ui theme
FileHandleResolver fileHandleResolver = new FallbackFileHandleResolver(new ClasspathFileHandleResolver(),
new InternalFileHandleResolver());
//Create asset manager for loading resources
assetManager = new AssetManager(fileHandleResolver);
//Add mini2Dx-ui theme loader
assetManager.setLoader(UiTheme.class, new UiThemeLoader(fileHandleResolver));
//Load default theme
assetManager.load(UiTheme.DEFAULT_THEME_FILENAME, UiTheme.class);
uiContainer = new UiContainer(this, assetManager);
Gdx.input.setInputProcessor(uiContainer);
texture = new Texture("mini2Dx.png");
// text box
textBox = new TextBox(20, 50, 50, 20);
textBox.setVisibility(Visibility.VISIBLE);
textBox.setValue("5");
uiContainer.add(textBox);
}
@Override
public void update(float delta) {
// UI
if(!assetManager.update()) {
//Wait for asset manager to finish loading assets
return;
}
if(!UiContainer.isThemeApplied()) {
UiContainer.setTheme(assetManager.get(UiTheme.DEFAULT_THEME_FILENAME, UiTheme.class));
}
uiContainer.update(delta);
}
@Override
public void interpolate(float alpha) {
uiContainer.interpolate(alpha);
}
@Override
public void render(Graphics g) {
g.drawTexture(texture, 0f, 0f);
uiContainer.render(g);
}
}
Activity