It is currently 23 Apr 2024, 22:11
   
Text Size

Simple Phase Step Viewer

Moderators: ubeefx, beholder, melvin, ShawnieBoy, Lodici, CCGHQ Admins

Simple Phase Step Viewer

Postby 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".

PhaseStepViewer.png

-Lodici
Attachments
PhaseStepViewer.diff.txt
(8.42 KiB) Downloaded 279 times
User avatar
Lodici
Programmer
 
Posts: 399
Joined: 13 Oct 2013, 09:44
Has thanked: 29 times
Been thanked: 71 times

Re: Simple Phase Step Viewer

Postby 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.
User avatar
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

Postby 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
User avatar
Lodici
Programmer
 
Posts: 399
Joined: 13 Oct 2013, 09:44
Has thanked: 29 times
Been thanked: 71 times

Re: Simple Phase Step Viewer

Postby 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.
User avatar
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

Postby 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
Attachments
PhaseStepViewer_MigLayout.diff.txt
(2.11 KiB) Downloaded 286 times
User avatar
Lodici
Programmer
 
Posts: 399
Joined: 13 Oct 2013, 09:44
Has thanked: 29 times
Been thanked: 71 times

Re: Simple Phase Step Viewer

Postby 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)?
User avatar
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

Postby Lodici » 27 Oct 2013, 14:45

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)?
Ah, you discovered my deliberate error. :wink: You are right, they should both be the same value.

- Lodici
User avatar
Lodici
Programmer
 
Posts: 399
Joined: 13 Oct 2013, 09:44
Has thanked: 29 times
Been thanked: 71 times

Re: Simple Phase Step Viewer

Postby 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
Attachments
GameDuelViewer_Cosmetics.diff.txt
(1.95 KiB) Downloaded 276 times
User avatar
Lodici
Programmer
 
Posts: 399
Joined: 13 Oct 2013, 09:44
Has thanked: 29 times
Been thanked: 71 times

Re: Simple Phase Step Viewer

Postby melvin » 28 Oct 2013, 03:39

Lodici wrote:Please find attached the PhaseStepViewer inset fix and a fix for the border painting on the GameDuelViewer titlebar.
Wonderful, I've merged this change in as https://code.google.com/p/magarena/sour ... 5dd622fa7f

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.
User avatar
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

Postby 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.
screenshot.png
screenshot.png (7.57 KiB) Viewed 5858 times


- Lodici
Attachments
TranslucentTabSelector.diff.txt
(3.46 KiB) Downloaded 274 times
User avatar
Lodici
Programmer
 
Posts: 399
Joined: 13 Oct 2013, 09:44
Has thanked: 29 times
Been thanked: 71 times

Re: Simple Phase Step Viewer

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

screenshot.png

Note, this does require MigLayout.

- Lodici
Attachments
GameDuelViewerAvatar.diff.txt
(9.16 KiB) Downloaded 288 times
User avatar
Lodici
Programmer
 
Posts: 399
Joined: 13 Oct 2013, 09:44
Has thanked: 29 times
Been thanked: 71 times

Re: Simple Phase Step Viewer

Postby 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.
Attachments
clip.png
User avatar
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

Postby 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
Attachments
GameDuelViewer_ResizeFix.diff.txt
(2.86 KiB) Downloaded 279 times
User avatar
Lodici
Programmer
 
Posts: 399
Joined: 13 Oct 2013, 09:44
Has thanked: 29 times
Been thanked: 71 times

Re: Simple Phase Step Viewer

Postby melvin » 29 Oct 2013, 01:42

Thanks, that did the trick. It all fits now. I've merged your changes to the main repo.
Attachments
dialog.png
User avatar
melvin
AI Programmer
 
Posts: 1062
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 459 times


Return to Magarena

Who is online

Users browsing this forum: No registered users and 14 guests


Who is online

In total there are 14 users online :: 0 registered, 0 hidden and 14 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 14 guests

Login Form