can someone pleae POst an example in which a GUI actually WORKS?

  • Please avoid writing whole words in captial letters in the headline, unless it makes sense (e.g. GUI).


    To create a build a gui, simply create a new gui element, and once a player connects to the server (e.g. in the PlayerConnectEvent or PlayerSpawnEvent), add the element to the players gui by calling player.addGuiElement(element)


    Basic example which creates a panel and a label:


  • thanks and sorry for the caps, I was just getting frustrated because my database won't work so now I'm working on a different Project and this GUI Thing is getting on my nerves


    and when I think of RGBA I think of
    this: rgba(255, 0, 0, 0.3)


    I don't know where you are coming up with (Oox000000BB) it looks like an extended version of the hexadecimal colors.

  • thanks and sorry for the caps, I was just getting frustrated because my database won't work so now I'm working on a different Project and this GUI Thing is getting on my nerves


    and when I think of RGBA I think of
    this: rgba(255, 0, 0, 0.3)


    I don't know where you are coming up with (Oox000000BB) it looks like an extended version of the hexadecimal colors.

    heres a color chart that may help http://www.nthelp.com/colorcodes.htm

    Yahgiggle Steam Signature, real name Deon Hamilton :thumbsup: Server @ ip 139.99.136.76:4255 Name (The Federation of territory) Unity :thumbsup:

    If at first your code does not work call it version 0.1 with the odd bug :thinking:

    My Own Website




    31245-logo-png
  • The 0xRRGGBBAA is a hexadecimal color indeed (RR is the red color part, GG the green color, BB the blue color and AA the alpha part). Alternatively you can use the guiElement.setColor(r, g, b, a) method, there you can provide separate red, green, blue and alpha values (however, the range is between 0.0 and 1.0 in this case, instead of 0 and 255 [in other words, 255 == 1.0, 128 == 0.5 etc]). Example:

    Java
    GuiPanel panel = new GuiPanel();
    //Sets a full red color (i.e. red == 255), half transparent
    panel.setColor(1.0f, 0.0f, 0.0f, 0.5f);
  • I'm assuming this is Normal when you add a text Field? i scaled it down and i get a big white screen


  • Code
    GuiLabel label = new GuiLabel(0.9f, 0.05f, true);
    label.setText("text goes here");
    label.setPivot(PivotPosition.BottomRight);
    label.setFont(Font.DefaultMono_Bold);
    label.setFontSize(16);
    player.addGuiElement(label);
    Timer testTimer = new Timer(0f, 5f, 0, () -> {
    label.setVisible(false);
    });
    testTimer.start();

    here my code with a timer set to 5sec this works fine

    Yahgiggle Steam Signature, real name Deon Hamilton :thumbsup: Server @ ip 139.99.136.76:4255 Name (The Federation of territory) Unity :thumbsup:

    If at first your code does not work call it version 0.1 with the odd bug :thinking:

    My Own Website




    31245-logo-png

  • This works fine did you import the stuff needed for it to work oO

    Yahgiggle Steam Signature, real name Deon Hamilton :thumbsup: Server @ ip 139.99.136.76:4255 Name (The Federation of territory) Unity :thumbsup:

    If at first your code does not work call it version 0.1 with the odd bug :thinking:

    My Own Website




    31245-logo-png

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!