Gone too far?
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 :)
Depends. Can you reuse the code easily? If not, can you modify it to be reusable easily? If no to both, then yes, you're probably going overboard - not that it's necessairly bad as a learning experience.
If it's reusable, keep it. Share it/use it for future projects.
If it's reusable, keep it. Share it/use it for future projects.
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.
i would expect, at its lowest level, that system to be trivial.
this is top off my head stuff, so i dunno..
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 classclass CButton : public IWidget{public: void OnClick(int x, int y) { CMessage msg; msg.message = W_BUTTON_CLICK; msg.Lparam = buttonId; CWinManager::getSingleton().sendMessage( msg ); }};
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement