• entries
    707
  • comments
    1173
  • views
    433781

Untitled

Sign in to follow this  
Programmer16

71 views

Well, I guess I'll repost since I only got one reply (thanks Telastyn.) Refer to the last entry and it's second comment.

I worked on another map for Malathedra today, almost completely finished (still needs graphics.) Not much I can really say without giving something away. So, moving on.

I worked a little bit on my 4E5 entry today. I copied a lot of code from my 5 Hour Demo. So far I have my splash screen and my main menu. I just got done implementing a message box system. Like Win32 it supports ok, ok-cancel, yes, yes-no, and yes-no-cancel. BUT, you have to position and size it accordingly (buttons are 100x24, so for yes-no-cancel, 320xHeight is the best choice. Here's a screenshot:

MessageBox w/ ButtonSets::YesNoCancel


I'm going to try a different implementation tomorrow, since with this you have to position, size, have an instance sitting around, track it's visibility, etc, etc. I'm not going to spend too much time on it though, since I need to move onto the actual game stuff.

Here's the code that uses it:

// Init()
m_MsgBox.Set("Really quit?", "Are you sure you want to quit?", MessageBox::ButtonSets::YesNoCancel, (m_pGraphics->GetPresentParams().BackBufferWidth / 2) - 160, (m_pGraphics->GetPresentParams().BackBufferHeight / 2) - (96 / 2), 320, 96);

// Frame()
if(m_bQuitBoxVisible)
m_MsgBox.Render(m_pGraphics, m_pFont);

//EventHandler()
int nResults = 0;
if(m_bQuitBoxVisible)
{
nResults = m_MsgBox.EventHandler(Event);
if(nResults == MessageBox::Buttons::Yes)
PostQuitMessage(0);
else if(nResults == MessageBox::Buttons::No)
m_bQuitBoxVisible = false;
}



On a side note - is using static-const filled structs instead of enums a bad idea?

For example, my ButtonSets looks like so:

struct ButtonSets
{
static const int Ok = 0;
static const int OkCancel = 1;
static const int YesNo = 2;
static const int YesNoCancel = 3;
};


I really like accessing my values better this way.

Anyway, more tomorrow!
[/entry]
Sign in to follow this  


2 Comments


Recommended Comments

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