Now I have tought about how could a card editor could work. I am only currently trying to design what it would look like, I am not actively coding. I found a GUI lately that works well and which is convenient to use(code). I also found the "alfont" library which allows to use resizable ttf fonts in Allegro. I simply did not find a free, simple to use PDF maker library so the files will be save on either 300 or 600 DPI Jpg. I tought I could make a post to ask some question and get some comments.
The card editor would basically require these steps
- Template Data : This step is important because it cannot be changed later. It consist in determining what it the items(see below) that will appear on the cards. It cannot be changed later because adding and removing items would mean to change the card database information.
- Template Configuration : Is is simply placing the items, setting options, changing colors, etc.
- Material Loading: It consist in loading textures, background, pictures, icons that will be used by the template.
- Data Entry : This step consist in entring data in the database to create cards. You will abe able to preview the cards.
- Card generation : You select some options, push the red button and it generates the cards.
A card will be made of items or if you prefer components. These components are listed below. Feel free to add some if you have new ideas.
- Bitmap : The bitmap component is used for card background and picture on the card. You will be allowed to determine the size and the placement with zoom, stretch and other possibilities.
- Text String : This is a simple text string used to show the card's name, type of card, illustrator's name, etc. You would be allowed to rotate text and if possible draw it from top to bottom.
- Multiline text : This is used for writting a paragraph of text. This item would be more sophisticated than text string since it must do some word wrap and must adjust the size of the font according to the amount of text to write.
- Icon List : The best example is mana cost in MTG. You have a series of icon where is icon is identified by a letter or number.(ex : in MTG : 2WW ). This component will also allow you to draw your icon in columns or in a 3xN grid like in vampire.
- Shape : This will allow you to draw any basic shape ( circle, rectangle ) anywhere on the card. You would also be able to apply any other effect , like translucency or texture maping, which are available in the Allegro library.
Now there is a few thing that I am not sure if I am going to be able to implements :
- Conditional layout : Change some aspect of the layout according to some information in the card. Ex : In MTG, creatures have an additional rectangle with power/toughness number in it. In this case, you will have to make 2 different card database.
- Icon in text: Since I would be using TTF, I don't think I would be able to put an icon in the middle of a text string and then continue the text. Unless you have a font that actually contains those symbols.
- Standard Variables: One nice thing in the MTG editor are varaibles that can be used in the text like: card name, card id number, etc. I am not sure If I will do this.
For example, a MTG card has the following components :
Text String : Card Name
Text String : Card Type
Text String : Illustrator's name
Text String : Copyright
Text String : Power/Toughness
Multiline Text : Card effect
Multiline Text : Useless additional text
Bitmap : Background
Bitmap : Picture
Icon List : Mana
Icon List : Collection
For a total of 11 components.
Now I intend to make the number of components you can place on a card static ( easier to code ).
Do you think that 16 components on a card is far enough or do you need more components?
I will probably be using my own database system that I have created for video games. All the data in an entry are saved as a data stream of bytes in memory or a file. The stream is made according to a data structure and it works pretty well.
Now the problem is that the data structure must now be dynamic because I don't know what item would the user want on his card. The only way to make it static is to predefine the item on the card (ex: all cards have 3 multitex, 5 string, 3 icon list and 3 picture). But it is ugly and it will take too much space for nothing.
So I must create a list of items according to the user and I must read the stream byte per byte since I don't have a struct. Now removing or adding items on the card would mean to alterate all the data in all the data stream which is already variables. So doing so would require some conversion operation between the old and new format.
Now the reason why I tought of determining a fixed list of item is because it is first easier to manage internally since we would would now have : a variables list of item with varaibles content type ( too much variables (^_^) ) and all the forms and windows will have to be generated dynamically because I don't know how much neither the type of control that should appear on the form before run-time.
It get even worst when the gui create a new class for components that can be clicked ( ex: button ) to redefine the onClick method ( sorry for the technicallities ). The problem is that I can't create a class at run-time. It just complexify things.
By the way, I cannot use rich text boxes ( I am not coding with windows DLL here ). From what I know, I can draw some character strings according to a font. I can look to see how much control I have on the position of the text to cut the text, draw an icon, and then continue the text, but I am not sure yet and it might get ugly with the font resizing.
Anyway, It does not mean that everything above is impossible, it just mean that it will take more time. So I would better have a more limited software, done faster that works. Then if I want it, I could make improvements.