Slick Forums

Discuss the Slick 2D Library
It is currently Sat May 18, 2013 10:30 am

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: BUG: clipping
PostPosted: Tue Aug 05, 2008 8:30 am 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
The following XML makes a combobox. When opened, if the dropdown hits the edge of the game window, the dropdown will scroll. The items in the dropdown are not clipped properly when scrolling.

Code:
<panel>
   <panel border="true" pad="10">
      <combobox selected="0" editable="false" name="resolutionList">
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
         <choice text="Test"/>
      </combobox>
   </panel>
</panel>


Image

---

Here is another problem:
Code:
<panel>
   <tabbedpane width="600" height="324">
      <tab text="Microphones">
         <table weightx="1" weighty="1">
            <header>
               <column text="Name" width="250"/>
               <column text="Device"/>
            </header>
         </table>
      </tab>
   </tabbedpane>
   <dialog text="New Microphone" resizable="true" modal="true" width="265" height="240">
      <list name="deviceList" weightx="1" weighty="1"/>
   </dialog>
</panel>

Moving the dialog around causes the table in the tabbedpane to clip strangely. This test case isn't just a weird bug, it actually occurs in my game when I open a dialog over a table in a tabbedpane.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 05, 2008 9:56 am 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
The first one, no idea, I'll check tonight.

The second one - is it really valid to have a dialog within a panel?

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 05, 2008 11:43 am 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Got the first one at lunch, in SVN.

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 05, 2008 12:23 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Fixed something with clipping, tabbed panes and dialogs. Not sure if it's your issue tho :)

In SVN.

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 05, 2008 6:23 pm 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
Woohoo! Both are fixed. Thanks Kev!! :D


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 06, 2008 9:54 am 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
Still seeing some weirdness with clipping and dialogs. I'll try to reproduce.

Found another weird clipping problem, I simplified my GUI down to this...
Code:
<panel>
   <combobox width="300"/>
   <combobox>
      <choice text="Moo"/>
   </combobox>
   <combobox/>
   <combobox/>
   <spinbox/>
</panel>

Type into the first combobox and it will start clipping before reaching the end of the box. :?: Open the second combo and the first one clips correctly! :shock:


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 06, 2008 6:24 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Fixed in SVN.

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 18, 2008 8:14 am 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
Sorry I haven't responded sooner. Got sidetracked on another project. Finished it though! Check it out:
http://yamlbeans.sourceforge.net/

I am still seeing some clipping problems. I'll post some repro XML once I narrow it down.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 19, 2008 7:51 am 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
Ok here is some code showing the problem.

Code:
public class ThingleTest {
   public static void main (String[] args) throws SlickException {
      BasicGame game = new BasicGame("ThingleTest") {
         Page page;
         Image testImage;

         public void init (GameContainer container) throws SlickException {
            testImage = new BigImage("testdata/logo.png");

            Thingle.init(new SlickThinletFactory(container));
            page = new Page();
            page.setDrawDesktop(false);
            page.enable();
            try {
               Widget widget = page.parse("<panel background='#66000000' top='100' left='100'>" //
                  + "<dialog text='Alert' modal='true' width='200' height='200'"
                  + " resizable='true' columns='1' gap='10' pad='10'>" //
                  + "<textarea focusable='false' wrap='true' weighty='1' weightx='1'" //
                  + " background='transparent' border='false' colspan='2'" //
                  + " text='This is my super important message dialog for telling users about things.' />" //
                  + "<panel gap='10' colspan='2' halign='right'>" //
                  + "<button text='OK' /><button text='Cancel' />" //
                  + "</panel>" //
                  + "</dialog>" //
                  + "</panel>");
               page.add(widget);
            } catch (ThingleException ex) {
               ex.printStackTrace();
            }

            Graphics g = container.getGraphics();
            g.setBackground(Color.white);
         }

         public void update (GameContainer container, int delta) throws SlickException {
            page.update(delta);
         }

         public void render (GameContainer container, Graphics g) throws SlickException {
            g.drawImage(testImage, 100, 100);

            page.render();
         }
      };
      AppGameContainer container = new AppGameContainer(game);
      container.setDisplayMode(600, 800, false);
      container.start();
   }
}


* Move the dialog around and observe the wacky clipping. Turns out the BigImage is what is doing it! Doesn't make much sense. BigImage#draw resets the scale and translate. Change BigImage to Image though, and you'll see the problem goes away.

* Sizing the dialog very small, the buttons and scrollbars are drawn outside the bounds of the dialog. This isn't that big of a deal since a minimum size can be used, but I'm not sure if it should be clipping and if so there may be some scenario where it looks bad.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 21, 2008 7:19 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Fixed in SVN.

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 22, 2008 2:01 am 
Offline
Game Developer
User avatar

Joined: Sun May 25, 2008 9:45 am
Posts: 578
Awesome! Works perfectly now. :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group