It is currently 05 Nov 2025, 21:53
   
Text Size

General UI support

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins

Re: General UI support

Postby Chris H. » 16 Feb 2012, 02:54

Rev 14095 replaces Sloth's earlier temp fix and I no longer get an error preventing a build. Looks good here. Thank you.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: General UI support

Postby Doublestrike » 16 Feb 2012, 04:56

Great, thanks for that - not sure what happened there, I didn't change anything on the fix, just re-committed :/

====

Composited graphics will not work for these darn round corners. This functionality is important to the global look of the UI, but is apparently tricky to get right, so I apologize for the delay.

The alternative is square corners on the panels (boo). My internet is flaky right now so I can't get a virtual machine up to develop on. The problem lies directly in setClip on a graphics object.

I have committed r14097 as a last gasp effort to fix this. If a dev who is having troubles wanted to have a look at the problem, it's in FPanel$drawBackgroundTexture (around line 245) in forge.view.toolbox. The code looks like this (I've added extra comments, starting with FLAG for the parts to experiment with):

Code: Select all
// FLAG: SAVE OLD CLIP FOR RESET
Rectangle oldClipBounds = g2d0.getClipBounds();

// FLAG: CLIP THE MASK OUT OF GRAPHICS
clip = new Area(new RoundRectangle2D.Float(0, 0, pnlW, pnlH, cornerDiameter, cornerDiameter));
g2d0.setClip(clip);

// Texture tiling algorithm, no need to change this, is painted inside clip
this.tempX = 0;
this.tempY = 0;

  while (this.tempX < this.pnlW) {
    while (this.tempY < this.pnlH) {
      g2d0.drawImage(this.backgroundTexture, (int) this.tempX, (int) this.tempY, null);
      this.tempY += this.textureH;
    }
  this.tempX += this.textureW;
  this.tempY = 0;
  }
  this.tempX = 0;
  // End tiling algorithm
       
  // FLAG:RESET TO OLD CLIP - NOT HAPPENING, OR SOMETHING
  g2d0.setClip(oldClipBounds);
If you can get this working without the repaint problem, the rest is finished. It's these few lines that are causing that trouble. So, if someone could play with this a bit, I would greatly appreciate it. If not, I'll just put square corners on everything.

====

On the outside chance this last thing worked, background textures should be returned.
---
A joke is a very serious thing.
User avatar
Doublestrike
UI Programmer
 
Posts: 715
Joined: 08 Aug 2011, 09:07
Location: Bali
Has thanked: 183 times
Been thanked: 161 times

Re: General UI support

Postby moomarc » 16 Feb 2012, 06:39

Well, things are working on my side, but that doesn't help I guess seeing as I never had any of the issues.

I have come across something else though (it might already be on the list for post-current situation). Avatar selections don't take effect until the next restart of Forge.

Another weird one to do with avatar selection: selecting any avatar after the djinn (left column, sixth row) and assuming left-to-right top-down pattern, the avatar image's in the prefs selection don't match the battlefield avatar. Looking at the actual sprite image the battlefield loads the correct order, so there's something about how the selection screen loads/orders them.
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: General UI support

Postby Doublestrike » 16 Feb 2012, 06:53

moomarc wrote:Well, things are working on my side, but that doesn't help I guess seeing as I never had any of the issues.
Thanks and yep, that's the rub, right there :wink:

moomarc wrote:...avatars...
Will have a look. I'm actually working on that section right now, trying to get the avatars to flow across the full area that's allowed them. (The 3-per-row thing is to accomodate the smallest screen setting without the dreaded horizontal scrollbar.)
---
A joke is a very serious thing.
User avatar
Doublestrike
UI Programmer
 
Posts: 715
Joined: 08 Aug 2011, 09:07
Location: Bali
Has thanked: 183 times
Been thanked: 161 times

Re: General UI support

Postby Sloth » 16 Feb 2012, 09:17

Doublestrike wrote:I have committed r14097 as a last gasp effort to fix this.
The problem is back, sorry Doublestrike. I will take a look at the code though.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: General UI support

Postby Doublestrike » 16 Feb 2012, 10:44

Thanks Sloth! It's really just a problem with the clip - apparently completely possible...
---
A joke is a very serious thing.
User avatar
Doublestrike
UI Programmer
 
Posts: 715
Joined: 08 Aug 2011, 09:07
Location: Bali
Has thanked: 183 times
Been thanked: 161 times

Re: General UI support

Postby Sloth » 16 Feb 2012, 11:48

Doublestrike wrote:I have committed r14097 as a last gasp effort to fix this. If a dev who is having troubles wanted to have a look at the problem, it's in FPanel$drawBackgroundTexture (around line 245) in forge.view.toolbox. The code looks like this (I've added extra comments, starting with FLAG for the parts to experiment with):

Code: Select all
// FLAG: SAVE OLD CLIP FOR RESET
Rectangle oldClipBounds = g2d0.getClipBounds();

// FLAG: CLIP THE MASK OUT OF GRAPHICS
clip = new Area(new RoundRectangle2D.Float(0, 0, pnlW, pnlH, cornerDiameter, cornerDiameter));
g2d0.setClip(clip);

// Texture tiling algorithm, no need to change this, is painted inside clip
this.tempX = 0;
this.tempY = 0;

  while (this.tempX < this.pnlW) {
    while (this.tempY < this.pnlH) {
      g2d0.drawImage(this.backgroundTexture, (int) this.tempX, (int) this.tempY, null);
      this.tempY += this.textureH;
    }
  this.tempX += this.textureW;
  this.tempY = 0;
  }
  this.tempX = 0;
  // End tiling algorithm
       
  // FLAG:RESET TO OLD CLIP - NOT HAPPENING, OR SOMETHING
  g2d0.setClip(oldClipBounds);
