• entries
    707
  • comments
    1173
  • views
    434109

I pray to thee, Internet Gods!

Sign in to follow this  

69 views

My internet is acting really screwy, like always. I started writing this at about 4 this morning, but before I could post it, my cable went out again. Hoping, now that it is 4pm, I can post it. Not much to update about. I spent entirely too much time working on my GUI over the weekend and too little time working on Malathedra. Raymond on the other hand got a shit ton of stuff done and the game is really looking good. So, I sat my other projects aside for now and I'm going to focus on Malathedra. Finishing my contest entry is important to me, but it's not fair to make Raymond do all the work.

So, anyway. I have a couple screenshots to show off[grin].


OMFG, CHECKBOXES!!!


This uses the default ListBoxItem class and I just add checkboxes to each at m_nWidth - 28 or something like that.


Transparency


I finally setup the system so that I can use partially transparent textures (kind of hard to tell in this screenshot, but the blue shows through somewhat.) I've also set the ListBoxItem's inactive background color to 0 alpha so that it doesn't look horrible.


Etc.


I implemented a system that calculates the number of visible characters and appends an elipsis to the end so that it looks better. "But, what if I want to see the whole text Donny?", you ask.


Almost there



Got it


The ListBoxItem is expanded upon hover and clicking and then returns to normal when not hovered/clicked.

The only thing I really need to implement now is text-scrolling for my TextBox class, but I'm going to save that for another time.

I also fixed my code. Here's the old initialization code for comparison:

Button* pButton = new Button;
pButton->Set(0, "Add Item", 10, 10, 100, 24, NewGameButtonID);
m_WidgetMgr.AddWidget(pButton);

pButton = new Button;
pButton->Set(0, "Password", 120, 10, 100, 24, PasswordButtonID);
m_WidgetMgr.AddWidget(pButton);

pButton = new Button;
pButton->Set(0, "Quit", 230, 10, 100, 24, QuitButtonID);
m_WidgetMgr.AddWidget(pButton);

TextBox* pTextBox = new TextBox;
pTextBox->Set(0, "This is sample text", 300, 300 - 36, 200, 24, DemoTextBoxID);
m_WidgetMgr.AddWidget(pTextBox);

pTextBox = new TextBox;
pTextBox->Set(0, "*", 400 - 12, 300, 24, 24, PasswordCharBoxID);
pTextBox->SetCharLimit(1);
m_WidgetMgr.AddWidget(pTextBox);

Fader* pFader = new Fader;
pFader->Set(0, 100, 100, 255, 20, RedSliderID, true);
pFader->SetMaxValue(255);
m_WidgetMgr.AddWidget(pFader);

pFader = new Fader;
pFader->Set(0, 100, 130, 255, 20, GreenSliderID, true);
pFader->SetMaxValue(255);
m_WidgetMgr.AddWidget(pFader);

pFader = new Fader;
pFader->Set(0, 100, 160, 255, 20, BlueSliderID, true);
pFader->SetMaxValue(255);
m_WidgetMgr.AddWidget(pFader);

CheckBox* pCheckBox = new CheckBox;
pCheckBox->Set(0, 500, 500, CheckBoxID);
m_WidgetMgr.AddWidget(pCheckBox);

Tally* pTally = new Tally;
pTally->Set(0, 150, 200, 150, 24, TallyID);
pTally->SetMaxValue(5);
m_WidgetMgr.AddWidget(pTally);

pTextBox = new TextBox;
pTextBox->Set(0, "5", 307, 200, 30, 24, TallyMaxValueTextBoxID);
pTextBox->SetCharLimit(2);
m_WidgetMgr.AddWidget(pTextBox);

pButton = new Button;
pButton->Set(0, "Apply", 341, 200, 100, 24, SetTallyMaxValueButtonID);
m_WidgetMgr.AddWidget(pButton);

Counter* pCounter = new Counter;
pCounter->Set(0, 500, 200, 77, 24, CounterID);
pCounter->SetMaxValue(10);
m_WidgetMgr.AddWidget(pCounter);

ListBox* pListBox = new ListBox;
pListBox->Set(0, 500, 300, 250, (50 * 3) + 1, ListBoxID);
ListBox::ListBoxItem* pItem = 0;
for(int nIndex = 1; nIndex < 16; ++nIndex)
{
char szText[32];
sprintf(szText, "Item %i", nIndex);
pItem = new ListBox::ListBoxItem;
pItem->Set(pListBox, szText);
pListBox->AddChild(pItem);
}
m_WidgetMgr.AddWidget(pListBox);

pListBox = new ListBox;
pListBox->Set(0, 100, 300, 250, (50 * 3) + 1, ListBox2ID);
for(int nIndex = 1; nIndex < 16; ++nIndex)
{
char szText[32];
sprintf(szText, "Item %i", nIndex);
pItem = new ListBox::ListBoxItem;
pItem->Set(pListBox, szText);
pListBox->AddChild(pItem);
}
m_WidgetMgr.AddWidget(pListBox);

