Skip to content

#08.3 Layer

Valkryst edited this page Sep 29, 2017 · 10 revisions

Create a Layer

import com.valkryst.VTerminal.Panel;
import com.valkryst.VTerminal.builder.PanelBuilder;
import com.valkryst.VTerminal.builder.component.LayerBuilder;
import com.valkryst.VTerminal.component.Layer;
import com.valkryst.VTerminal.font.Font;
import com.valkryst.VTerminal.font.FontLoader;

import java.awt.Color;
import java.io.IOException;
import java.net.URISyntaxException;

public class Driver {
    public static void main(final String[] args) throws IOException, URISyntaxException, InterruptedException {
        final Font font = FontLoader.loadFontFromJar("Fonts/DejaVu Sans Mono/20pt/bitmap.png",
                                                     "Fonts/DejaVu Sans Mono/20pt/data.fnt",
                                                      1);

        final PanelBuilder builder = new PanelBuilder();
        builder.setFont(font);
        final Panel panel = builder.build();

        
        final LayerBuilder layerBuilder = new LayerBuilder();
        layerBuilder.setColumnIndex(10);
        layerBuilder.setRowIndex(10);
        layerBuilder.setWidth(5);
        layerBuilder.setHeight(5);
        layerBuilder.setBackgroundColor(Color.BLACK);

        final Layer layer = layerBuilder.build();

        panel.addComponent(layer);


        Thread.sleep(50);

        panel.draw();
    }
}

Code Explanation

To be written.

Clone this wiki locally