Simple Phase Step Viewer
by ubeefx
Moderators: ubeefx, beholder, melvin, ShawnieBoy, Lodici, CCGHQ Admins
Simple Phase Step Viewer
by Lodici » 26 Oct 2013, 17:34
Being new to MTG I wrote this small feature to help me remember how the various phases and steps that make up a turn are organized. It uses tooltips to display the full phase/step name, for example if I hover the mouse cursor over "DA" it will display "Combat Phase: Declare Attackers Step".
-Lodici
-Lodici
- Attachments
-
- PhaseStepViewer.diff.txt
- (8.42 KiB) Downloaded 279 times
Re: Simple Phase Step Viewer
by melvin » 27 Oct 2013, 01:40
This is very helpful! A good step in the direction to addressing https://code.google.com/p/magarena/issues/detail?id=1
Merging this right now, just in time for this month's release.
Merging this right now, just in time for this month's release.
-
melvin - AI Programmer
- Posts: 1062
- Joined: 21 Mar 2010, 12:26
- Location: Singapore
- Has thanked: 36 times
- Been thanked: 459 times
Re: Simple Phase Step Viewer
by Lodici » 27 Oct 2013, 11:15
Not sure why you changed the layout - I used BoxLayout instead of FlowLayout (which is very limited) specifically so that it would use the whole width of the GameDualViewer which I think looks better and less cramped. If I had wanted to make the code simpler (ie use ordinal) without changing the display I would have preferred to use MigLayout but that would have meant introducing a new external library.
- Lodici
- Lodici
Re: Simple Phase Step Viewer
by melvin » 27 Oct 2013, 11:59
The BoxLayout was overflowing for me on a 1920 x 1080 display, the last two phases were not visible. I tried tweaking the amount of gap and initial padding but I wasn't sure if it would work properly on different resolutions. The FlowLayout seems to do it properly without any additional tweaks, hence I chose it in the end.
Is it possible to have it use the full width in a programmatic way without fixing the amount gap in advance? I think SpringLayout might do the trick but didn't have enough time to work it out.
Is it possible to have it use the full width in a programmatic way without fixing the amount gap in advance? I think SpringLayout might do the trick but didn't have enough time to work it out.
-
melvin - AI Programmer
- Posts: 1062
- Joined: 21 Mar 2010, 12:26
- Location: Singapore
- Has thanked: 36 times
- Been thanked: 459 times
Re: Simple Phase Step Viewer
by Lodici » 27 Oct 2013, 13:42
Ok, thanks for the clarification. The LHS of the game screen appears to be fixed at 300px so I assumed that absolute dimensions would work regardless of resolution.
I am not sure whether the SpringLayout would work either. TBH, most of my experience is with MigLayout which is a powerful replacement for all the myriad native layout managers producing much more concise and cleaner code.
I have attached an update you might want to try which I think will fix the problem. Note, the minimal update required to the existing code.
It uses the MigLayout library which I have added via the Build.xml file - not sure if this is correct way to do it. After downloading, you will need to add a reference to "miglayout-core-4.2.jar" and "miglayout-swing-4.2.jar" in order to build.
- Lodici
I am not sure whether the SpringLayout would work either. TBH, most of my experience is with MigLayout which is a powerful replacement for all the myriad native layout managers producing much more concise and cleaner code.
I have attached an update you might want to try which I think will fix the problem. Note, the minimal update required to the existing code.
It uses the MigLayout library which I have added via the Build.xml file - not sure if this is correct way to do it. After downloading, you will need to add a reference to "miglayout-core-4.2.jar" and "miglayout-swing-4.2.jar" in order to build.
- Lodici
- Attachments
-
- PhaseStepViewer_MigLayout.diff.txt
- (2.11 KiB) Downloaded 286 times
Re: Simple Phase Step Viewer
by melvin » 27 Oct 2013, 14:21
I just checkout out your patch, it looks good and the needed lib are self contained and quite small.
I'm curious as to why the asymmetry in the insets for the left and right side (4 on the left and 6 on the right)?
I'm curious as to why the asymmetry in the insets for the left and right side (4 on the left and 6 on the right)?
-
melvin - AI Programmer
- Posts: 1062
- Joined: 21 Mar 2010, 12:26
- Location: Singapore
- Has thanked: 36 times
- Been thanked: 459 times
Re: Simple Phase Step Viewer
by Lodici » 27 Oct 2013, 14:45
Ah, you discovered my deliberate error. You are right, they should both be the same value.melvin wrote:I'm curious as to why the asymmetry in the insets for the left and right side (4 on the left and 6 on the right)?
- Lodici
Re: Simple Phase Step Viewer
by Lodici » 27 Oct 2013, 20:40
Please find attached the PhaseStepViewer inset fix and a fix for the border painting on the GameDuelViewer titlebar.
- Lodici
- Lodici
- Attachments
-
- GameDuelViewer_Cosmetics.diff.txt
- (1.95 KiB) Downloaded 276 times
Re: Simple Phase Step Viewer
by melvin » 28 Oct 2013, 03:39
Wonderful, I've merged this change in as https://code.google.com/p/magarena/sour ... 5dd622fa7fLodici wrote:Please find attached the PhaseStepViewer inset fix and a fix for the border painting on the GameDuelViewer titlebar.
For the longest time, this project had no external dependency. The first to be added was Groovy, as it allowed us to write card scripts in groovy that can be loaded dynamically at runtime.
In this case, I think the ability of MigLayout to simplify and make it easier for us to modify the UI going forward is sufficient reason to include it as a dependency.
-
melvin - AI Programmer
- Posts: 1062
- Joined: 21 Mar 2010, 12:26
- Location: Singapore
- Has thanked: 36 times
- Been thanked: 459 times
Re: Simple Phase Step Viewer
by Lodici » 28 Oct 2013, 11:32
Here is a small update that makes the TabSelector buttons appear kind of translucent on the GameDuelViewer component. Note this is an optional property via an additional constructor method and does not affect any of the other instances where the TabSelector is used.
- Lodici
- screenshot.png (7.57 KiB) Viewed 5878 times
- Lodici
- Attachments
-
- TranslucentTabSelector.diff.txt
- (3.46 KiB) Downloaded 274 times
Re: Simple Phase Step Viewer
by Lodici » 28 Oct 2013, 12:20
Here is an update that replaces the up/down arrow with the actual avatar of the player whose turn it is which I think is a bit clearer.
Note, this does require MigLayout.
- Lodici
Note, this does require MigLayout.
- Lodici
- Attachments
-
- GameDuelViewerAvatar.diff.txt
- (9.16 KiB) Downloaded 288 times
Re: Simple Phase Step Viewer
by melvin » 28 Oct 2013, 13:09
Thanks for the two updates. The translucent tab looks nicer and less jaring. Replacing the arrow to an avatar is a great idea! Unfortunately, after I apply your patch the title bar and phase step viewer overflow and is clipped of. See attached screenshot.
-
melvin - AI Programmer
- Posts: 1062
- Joined: 21 Mar 2010, 12:26
- Location: Singapore
- Has thanked: 36 times
- Been thanked: 459 times
Re: Simple Phase Step Viewer
by Lodici » 28 Oct 2013, 14:34
It looks like your "dialog" font is wider than mine. I have attached what I hope is a fix for your problem. I have reduced the font size of the phase bar and amended a couple of resizing parameters which previously were preventing components shrinking to a more optimum minimum size.
- Lodici
- Lodici
- Attachments
-
- GameDuelViewer_ResizeFix.diff.txt
- (2.86 KiB) Downloaded 279 times
Re: Simple Phase Step Viewer
by melvin » 29 Oct 2013, 01:42
Thanks, that did the trick. It all fits now. I've merged your changes to the main repo.
-
melvin - AI Programmer
- Posts: 1062
- Joined: 21 Mar 2010, 12:26
- Location: Singapore
- Has thanked: 36 times
- Been thanked: 459 times
14 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 49 guests