TEST SCREEN
Everything is same with previous test screens. Did you play Amazing Alex, did you see the sliding menus from both side, do you know how easy is to implement that with LibGDX and with abit help of MTX. I also used these in my game Puzzle Slide.
-
TABLEOVERLARYER from MTX
Table overlayer is only extending Table of LibGDX with a texturebackground. Of course normally Table has a texture if you need, but I like these abstraction, I have cool ideas for next versions of MTX, very rich features for tableoverlayers. You can check this class in mtx package.
MENUSIDEBOXOVERLYAYER as Test Model
This is only extending TableOverLayer I mentioned before. So basic, so fast and very effective.
SETTING SIDE SLIDING MENU
I created two menusideboxlayers for left and right with different widths and with a transparent black texture, I set their initial positions out side of the screen. I put a ButtonToggle from MTX to slide in and out with actions. I also put dummy buttons for test, and its done.
Everything is same with previous test screens. Did you play Amazing Alex, did you see the sliding menus from both side, do you know how easy is to implement that with LibGDX and with abit help of MTX. I also used these in my game Puzzle Slide.
-
TABLEOVERLARYER from MTX
Table overlayer is only extending Table of LibGDX with a texturebackground. Of course normally Table has a texture if you need, but I like these abstraction, I have cool ideas for next versions of MTX, very rich features for tableoverlayers. You can check this class in mtx package.
MENUSIDEBOXOVERLYAYER as Test Model
This is only extending TableOverLayer I mentioned before. So basic, so fast and very effective.
public class MenuSideBoxOverLayer extends TableOverLayer {
public MenuSideBoxOverLayer(TextureRegion textureBackground, float x,
float y, float width, float height) {
super(textureBackground, x, y, width, height);
}
}
SETTING SIDE SLIDING MENU
I created two menusideboxlayers for left and right with different widths and with a transparent black texture, I set their initial positions out side of the screen. I put a ButtonToggle from MTX to slide in and out with actions. I also put dummy buttons for test, and its done.
private void setUpGameMenu() {
// #8.1 TEST
// Create two side boxes in different sizes
// Make them out of the screen
// Left box 120px - Right box 80px
// ###################################################################
sideBoxLeft = new MenuSideBoxOverLayer(Assets.imgTransparentBlack, -120, 0, 120, getStage().getHeight());
sideBoxRight = new MenuSideBoxOverLayer(Assets.imgTransparentBlack, getStage().getWidth(), 0, 80, getStage().getHeight());
getStage().addActor(sideBoxLeft);
getStage().addActor(sideBoxRight);
//8.2 TEST
// Create a menu button anyhere you want, I use a toggle button here
// Toggle Button
// ####################################################
final ButtonToggle btnTest = MenuCreator.createCustomToggleButton(Assets.btnAllMenuPressed, Assets.btnAllMenu, false);
btnTest.setPosition(getStage().getWidth() / 2 - 100, 20);
btnTest.setText(Assets.font2, "Menu", true);
btnTest.setTextPosXY(20, 50);
btnTest.addListener(new ActorGestureListener() {
@Override
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
super.touchUp(event, x, y, pointer, button);
// Toggle the button, and change animation of abstract actor
btnTest.setToggleSwitch();
if(btnTest.isToggleActive()){
// Send boxes into screen
sideBoxLeft.addAction(Actions.moveTo(0, 0, 0.4f));
sideBoxRight.addAction(Actions.moveTo(getStage().getWidth() - 80, 0, 0.4f));
} else{
// Send boxes out of screen
sideBoxLeft.addAction(Actions.moveTo(- 120, 0, 0.4f));
sideBoxRight.addAction(Actions.moveTo(getStage().getWidth(), 0, 0.4f));
}
}});
getStage().addActor(btnTest);
//#8.3 TEST
// Dummy buttons to put on boxes, just for fun
// #########################################################
ButtonGame btnTest1 = MenuCreator.createCustomGameButton(Assets.btnBatCircle, Assets.btnBatCirclePressed);
sideBoxLeft.add(btnTest1);
sideBoxLeft.row();
ButtonGame btnTest2 = MenuCreator.createCustomGameButton(Assets.btnBatCircle, Assets.btnBatCirclePressed);
sideBoxLeft.add(btnTest2);
sideBoxLeft.row();
ButtonGame btnTest3 = MenuCreator.createCustomGameButton(Assets.btnBatCircle, Assets.btnBatCirclePressed);
sideBoxLeft.add(btnTest3);
sideBoxLeft.row();
ButtonGame btnTest4 = MenuCreator.createCustomGameButton(Assets.btnBatCircle, Assets.btnBatCirclePressed);
sideBoxLeft.add(btnTest4);
sideBoxLeft.row();
ButtonGame btnTest5 = MenuCreator.createCustomGameButton(Assets.btnLevel, Assets.btnLevelPressed);
sideBoxRight.add(btnTest5);
sideBoxRight.row();
ButtonGame btnTest6 = MenuCreator.createCustomGameButton(Assets.btnLevel, Assets.btnLevelPressed);
sideBoxRight.add(btnTest6);
sideBoxRight.row();
}
0 yorum:
Yorum Gönder