Search in sources :

Example 1 with MenuState

use of org.asassecreations.voxelgame.state.MenuState in project Voxel_Game by ASasseCreations.

the class MenuGuiSystem method init.

public static final void init(final MenuState state) {
    menuContainer = new GuiPanel(0f, 0f, .8f, .8f, new Color(0f, 0f, 0f, .75f));
    startButton = new GuiButton(0f, .5f, .5f, .1f, data -> state.manager().push(new GameState(100)), menuContainer);
    settingsButton = new GuiButton(0f, 0f, .5f, .1f, data -> {
    }, menuContainer);
    quitButton = new GuiButton(0f, -.5f, .5f, .1f, data -> state.manager().pop(), menuContainer);
    text = new SoftwareImage((int) startButton.getScreenWidth(), (int) startButton.getScreenHeight());
    text.clear();
    text.graphics().setFont(new Font("Arial", Font.PLAIN, 32));
    text.centerString("Start", Color.WHITE, null);
    startImage = new GuiImage(0f, 0f, 1f, 1f, text.toTexture(null), startButton);
    text.clear();
    text.graphics().setFont(new Font("Arial", Font.PLAIN, 32));
    text.centerString("Settings", Color.WHITE, null);
    settingsImage = new GuiImage(0f, 0f, 1f, 1f, text.toTexture(null), settingsButton);
    text.clear();
    text.graphics().setFont(new Font("Arial", Font.PLAIN, 32));
    text.centerString("Quit", Color.WHITE, null);
    quitImage = new GuiImage(0f, 0f, 1f, 1f, text.toTexture(null), quitButton);
    menuContainer.add();
}
Also used : GuiImage(org.asassecreations.engine.gui.GuiImage) Color(org.asassecreations.engine.render.Color) GuiButton(org.asassecreations.engine.gui.GuiButton) MenuState(org.asassecreations.voxelgame.state.MenuState) Font(java.awt.Font) SoftwareImage(org.asassecreations.engine.tools.SoftwareImage) GuiPanel(org.asassecreations.engine.gui.GuiPanel) GameState(org.asassecreations.voxelgame.state.GameState) GuiImage(org.asassecreations.engine.gui.GuiImage) GuiButton(org.asassecreations.engine.gui.GuiButton) SoftwareImage(org.asassecreations.engine.tools.SoftwareImage) GuiPanel(org.asassecreations.engine.gui.GuiPanel) Color(org.asassecreations.engine.render.Color) GameState(org.asassecreations.voxelgame.state.GameState) Font(java.awt.Font)

Example 2 with MenuState

use of org.asassecreations.voxelgame.state.MenuState in project Voxel_Game by ASasseCreations.

the class VoxelGame method init.

public final void init() {
    try {
        AssetLoader.loadOriginalTextures();
        AssetLoader.loadModifiedTextures();
        ChunkModel.getTexture(AssetLoader.getTextureAtlasSize());
        final AtlasResult result = AssetLoader.createAtlas();
        TEXTURE_ATLAS = result.image;
        AssetLoader.loadItems();
        Block.BLOCKS = AssetLoader.loadBlocks(result.textures);
        result.textures.clear();
    } catch (final IOException | URISyntaxException e) {
        e.printStackTrace();
    }
    manager.push(new MenuState());
}
Also used : AtlasResult(org.asassecreations.voxelgame.asset.AtlasResult) MenuState(org.asassecreations.voxelgame.state.MenuState) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException)

Aggregations

MenuState (org.asassecreations.voxelgame.state.MenuState)2 Font (java.awt.Font)1 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 GuiButton (org.asassecreations.engine.gui.GuiButton)1 GuiImage (org.asassecreations.engine.gui.GuiImage)1 GuiPanel (org.asassecreations.engine.gui.GuiPanel)1 Color (org.asassecreations.engine.render.Color)1 SoftwareImage (org.asassecreations.engine.tools.SoftwareImage)1 AtlasResult (org.asassecreations.voxelgame.asset.AtlasResult)1 GameState (org.asassecreations.voxelgame.state.GameState)1