[CODE] New Deck Editor

All code submission.
Dimoutzi
Posts: 10
Joined: Mon Feb 15, 2010 3:06 pm

[CODE] New Deck Editor

Post by Dimoutzi » Wed Feb 17, 2010 12:24 pm

I made a little Deck Editor, mainly to familiarize myself with the Wagic Code. It's not intended to be better than
the old editor, it has no fancy card scrolling or deck statistics, but it is "Fast and Simple". I made it for myself,
but here is the code if someone wants to check it out.

http://www.megaupload.com/?d=8658EA65
http://rapidshare.com/files/350969074/w ... r.rar.html
(i also added it as a file attachment with this post).

1. download the code and unrar
copy GameStateDeckEditor.cpp to the /src/ directory
copy GameStateDeckEditor.h to the /include/ directory
copy filter_buttons.png to the /bin/Res/graphics/ directory

I copied the filter buttons from Micropose's 'shandalar' game. If you dont like it, then just load the file and make
new buttons in a paint program. Just make certain you keep the buttons 40x40 (unless you want to edit the code)

2. Go to gameApp.cpp and replace the 'GameStateDeckViewer' with 'GameStateDeckEditor' and compile

No need to overwrite anything because this editor has it's own files. Optionally people can add a new
option to the OptionsMenu so players can choose between the 'classic' or 'turbo' deck editor.

Some screenshots:

The Editor in 'Deck Mode'
Image

The Editor in 'Collection Mode'
Image

The Editor in 'Filter Mode'. The editor only shows RED and ARTIFACT cards.
Image

Keys:
Most keys are the same as in the old editor. I copy&pasted the old menus (sell, welcome, main) from
the old editor. Some changes:

SELECT Button:
==============
This button places the us on the FilterButtons.

With the LEFT/RIGHT buttons we can cycle through the various filter buttons. The current
position is show with the golden edge around the button.

With the UP button we can "push" the button, which means the cards are shown normally. Pushed
buttons are shown with the grey edge.

With the DOWN button a white edge appears around the button. That means those cards are filtered
out.

To go back to the normal DECK/COLLECTION modes we push the SELECT button again.

When a change happens in the filterbuttons, the displayed cards are immediatly updated.

***

This is my first attempt to code something in Wagic, so make sure you backup your player profile/decks if you
try out this editor.
TODO list:
- when you resize the screen (PC) the layout becomes slightly messed up, because i'm not really familiar with the
way Wagic handles all the scaling of the graphics. I'll look into that some other time, but even with the messed up
layout it still works.
- Add some basic statistics for the deck, but this is a low priority, this editor was designed to be FAST and SIMPLE.
Attachments

[The extension rar has been deactivated and can no longer be displayed.]


bcdiscman
Posts: 222
Joined: Sat Jul 18, 2009 4:40 am
Location: Indiana - USA

Re: New Deck Editor

Post by bcdiscman » Wed Feb 17, 2010 2:39 pm

This looks great, will definitely give it a try.
ImageImageImageImage
BCdiscman

Jeck
Posts: 71
Joined: Mon Aug 17, 2009 11:53 pm
Location: Snow-covered forest

Re: New Deck Editor

Post by Jeck » Wed Feb 17, 2010 2:45 pm

Heh, nice. I'll download and check this out today- it looks like you've added a text overview, which is a very needed feature imho. If you're interested, I've started a thread asking for suggestions about the deck editor, please check out viewtopic.php?f=14&t=1178 . It would help Wagic to hear what things you were looking at that inspired a change like this, maybe there's something we haven't noticed :)

Jeck
Posts: 71
Joined: Mon Aug 17, 2009 11:53 pm
Location: Snow-covered forest

Re: New Deck Editor

Post by Jeck » Wed Feb 17, 2010 2:46 pm

Oh, one thing I forgot: I really like your idea to use filter icons. The current SVN has a filtering system I wrote, but adding iconic representations would be a really neat idea..

abrasax
Posts: 976
Joined: Wed Oct 15, 2008 7:46 am
Location: Switzerland

Re: New Deck Editor

Post by abrasax » Wed Feb 17, 2010 3:02 pm

Hi,

Cannot compile...

I had to change the button definition since they have change (e.g. PSP_CTRL_CROSS is now JGE_BTN_SEC) but I still have an error :

Error 5 error C2039: 'totalCopies' : is not a member of 'DeckDataWrapper' d:\wth\projects\mtg\src\gamestatedeckeditor.cpp 725

I've look at the previous rev but could not find that this was defined ?

Did I forgot domething ?

Grü

