private void pauseGame() { if (paused) return; paused = true; final Window.WindowStyle pauseWindowStyle = new Window.WindowStyle(); pauseWindowStyle.titleFont = game.getFonts().get("moonhouse64"); pauseWindowStyle.background = new TextureRegionDrawable(new TextureRegion(background)); pauseWindow = new PauseWindow(pauseWindowStyle, game.getFonts().get("moonhouse64"), new Runnable() { @Override public void run() { unpauseGame(); } }, new Runnable() { @Override public void run() { save(); } }, game, uiAssets, button); pauseWindow.setBounds(viewport.getWorldWidth() / 2 - viewport.getWorldWidth() / 3, viewport.getWorldHeight() / 2 - viewport.getWorldHeight() / 3, viewport.getWorldWidth() / 3 * 2, viewport.getWorldHeight() / 3 * 2); stage.addActor(pauseWindow); }
@Override public void doBeforeShow(final Window dialog) { // Too lazy to implement in LML. I'm tired. scoresTable.clear(); final Array<Control> controls = controlsService.getControls(); for (int index = 0; index < controls.size; index++) { final Control control = controls.get(index); if (control.isActive() && control.isHumanControlled()) { final VisLabel name = new VisLabel( localeService.getI18nBundle().get(playerService.getSpriteType(index).name()), VisUI.getSkin().getColor("vis-blue")); scoresTable.add(name).expand().align(Align.left).padRight(5f); scoresTable.add(String.valueOf(box2dService.getPoints(index))).expand().align(Align.right).padLeft(5f) .row(); } } }
@Subscribe @SuppressWarnings("unused") public void takeSnapshot(CommandSnapshot command) { if (ui != null) { List<Window> windows = ui.getWindows(); for (int i = 0; i < windows.size(); i++) { Window window = windows.get(i); if (window instanceof SamplerEditor) { if (window.isVisible()) { SamplerEditor e = ((SamplerEditor) window); String selectedSamplerId = e.getSelectedSamplerId(); if (selectedSamplerId != null) { Editor.post(new CommandSnapshotBySampler(selectedSamplerId, 1, false)); } } } } } }
public LoginActor(Skin skin) { super(skin); login = new Login(); Window loginWindow = new TWindow("", skin, "window2"); Label teacherName = new Label("Lehrer", skin); teachersSelectBox = new SelectBox<String>(skin); TextButton loginButton = new TextButton("Start", skin, "defaultBig"); setPosition(AppMain.WIDTH / 2, 225); loginWindow.add(teacherName).row(); loginWindow.add(teachersSelectBox).width(175).row(); loginWindow.add(loginButton).width(175).height(100).colspan(2).padTop(40); add(loginWindow); loginButton.addListener(new ChangeListener() { public void changed (ChangeEvent event, Actor actor) { AppMain.user.login(teachersSelectBox.getSelected()); } }); }
public GUIContainerItem(String n, Window w, ItemType type, Vector2 vector2, Vector2 vector22, int j, int i, int k, int l) { this.name = n; this.type = type; modal = w; this.modal.setPosition(vector2.x / (float)Vars.getDouble("balancedScreenWidth"), vector2.y / (float)Vars.getDouble("balancedScreenHeight")); this.modal.setHeight(vector22.y / (float)Vars.getDouble("balancedScreenHeight")); this.modal.setWidth(vector22.x / (float)Vars.getDouble("balancedScreenWidth")); modal.defaults().padLeft(i); modal.defaults().padRight(j); modal.defaults().padTop(k); modal.defaults().padBottom(l); modal.defaults().minWidth(10); modal.defaults().minHeight(10); modal.add(new Image(GameManager.getTexture(type.name().toLowerCase(), TypeId.getTypeId(Type.Item)))); modal.setTitle(""); }
public GUIList(String n, Window w, Vector2 vector2, Vector2 vector22, int i, int j, int k, int l) { this.name = n; this.window = w; this.window.setName(n); this.window.setPosition(vector2.x / (float)Vars.getDouble("balancedScreenWidth"), vector2.y / (float)Vars.getDouble("balancedScreenHeight")); this.window.setHeight(vector22.y / (float)Vars.getDouble("balancedScreenHeight")); this.window.setWidth(vector22.x / (float)Vars.getDouble("balancedScreenWidth")); window.defaults().padLeft(i); window.defaults().padRight(j); window.defaults().padTop(k); window.defaults().padBottom(l); window.defaults().minWidth(100); window.defaults().minHeight(30); }
public GUIChatWindow() { this.name = "GenericWindow"; this.window = new Window(this.name, GameManager.getSkin(GameManager.selectedSkin), "window"); this.window.setName(name); this.window.setPosition(0 / (float)Vars.getDouble("balancedScreenWidth"), 0 / (float)Vars.getDouble("balancedScreenHeight")); this.window.setHeight(0 / (float)Vars.getDouble("balancedScreenHeight")); this.window.setWidth(0 / (float)Vars.getDouble("balancedScreenWidth")); window.defaults().padLeft(0); window.defaults().padRight(0); window.defaults().padTop(0); window.defaults().padBottom(0); window.defaults().minWidth(100 / (float)Vars.getDouble("balancedScreenWidth")); window.defaults().minHeight(30 / (float)Vars.getDouble("balancedScreenHeight")); }
public GUIWindow() { this.name = "GenericWindow"; this.window = new Window(this.name, GameManager.getSkin(GameManager.selectedSkin), "window"); this.window.setName(name); this.window.setPosition(0 / (float)Vars.getDouble("balancedScreenWidth"), 0 / (float)Vars.getDouble("balancedScreenHeight")); this.window.setHeight(0 / (float)Vars.getDouble("balancedScreenHeight")); this.window.setWidth(0 / (float)Vars.getDouble("balancedScreenWidth")); window.defaults().padLeft(0); window.defaults().padRight(0); window.defaults().padTop(0); window.defaults().padBottom(0); window.defaults().minWidth(100 / (float)Vars.getDouble("balancedScreenWidth")); window.defaults().minHeight(30 / (float)Vars.getDouble("balancedScreenHeight")); mainTable = new Table(); mainTable.setFillParent(true); mainTable.add(window); mainActor = mainTable; }
public GUIWindow(String n, Window w, Vector2 vector2, Vector2 vector22, int i, int j, int k, int l) { this.name = n; this.window = w; this.window.setName(n); this.window.setPosition(vector2.x / (float)Vars.getDouble("balancedScreenWidth"), vector2.y / (float)Vars.getDouble("balancedScreenHeight")); this.window.setHeight(vector22.y / (float)Vars.getDouble("balancedScreenHeight")); this.window.setWidth(vector22.x / (float)Vars.getDouble("balancedScreenWidth")); window.defaults().padLeft(i); window.defaults().padRight(j); window.defaults().padTop(k); window.defaults().padBottom(l); window.defaults().minWidth(100); window.defaults().minHeight(30); mainActor = w; }
public GUIWindow(String n, Window w, Vector2 vector22, int i, int j, int k, int l) { this.name = n; this.window = w; this.window.setName(n); this.window.setHeight(vector22.y / (float)Vars.getDouble("balancedScreenHeight")); this.window.setWidth(vector22.x / (float)Vars.getDouble("balancedScreenWidth")); window.defaults().padLeft(i); window.defaults().padRight(j); window.defaults().padTop(k); window.defaults().padBottom(l); window.defaults().minWidth(100); window.defaults().minHeight(30); mainTable = new Table(); mainTable.setFillParent(true); mainTable.add(window); mainActor = mainTable; }
private void textWindowDemo() { BitmapFont plotFont = context.getAssetManager().get( PLOT_FONT, BitmapFont.class ); String loremIpsum = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, "; loremIpsum += "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; loremIpsum += "\n\nThis window is draggable."; rootAtlas = context.getAssetManager().get( ROOT_ATLAS, TextureAtlas.class ); TextureRegion plotDlgRegion = rootAtlas.findRegion( "box-text1" ); NinePatchDrawable plotDlgBgDrawable = new NinePatchDrawable( new NinePatch( plotDlgRegion, 20, 20, 35, 20 ) ); Window plotDlg = new Window( "", new Window.WindowStyle( plotFont, new Color( 1f, 1f, 1f, 1f ), plotDlgBgDrawable ) ); plotDlg.setKeepWithinStage( true ); plotDlg.setMovable( true ); plotDlg.setSize( 200, 250 ); plotDlg.setPosition( 765, 60 ); plotDlg.row().top().expand().fill(); Label plotLbl = new Label( loremIpsum, new Label.LabelStyle( plotFont, new Color( 1f, 1f, 1f, 1f ) ) ); plotLbl.setAlignment( Align.top|Align.left, Align.center|Align.left ); plotLbl.setWrap( true ); plotDlg.add( plotLbl ); // setKeepWithinStage() only applies if added to the stage root. :/ popupStage.addActor( plotDlg ); }
public static Window createWindowDebug(ResourcesManager resourcesManager){ BitmapFont font = (BitmapFont) resourcesManager.get(resourcesManager.DEBUG_FONT); font.setScale(1 / 150F); font.setUseIntegerPositions(false); Window.WindowStyle style = new Window.WindowStyle(); //style.background = background; style.titleFont = font; style.titleFontColor=new Color(1, 1, 1, 0.4f); Sprite background = new Sprite((Texture) resourcesManager.get(resourcesManager.DEBUG_BACKGROUND)); background.setSize(10,8); background.setOrigin(background.getWidth() / 2, background.getHeight() / 2); background.setColor(1,1,1,0.4f); style.background= new SpriteDrawable(background); Window window = new DebugWindow("", style); window.setPosition(0, 0); window.setKeepWithinStage(false); window.setTransform(false); window.setFillParent(true); Label.LabelStyle labelStyle= new Label.LabelStyle(font,new Color(1, 1, 1, 1)) ; myLabel= new Label("",labelStyle); window.add(myLabel).pad(0.2f).width(8); return window; }
private Window.WindowStyle createWindowStyle() { Window.WindowStyle style = new Window.WindowStyle(); style.background = new TextureRegionDrawable(new TextureRegion(backgroundTexture)); style.titleFont = titleFont; style.titleFontColor = modalDialogDescriptor.getTitleFontColor(); style.stageBackground = new TextureRegionDrawable(new TextureRegion(stageBackgroundTexture)); return style; }
public UIManager(String title, Skin skin,IGameService service) { super(); mainMenu = new Window(title, skin); addActor(mainMenu); this.components = getRoot(); this.batch = getSpriteBatch(); this.service = service; }
@Override public void onUpdate(final Window window, final Table table) { if (AllCameras == null && BlueIrisViewer.images != null) { AllCameras = BlueIrisViewer.images.GetCameraNamesStringArray(); if (AllCameras != null) listAllCams.setItems(AllCameras); } }
@Override protected void onUpdate(final Window window, final Table table) { IntRectangle currentPosition = BlueIrisViewer.windowHelper.GetWindowRectangle(); if (currentPosition.x != previousPosition.x) txtWindowX.setText(String.valueOf(currentPosition.x)); if (currentPosition.y != previousPosition.y) txtWindowY.setText(String.valueOf(currentPosition.y)); if (currentPosition.width != previousPosition.width) txtWindowW.setText(String.valueOf(currentPosition.width)); if (currentPosition.height != previousPosition.height) txtWindowH.setText(String.valueOf(currentPosition.height)); previousPosition = currentPosition; }
public UIElement(Skin skin) { UI.uiElements.add(this); parent = new Table(); parent.setFillParent(true); window = new Window("Unnamed Window", skin); window.setModal(BlueIrisViewer.bivSettings.modalUI); table = new Table(skin); window.add(table); hide(); parent.add(window); onCreate(skin, window, table); }
private void addWindow(Table table, Element element) { Gdx.app.log("JXmlUi", "addWindow"); String title = element.get("title", ""); Table newTable = new Window(title, skin); Cell<Table> cell = table.add(newTable); ObjectMap<String, String> atrributes = element.getAttributes(); if (atrributes == null) { atrributes = new ObjectMap<String, String>(); } cellPrepare(cell, atrributes); addChildrens(element, newTable); }
@Override public void doBeforeShow(final Window dialog) { final Array<Control> controls = service.getControls(); for (int index = 0; index < Configuration.PLAYERS_AMOUNT; index++) { refreshPlayerView(index, controls.get(index)); refreshPlayerSprite(index); } }
@Override public void doBeforeShow(final Window dialog) { attachListeners(); setCurrentControls(); changeView(); updateAction.reset(); mockUpEntity.setColor(Color.WHITE); mockUpEntity.addAction(Actions.forever(updateAction)); }
/** * Returns true if any modal dialog is currently open. This includes * the message, confirmation, target selection and progress dialogs. * @return */ public static boolean isAnyModalOpen() { for (Actor actor : stage.getActors()) { if (actor.isVisible() && actor instanceof Window) { if (((Window)actor).isModal()) { return true; } } } return false; }
public ErrorScreen(String errorMessage, String optionalButtonText) { this.skin = new SkinWithTrueTypeFonts(Gdx.files.internal(ModuleSelectionScreen.SKIN_PATH)); TextButton exitButton = new TextButton("Exit", skin); exitButton.addListener(new EventListener() { @Override public boolean handle(Event event) { if (event instanceof ChangeEvent) { dispose(); Gdx.app.exit(); } return false; } }); Window window = new Window("Error", skin); window.pad(30, 10, 10, 10); window.setModal(true); window.setMovable(false); window.add(new Label(errorMessage, skin)).padBottom(20).padTop(10); window.row(); Table buttonsTable = new Table(); if (optionalButtonText != null) { optionalButton = new TextButton(optionalButtonText, skin); buttonsTable.add(optionalButton).fill().minWidth(100).height(40).padRight(30); } buttonsTable.add(exitButton).fill().minWidth(100).height(40); window.add(buttonsTable).center(); window.pack(); stage.addActor(window); WindowPosition.CENTER.position(window); }
@Subscribe public void limitWindowSizes(CommandLimitWindowSizes command) { for (Window window : windowList) { if (window.getHeight() > cfg.height) { window.setHeight(cfg.height - (PADDING_TOP)); } } topMenu.toFront(); }
public List<Settings.WindowSetting> createWindowSettings() { List<Settings.WindowSetting> windowSettings = new ArrayList<Settings.WindowSetting>(); for (Window window : windowList) { Settings.WindowSetting s = new Settings.WindowSetting(); s.name = window.getClass().getSimpleName(); s.x = (int) window.getX(); s.y = (int) window.getY(); s.visible = window.isVisible(); windowSettings.add(s); } return windowSettings; }
public void addHideWindowEffect(final Window window, final int swooshToX, final int swooshToY) { addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { window.setModal(false); window.addAction( Actions.sequence(Actions.fadeOut(.4f), Actions.moveTo(swooshToX, swooshToY))); } }); }
/** Creates instance of the managed dialog actor. */ public void prepareDialogInstance() { final LmlParser parser = interfaceService.getParser(); if (actionContainer != null) { parser.getData().addActionContainer(getId(), actionContainer); } dialog = (Window) parser.createView(wrappedObject, Gdx.files.internal(dialogData.value())).first(); if (actionContainer != null) { parser.getData().removeActionContainer(getId()); } }
@Override public void create () { spriteBatch = new SpriteBatch(); font = new BitmapFont(Gdx.files.internal("data/verdana39.fnt"), false); multiPageFont = new BitmapFont(Gdx.files.internal("data/multipagefont.fnt")); // Add user defined color Colors.put("PERU", Color.valueOf("CD853F")); renderer = new ShapeRenderer(); renderer.setProjectionMatrix(spriteBatch.getProjectionMatrix()); stage = new Stage(); Skin skin = new Skin(Gdx.files.internal("data/uiskin.json")); BitmapFont labelFont = skin.get("default-font", BitmapFont.class); labelFont.setMarkupEnabled(true); // Notice that the last [] has been deliberately added to test the effect of excessive pop operations. // They are silently ignored, as expected. Label label = new Label("<<[BLUE]M[RED]u[YELLOW]l[GREEN]t[OLIVE]ic[]o[]l[]o[]r[]*[MAROON]Label[][]>>", skin); label.setPosition(200, 200); stage.addActor(label); Window window = new Window("[RED]Multicolor[GREEN] Title", skin); window.setPosition(400, 200); window.pack(); stage.addActor(window); }
private VisTextField findNextTextField (Array<Actor> actors, VisTextField best, Vector2 bestCoords, Vector2 currentCoords, boolean up) { Window modalWindow = findModalWindow(this); for (int i = 0, n = actors.size; i < n; i++) { Actor actor = actors.get(i); if (actor == this) continue; if (actor instanceof VisTextField) { VisTextField textField = (VisTextField) actor; if (modalWindow != null) { Window nextFieldModalWindow = findModalWindow(textField); if (nextFieldModalWindow != modalWindow) continue; } if (textField.isDisabled() || !textField.focusTraversal || isActorVisibleInStage(textField) == false) continue; Vector2 actorCoords = actor.getParent().localToStageCoordinates(tmp3.set(actor.getX(), actor.getY())); if ((actorCoords.y < currentCoords.y || (actorCoords.y == currentCoords.y && actorCoords.x > currentCoords.x)) ^ up) { if (best == null || (actorCoords.y > bestCoords.y || (actorCoords.y == bestCoords.y && actorCoords.x < bestCoords.x)) ^ up) { best = (VisTextField) actor; bestCoords.set(actorCoords); } } } else if (actor instanceof Group) best = findNextTextField(((Group) actor).getChildren(), best, bestCoords, currentCoords, up); } return best; }
private void actorAdded (Actor actor) { if (actor instanceof Window) { Window window = (Window) actor; if (window.isModal()) modalWindows.add(window); } }
private void actorRemoved (Actor actor) { if (actor instanceof Window) { Window window = (Window) actor; if (window.isModal()) modalWindows.removeValue(window, true); } }
public static void fillContainer(GUIContainer guiContainer, String containerArrayName) { ContainerInfo container = getContainer(containerArrayName); GUIContainerItem i; for (Item item : container.items.values()) { i = new GUIContainerItem(item.caption + "_slot", new Window( item.caption + "_slot", GameManager.getSkin(GameManager.selectedSkin), "window"), item.itemType, new Vector2(), new Vector2(), 0, 0, 0, 0); guiContainer.addChild(i); } }
public GUIContainer() { this.name = "GenericContainer"; type = ContainerType.Bag; modal = new Window(this.name, GameManager.getSkin(GameManager.selectedSkin), "window"); }
public GUIList() { this.name = "GenericGUIList"; this.window = new Window(this.name, GameManager.getSkin(GameManager.selectedSkin), "window"); this.window.setName(name); this.window.setPosition(0 / (float)Vars.getDouble("balancedScreenWidth"), 0 / (float)Vars.getDouble("balancedScreenHeight")); this.window.setHeight(0 / (float)Vars.getDouble("balancedScreenHeight")); this.window.setWidth(0 / (float)Vars.getDouble("balancedScreenWidth")); window.defaults().padLeft(0); window.defaults().padRight(0); window.defaults().padTop(0); window.defaults().padBottom(0); window.defaults().minWidth(100 / (float)Vars.getDouble("balancedScreenWidth")); window.defaults().minHeight(30 / (float)Vars.getDouble("balancedScreenHeight")); table = new Table(); table.defaults().padLeft(0); table.defaults().padRight(0); table.defaults().padTop(0); table.defaults().padBottom(0); table.setFillParent(true); table.setWidth(100); table.setHeight(30); table.left(); table.bottom(); scroll = new ScrollPane(table); scroll.setScrollBarPositions(false, true); scroll.setScrollingDisabled(true, true); scroll.setScrollbarsOnTop(true); scroll.setFadeScrollBars(false); scroll.setFillParent(true); scroll.setSmoothScrolling(false); scroll.setWidth(90); scroll.setHeight(30); window.add(scroll).fill(); }
public LoadingScreenGUI(Stage s) { super(s, "loading_screen"); ChangeListener el = new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { if (canDisturb) { Hide(); } } }; table = new Table(); table.setFillParent(true); Window w = new Window("Loading", GameManager.getSkin(GameManager.selectedSkin), "window"); label = new GUILabel("", new Label("", GameManager.getSkin(GameManager.selectedSkin), "label"), "", 25); GUIButton disturb = new GUIButton("X", new TextButton("X", GameManager.getSkin(GameManager.selectedSkin), "button"), el); window = new GUIWindow("Loading", w, new Vector2(400, 400), new Vector2(700, 700), 15, 0, 0, 0); window.AddControl(label); window.AddControl(disturb); table.add(window.getElementAsActor()); register(window.getElementAsActor()); }
public StatusGUI(Stage s, String name) { super(s, name); Window w = new Window("Status", GameManager.getSkin(GameManager.selectedSkin), "window"); GUILabel hp = new GUILabel("HP:", new Label("HP:", GameManager.getSkin(GameManager.selectedSkin), "label"), "hits_value", 25); GUILabel mana = new GUILabel("MANA:", new Label("MANA:", GameManager.getSkin(GameManager.selectedSkin), "label"), "mana_value", 25); GUILabel inte = new GUILabel("INT:", new Label("INT::", GameManager.getSkin(GameManager.selectedSkin), "label"), "int_value", 25); GUILabel str = new GUILabel("STR:", new Label("STR:", GameManager.getSkin(GameManager.selectedSkin), "label"), "stringth_value", 25); GUILabel dex = new GUILabel("DEX:", new Label("DEX:", GameManager.getSkin(GameManager.selectedSkin), "label"), "dexterity_value", 25); window = new GUIWindow("Status", w, new Vector2(10, 10), new Vector2( 150, 50), 15, 0, 0, 0); window.AddControl(hp); window.AddControl(mana); window.AddControl(inte); window.AddControl(str); window.AddControl(dex); actors.add(window); actors.add(hp); actors.add(mana); actors.add(inte); actors.add(str); actors.add(dex); MainScreen.currentStage.addActor(window.getElementAsActor()); window.Show(); }
/** * Initializes this MenuScreen's table with all necessary elements. */ protected void initialize() { window = new Window(title, skin); window.setSize(Display.getPreferredWidth(), Display.getPreferredHeight()); window.setPosition(0, 0); if (background != null) window.setBackground(background); stage.addActor(window); }
private void initMenuComponents(Stage stage) { descWindow = new Window("", Game.assets.getSkin()); int w = 320; descWindow.setWidth(w); descWindow.setHeight(100); descWindow.setPosition((Gdx.graphics.getWidth() - w) / 2, 50); descWindow.setMovable(false); stage.addActor(descWindow); }
private void initStatusWindow() { statusWindow = new Window("Blobs Status", getDefaultSkin()); int margin = 50; int w = 300; statusWindow.setWidth(w); statusWindow.setMovable(false); stage.addActor(statusWindow); // Display blobs for (Blob b : game.player.blobs) { Table blobTable = new Table(getDefaultSkin()); blobTable.setColor(0.5f, 0.3f, 0.8f, 0.7f); addStat("Name", b.name, blobTable); addStat("Age", String.valueOf(b.age), blobTable); addStat("Life", b.getAttributeCurrent(Attributes.HP) + "/" + b.getAttributeBase(Attributes.HP), blobTable); blobTable.setWidth(w - 2 * margin); statusWindow.add(blobTable); statusWindow.add("").expandX(); statusWindow.row(); statusWindow.add("").height(50); statusWindow.row(); } statusWindow.setHeight(120 * game.player.blobs.size()); statusWindow.add("").expandY(); statusWindow.setPosition(margin, Gdx.graphics.getHeight() - margin - statusWindow.getHeight()); }
public Window getMainMenu() { return mainMenu; }