User Tag List

Results 1 to 5 of 5

Thread: Purple stuff.

  1. #1
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,827
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,978
    Level
    33
    vBActivity - Bars
    Lv. Percent
    28.3%

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

    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.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  2. #2
    Cor Blimey! CJC's Avatar
    Join Date
    Dec 2002
    Location
    Fading into the darkness
    Age
    36
    Posts
    1,398
    Mentioned
    150 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,640
    Level
    25
    vBActivity - Bars
    Lv. Percent
    4.39%
    I was just thinking about FFC... Awesome work Gleeok!

  3. #3
    birb Tim's Avatar
    Join Date
    Apr 2004
    Age
    36
    Posts
    679
    Mentioned
    41 Post(s)
    Tagged
    8 Thread(s)
    vBActivity - Stats
    Points
    3,636
    Level
    19
    vBActivity - Bars
    Lv. Percent
    29.04%
    This is neat. I've been waiting to hear some development news.

  4. #4
    クールな男
    MasterSwordUltima's Avatar
    Join Date
    Jul 2001
    Location
    Keystonia
    Age
    36
    Posts
    5,588
    Mentioned
    20 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    8,615
    Level
    27
    vBActivity - Bars
    Lv. Percent
    99.77%
    Oh boy oh boy!!

  5. #5
    Karate guys for cash. Aegix Drakan's Avatar
    Join Date
    Sep 2005
    Location
    Montreal, Canada.
    Age
    36
    Posts
    2,305
    Mentioned
    0 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    6,858
    Level
    25
    vBActivity - Bars
    Lv. Percent
    38.8%
    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.]
    Last edited by Aegix Drakan; 02-04-2014 at 08:49 PM.
    Quote Originally Posted by phattonez
    AGN is not meant for people who have lives. Come back home, turn the lights off and stare in awe at the glow that comes from the monitor.
    Do you enjoy challenging RPGs? Do you enjoy dark storylines? You'll like my game. Go on, it's not very long.
    You can download my game for free right here!
    Feedback on it would be nice. It'll help with future projects.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social