Spout and GenericTexture

Discussion in 'Plugin Development' started by okami35, Nov 16, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    okami35

    Hello,
    I would like like to whow to the player a texture, so this is my code:

    Code:
    GenericTexture texture = new GenericTexture("http://213.246.52.45/parchemin.png");
    GenericPopup popup = new GenericPopup();
            popup.attachWidget(plugin, texture);
    sp.getMainScreen().attachPopupScreen(popup);
    And in onPlayerJoinEvent:

    Code:
    public void onPlayerJoin (PlayerJoinEvent event) {
            SpoutManager.getFileManager().addToPreLoginCache(plugin, "http://213.246.52.45/parchemin.png");
        }
    But it does not work, and i'm sure the URL is good

    Thank you for your help
     
  2. Offline

    Afforess

    You need an x,y for the texture position, as well as a width and height.
     
  3. Offline

    okami35

    I forgot this:
    Code:
    texture.setAnchor(WidgetAnchor.CENTER_CENTER);
            texture.setWidth(200);
            texture.setHeight(200);
            texture.setPriority(RenderPriority.Highest);
    But still no texture in game...

    Thank ou for your help
     
  4. Offline

    Afforess

    X and Y position? :p
     
  5. Offline

    DrBowe

    I was under the impression that setting an anchor is the equivalent of setting X and Y?
     
  6. Offline

    DDoS

    I think it's just the reference point for the coordinates. I made the same mistake back when I first started using Spout, the labels would appear at the edges of the screen.
     
  7. Offline

    DrBowe

    @DDoS
    In any case, I haven't been able to get my GenericTexture to show up yet either.

    Been using this...
    Code:java
    1.  
    2. GenericTexture synergyBar = new GenericTexture();
    3. synergyBar.setUrl("[URL]http://i.imgur.com/xdASZ.png[/URL]");
    4. synergyBar.setWidth(64).setHeight(250).setX(100).setY(100);
    5. synergyBar.setAnchor(WidgetAnchor.BOTTOM_LEFT);
    6. synergyBar.setPriority(RenderPriority.Highest);
    7. SpoutPlayer sP = (SpoutPlayer)event.getPlayer();
    8. sP.getMainScreen().attachWidget(plugin, synergyBar);
    9. sP.getMainScreen().setVisible(true);
    10.  


    ...which is used inside onPlayerJoin. And yet I can't get a single thing to appear on my screen. Notice anything that's clearly wrong?

    EDIT:
    Obviously the URL tags aren't there in the code, but the forums are refusing to let me remove those tags.
     
  8. Offline

    Afforess

    >onPlayerJoin

    GUI won't work until after OnSpoutcraftEnable. >.>
     
    r3Fuze likes this.
  9. Offline

    DDoS

    You'll have to ask @Afforess, he knows way much more then me. I've just started using GUIs with Spout. But I guess, maybe you should remove the url tags (or is that just the forums that messed it up :p). Maybe I should post my GUI code...

    Well, I guess I'm not need anymore. :p
     
  10. Offline

    DrBowe

    Oh. Must've missed that in the development tutorials.
    My bad. :|
     
  11. Offline

    Windwaker

    Btw, have you guys had any trouble with the player getting all spazzed out after closing a gui that was attached onPlayerJoin?
     
  12. Offline

    okami35

    I tried with setX and setY but still doesn't work...

    Thank you very much for your help
     
  13. Offline

    okami35

    up, this is my new code:

    Code:
    GenericTexture texture = new GenericTexture("http://sd-2.archive-host.com/membres/images/42296595646464925/header3.png");
            texture.setWidth(200);
            texture.setHeight(200);
            texture.setY(50).setY(50);
            texture.setAnchor(WidgetAnchor.CENTER_CENTER);
            texture.setPriority(RenderPriority.Highest);
    
            GenericPopup popup = new GenericPopup();
            popup.attachWidget(plugin, texture);
            popup.attachWidget(plugin, tlabel);
            popup.attachWidget(plugin, vlabel);
            sp.getMainScreen().attachPopupScreen(popup);
    And still no texture...

    Thank you
     
  14. Offline

    Windwaker

    How are you using this? Also, I don't know if the problem, but you shouldn't set an anchor and an x and a y.
     
  15. Offline

    okami35

    Always the same problem without setAnchor.
    This method is called when the player press "F6"
    tlabel and vlabel work perfectly, but no texture...

    Thank you very much
     
  16. Offline

    okami35

    up please
     
Thread Status:
Not open for further replies.

Share This Page