DropDownList* pDropDownList = new DropDownList;
pDropDownList->Set(0, 565, 10, 250, 280, DropListID);
for(int nIndex = 1; nIndex < 16; ++nIndex)
{
char szText[32];
sprintf(szText, "Item %i", nIndex);
pItem = new ListBox::ListBoxItem;
pItem->Set(pDropDownList, szText);
pDropDownList->AddChild(pItem);
}
m_WidgetMgr.AddWidget(pDropDownList);

pButton = new Button;
pButton->Set(0, "Remove", 650, 455, 100, 24, RemoveItemButtonID);
m_WidgetMgr.AddWidget(pButton);






And the new code:

m_WidgetMgr.AddWidget(new Button(0, "Add Item", 10, 10, 100, 24, NewGameButtonID));
m_WidgetMgr.AddWidget(new Button(0, "Password", 120, 10, 100, 24, PasswordButtonID));
m_WidgetMgr.AddWidget(new Button(0, "Quit", 230, 10, 100, 24, QuitButtonID));
m_WidgetMgr.AddWidget(new Button(0, "Remove", 500, 555, 100, 24, RemoveItemButtonID));

m_WidgetMgr.AddWidget(new TextBox(0, "This is sample text", 300, 300 - 36, 200, 24, DemoTextBoxID));
m_WidgetMgr.AddWidget(new TextBox(0, "*", 400 - 12, 300, 24, 24, PasswordCharBoxID, 1));

m_WidgetMgr.AddWidget(new Fader(0, 100, 100, 255, 20, RedSliderID, true, 0, 255));
m_WidgetMgr.AddWidget(new Fader(0, 100, 130, 255, 20, GreenSliderID, true, 0, 255));
m_WidgetMgr.AddWidget(new Fader(0, 100, 160, 255, 20, BlueSliderID, true, 0, 255));

m_WidgetMgr.AddWidget(new CheckBox(0, 450, 500, CheckBoxID));

m_WidgetMgr.AddWidget(new Tally(0, 150, 200, 150, 24, TallyID, 5));

m_WidgetMgr.AddWidget(new Counter(0, 500, 200, 77, 24, CounterID, 0, 10));

ListBox* pListBox = (ListBox*)m_WidgetMgr.AddWidget(new ListBox(0, 500, 300, 250, (31 * 8) + 1, ListBoxID));
for(int nIndex = 1; nIndex < 16; ++nIndex)
{
char szText[32];
sprintf(szText, "Item %i", nIndex);

ListBox::ListBoxItem* pItem = (ListBox::ListBoxItem*)pListBox->AddChild(new ListBox::ListBoxItem(pListBox, szText, 31));
pItem->AddChild(new CheckBox(pItem, pItem->GetWidth() - 28, 3, pItem->GetID()));

}

pListBox = (ListBox*)m_WidgetMgr.AddWidget(new ListBox(0, 100, 300, 250, 250, ListBox2ID));
for(int nIndex = 1; nIndex < 16; ++nIndex)
{
char szText[32];
sprintf(szText, "Item %i", nIndex);

pListBox->AddChild(new ListBox::ListBoxItem(pListBox, szText, 24));

}

Widget* pDropDownList = m_WidgetMgr.AddWidget(new DropDownList(0, 565, 10, 250, 280, DropListID));
for(int nIndex = 1; nIndex < 16; ++nIndex)
{
char szText[32];
sprintf(szText, "Item %i", nIndex);

pDropDownList->AddChild(new ListBox::ListBoxItem(pListBox, szText, 24));

}






Old code = 99 lines
New code = 49 lines

Anyway, I'm submitting before my internet goes again. I'll update once I get the notice from them that they've fixed it/stopped working on it or whatever. Anyway, I'm off to do some Malathedra scripting.

Edit: Also, sorry about the watermarks. I'm going to be removing them since they get in the way and bloat the file.

Edit 2: One other thing. I modified the DropDownList so that when you open it, the listbox is activated (meaning, that when you open the drop-down-list, you can scroll with the mousewheel without having to open-click-reopen (since it closes when an item is selected.)

I also tried a different texture, just to test things out. I'm really glad I did because I had my texture system all screwed up . I'm not going to go into it though (It's not difficult to explain or understand, it's just hard without chopping a bunch of code snippets together and I don't have the time.) Suffice it to say, my texture system is working perfect now (AFAIK, I'll have to upload another demo for you guys to test for me), and it's a lot easier to interact with.

Edit 3: Agh, I almost forgot. I made 2 new images and added them to my gallery last night. I decided to try my hand at pixel art. The original skull was done in paint and then I imported it into Adobe Photoshop Elements 3.0 and colored it, added the red eye, and blurred the outline. The flames for the second one were done in Macromedia Fireworks.
Sign in to follow this  


2 Comments


Recommended Comments

How dare you not have Malathedra up on the absolute things that need 110% effort, dedication and focus list!

I'm telling! (since raymond never reads journals)

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now