General UI support
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
Re: General UI support
by 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.
-

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
by 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):
====
On the outside chance this last thing worked, background textures should be returned.
====
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);
====
On the outside chance this last thing worked, background textures should be returned.
---
A joke is a very serious thing.
A joke is a very serious thing.
-

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
by 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.
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
-

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
by Doublestrike » 16 Feb 2012, 06:53
Thanks and yep, that's the rub, right theremoomarc wrote:Well, things are working on my side, but that doesn't help I guess seeing as I never had any of the issues.
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.)moomarc wrote:...avatars...
---
A joke is a very serious thing.
A joke is a very serious thing.
-

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
by Sloth » 16 Feb 2012, 09:17
The problem is back, sorry Doublestrike. I will take a look at the code though.Doublestrike wrote:I have committed r14097 as a last gasp effort to fix this.
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: General UI support
by 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.
A joke is a very serious thing.
-

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
by Sloth » 16 Feb 2012, 11:48
I don't know what it should look like, but when i remove the following part, i don't have problems anymore: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):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.
- 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);
- 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);
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: General UI support
by Chris H. » 16 Feb 2012, 12:25
just for the heck of it, I modified line 248 from:
to:
and it looks better, I get a similar result as the one from Sloth. Granted, the battlefield is missing the picture.
- 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.
-

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
by 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
- 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
by Sloth » 16 Feb 2012, 12:53
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?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.
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: General UI support
by moomarc » 16 Feb 2012, 13:17
I'll add it to the avatars sprite. Look for it soon...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
EDIT: Done! Its the last avatar in the list.
-Marc
-

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
by 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.
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.
-

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
by Doublestrike » 17 Feb 2012, 00:25
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.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.
Yeah, not too hard a problem to solve - unless you can't see the artifacts
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...Chris H wrote:g2d0.create().setClip(clip);
===
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.
A joke is a very serious thing.
-

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
by Doublestrike » 17 Feb 2012, 00:33
Was re-reading this - do these versions have rounded corners? That's the whole problem here.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?
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.
A joke is a very serious thing.
-

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
by 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.
-

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
Who is online
Users browsing this forum: No registered users and 63 guests