We all know it is easier to give an answer than it is to formulate a question.
Most of the time when a question is precise, you know the answer.
Questions can be very abstract, answer can be very abstract too. Whether they are abstract or not, they need to be precise to get answered.
That is why people here ask questions like "please give more details", "what are you aiming for". It is not to insult, it is to help define the question.
Things like programming languages, OO and natural languages are tools to both express the question and the answer. Do not dismiss a tool unless you have a very good reason to do so. Many times you will have to learn a new tool to address a new question (and its answers).
So when you ask about a subject that is relatively new to you and people start giving answers expect new tools to show up. It is part of the answer to learn the new tools.
For GUIs, OO is a very natural tool, however, an OO design 'can' be implemented in a non-OO language. Expect most documentation on GUIs to use OO to explain the workings, so you might end up translation the OO design into a non-OO implementation.
Read Petzold's "Programming Windows" book and ask more questions.
need help designing an event-based gui system
Gusso, what do you mean by systems?
I know there is a QBASIC example of a GUI out there that I came across years ago. And they are used in BIOS all the time. Both of those are non-OOP
I just don't get your question.
a GUI is a graphical user interface. It's function is to serve as a menu to quickly access other screens or menus that you would otherwise need to know a direct pathway to. There is nothing else to it.
Generally speaking a GUI needs an active and inactive state and you will want to figure out a way to encapsulate this without OOP.
This should not be a problem to do as if you know OOP you should know that essentially all the stuff in OOP based languages are mostly just more elegant, efficient, and understandable code.
In OOP your going to make a class/object (excuse me if my usage is not correct as I only moderately use OOP) that has function that will set a variable in that object to active/inactive and it will then display the menu. All you are doing is taking all that code out of the Class and setting a basic array to act in the manner they would in the class...
If that is what you are looking to do then your question leaves me with the question of why did you say systems when you should have said functions or sub-functions or processes...or any number of other words that make more sense.
This is the only thing I can think of that you might be meaning using what you asked.
I know there is a QBASIC example of a GUI out there that I came across years ago. And they are used in BIOS all the time. Both of those are non-OOP
I just don't get your question.
a GUI is a graphical user interface. It's function is to serve as a menu to quickly access other screens or menus that you would otherwise need to know a direct pathway to. There is nothing else to it.
Generally speaking a GUI needs an active and inactive state and you will want to figure out a way to encapsulate this without OOP.
This should not be a problem to do as if you know OOP you should know that essentially all the stuff in OOP based languages are mostly just more elegant, efficient, and understandable code.
In OOP your going to make a class/object (excuse me if my usage is not correct as I only moderately use OOP) that has function that will set a variable in that object to active/inactive and it will then display the menu. All you are doing is taking all that code out of the Class and setting a basic array to act in the manner they would in the class...
If that is what you are looking to do then your question leaves me with the question of why did you say systems when you should have said functions or sub-functions or processes...or any number of other words that make more sense.
This is the only thing I can think of that you might be meaning using what you asked.
Theres an interesting technique gui for having a realy lightweight memory footprint. I dont remember whats is called, but it can look something like this:
Where a minimum och ram is used. This is however more usefull for old consoles where there is more rom than ram. Using this sort of programming you can get a gui system roling on just 256 bytes of ram.
The biggest drawback is the problem of using dynamic layout.
[Edited by - mzeo77 on December 28, 2008 5:27:43 AM]
void handleEvent(struct Event * event) { if (button(0, 0, 100, 10, "Ok", event, OK_BUTTON_ID)) { handleOkWasPressed(); } if (button(0, 10, 100, 10, "Cancel", event, CANCEL_BUTTON_ID)) { handleCancelWasPressed(); }}int button(int x, int y, int width, int height, char * text, struct Event * event, int id){ switch(event->type) { case RENDER_EVENT: renderButton(x, y, width, height, text); break; case MOUSE_BUTTON: if (!hitTest(x, y, width, height, event->x, event->y) break; /* fallthrough */ case SELECT: return TRUE; case NEXT_BUTTON: if (event->state->selected == id) event->state->selected = 0; else if (event->state->selected == 0) event->state->selected = id; break; case NEXT_BUTTON: break; .... } return FALSE;}
Where a minimum och ram is used. This is however more usefull for old consoles where there is more rom than ram. Using this sort of programming you can get a gui system roling on just 256 bytes of ram.
The biggest drawback is the problem of using dynamic layout.
[Edited by - mzeo77 on December 28, 2008 5:27:43 AM]
Quote:Original post by gusso
If you read carefully I'm not asking "how to write XYZ in this language", perhaps many so called newbies do ask those things, all I asked for was "what systems should I write to create an event based gui system".
Just as Telastyn said; there's plenty of ways of doing something, specially in programming. I'm a programmer, too and I've learned people are not going to do your homework. What do I mean? Ask yourself some interesting questions:
Q: What is a GUI?
A: http://en.wikipedia.org/wiki/Graphical_user_interface
Q: What is a GUI composed by?
A: http://www.webopedia.com/TERM/G/Graphical_User_Interface_GUI.html
Q: How can I implement a way of handling those things on my own?
A: You have the answer... nobody else does.
Asking something like: "What do I need to make a GUI system?" will lead you to a better answer than asking what you should write (writing involves studying and doing your homework).
Quote:Original post by gusso
All I need is a bunch of pointers toward the right information, google doesn't seem to bother on this and I've been filtering the results for a long time without any good results, all I see are hacks here and hacks there, no real gui system at all and the ones I did indeed perceive as such, they were all so abstracted into the world of OOP that I couldn't make up any of it into a non-oop environment.
Ok... another option is learning from others and study their code:
http://www.cegui.org.uk/wiki/index.php/Main_Page
http://www.minigui.org/
http://guichan.sourceforge.net/wiki/index.php/Main_Page
I hope I helped a little bit a remember to always go from the ground up
Quote:Original post by mzeo77
Theres an interesting technique gui for having a realy lightweight memory footprint. I dont remember whats is called...
Immediate Mode GUI or IMGUI.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement