Sign in to follow this  
aaron_ds

Gone too far?

Recommended Posts

aaron_ds    486
Hey! I started on a new portion of my project a few weeks ago: the menu system. Its been going really well. Unfortunatly I think its sort of gotten out of control. I ended up writting a skinable windowing GUI. Is this overkill? I started with the Enginuity tutorial and wrote a kernel, and now I'm making a windowing system. I feel like I'm writting an OS or something. Just wondering if anyone else has the same thoughts. There is a bright side, I'm learning a ton. Hopefully I'll have some cool screenshots to post in a couple of months :)

Share this post


Link to post
Share on other sites
aaron_ds    486
definatly reuseable. Its really only a few thousand lines of code. By the way, Does anyone know of some good tutorials on designing messagebased windowing systems? I'm looking for something on writing one, not using one. Unfortunarlty google searches mostly yeild tutorials on how to use existing frameworks.

Share this post


Link to post
Share on other sites
silvermace    634
i would expect, at its lowest level, that system to be trivial.

this is top off my head stuff, so i dunno..


const int W_CLOSE = 1;
const int W_BUTTON_CLICK = 2;

class CMessage {
public:
int message;
int Lparam;
int Hparam;

CMessage& operator=(const CMessage& rhs) {
// do copy stuff here
}
};

class CWinManager : public ISingleton<CWinManager>
{
public:
// maybe use a deque?
CMessage stack[100]; //que 100 messages on stack
int top;

void sendMessage( CMessage& msg ) {
stack[top++] = msg;
}

// maybe in a seprate thread?
void process() {
// do message handling ...
}
};

// simple button class
class CButton : public IWidget
{
public:
void OnClick(int x, int y) {
CMessage msg;
msg.message = W_BUTTON_CLICK;
msg.Lparam = buttonId;

CWinManager::getSingleton().sendMessage( msg );
}
};

Share this post


Link to post
Share on other sites

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

Sign in to follow this