List of usage examples for com.badlogic.gdx.graphics Color Color
public Color(Color color)
From source file:org.anism.lotw.LOTW.java
License:Open Source License
public Goody addDumbGoody(Stage src, Color color, float cx, float cy) { Goody g = new Goody(G, cx, cy, new Color(color)); src.addActor(g);//from ww w . jav a2s . com return g; }
From source file:org.anism.lotw.LOTW.java
License:Open Source License
public void initEverything() { Color fullAnti = new Color(G.getAntiColor()); fullAnti.a = 1;//w w w . j ava 2s . c om Texture upTexture = new Texture(Gdx.files.internal("images/grey_button_up.png")); Texture downTexture = new Texture(Gdx.files.internal("images/grey_button_down.png")); NinePatch buttonPatchUp = new NinePatch(upTexture, 11, 11, 11, 11); NinePatch buttonPatchDown = new NinePatch(downTexture, 11, 11, 11, 11); NinePatchDrawable npdUp = new NinePatchDrawable(buttonPatchUp); NinePatchDrawable npdDown = new NinePatchDrawable(buttonPatchDown); textButtonStyle = new TextButton.TextButtonStyle(npdUp, npdDown, npdUp, G.roboto16); textButtonStyle.fontColor = new Color(G.getAntiColor()); textButtonStyle.fontColor.a = 1; buttonStyle = new ButtonStyle(npdUp, npdDown, npdUp); labelStyle = new Label.LabelStyle(G.roboto24, G.getAntiColor()); labelStyleSmall = new Label.LabelStyle(G.roboto16, G.getAntiColor()); resumeButton = addIconButton(game, G.playIcon, new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { if (!G.pausing) { G.pause(); } } }, buttonWidth / dpi / 2 + 4 * dpi, -48, buttonWidth / dpi, 88); resumeButton.setColor(G.colors.green); exitButton = addIconButton(game, G.backIcon, new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { if (!G.pausing) { G.gameOver(); } } }, -buttonWidth / dpi / 2 - 4 * dpi, -48, buttonWidth / dpi, 88); exitButton.setColor(G.colors.red); togglePauseButtons(); //intro.addActor(logo); //putLogo(settings); putLogo(instructions); //putLogo(statistics); /* // intro screen: addButton(intro, game, "Start Game", 0, 0, 200f, 40f); addButton(intro, settings, "Settings", 0, -70, 100f, 40f); addButton(intro, instructions, "How to Play", 0, -120, 100f, 40f); */ // settings screen: ImageTextButton.ImageTextButtonStyle lbs = new ImageTextButton.ImageTextButtonStyle(textButtonStyle); TextureRegionDrawable gamepadDrawable = new TextureRegionDrawable(new TextureRegion(G.controllerIcon)); lbs.imageChecked = gamepadDrawable; lbs.imageCheckedOver = gamepadDrawable; lbs.imageDisabled = gamepadDrawable; lbs.imageDown = gamepadDrawable; lbs.imageOver = gamepadDrawable; lbs.imageUp = gamepadDrawable; logButton = new ImageTextButton("Sign In", lbs); if (actionResolver.getSignedInGPGS()) { logButton.setText("Sign Out"); } logButton.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { if (actionResolver.getSignedInGPGS()) { actionResolver.logoutGPGS(); } else { actionResolver.loginGPGS(); } G.toggleAutologin(); } }); logButton.setWidth(184 * dpi); logButton.setHeight(88 * dpi); logButton.setColor(G.colors.grey); logButton.getImage().setColor(fullAnti); //settings.addActor(logButton); TextureRegionDrawable cbOn = new TextureRegionDrawable(new TextureRegion(G.dashIcon)); TextureRegionDrawable cbOff = new TextureRegionDrawable(new TextureRegion(G.circleIcon)); CheckBoxStyle cbs = new CheckBoxStyle(cbOff, cbOn, G.roboto16, fullAnti); cbs.checked = npdUp; cbs.checkedOver = npdUp; cbs.down = npdDown; cbs.over = npdUp; cbs.up = npdUp; // colorblind settings: CheckBox colorButton = new CheckBox("", cbs); colorButton.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.toggleColorblind(); } }); colorButton.setWidth(88 * dpi); colorButton.setHeight(88 * dpi); /* colorButton.setPosition(G.width/2 - 188 * dpi, G.height/2 + 100*dpi); */ Table colorTable = makeSettingsTable("Display"); colorButton.setColor(Math.random() > 0.5 ? G.colors.green : G.colors.red); colorButton.getImage().setColor(fullAnti); colorButton.setChecked(G.settings.colorblind); ListStyle listStyle = new ListStyle(G.roboto16, G.getAntiColor(), G.getAntiColor(), npdDown); listStyle.background = npdUp; SelectBoxStyle sbs = new SelectBoxStyle(G.roboto16, new Color(0x00000000), npdUp, new ScrollPane.ScrollPaneStyle(), listStyle); final SelectBox<Season> seasonPicker = new SelectBox(sbs); seasonPicker.setItems((Season[]) G.settings.getUnlockedSeasons()); if (G.settings.unlock) { seasonPicker.setSelected(G.settings.unlockSeason); } else { seasonPicker.setSelected(G.settings.getSeason()); } seasonPicker.setColor(G.colors.grey); seasonPicker.getList().setColor(G.colors.grey); Stack seasonStack = new Stack(); final Container seasonImage = new Container(new Image(seasonPicker.getSelected().getIcon())); seasonImage.setSize(32, 32); seasonImage.setTouchable(Touchable.disabled); seasonImage.getActor().setColor(G.getAntiColor()); seasonStack.add(seasonPicker); seasonStack.add(seasonImage); seasonPicker.addListener(new ChangeListener() { @Override public void changed(ChangeEvent e, Actor a) { Season s = seasonPicker.getSelected(); if (s.getName().toUpperCase().equals("UNLOCK")) { G.glider.score = 0; G.settings.unlock = true; G.settings.setSeason(G.settings.getSeasons()[0]); G.updateBgColor(); G.lotw.resetEverything(); } else { G.settings.unlock = false; G.changeSeason(s); } } }); putSettingsButton(colorTable, seasonStack, "Season."); CheckBox ninjaButton = new CheckBox("", cbs); ninjaButton.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.toggleNinja(); } }); ninjaButton.setColor(G.colors.grey); ninjaButton.getImage().setColor(fullAnti); ninjaButton.setChecked(G.settings.ninjaMode); putSettingsButton(colorTable, colorButton, "Add markings to distinguish red and green orbs."); putSettingsButton(colorTable, ninjaButton, "Ninja mode."); // advanced settings: CheckBox bottomButton = new CheckBox("", cbs); bottomButton.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.toggleBottomOut(); } }); bottomButton.setChecked(G.settings.bottomOut); bottomButton.setColor(G.colors.grey); bottomButton.getImage().setColor(fullAnti); Table bottomTable = makeSettingsTable("Advanced"); putSettingsButton(bottomTable, bottomButton, "The glider respawns if it falls too far. Experienced players may wish to turn this off."); ImageButton statsButton = addIconButton(null, G.image("icons/stats.png"), new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { seeStats(); } }, 96, -48, 88, 88); statsButton.setColor(G.colors.grey); putSettingsButton(bottomTable, statsButton, "View aggregate and record statistics."); ImageButton aboutButton = addIconButton(null, G.infoIcon, new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { setStage(about); } }, 0, 0, 0, 0); aboutButton.setColor(G.colors.grey); putSettingsButton(bottomTable, aboutButton, "About."); // online settings: ImageButton leaderButton = addIconButton(null, G.leaderIcon, new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { actionResolver.getLeaderboardGPGS(G.constants.scoreBoard); } }, 48, -G.height / 2 / dpi + 48, 88, 88); leaderButton.setColor(G.colors.gold); ImageButton achieveButton = addIconButton(null, G.achieveIcon, new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { actionResolver.getAchievementsGPGS(); } }, -48, -G.height / 2 / dpi + 48, 88, 88); achieveButton.setColor(G.colors.blue); Table loginTable = makeSettingsTable("Online"); putSettingsButton(loginTable, achieveButton, "View achievements."); putSettingsButton(loginTable, leaderButton, "Access leaderboards."); loginTable.add(logButton).width(182 * dpi).pad(4 * dpi).colspan(2).center(); // control settings: Table controlTable = makeSettingsTable("Controls"); CheckBox twoTouchControls = new CheckBox("", cbs); twoTouchControls.setColor(G.colors.grey); twoTouchControls.getImage().setColor(fullAnti); twoTouchControls.setChecked(G.settings.twoTouch()); twoTouchControls.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.settings.setControl("TWO_TOUCH"); } }); CheckBox tiltControls = new CheckBox("", cbs); tiltControls.setColor(G.colors.grey); tiltControls.getImage().setColor(fullAnti); tiltControls.setChecked(G.settings.tilt()); tiltControls.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.settings.setControl("TILT"); } }); CheckBox dragControls = new CheckBox("", cbs); dragControls.setColor(G.colors.grey); dragControls.getImage().setColor(fullAnti); dragControls.setChecked(G.settings.oneTouch()); dragControls.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.settings.setControl("ONE_TOUCH"); } }); ButtonGroup controlGroup = new ButtonGroup(twoTouchControls, tiltControls, dragControls); controlGroup.setMaxCheckCount(1); controlGroup.setMinCheckCount(1); controlGroup.setUncheckLast(true); putSettingsButton(controlTable, twoTouchControls, "Touch on the left or right."); putSettingsButton(controlTable, tiltControls, "Tilt your device."); putSettingsButton(controlTable, dragControls, "Touch and drag."); // mode settings: Table modeTable = makeSettingsTable("Mode"); CheckBox hellMode = new CheckBox("", cbs); hellMode.setColor(G.colors.red); hellMode.getImage().setColor(fullAnti); hellMode.setChecked(G.settings.hell()); hellMode.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.settings.setMode(-1); } }); CheckBox normalMode = new CheckBox("", cbs); normalMode.setColor(G.colors.grey); normalMode.getImage().setColor(fullAnti); normalMode.setChecked(G.settings.normal()); normalMode.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.settings.setMode(0); } }); ButtonGroup modeGroup = new ButtonGroup(hellMode, normalMode); modeGroup.setMaxCheckCount(1); modeGroup.setMinCheckCount(1); modeGroup.setUncheckLast(true); putSettingsButton(modeTable, normalMode, "Normal mode: catch orbs for points."); putSettingsButton(modeTable, hellMode, "Hell mode: dodge red orbs."); putActionBar(settings); putActionBar(colorSettings); putActionBar(controlSettings); putActionBar(modeSettings); putActionBar(loginSettings); putActionBar(bottomSettings); putSettingsMenu(settings); putSettingsMenu(colorSettings); colorSettings.addActor(colorTable); putSettingsMenu(controlSettings); controlSettings.addActor(controlTable); putSettingsMenu(loginSettings); loginSettings.addActor(loginTable); putSettingsMenu(modeSettings); modeSettings.addActor(modeTable); putSettingsMenu(bottomSettings); bottomSettings.addActor(bottomTable); Table aboutTable = new Table(); aboutTable.setSize(G.width, G.height - 88 * dpi); aboutTable.setPosition(0, 88 * dpi); aboutTable.add(new Label("About", labelStyle)); aboutTable.row(); Label aboutTextLabel = new Label( "Leaf on the Wind copyright 2014 Ethan Goldberg, all rights reserved.\n\nIcons made by Google and licensed under CC BY 4.0.\n\n\nThank you for playing!", labelStyleSmall); aboutTextLabel.setWrap(true); aboutTextLabel.setAlignment(Align.center, Align.center); aboutTable.add(aboutTextLabel).width(G.width / 2); ImageButton aboutBackButton = addIconButton(about, G.backIcon, new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { setStage(bottomSettings); } }, 0, -G.height / 2 / dpi + 48, buttonWidth / dpi, 88); aboutBackButton.setColor(G.colors.red); about.addActor(aboutTable); about.addActor(aboutBackButton); // instructions: //delay float d = 0f; addLabel(instructions, "This is your glider.", 0, G.height / 2 / dpi - 96, 8, tr) .addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); // wait two seconds: d += 2.5; addLabel(instructions, "Touch the screen", 0, G.height / 2 / dpi - 136, 8, tr) .addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); d += 1; addLabel(instructions, "on the left,", -G.width / 4 / dpi, G.height / 2 / dpi - 166, 8, tr) .addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); d += 1.5; addLabel(instructions, "or the right.", G.width / 4 / dpi, G.height / 2 / dpi - 166, 8, tr) .addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); d += 3; int pickUpOffset = G.size * 2; addLabel(instructions, "Catch these,", -G.width / 4 / dpi, -G.height / 6 / dpi, G.size * 2 / dpi, tr) .addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); Goody i; d += 1.5; Color r = new Color(G.colors.goodyRed); r.a = 0; Color gr = new Color(G.colors.goodyGreen); gr.a = 0; Color go = new Color(G.colors.goodyGold); go.a = 0; Color b = new Color(G.colors.goodyBlue); b.a = 0; i = addDumbGoody(instructions, b, -G.width / 4 / dpi - (G.size * 2) / dpi, -G.height / 6 / dpi + pickUpOffset); i.addAction(Actions.delay(d, Actions.alpha(1))); //bounce(i, 0, 8, 0.33f, 8); bounce(i, 0, 8, 0.33f, 4); d += .5; i = addDumbGoody(instructions, gr, -G.width / 4 / dpi, -G.height / 6 / dpi + pickUpOffset); i.addAction(Actions.delay(d, Actions.alpha(1))); //bounce(i, 0.25f, 8, 0.33f, 8); bounce(i, 0.25f, 8, 0.33f, 4); d += .5; i = addDumbGoody(instructions, go, -G.width / 4 / dpi + (G.size * 2) / dpi, -G.height / 6 / dpi + pickUpOffset); i.addAction(Actions.delay(d, Actions.alpha(1))); //bounce(i, 0.5f, 8, 0.33f, 8); bounce(i, 0.5f, 8, 0.33f, 4); d += 1.5; addLabel(instructions, "not these.", G.width / 4 / dpi, -G.height / 6 / dpi, G.size * 2 / dpi, tr) .addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); d += 2; i = addDumbBaddy(instructions, r, G.width / 4 / dpi, -G.height / 6 / dpi + pickUpOffset); i.addAction(Actions.delay(d, Actions.alpha(1))); //bounce(i, 0.75f, 8, 0.33f, 8); bounce(i, 0.75f, 8, 0.33f, 4); d += 2; addIconButton(instructions, G.playIcon, new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { setStage(game); } }, G.width / 2 / dpi - buttonWidth / dpi / 2 - 4, -G.height / 2 / dpi + 48, buttonWidth / dpi, 88) .setColor(G.colors.green); addIconButton(instructions, G.image("icons/settings.png"), new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { setStage(settings); } }, -G.width / 2 / dpi + buttonWidth / 2 / dpi + 4, -G.height / 2 / dpi + 48, buttonWidth / dpi, 88) .setColor(G.colors.grey); d += 2; Color c = new Color(G.getAntiColor()); c.a = 0; addImage(instructions, G.playWrite, c, G.width / 2 / dpi - 3 * buttonWidth / 2 / dpi - 8, -G.height / 2 / dpi + 48, buttonWidth / 2 / dpi, 48) .addAction(Actions.delay(d, Actions .forever(Actions.sequence(Actions.fadeOut(fadeDur), Actions.fadeIn(fadeDur))))); /* TextButton b1 = addButton(instructions, game, "Start", 0, -G.height/2/dpi + 88f, 192, 40f); TextButton b2 = addButton(instructions, settings, "Settings", 0, -G.height/2/dpi + 40f, 192, 40f); b1.addAction(Actions.alpha(.5f)); b2.addAction(Actions.alpha(.25f)); b1.addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); b2.addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); */ }
From source file:org.destinationsol.game.dra.RectSprite.java
License:Apache License
/** * consumes relPos, doesn't consume Color * */// w w w. j a v a2 s . c om public RectSprite(TextureAtlas.AtlasRegion tex, float texSz, float origPercX, float origPercY, @Consumed Vector2 relPos, DraLevel level, float relAngle, float rotSpd, Color tint, boolean additive) { if (tex == null) throw new AssertionError("tex is null"); myTex = tex; myOrigPercX = origPercX; myOrigPercY = origPercY; this.relPos = relPos; myPos = new Vector2(); myLevel = level; this.relAngle = relAngle; myRotSpd = rotSpd; myEnabled = true; baseAlpha = tint.a; this.tint = new Color(tint); setTexSz(texSz); myAdditive = additive; }
From source file:org.destinationsol.game.item.SolItemType.java
License:Apache License
public SolItemType(Color color, SolSound pickUpSound, float sz) { this.color = color; this.sz = sz; uiColor = new Color(color); uiColor.a = .3f;/*from w ww . j ava2 s. c o m*/ this.pickUpSound = pickUpSound; }
From source file:org.destinationsol.game.MapDrawer.java
License:Apache License
public MapDrawer(TextureManager textureManager, float screenHeight) { myZoom = MAX_ZOOM / MUL_FACTOR / MUL_FACTOR; float minIconRad = MIN_ICON_RAD_PX / screenHeight; myIconRad = ICON_RAD < minIconRad ? minIconRad : ICON_RAD; myAreaWarnCol = new Color(SolColor.W); myAreaWarnBgCol = new Color(SolColor.UI_WARN); myWarnAreaBg = textureManager.getTex(MAP_TEX_DIR + "warnBg", null); myAtmTex = textureManager.getTex(MAP_TEX_DIR + "atm", null); myPlanetTex = textureManager.getTex(MAP_TEX_DIR + "planet", null); myPlanetCoreTex = textureManager.getTex(MAP_TEX_DIR + "planetCore", null); myStarTex = textureManager.getTex(MAP_TEX_DIR + "star", null); myMazeTex = textureManager.getTex(MAP_TEX_DIR + "maze", null); mySkullBigTex = textureManager.getTex(MAP_TEX_DIR + "skullBig", null); myBeltTex = textureManager.getTex(MAP_TEX_DIR + "asteroids", null); myBeaconAttackTex = textureManager.getTex(MAP_TEX_DIR + "beaconAttack", null); myBeaconMoveTex = textureManager.getTex(MAP_TEX_DIR + "beaconMove", null); myBeaconFollowTex = textureManager.getTex(MAP_TEX_DIR + "beaconFollow", null); myWhiteTex = textureManager.getTex(MAP_TEX_DIR + "whiteTex", null); myLineTex = textureManager.getTex(MAP_TEX_DIR + "gridLine", null); myIconBg = textureManager.getTex(TextureManager.HULL_ICONS_DIR + "bg", null); mySkullTex = textureManager.getTex(TextureManager.HULL_ICONS_DIR + "skull", null); myStarPortTex = textureManager.getTex(TextureManager.HULL_ICONS_DIR + "starPort", null); }
From source file:org.destinationsol.game.particle.LightSrc.java
License:Apache License
/** doesn't consume relPos *//*from w ww . j av a 2 s . c o m*/ public LightSrc(SolGame game, float sz, boolean hasHalo, float intensity, Vector2 relPos, Color col) { TextureAtlas.AtlasRegion tex = game.getTexMan().getTex("smallGameObjs/particles/lightCircle", null); mySz = sz; myCircle = new RectSprite(tex, 0, 0, 0, new Vector2(relPos), DraLevel.PART_BG_0, 0, 0, col, true); tex = game.getTexMan().getTex("smallGameObjs/particles/lightHalo", null); if (hasHalo) { Color haloCol = new Color(col); SolColorUtil.changeBrightness(haloCol, .8f); myHalo = new RectSprite(tex, 0, 0, 0, new Vector2(relPos), DraLevel.PART_FG_0, 0, 0, haloCol, true); } else { myHalo = null; } myIntensity = intensity; myFadeTime = DEFAULT_FADE_TIME; }
From source file:org.destinationsol.game.screens.WarnDrawer.java
License:Apache License
public WarnDrawer(float r, String text) { myWarn = rect(r);// ww w . ja v a 2s . co m myText = text; myBgCol = new Color(SolColor.UI_WARN); myBgOrigA = myBgCol.a; myTextCol = new Color(SolColor.W); }
From source file:org.destinationsol.ui.SolInputManager.java
License:Apache License
public SolInputManager(TextureManager textureManager, float r) { myPtrs = new Ptr[POINTER_COUNT]; for (int i = 0; i < POINTER_COUNT; i++) { myPtrs[i] = new Ptr(); }/*w w w . j a va 2 s. c o m*/ SolInputProcessor sip = new SolInputProcessor(this); Gdx.input.setInputProcessor(sip); myFlashPtr = new Ptr(); myMousePos = new Vector2(); myMousePrevPos = new Vector2(); // Load the cursor image - the hotspot is where the click point is which is in the middle in this image. Pixmap pm = new Pixmap(FileManager.getInstance().getStaticFile("res/imgs/cursorHidden.png")); hiddenCursor = Gdx.graphics.newCursor(pm, 0, 0); Gdx.graphics.setCursor(hiddenCursor); pm.dispose(); // We want the original mouse cursor to be hidden as we draw our own mouse cursor. Gdx.input.setCursorCatched(false); setMouseCursorHidden(); myUiCursor = textureManager.getTex("ui/cursor", null); myScreens = new ArrayList<SolUiScreen>(); myToRemove = new ArrayList<SolUiScreen>(); myToAdd = new ArrayList<SolUiScreen>(); myWarnCol = new Color(SolColor.UI_WARN); FileHandle hoverSoundFile = FileManager.getInstance().getSoundsDirectory().child("ui").child("uiHover.ogg"); myHoverSound = Gdx.audio.newSound(hoverSoundFile); }
From source file:Screens.CreditsScreen.java
@Override public void show() { stage = new Stage(); Gdx.input.setInputProcessor(stage);/*from w w w .j a v a 2 s .c o m*/ click = assets.manager.get(ScreenAssets.click_sound2); font = assets.manager.get(ScreenAssets.font); /**TextureAtlas and skin */ buttons_atlas = assets.manager.get(ScreenAssets.buttons_atlas); buttons_skin = new Skin(buttons_atlas); lbl_style = new Label.LabelStyle(); lbl_style.font = font; lbl_style.fontColor = new Color(Color.WHITE); image_style = new ImageButton.ImageButtonStyle(); image_style.imageUp = buttons_skin.getDrawable("pause_return"); /**Music labels*/ music1 = new Label("Menu: \n" + "Mason - Exceeder (Original Mix) ", lbl_style); music2 = new Label("MAP 1 - Classic: \n" + "Wiggle (8 Bit Remix Cover Version)\n" + "8 Bit Universe", lbl_style); music3 = new Label("MAP 2 - Snow: \n" + "Lensko - Cetus", lbl_style); music4 = new Label("MAP 3 - Space: \n" + "Asura - Dust and Daffodils", lbl_style); winningSound = new Label("Finish Sound - Mario Kart 64", lbl_style); /**Table*/ Table table = new Table(); table.add(new Label("Authors: ", lbl_style)).pad(20); table.row(); table.add(new Label("Rosy Teasdale", lbl_style)); table.row(); table.add(new Label("Jonathan Cournoyer", lbl_style)); table.row(); table.add(new Label("Music: ", lbl_style)).pad(20); table.row(); table.add(music1).pad(5); table.row(); table.add(music2).pad(5); table.row(); table.add(music3).pad(5); table.row(); table.add(music4).pad(5); table.row(); table.add(new Label("Sound: ", lbl_style)).pad(20); table.row(); table.add(winningSound); return_mainmenu = new ImageButton(image_style); return_mainmenu.setPosition(900, 10); table.setPosition(640, 400); stage.addActor(table); stage.addActor(return_mainmenu); listeners(); }
From source file:Screens.LeaderboardScreen.java
@Override public void show() { table = new Table(); stage = new Stage(); Gdx.input.setInputProcessor(stage);// w w w. j a va 2 s. c o m click = assets.manager.get(ScreenAssets.click_sound2); /**TextureAtlas and skin */ buttons_atlas = assets.manager.get(ScreenAssets.buttons_atlas); buttons_skin = new Skin(buttons_atlas); /** BitmapFont */ font = new BitmapFont(Gdx.files.internal("menu/button_font.fnt"), Gdx.files.internal("menu/button_font.png"), false); /**Style*/ lbl_style = new Label.LabelStyle(); lbl_style.font = font; lbl_style.fontColor = new Color(Color.WHITE); image_style = new ImageButton.ImageButtonStyle(); image_style.imageUp = buttons_skin.getDrawable("pause_return"); nextmap_style = new ImageButton.ImageButtonStyle(buttons_skin.getDrawable("nextarrow_big"), null, null, null, null, null); prevmap_style = new ImageButton.ImageButtonStyle(buttons_skin.getDrawable("backarrow_big"), null, null, null, null, null); map = new Label("For Map #" + Integer.toString(mapNum + 1), lbl_style); map.setPosition(590, 600); title_texture = assets.manager.get(ScreenAssets.leaderboardTitle); title = new Image(title_texture); title.setPosition(280, 648); return_mainmenu = new ImageButton(image_style); return_mainmenu.setPosition(950, 10); /**Column Labels*/ positionLbl = new Label(" POSITION ", lbl_style); carNameLbl = new Label(" CAR\nUSED ", lbl_style); playerNameLbl = new Label(" PLAYER\nNAME ", lbl_style); timeLbl = new Label(" TIME ", lbl_style); selectPreviousMapButton = new ImageButton(prevmap_style); selectPreviousMapButton.setX(70); selectPreviousMapButton.setY(360); selectNextMapButton = new ImageButton(nextmap_style); selectNextMapButton.setX(1150); selectNextMapButton.setY(360); /** Position numbers*/ positionNum1 = new Label(Integer.toString(1), lbl_style); positionNum2 = new Label(Integer.toString(2), lbl_style); positionNum3 = new Label(Integer.toString(3), lbl_style); positionNum4 = new Label(Integer.toString(4), lbl_style); positionNum5 = new Label(Integer.toString(5), lbl_style); positionNum6 = new Label(Integer.toString(6), lbl_style); positionNum7 = new Label(Integer.toString(7), lbl_style); positionNum8 = new Label(Integer.toString(8), lbl_style); //assign the table values setValues(); /** DRAW THE TABLE */ /**Row 1*/ table.add(positionLbl).pad(10); table.add(playerNameLbl).pad(10); table.add(carNameLbl).pad(10); table.add(timeLbl).pad(10); //table.add(mapNameLbl).pad(10); //table.add(totalFuelConsumptionLbl).pad(10); //table.add(numberOfStopsForFuelLbl).pad(10); table.row(); /**Row 2*/ table.add(positionNum1).pad(10); table.add(playerName1).pad(10); table.add(carName1).pad(10); table.add(time1).pad(10); table.row(); /**Row 3*/ table.add(positionNum2).pad(10); table.add(playerName2).pad(10); table.add(carName2).pad(10); table.add(time2).pad(10); table.row(); /**Row 4*/ table.add(positionNum3).pad(10); table.add(playerName3).pad(10); table.add(carName3).pad(10); table.add(time3).pad(10); table.row(); /**Row 5*/ table.add(positionNum4).pad(10); table.add(playerName4).pad(10); table.add(carName4).pad(10); table.add(time4).pad(10); table.row(); /**Row 6*/ table.add(positionNum5).pad(10); table.add(playerName5).pad(10); table.add(carName5).pad(10); table.add(time5).pad(10); table.row(); /**Row 7*/ table.add(positionNum6).pad(10); table.add(playerName6).pad(10); table.add(carName6).pad(10); table.add(time6).pad(10); table.row(); /**Row 8*/ table.add(positionNum7).pad(10); table.add(playerName7).pad(10); table.add(carName7).pad(10); table.add(time7).pad(10); table.row(); /**Row 9*/ table.add(positionNum8).pad(10); table.add(playerName8).pad(10); table.add(carName8).pad(10); table.add(time8).pad(10); table.setPosition(600, 350); stage.addActor(table); stage.addActor(title); stage.addActor(return_mainmenu); stage.addActor(map); stage.addActor(selectNextMapButton); stage.addActor(selectPreviousMapButton); listeners(); }