Author Topic: GUI or swing??? help!!!  (Read 7284 times)

Offline majitri

  • byte
  • *
  • Posts: 17
    • View Profile
Re: GUI or swing??? help!!!
« Reply #15 on: October 05, 2009, 11:49:19 am »
   
such a way that shows me a window of my interface would be:




   private void dialogoCorto(String texto){
         try{
            TextureManager tm = TextureManager.getInstance();
            backDrop = new Texture("ventanas"+File.separatorChar+"panel2.gif");   
            window = new Ventana(backDrop, 150, 15);
            aceptar = new Boton(77, 177, 138, 19);
            aceptar.setEtiqueta("Sí");
            aceptar.setListener(this);   
            cancelar = new Boton(298, 177, 138, 19);
            cancelar.setEtiqueta("No");             
            cancelar.setListener(this);   
            stateLabel = new Etiqueta(77, 77);
            stateLabel.setTexto(texto); 
            stateLabel.setTexto();         
            window.add(stateLabel);   
            window.add(aceptar);
            window.add(cancelar);   
         }
             catch(Exception e){}
      }   




How do I apply it like you're explaining?

Offline majitri

  • byte
  • *
  • Posts: 17
    • View Profile
Re: GUI or swing??? help!!!
« Reply #16 on: October 05, 2009, 08:15:36 pm »
   
I use
blit (Texture src, int srcX, srcY int, int destX, desty int, int width, int height, boolean transparent)

Does that slow you can do?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11862
    • View Profile
    • http://www.jpct.net
Re: GUI or swing??? help!!!
« Reply #17 on: October 05, 2009, 09:30:51 pm »
That's fine as long as you don't change the texture all the time. Maybe it would be helpful to actually define "slow". Which renderer are you using, how does your GUI looks like (screen shot?) and what's the frame rate?

Offline majitri

  • byte
  • *
  • Posts: 17
    • View Profile
Re: GUI or swing??? help!!!
« Reply #18 on: October 05, 2009, 09:52:41 pm »
  imagenes.enableRenderer (IRenderer.RENDERER_OPENGL, IRenderer.MODE_OPENGL);
  imagenes.disableRenderer (IRenderer.RENDERER_SOFTWARE);

Is that what you mean with the kind of processor?

I do not know how to add a picture to the forum, so I tell my windows GUI is similar to feud_demo project (in fact I have relied on it to make my interface and classes).

with slow I mean it starts to work fine, but when it is displayed multiple windows (to click on a button opens another window, closing the first) begins like to stay caught and spend a few seconds to display the window, but from there begins to take more

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: GUI or swing??? help!!!
« Reply #19 on: October 05, 2009, 10:13:27 pm »
such a way that shows me a window of my interface would be:

   private void dialogoCorto(String texto){
         try{
            TextureManager tm = TextureManager.getInstance();
            backDrop = new Texture("ventanas"+File.separatorChar+"panel2.gif");   
            window = new Ventana(backDrop, 150, 15);
            aceptar = new Boton(77, 177, 138, 19);
            aceptar.setEtiqueta("Sí");
            aceptar.setListener(this);   
            cancelar = new Boton(298, 177, 138, 19);
            cancelar.setEtiqueta("No");             
            cancelar.setListener(this);   
            stateLabel = new Etiqueta(77, 77);
            stateLabel.setTexto(texto); 
            stateLabel.setTexto();         
            window.add(stateLabel);   
            window.add(aceptar);
            window.add(cancelar);   
         }
             catch(Exception e){}
      }   
How do I apply it like you're explaining?
I can't really get any more specific than I already have, without seeing your code for the Ventana, Boton, and Etiqueta classes.  It should be simple, to be completely honest.  You draw those things at some point, right?  Well instead of drawing them onto the applet/frame, draw them onto the guiImage instead.  And then apply the effect.

You say:

  public void apply (int [] dest, int [] source)
         (
             PixelGrabber pg = new PixelGrabber (guiImage, 0, 0,
                                                 imageWidth,
                                                 imageHeight,
                                                 dest, 0, textureWidth);

but where guiImage and get those parameters?

Umm...
Code: [Select]
        guiImage = new BufferedImage( imageWidth, imageHeight,
                                   BufferedImage.TYPE_4BYTE_ABGR );

        //only needed if image dimensions are not powers of 2:
        textureWidth = nextPowerOf2( imageWidth);
        textureHeight = nextPowerOf2( imageHeight );


As the names imply, varriable 'guiImage' is the BufferedImage that you would draw your GUI onto, and varriables 'imageWidth' and 'imageHeight' are the dimensions you want that image to be.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11862
    • View Profile
    • http://www.jpct.net
Re: GUI or swing??? help!!!
« Reply #20 on: October 05, 2009, 10:58:08 pm »
  with slow I mean it starts to work fine, but when it is displayed multiple windows (to click on a button opens another window, closing the first) begins like to stay caught and spend a few seconds to display the window, but from there begins to take more
A few SECONDS? ??? Now that IS slow. Do you have a fps counter implemented? Maybe the frame rate is actually fine and just the GUI itself is somehow delayed!?