Abra
We need your Help !!!
New to wagic ? Be sure to check the following :

Bug report: Bug reporting
Help us: Add cards & Compiling.
Customize: Themes FAQ, All images thread, Abra's Mediafire folder

Dimoutzi
Posts: 10
Joined: Mon Feb 15, 2010 3:06 pm

Re: New Deck Editor

Post by Dimoutzi » Wed Feb 17, 2010 3:16 pm

abrasax wrote:Hi,
I had to change the button definition since they have change (e.g. PSP_CTRL_CROSS is now JGE_BTN_SEC) but I still have an error :

Error 5 error C2039: 'totalCopies' : is not a member of 'DeckDataWrapper' d:\wth\projects\mtg\src\gamestatedeckeditor.cpp 725
My version is still 0.11.0, so i guess changes were made. I will download the new svn code and check it out.

But you can just comment out the lines with that contain totalCopies, it's just a little statistic on the bottom of the screen, so not essential stuff.

totalCopies is a number of the total cards in a deck. So if you have 20 mountains in a deck (and no other cards). The totalCopies will be 20, but there is only 1 card in the deck (with a quantity of 20).

Dimoutzi
Posts: 10
Joined: Mon Feb 15, 2010 3:06 pm

Re: New Deck Editor

Post by Dimoutzi » Wed Feb 17, 2010 3:18 pm

Jeck wrote:it looks like you've added a text overview, which is a very needed feature imho.
My text overview is very raw, all code contained within the GameStateDeckEditor. If other parts of Wagic uses similair listviews (Trophy Room, Deck opponent chooser, etc) then it would be practical to write a SimpleListView class similair to SimpleMenu.

Dimoutzi
Posts: 10
Joined: Mon Feb 15, 2010 3:06 pm

Re: New Deck Editor

Post by Dimoutzi » Wed Feb 17, 2010 4:23 pm

ok, i found out what changed.

The totalCopies() function was renamed to totalCards() and it can now only be accessed from the MTGDeck class.
So replace: (deck)->totalCopies() with (deck)->parent->totalCards() and it works.

I'll attach the fixed files.
Attachments

[The extension rar has been deactivated and can no longer be displayed.]


abrasax
Posts: 976
Joined: Wed Oct 15, 2008 7:46 am
Location: Switzerland

Re: New Deck Editor

Post by abrasax » Wed Feb 17, 2010 4:39 pm

Hi,

So filtering works fine, I would have preferred that you filter the cards “in” instead of “out”, but that’s a matter of taste I suppose. I must admit I’m almost more fan of this filtering system than the current one, because it’s visual and because you have your deck in a list which is much easier to manage.

On the other hand the current filtering system in the SVN also have some very nice and usefull filter such as the basic ability, first letter (did we include the subtype yet ?) + you have the deck statistics…

Well anyway great work, thanks a lot for sharing it.

Grü

Abra
We need your Help !!!
New to wagic ? Be sure to check the following :

Bug report: Bug reporting
Help us: Add cards & Compiling.
Customize: Themes FAQ, All images thread, Abra's Mediafire folder

Yorien
Posts: 33
Joined: Tue Feb 02, 2010 10:59 pm

Re: New Deck Editor

Post by Yorien » Wed Feb 17, 2010 5:20 pm

Yorien says:

*smiles*

Ahh, the old Shandalar-style filtering... simple, fast and effective.

Definitively I'll try this one.

Also, some extra ideas.

- STATS on DECK Mode main screen. The most useful ones at least, (mana curve and the like) so you can have a quick glance of the deck just by taking a look at card names. Not much needed. Seems to be enough space at the right side...

- BACKGROUND. Since you seem to color-code the cards (haven't seen black cards, though, but taking into account the screenshots posted, blue doesnt' read very well) you could add some kind of "neutral" (grey, sand or whatever) background so all card colors can be clearly seen.

- MANA COST icons next to the card name. May be repetitive (you can just check the cost in the picture), but can help navigating and looking for a particular card easier.

- LAND GROUP/UNGROUP on DECK Mode. Is easier to see x19 FOREST than a bunch of x1 FOREST, x2 FOREST, x1 FOREST... in a deck. This way, you can get a quick view at the x19 FOREST if your'e only interested in the land total, but can UNGROUP them to see/change/modify if you're picky about the images or whatever.

- MORE FILTERS: Well, as abrasax said the "current" filtering method has some options this one doesn't. But since they're already coded, maybe you could also implement them on this system.
Last edited by Yorien on Wed Feb 17, 2010 8:50 pm, edited 2 times in total.

Post Reply