-
Purple stuff.
Well, it's come to this, my least favorite thing to work on. It's like the stuff in the fridge that never gets drank until you're out of everything else: The purple stuff. :tongue2: (I'm talking about the UI of course.)
There's actually been a whole bunch of cool stuff, but a there's a few pertaining to this particular topic worthy of interest. The first is actual good looking pixel-perfect font support such as bitmap and ASCII type fonts. These are much easier to get to look right at low resolutions than freetype fonts. That and the GUI code is actually being worked on now. That last part might also be important... :\
Also, the complete bestiary:
http://s28.postimg.org/q7yygcba1/gui1.jpg ... http://s30.postimg.org/pifr856b1/gui2.jpg
The todo list for these isn't actually so bad though. In a nutshell:
-Implement some kind of auto layout.
-Have a parent of default GUI so that fonts and skins don't have to be manually set.
-Implement a ListBox with customizable ListContents so that UI's with many items or texts will be much more simple (eg. Inventories).
-Fix bugs aaah!
You can see what I mean from the code that does the window:
Code:
class TestScreen : public Screen
{
public:
Font f;
Texture frameTex;
Texture bgTex;
Sprite frameSprite;
Sprite bgSprite;
AnimatedSpriteSet curMonsterSprite;
SpriteBatch m_spriteBatch;
Widget mainMenu;
Frame frame[3];
Widget infoContainer;
Label monsterName;
Label attribNames[12];
Label monsterStats[12];
BackgroundImage bgImage;
int curID;
bool needsUpdate;
TestScreen()
{
curID = 0;
needsUpdate = true;
f.LoadFromFile("data/fonts/ff1_gba_font.png", 8);
bgTex.LoadFromFile("data/textures/gui.png");
//bgTex.SetFilterMode(0x2601);
frameSprite.Create( &bgTex, Rect(0,64,24,24) );
bgSprite.Create( &bgTex, Rect(64,0,64,64) );
bgImage.SetSize(256,224);
bgImage.SetSprite( bgSprite );
bgImage.SetAutoFitSprite(true);
foreachi(i, 3) {
frame[i].SetFromSprite(frameSprite);
//frame[i].SetBackground(bgSprite);
}
monsterName.SetFont(&f);
monsterName.SetPosition(12,12);
monsterName.SetSize(20, 80);
monsterName.SetTextAlignment(AlignCenter);
frame[0].AddChild(&monsterName);
frame[0].SetSize( 128, 32 );
frame[1].SetSize( 128, 224 );
frame[2].SetSize( 128, 32 );
frame[0].SetPosition( 0, 0 );
frame[1].SetPosition( 128, 0 );
frame[2].SetPosition( 0, 224-32 );
infoContainer.SetPosition(16,16);
infoContainer.SetSize(frame[1].GetSize() - 32.f);
const char* attr[12] = {
"Defeated",
"HP",
"Attack",
"Accuracy",
"Defense",
"Agility",
"Intelligence",
"Evasion",
"Magic Defense",
"Gil",
"EXP",
"Treasure"
};
foreachi(i, 12) {
//TODO: Implement a default "skin" for all parent GUI objects to make these go away.
attribNames[i].SetFont(&f);
attribNames[i].SetText(attr[i]);
monsterStats[i].SetFont(&f);
monsterStats[i].SetColor( Color::Yellow() );
monsterStats[i].SetTextAlignment(AlignRight);
//TODO improve ListBox to easily handle this kind of crap.
attribNames[i].SetPosition(0, i * 16);
monsterStats[i].SetPosition(80, i * 16);
attribNames[i].SetSize(80, 16);
monsterStats[i].SetSize(20, 16);
infoContainer.AddChild(&attribNames[i]);
infoContainer.AddChild(&monsterStats[i]);
}
frame[1].AddChild(&infoContainer);
mainMenu.AddChild(&bgImage);
mainMenu.AddChild(&frame[0]);
mainMenu.AddChild(&frame[1]);
mainMenu.AddChild(&frame[2]);
}
void Update()
{
if( Input::GetKeyboard()->IsKeyPressed(KEY_LEFT) )
{
if( --curID < 0 )
curID = 127;
needsUpdate = true;
}
else if( Input::GetKeyboard()->IsKeyPressed(KEY_RIGHT) )
{
if( ++curID > 127 )
curID = 0;
needsUpdate = true;
}
if(needsUpdate)
{
needsUpdate = false;
MonsterData* m = GetDatabase()->GetMonster(curID);
ASSERT(m);
AnimatedSpriteSetAsset* as = GetDatabase()->GetMonsterBattleSpriteSetAsset(m->battle_spriteset_id);
bool isLoaded = as->LoadAnimatedSpriteSet(curMonsterSprite);
ASSERT(isLoaded);
int i(0);
monsterName.SetText( m->name );
monsterStats[i++].SetText("0");
monsterStats[i++].SetText( ToString(m->attributes.max_params[0]) );
monsterStats[i++].SetText( ToString(m->attributes.stats[0]) );
monsterStats[i++].SetText( ToString(m->attributes.stats[2]) );
monsterStats[i++].SetText( ToString(m->attributes.stats[1]) );
monsterStats[i++].SetText( ToString(m->attributes.stats[3]) );
monsterStats[i++].SetText( ToString(m->attributes.stats[4]) );
monsterStats[i++].SetText( ToString(m->attributes.stats[3]) );
monsterStats[i++].SetText( ToString(m->attributes.stats[5]) );
monsterStats[i++].SetText( ToString(m->gold) );
monsterStats[i++].SetText( ToString(m->exp) );
monsterStats[i++].SetText(""); //treasure
}
mainMenu.Update();
curMonsterSprite.Update();
}
void Render()
{
m_spriteBatch.Begin();
// draw it
mainMenu.Render(&m_spriteBatch);
m_spriteBatch.DrawAnimatedSpriteSet( curMonsterSprite, Vector2(64,112) - (curMonsterSprite.size/2.f) );
m_spriteBatch.Render();
m_spriteBatch.End();
}
};
Obviously not the worst Gui code--most other game UI code is pretty horrendous, actually-- but with a little work it shouldn't be too bad. It'll also be easier to do menus as a script in it's final form.
-
I was just thinking about FFC... Awesome work Gleeok!
-
This is neat. I've been waiting to hear some development news.
-
-
:D Purple dragon! I like purple! Purple is awesome!
...Wait, all that code is for making things purple?! :o That looks like a lot of work for purple! I respect it even more now!
[/obviously a joke. Duh. but I really do like purple.]