If you can get this working without the repaint problem, the rest is finished. It's these few lines that are causing that trouble. So, if someone could play with this a bit, I would greatly appreciate it. If not, I'll just put square corners on everything.
I don't know what it should look like, but when i remove the following part, i don't have problems anymore:

Code: Select all
// FLAG: CLIP THE MASK OUT OF GRAPHICS
clip = new Area(new RoundRectangle2D.Float(0, 0, pnlW, pnlH, cornerDiameter, cornerDiameter));
g2d0.setClip(clip);
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: General UI support

Postby Chris H. » 16 Feb 2012, 12:25

just for the heck of it, I modified line 248 from:

Code: Select all
g2d0.setClip(clip);
`
to:

Code: Select all
g2d0.create().setClip(clip);
`
and it looks better, I get a similar result as the one from Sloth. Granted, the battlefield is missing the picture.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: General UI support

Postby slapshot5 » 16 Feb 2012, 12:34

What happened to the red-colored mage avatar we used to have for the computer? It's no an option on the Settings > Avatars panel.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: General UI support

Postby Sloth » 16 Feb 2012, 12:53

Chris H. wrote:just for the heck of it, I modified line 248 from:

Code: Select all
g2d0.setClip(clip);
`
to:

Code: Select all
g2d0.create().setClip(clip);
`
and it looks better, I get a similar result as the one from Sloth. Granted, the battlefield is missing the picture.
I toyed around with the code and i find several versions that prevents the artifacts from appearing. Now i wonder what else could be wrong. Should the battlefield background image be visible?
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: General UI support

Postby moomarc » 16 Feb 2012, 13:17

slapshot5 wrote:What happened to the red-colored mage avatar we used to have for the computer? It's no an option on the Settings > Avatars panel.

-slapshot5
I'll add it to the avatars sprite. Look for it soon... :)

EDIT: Done! Its the last avatar in the list.
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: General UI support

Postby Chris H. » 16 Feb 2012, 14:07

Sloth wrote:I toyed around with the code and i find several versions that prevents the artifacts from appearing. Now i wonder what else could be wrong. Should the battlefield background image be visible?
`
Yeah, my lack of knowledge is holding me back. :mrgreen:

The setClip() javadoc states:

Sets the current clipping area to an arbitrary clip shape. Not all objects that implement the Shape interface can be used to set the clip. The only Shape objects that are guaranteed to be supported are Shape objects that are obtained via the getClip method and via Rectangle objects. This method sets the user clip, which is independent of the clipping associated with device bounds and window visibility.
`
So the RoundRectangle2D might be a problem under some OS' and look OK on others?


Edit:

I do not think that the battleground image should be visible at this time. There are a few methods in this class that are not used locally at this time. It looks like drawForegroundScaled() might be responsible for drawing the image.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: General UI support

Postby Doublestrike » 17 Feb 2012, 00:25

Chris H. wrote:I do not think that the battleground image should be visible at this time. There are a few methods in this class that are not used locally at this time. It looks like drawForegroundScaled() might be responsible for drawing the image.
Thanks fellas - that's exactly right. Currently, only the background texture should be drawn. If that's OK, then the same method can be applied elsewhere.

Yeah, not too hard a problem to solve - unless you can't see the artifacts :lol:

Chris H wrote:g2d0.create().setClip(clip);
Actually, g2d0 is already created from the root graphics, so that would be introducing another graphics canvas, just so you know (performance!). But that may be the only way to solve the problem...

===

So, if background texture is OK, I'll have a chance to rebuild the draw methods in about 24 hours. If someone could commit the preferred version of FPanel (for the background texture only) I'll get to work. Thanks for the help!
Last edited by Doublestrike on 17 Feb 2012, 03:31, edited 1 time in total.
---
A joke is a very serious thing.
User avatar
Doublestrike
UI Programmer
 
Posts: 715
Joined: 08 Aug 2011, 09:07
Location: Bali
Has thanked: 183 times
Been thanked: 161 times

Re: General UI support

Postby Doublestrike » 17 Feb 2012, 00:33

Sloth wrote:I toyed around with the code and i find several versions that prevents the artifacts from appearing. Now i wonder what else could be wrong. Should the battlefield background image be visible?
Was re-reading this - do these versions have rounded corners? That's the whole problem here.

Nothing else is wrong, just commented out. The code is built so multiple backgrounds won't be painted if it's not necessary. It's all been fully tested and works great, except for those blasted radii.
---
A joke is a very serious thing.
User avatar
Doublestrike
UI Programmer
 
Posts: 715
Joined: 08 Aug 2011, 09:07
Location: Bali
Has thanked: 183 times
Been thanked: 161 times

Re: General UI support

Postby Chris H. » 17 Feb 2012, 01:01

Doublestrike wrote:Actually, g2d0 is already created from the root graphics, so that would be introducing another graphics canvas, just so you know (performance!). But that may be the only way to solve the problem...
`
I built a local copy with Maven using my attempt and played for awhile. It got to the point where things were starting to slow down during one of the matches. I checked my Activity Monitor and forge was using less than 700 MB at that time.

So my solution may need additional testing. :(
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 63 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 63 users online :: 0 registered, 0 hidden and 63 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 63 guests

Login Form