Skip to content
Elysio Martins edited this page Nov 6, 2023 · 4 revisions

wiki_logo

Introduction

Welcome to the EasyUIBuilder project wiki. This wiki provides in-depth information on how to use, configure, and extend the EasyUIBuilder project, a PHP library for creating user interfaces.

installation

git clone https://github.com/GoldRush-developpement/EasyUIBuilder
cd EasyUIBuilder/

start

  1. create root file in refaltor/roots/

root example

<?php

namespace refaltor\roots;

use refaltor\ui\builders\Root;
use refaltor\ui\builders\RootBuild;
use refaltor\ui\colors\BasicColor;
use refaltor\ui\elements\Label;

class LabelTest implements RootBuild
{

    public function root(): Root
    {
        # create root instance
        $root = Root::create();


        # create my element
        $label = Label::create("label_test", "Hello EasyUIBuilder !")
            ->setFontType(Label::TYPE_MINECRAFT_TEN)
            ->setFontSize(Label::FONT_EXTRA_LARGE)
            ->setColor(BasicColor::blue())
            ->setShadow();


        # add element in root instance
        $root->addElement($label);

        # return root instance
        return $root;
    }

    # namespace and .json file name
    public function getNamespace(): string
    {
        return "ui_test";
    }


    # put the getPathName in your texture pack
    # for the script to automatically generate the ui and
    # the condition for the visible UI
    # ---
    # example put in your developpement_resources_pack in .com_mojang :)
    public function getPathName(): string
    {
        return "./resources/pack_example/";
    }

    # title condition is very important because
    # this is the title that makes your ui will become visible
    public function titleCondition(): string
    {
        return "LABEL_TEST";
    }
}
  1. register root file in refaltor/ui/Entry.php il startingService() function

register example

<?php

namespace refaltor\ui;


use refaltor\roots\LabelTest;
use refaltor\ui\builders\RootBuild;
use refaltor\ui\helpers\RegisterHelper;

class Entry extends RegisterHelper
{
    public function startingService(): void {


        # register root ui
        $this->register(new LabelTest());
    }
}
  1. start generation of your uis with the start.cmd or php start.php
Clone this wiki locally